Advertisement
Guest User

RttR Script

a guest
Feb 14th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.93 KB | None | 0 0
  1. rttr.Log("script started")
  2.  
  3. t1="Return to the Roots Campaign - I (20150823)"
  4. m1="Welcome to the Return to the Campaign. This campaign was made by the\nReturn to the Roots team.\nPlease remember that LUA is still a work in progress feature! You can\nnot save your progress and have to finish a mission in one session!\n\nHave fun and report any Problems!\n"
  5. m2="You:\nFinally I'm home after years of fighting, can see my strong son and\nhold my wife in my arms\n\nPeasant(Out of breath):\nMaster... I... I...\n\nYou:\nWhat is it?\n\nPeasant:\nOur village, some devils are raiding it.\n"
  6. m3="You:\nFellow citizens, to arms!\n\nPeasants:\nWe have no weapons, only some broken scythes...\n\nYou:\nThat's not enough to fight hell, what should we do?\n"
  7. m4="The dusk slowly settles, the hot burning fires estinguish...\nYour eyes skim over your once beloved village, nothing is left. But\nsuddenly you spot some corpse, of a beautiful women. As you slowly\naproach the poor soul lying there, it's head torn off, you burst\ninto tears as you remember the necklace visible.\nAfter some minutes, maybe hours sitting idle and gripped by the sight\na man slowly comes closer.\n He tells you, that they have taken most\nwomen to their camp, as they were leaving northwards. He then stops\nfor a moment and tells you halting, that they have also taken a boy\nwith them.\nYou jump up from your spot, roar into the sky, clench your fist and\nwhisper 'Too long I waited, but thats over, they will pay, they will\npay a lot for their faults'\n"
  8. m5="You:\nMy son, he was with them, they passed a strange gate.\n\nMilitia:\nMaybe we should spare the live of those innocent people then.\nThere are some women and children as well, I don't think, that they\nhave been raiding your village as well.\n\nYou:\nYou may be right, you may be wrong...\n\n"
  9. m6="You reach the gate and use it without hesitating.\nPlease write down the following values!\nKarma:\nPositive: "
  10. m62="\nNeutral: "
  11. m63="\nNegative: "
  12. e1="You found some tracks, they lead to the north east. You should follow\nthem to get your revenge.\n"
  13. e2="You found some tracks, they lead to the east. You should follow\nthem to get your revenge.\n"
  14. e3="You found some tracks, they lead to the south east. You should follow\nthem to get your revenge.\n"
  15.  
  16. g1="Thats my old friend, I guess he can trade me some beer for gold. I\nneed to rise an army to fight those devils.\n"
  17. g2="We found soem gold, maybe we can trade that for beer so we can\nrise an army.\n"
  18. g3="Vendor:\nMy brother was always fishing but now his small village is lost and\nI have to help him.\n\nYou:\nWell I may help you as well, I could...\n\nVendor:\nNo thanks, you are the reason for this misery. You will pay twice\nthe price.\n\nYou:\nBut I have to find my son!\n\nVendor:\nEverybody pays a price, maybe you should pay more and innocent\npeople should pay less.\n"
  19. g4="You bought some\nBeer. Amount: "
  20. ----------------------------------------------------------------------
  21. n1="Your scouts discovered a strange nation. They seem friendly and not\nagressive in any way.\nAlso they are just fisihing.\n"
  22. n2="Please stop fishing"
  23. n3="Your scouts report, that the neutral village has grown a bit.\n"
  24. n4="Gift for not fishing\nFish: "
  25. n5="Your scouts report, that the neutral village has been abandoned by\nit's owner. They left withouth leaving anything behind.\n"
  26.  
  27. l1="Location"
  28.  
  29. nn=0
  30. ns=0
  31. nb=0
  32.  
  33. kb=0
  34. kp=0
  35. kn=0
  36.  
  37. p=0
  38. g=0
  39. el={0,0,0,0}
  40. pr=1
  41. lg=0
  42. cg=0
  43.  
  44. --START | END | STEPS |
  45. ga={2500,2507,1,2508,2515,1,6000,6009,0}
  46. --X | Y | ACTIVE | STEP | ID
  47. gl={25,73,0,0,1, 28,55,0,4,1, 25,68,0,1,0, 22,67,0,2,0, 22,63,0,3,0, 25,56,0,4,0, 27,66,0,5,0, 25,61,0,6,0, 55,62,1,0,2}
  48.  
  49. ASO=rttr.AddStaticObject
  50. AEO=rttr.AddEnvObject
  51. MS=rttr.MissionStatement
  52. PML=rttr.PostMessageWithLocation
  53. GWC=rttr.GetWareCount
  54. AW=rttr.AddWares
  55. GBC=rttr.GetBuildingCount
  56. PM=rttr.PostMessage
  57. DB=rttr.DisableBuilding
  58. EB=rttr.EnableBuilding
  59. CR=rttr.ClearResources
  60. AP=rttr.AddPeople
  61.  
  62. function onStart()
  63.     DB(0)
  64.     DB(1,9,16,21,27,28,34,36,38,39)
  65.    
  66.     CR(0)
  67.     CR(1)
  68.  
  69.     ASO(25,73,4,2)
  70.     ASO(28,55,2,2)
  71.  
  72.     ASO(25,68,0,2)
  73.     ASO(22,67,0,2)
  74.     ASO(22,63,0,2)
  75.     ASO(25,56,0,2)
  76.     ASO(27,66,0,2)
  77.     ASO(25,61,0,2)
  78.  
  79.     AEO(26,37,8,2)
  80.     AEO(44,33,8,2)
  81.     AEO(64,32,8,2)
  82.  
  83.     ASO(26,16,6,0)
  84.  
  85.     ASO(95,92,560,0xFFFF,2)
  86.  
  87.     AW(1,22,24,23,44,24,68,19,4,20,8,31,16,30,16,3,6,4,2,5,2,2,6,6,4,7,4,8,6,9,8,13,4,14,2)
  88.     AP(1,0,75,19,10,20,6,1,8,3,4,5,4,6,4,4,4,11,10,18,4,17,2,26,6,28,2,21,32)
  89.  
  90.     AW(0,22,12,23,22,24,34,19,2,20,4,31,8,30,8,3,3,4,1,5,1,2,8,6,2,7,2,8,6,9,6,13,2,14,0)
  91.     AP(0,0,25,19,5,20,3,1,4,3,2,5,2,6,2,4,2,11,6,18,2,17,1,26,4,28,1,21,16)
  92. end
  93.  
  94. function onGameFrame(gf)
  95.     if((gf%4)==0) then
  96.         for i=0, (#gl/5)-1 do
  97.             if(gl[3+i*5]==1) then
  98.                 if(ga[1+gl[5+i*5]*3]+gl[4+i*5] > ga[2+gl[5+i*5]*3]) then
  99.                     gl[4+i*5]=0
  100.                 end
  101.                 rttr.AddStaticObject(gl[1+i*5],gl[2+i*5],ga[1+gl[5+i*5]*3]+gl[4+i*5],0xFFFF)
  102.                 gl[4+i*5]=gl[4+i*5]+ga[3+gl[5+i*5]*3]
  103.             end
  104.         end
  105.     end
  106.    
  107.     if((gf%100)~=0) then
  108.     return
  109.     end
  110.  
  111.     if(ns==0 and gf>15000) then
  112.     ns=1
  113.     MS(0,t1,n1)
  114.     PML(0,55,62,l1)
  115.     end
  116.  
  117.     if p==0 then
  118.         p=1
  119.         MS(0,t1,m1)
  120.  
  121.     elseif (p==1 and gf > 500) then
  122.         p=2
  123.         MS(0,t1,m2)
  124.         gl[3]=1
  125.         gl[8]=1
  126.         gl[13]=1
  127.         gl[18]=1
  128.         gl[23]=1
  129.         gl[28]=1
  130.         gl[33]=1
  131.         gl[38]=1
  132.     elseif (p==2 and gf > 1000) then
  133.         p=3
  134.         MS(0,t1,m3)
  135.     elseif (p==3 and gf > 1500) then
  136.         p=4
  137.         MS(0,t1,m4)
  138. EB(0,1,2,4,10,11,12,13,18,19,20,22,24,25,26,29,31,32,33,35,37)
  139. gl[3]=0
  140. gl[8]=0
  141. gl[13]=0
  142. gl[18]=0
  143. gl[23]=0
  144. gl[28]=0
  145. gl[33]=0
  146. gl[38]=0
  147. AEO(25,73,2525)
  148. AEO(28,55,2525)
  149.  
  150. AEO(25,68,2524)
  151. AEO(22,67,2524)
  152. AEO(22,63,2524)
  153. AEO(25,56,2524)
  154. AEO(27,66,2524)
  155. AEO(25,61,2524)
  156.  
  157. AEO(23,61,547)
  158. AEO(25,69,547)
  159. AEO(32,62,547)
  160. AEO(29,56,547)
  161. AEO(20,63,547)
  162.  
  163. AEO(25,60,548)
  164. AEO(28,64,548)
  165. AEO(34,68,548)
  166. AEO(25,55,548)
  167. AEO(27,52,548)
  168.     elseif(p==6) then
  169.     if(GBC(1,0)==0)then
  170.     kb=kb+1
  171.     else
  172.     kp=kp+1
  173.     end
  174.     if(nb>=5) then
  175.     kb=kb+1
  176.     else
  177.     kp=kp+1
  178.     end
  179.     p=7
  180.     MS(0,t1,m6,kp,m62,kn,m63,kb)
  181.     end
  182.  
  183.     if((gf%1000)~=0) then
  184.     return
  185.     end
  186.  
  187.     if(ns==1 and nf==1) then
  188.         PM(0,n4,nn)
  189.         AW(0,19,nn)
  190.     end
  191.  
  192.     if((gf%5000)~=0) then
  193.     return
  194.     end
  195.  
  196.     if(g==1) then
  197.         cg=GWC(0,29)
  198.         AW(0,0,((cg-lg)*pr))
  199.         --MS(0,t1,g1,((cg-lg)*pr))
  200.         PM(0,g4,((cg-lg)*pr))
  201.         lg=cg
  202.     end
  203.     if(ns==1 and nb < 5) then
  204.         if(GBC(0,18)>0) then
  205.             MS(0,t1,n2)
  206.             nb=nb+1
  207.             nf=0
  208.         else
  209.             nf=1
  210.             if(gl[44] < ga[8]-ga[7]) then
  211.                 MS(0,t1,n3)
  212.                 nn=nn+1
  213.                 gl[44]=nn
  214.             end
  215.         end
  216.     elseif (nb >= 5) then
  217.         MS(0,t1,n5)
  218.         PML(0,55,62,l1)
  219.         PM(0,g3)
  220.         pr=0.5
  221.         ns=0
  222.         gl[43]=0
  223.         AEO(55,62,2524)
  224.         if(nn>2) then
  225.         AEO(52,61,2524)
  226.         end
  227.         if(nn>5) then
  228.         AEO(53,57,2524)
  229.         end
  230.         if(nn>8) then
  231.         AEO(55,54,2524)
  232.         end
  233.     end
  234.  
  235.  
  236. end
  237.  
  238. function onExplored(pl, ex, ey)
  239. if(pl~=0) then
  240. return
  241. end
  242.  
  243. if(ex==26 and ey==37 and el[1]==0) then
  244. MS(0,t1,e1)
  245. el[1]=1
  246. PML(0,el,ey,l1)
  247. elseif(ex==44 and ey==33 and el[2]==0) then
  248. MS(0,t1,e2)
  249. el[2]=1
  250. PML(0,el,ey,l1)
  251. elseif(ex==64 and ey==32 and el[3]==0) then
  252. MS(0,t1,e3)
  253. el[3]=1
  254. PML(0,el,ey,l1)
  255. elseif(ex==26 and ey==16 and el[4]==0) then
  256. g=1
  257. el[4]=1
  258. MS(0,t1,g1)
  259. PML(0,ex,ey,l1)
  260. end
  261. end
  262.  
  263. function onResourceFound(rp, rx, ry, rt, rq)
  264. if(rp~=0) then
  265. return
  266. end
  267.  
  268. if(g~=1 and rt==1) then
  269. MS(0,t1,g2)
  270. end
  271.  
  272. if(p==4) then
  273. p=5
  274. MS(0,t1,m5)
  275. end
  276. end
  277.  
  278. function onOccupied(op, ox, oy)
  279. if(op~=0) then
  280. return
  281. elseif(ox==95 and oy==92 and p==5) then
  282. ASO(ox,oy,561,0xFFFF,2)
  283. p=6
  284. end
  285. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement