Advertisement
Guest User

Shaman Defence V1.0

a guest
Oct 12th, 2013
1,129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 22.13 KB | None | 0 0
  1. players={}
  2. enemies={}
  3. friends={}
  4. towers={}
  5. teamA={}
  6. teamB={}
  7. count=0
  8. newGame = false
  9. timer=0
  10. round = 0
  11. balloonsLeft = 0
  12. totalBalloons = 0
  13. row = 0
  14. spawnCounter = 0
  15. teamCountA=1
  16. teamCountB = 1
  17. towerCount = 201
  18. speed=0
  19. endCount = 0
  20. newRoundTimer = 10
  21. tfm.exec.disableAutoShaman(true)
  22. tfm.exec.disableAfkDeath(true)
  23. tfm.exec.disableAutoTimeLeft(true)
  24. tfm.exec.disableAutoNewGame(true)
  25. tfm.exec.disableAutoScore(true)
  26. tfm.exec.newGame("@4356401")
  27. -- Map = @4356401
  28. function eventNewGame()
  29. ui.addTextArea(1, "<p align='center'><a href='event:helpNeeded'>Help</a></p><br>", NIL, 5, 25, 35, 20, 0x1C3C41, 0x1C3C41, 1)
  30. ui.addTextArea(101, "<p align='center'><a href='event:helpNeeded'>Help</a></p><br>", NIL, 805, 25, 35, 20, 0x1C3C41, 0x1C3C41, 1)
  31. ui.addTextArea(4, "<p align='center'><a href='event:shopOpened'>Shop</a></p><br>", NIL, 50, 25, 35, 20, 0x1C3C41, 0x1C3C41, 1)
  32. ui.addTextArea(104, "<p align='center'><a href='event:shopOpened'>Shop</a></p><br>", NIL, 850, 25, 35, 20, 0x1C3C41, 0x1C3C41, 1)
  33. enemy = 2
  34. teamPicker = 0
  35. doubleSpeed = false
  36. gameWon=false
  37. for name,player in pairs(tfm.get.room.playerList) do
  38.     system.bindMouse(name, true)
  39.     players[name]={
  40.         shamanObject=32, time = os.time(), team = teamPicker, cash = 0, friendlySpeed = 0
  41.     }
  42. end
  43. createTeams()
  44. newGame = true
  45. round = 1
  46. balloonsLeft = 0
  47. local i = 201
  48. while i < towerCount do
  49. ui.removeTextArea(i, NIL)
  50. i = i + 1
  51. end
  52. towerCount = 201
  53. end
  54.  
  55. function eventMouse(name, x,y)
  56. if towerBuildingMode== true and name == towerBuilder then
  57. if x > 0 and x < 100 or x > 350 and x < 450 or x > 700 and x < 800 or x > 800 and x < 900 or x > 1150 and x < 1250 or x > 1500 and x < 1600 then
  58. towers[towerCount]={towerX = x, towerY = y, towerObject = towerObjectPicker}
  59. if towerObjectPicker == 32 then
  60. ui.addTextArea(towerCount, "", NIL, x, y, 20, 20, 0x00FFFF, 0x00FFFF, 1)
  61. elseif towerObjectPicker == 19 then
  62. ui.addTextArea(towerCount, "", NIL, x, y, 20, 20, 0x0A0A0A, 0x0A0A0A, 1)
  63. end
  64. towerCount = towerCount + 1
  65. towerBuildingMode=false
  66. end
  67. else
  68. if players[name].team==0 then
  69. if x > 0 and x < 100 or x > 350 and x < 450 or x > 700 and x < 800 then
  70. if doubleSpeed == false then
  71. if players[name].time + 1000 < os.time() then
  72. if tfm.get.room.playerList[name].isFacingRight then
  73. id=tfm.exec.addShamanObject(players[name].shamanObject, x, y, 0, players[name].friendlySpeed, 0, false)
  74. table.insert(friends,{id, os.time()})
  75. players[name].time=os.time()
  76. else
  77. id=tfm.exec.addShamanObject(players[name].shamanObject, x, y, 180, players[name].friendlySpeed * -1,0, false)
  78. table.insert(friends,{id, os.time()})
  79. players[name].time=os.time()
  80. end
  81. end
  82. elseif doubleSpeed == true then
  83. if players[name].time + 500 < os.time() then
  84. if tfm.get.room.playerList[name].isFacingRight then
  85. id=tfm.exec.addShamanObject(players[name].shamanObject, x, y, 0, players[name].friendlySpeed, 0, false)
  86. table.insert(friends,{id, os.time()})
  87. players[name].time=os.time()
  88. else
  89. id=tfm.exec.addShamanObject(players[name].shamanObject, x, y, 180, players[name].friendlySpeed * -1,0, false)
  90. table.insert(friends,{id, os.time()})
  91. players[name].time=os.time()
  92. end
  93. end
  94. end
  95. end
  96. elseif players[name].team==1 then
  97. if x > 800 and x < 900 or x > 1150 and x < 1250 or x > 1500 and x < 1600 then
  98. if doubleSpeed == false then
  99. if players[name].time + 1000 < os.time() then
  100. if tfm.get.room.playerList[name].isFacingRight then
  101. id=tfm.exec.addShamanObject(players[name].shamanObject, x, y, 0, players[name].friendlySpeed, 0, false)
  102. table.insert(friends,{id, os.time()})
  103. players[name].time=os.time()
  104. else
  105. id=tfm.exec.addShamanObject(players[name].shamanObject, x, y, 180, players[name].friendlySpeed * -1,0, false)
  106. table.insert(friends,{id, os.time()})
  107. players[name].time=os.time()
  108. end
  109. end
  110. elseif doubleSpeed == true then
  111. if players[name].time + 500 < os.time() then
  112. if tfm.get.room.playerList[name].isFacingRight then
  113. id=tfm.exec.addShamanObject(players[name].shamanObject, x, y, 0, players[name].friendlySpeed, 0, false)
  114. table.insert(friends,{id, os.time()})
  115. players[name].time=os.time()
  116. else
  117. id=tfm.exec.addShamanObject(players[name].shamanObject, x, y, 180, players[name].friendlySpeed * -1,0, false)
  118. table.insert(friends,{id, os.time()})
  119. players[name].time=os.time()
  120. end
  121. end
  122. end
  123. end
  124. end
  125. end
  126. end
  127.  
  128. function eventLoop(time,remaining)
  129. tfm.exec.setUIShamanName("Round " .. round)
  130. timer = timer + 1
  131. if newGame == true then
  132. if gameWon == true then
  133. if endCount < 10 then
  134. if winner == 1 then
  135. ui.addTextArea(1001, "<p align='center'><font size='42'>You win :)</font></p><br>", NIL, 0, 150, 800, 100, 0x1C3C41, 0x1C3C41, 0)
  136. ui.addTextArea(1002, "<p align='center'><font size='42'>You lose :(</font></p><br>", NIL, 800, 150, 800, 100, 0x1C3C41, 0x1C3C41, 0)
  137. end
  138. if winner == 2 then
  139. ui.addTextArea(1001, "<p align='center'><font size='42'>You win :)</font></p><br>", NIL, 800, 150, 800, 100, 0x1C3C41, 0x1C3C41, 0)
  140. ui.addTextArea(1002, "<p align='center'><font size='42'>You lose :(</font></p><br>", NIL, 0, 150, 800, 100, 0x1C3C41, 0x1C3C41, 0)
  141. end
  142. if winner == 3 then
  143. ui.addTextArea(1001, "<p align='center'><font size='42'>You win :)</font></p><br>", NIL, 0, 150, 800, 100, 0x1C3C41, 0x1C3C41, 0)
  144. ui.addTextArea(1002, "<p align='center'><font size='42'>You win :)</font></p><br>", NIL, 800, 150, 800, 100, 0x1C3C41, 0x1C3C41, 0)
  145. end
  146. endCount = endCount + 1
  147. else
  148. endCount = 0
  149. ui.removeTextArea(1001, NIL)
  150. ui.removeTextArea(1002, NIL)
  151. gameWon = false
  152. winner = 0
  153. tfm.exec.newGame("@4356401")
  154. end
  155. else
  156. if newRoundTimer == 10 then
  157. if round == 1 then
  158. if timer >= 4 then
  159. totalBalloons = 15
  160. spawnEnemy(-1)
  161. timer = 0
  162. balloonsLeft = balloonsLeft + 1
  163. if balloonsLeft >= totalBalloons then
  164. newRoundTimer = 0
  165. round = 2
  166. balloonsLeft = 0
  167. end
  168. end
  169. end
  170. if round == 2 then
  171. if timer >= 3 then
  172. totalBalloons = 20
  173. spawnEnemy(-1)
  174. timer = 0
  175. balloonsLeft = balloonsLeft + 1
  176. if balloonsLeft >= totalBalloons then
  177. newRoundTimer = 0
  178. round = 3
  179. balloonsLeft = 0
  180. end
  181. end
  182. end
  183. if round == 3 then
  184. if timer >= 3 then
  185. totalBalloons = 15
  186. spawnEnemy(-2)
  187. timer = 0
  188. balloonsLeft = balloonsLeft + 1
  189. if balloonsLeft >= totalBalloons then
  190. newRoundTimer = 0
  191. round = 4
  192. balloonsLeft = 0
  193. end
  194. end
  195. end
  196. if round == 4 then
  197. for i,balloon in ipairs(enemies) do
  198. end
  199. if timer >= 2 then
  200. totalBalloons = 20
  201. spawnEnemy(-2)
  202. timer = 0
  203. balloonsLeft = balloonsLeft + 1
  204. if balloonsLeft >= totalBalloons then
  205. newRoundTimer = 0
  206. round = 5
  207. balloonsLeft = 0
  208. end
  209. end
  210. end
  211. if round == 5 then
  212. if timer >= 3 then
  213. totalBalloons = 15
  214. enemy=28
  215. spawnEnemy(-1)
  216. timer = 0
  217. balloonsLeft = balloonsLeft + 1
  218. if balloonsLeft >= totalBalloons then
  219. newRoundTimer = 0
  220. round = 6
  221. balloonsLeft = 0
  222. end
  223. end
  224. end
  225. if round == 6 then
  226. if timer >= 2 then
  227. totalBalloons = 20
  228. enemy=28
  229. spawnEnemy(-1)
  230. timer = 0
  231. balloonsLeft = balloonsLeft + 1
  232. if balloonsLeft >= totalBalloons then
  233. round = 7
  234. balloonsLeft = 0
  235. end
  236. end
  237. end
  238. if round == 7 then
  239. if timer >= 3 then
  240. totalBalloons = 15
  241. enemy=28
  242. spawnEnemy(-2)
  243. timer = 0
  244. balloonsLeft = balloonsLeft + 1
  245. if balloonsLeft >= totalBalloons then
  246. round = 8
  247. balloonsLeft = 0
  248. end
  249. end
  250. end
  251. if round == 8 then
  252. if timer >= 4 then
  253. totalBalloons = 10
  254. enemy=10
  255. spawnEnemy(-1)
  256. timer = 0
  257. balloonsLeft = balloonsLeft + 1
  258. if balloonsLeft >= totalBalloons then
  259. round = 9
  260. balloonsLeft = 0
  261. end
  262. end
  263. end
  264. if round == 9 then
  265. if timer >= 2 then
  266. totalBalloons = 20
  267. enemy=10
  268. spawnEnemy(-1)
  269. timer = 0
  270. balloonsLeft = balloonsLeft + 1
  271. if balloonsLeft >= totalBalloons then
  272. round = 10
  273. balloonsLeft = 0
  274. end
  275. end
  276. end
  277. if round == 10 then
  278. if timer >= 4 then
  279. totalBalloons = 15
  280. enemy=10
  281. spawnEnemy(-2)
  282. timer = 0
  283. balloonsLeft = balloonsLeft + 1
  284. if balloonsLeft >= totalBalloons then
  285. round = 11
  286. balloonsLeft = 0
  287. end
  288. end
  289. end
  290. if round == 11 then
  291. if timer >= 2 then
  292. totalBalloons = 20
  293. enemy=10
  294. spawnEnemy(-2)
  295. timer = 0
  296. balloonsLeft = balloonsLeft + 1
  297. if balloonsLeft >= totalBalloons then
  298. round = 12
  299. balloonsLeft = 0
  300. end
  301. end
  302. end
  303. if round == 12 then
  304. if timer >= 1 then
  305. totalBalloons = 30
  306. enemy=28
  307. spawnEnemy(-1)
  308. timer = 0
  309. balloonsLeft = balloonsLeft + 1
  310. if balloonsLeft >= totalBalloons then
  311. round = 13
  312. balloonsLeft = 0
  313. end
  314. end
  315. end
  316. if round == 13 then
  317. if timer >= 4 then
  318. totalBalloons = 12
  319. enemy=34
  320. spawnEnemy(-1)
  321. timer = 0
  322. balloonsLeft = balloonsLeft + 1
  323. if balloonsLeft >= totalBalloons then
  324. round = 14
  325. balloonsLeft = 0
  326. end
  327. end
  328. end
  329. if round == 14 then
  330. if timer >= 2 then
  331. totalBalloons = 25
  332. enemy=34
  333. spawnEnemy(-1)
  334. timer = 0
  335. balloonsLeft = balloonsLeft + 1
  336. if balloonsLeft >= totalBalloons then
  337. round = 15
  338. balloonsLeft = 0
  339. end
  340. end
  341. end
  342. if round == 15 then
  343. if timer >= 4 then
  344. totalBalloons = 15
  345. enemy=34
  346. spawnEnemy(-2)
  347. timer = 0
  348. balloonsLeft = balloonsLeft + 1
  349. if balloonsLeft >= totalBalloons then
  350. round = 16
  351. balloonsLeft = 0
  352. end
  353. end
  354. end
  355. if round == 16 then
  356. if timer >= 2 then
  357. totalBalloons = 30
  358. enemy=34
  359. spawnEnemy(-2)
  360. timer = 0
  361. balloonsLeft = balloonsLeft + 1
  362. if balloonsLeft >= totalBalloons then
  363. round = 17
  364. balloonsLeft = 0
  365. end
  366. end
  367. end
  368. if round == 17 then
  369. if timer >= 2 then
  370. totalBalloons = 30
  371. enemy=10
  372. spawnEnemy(-2)
  373. timer = 0
  374. balloonsLeft = balloonsLeft + 1
  375. if balloonsLeft >= totalBalloons then
  376. round = 18
  377. balloonsLeft = 0
  378. end
  379. end
  380. end
  381. if round == 18 then
  382. if timer >= 1 then
  383. totalBalloons = 50
  384. enemy=34
  385. spawnEnemy(-1)
  386. timer = 0
  387. balloonsLeft = balloonsLeft + 1
  388. if balloonsLeft >= totalBalloons then
  389. round = 19
  390. balloonsLeft = 0
  391. end
  392. end
  393. end
  394. if round == 19 then
  395. if timer >= 1 then
  396. totalBalloons = 50
  397. enemy=34
  398. spawnEnemy(-2)
  399. timer = 0
  400. balloonsLeft = balloonsLeft + 1
  401. if balloonsLeft >= totalBalloons then
  402. round = 20
  403. balloonsLeft = 0
  404. end
  405. end
  406. end
  407. if round == 20 then
  408. if timer >= 1 then
  409. totalBalloons = 100
  410. enemy=10
  411. spawnEnemy(-3)
  412. timer = 0
  413. balloonsLeft = balloonsLeft + 1
  414. if balloonsLeft >= totalBalloons then
  415. gameWon=true
  416. winner = 3
  417. end
  418. end
  419. end
  420. else
  421. newRoundTimer = newRoundTimer + 1
  422. end
  423. if #enemies > 0 then
  424. for i,balloon in ipairs(enemies) do
  425. if tfm.get.room.objectList[balloon[1]].y <= 20 and tfm.get.room.objectList[balloon[1]].y >= -50 then
  426. gameWon=true
  427. if tfm.get.room.objectList[balloon[1]].x > 800 then
  428. winner = 1
  429. else
  430. winner = 2
  431. end
  432. for i,balloon in ipairs(enemies) do
  433. table.remove(enemies,i)
  434. end
  435. end
  436. if tfm.get.room.objectList[balloon[1]].x > balloon[3] + 25 or tfm.get.room.objectList[balloon[1]].x < balloon[3] - 25 then
  437. if balloon[2]+1000<os.time() then
  438. tfm.exec.removeObject(balloon[1])
  439. table.remove(enemies,i)
  440. test = 1
  441. if balloon[3] < 800 then
  442. while test < teamCountA do
  443. players[teamA[test]].cash = players[teamA[test]].cash + 1
  444. tfm.exec.setPlayerScore(teamA[test], players[teamA[test]].cash, false)
  445. test = test + 1
  446. end
  447. elseif balloon[3] > 800 then
  448. while test < teamCountB do
  449. players[teamB[test]].cash = players[teamB[test]].cash + 1
  450. tfm.exec.setPlayerScore(teamB[test], players[teamB[test]].cash, false)
  451. test = test + 1
  452. end
  453. end
  454. end
  455. end
  456. end
  457. end
  458. for i,friend in ipairs(friends) do
  459. if friend[2] + 2000 < os.time() then
  460. tfm.exec.removeObject(friend[1])
  461. table.remove(friends,i)
  462. end
  463. end
  464. local i = 201
  465. while i < towerCount do
  466. id=tfm.exec.addShamanObject(towers[i].towerObject, towers[i].towerX, towers[i].towerY, math.random(360), 0,0, false)
  467. table.insert(friends,{id, os.time()})
  468. i = i +1
  469. end
  470. end
  471. end
  472. end
  473.  
  474. function createTeams()
  475. local i = 1
  476. while i < teamCountA do
  477. teamA[i] = NIL
  478. i = i +1
  479. end
  480. i=1
  481. while i < teamCountB do
  482. teamB[i] = NIL
  483. i = i +1
  484. end
  485. teamCountA=1
  486. teamCountB = 1
  487. twoTeams=false
  488. for name,player in pairs(tfm.get.room.playerList) do
  489. if teamPicker == 0 then
  490. players[name].team= teamPicker
  491. teamA[teamCountA] = name
  492. teamCountA = teamCountA + 1
  493. tfm.exec.movePlayer(name, 400, -500, false, 0, 0, false)
  494. teamPicker = 1
  495. elseif teamPicker == 1 then
  496. players[name].team= teamPicker
  497. teamB[teamCountB] = name
  498. teamCountB = teamCountB + 1
  499. tfm.exec.movePlayer(name, 1200, -500, false, 0, 0, false)
  500. twoTeams = true
  501. teamPicker = 0
  502. end
  503. end
  504. end
  505.  
  506. function spawnEnemy(speed)
  507. while spawnCounter<2 do
  508. if spawnCounter == 0 then
  509. if row == 0 then
  510. startLocation = 225
  511. id = tfm.exec.addShamanObject(enemy, startLocation, 400, 0, 0, speed, false)
  512. table.insert(enemies,{id, os.time(), startLocation})
  513. spawnCounter = spawnCounter + 1
  514. elseif row == 1 then
  515. startLocation = 575
  516. id = tfm.exec.addShamanObject(enemy, startLocation, 400, 0, 0, speed, false)
  517. table.insert(enemies,{id, os.time(), startLocation})
  518. spawnCounter = spawnCounter + 1
  519. end
  520. elseif spawnCounter == 1 then
  521. if twoTeams == true then
  522. if row == 0 then
  523. startLocation = 1025
  524. id = tfm.exec.addShamanObject(enemy, startLocation, 400, 0, 0, speed, false)
  525. table.insert(enemies,{id, os.time(), startLocation})
  526. spawnCounter = spawnCounter + 1
  527. row = 1
  528. elseif row == 1 then
  529. startLocation = 1375
  530. id = tfm.exec.addShamanObject(enemy, startLocation, 400, 0, 0, speed, false)
  531. table.insert(enemies,{id, os.time(), startLocation})
  532. spawnCounter = spawnCounter + 1
  533. row = 0
  534. end
  535. else
  536. spawnCounter = spawnCounter + 1
  537. if row == 0 then
  538. row = 1
  539. elseif row == 1 then
  540. row = 0
  541. end
  542. end
  543. end
  544. end
  545. spawnCounter = 0
  546. end
  547.  
  548. function eventTextAreaCallback(textAreaId, playerName, callback)
  549. if textAreaId == 1 then
  550. ui.addTextArea(2, [[<p align='center'><font size='20'>Welcome to Shaman Defence</font></p>
  551. <p align='center'>Made by Ordboka</p><p></p>
  552. <p align='center'><font size = '16'>How to play</font></p>
  553. <p align ='center'>Shaman Defence is a game where you use shaman objects to try and prevent the enemy shaman objects from reaching the top of the map. There are two teams, and the team that can survive the longest wins. You shoot by clicking on the screen on a yellow field and you use your arrow keys/WASD to decide what direction they are going when they spawn. For every object you can get outside of the red area you get a point. You can use these points to purchase upgrades like constant shooters and better weapons. You can see how many points by looking at the number next to your name where shamanpoints would usually be.</p><br>]],
  554.  playerName, 200, 50, 400, 275, 0x1C3C41, 0x1C3C41, 1)
  555. ui.addTextArea(3, "<p align='center'><a href='event:closeHelp'>I got it, let me play</a></p><br>", playerName, 200, 340, 400, 20, 0x1C3C41, 0x1C3C41, 1)
  556. elseif textAreaId == 3 then
  557. ui.removeTextArea(2, playerName)
  558. ui.removeTextArea(3, playerName)
  559. elseif textAreaId == 4 then
  560. ui.addTextArea(6, "<p align='center'><a href='event:closeHelp'>Close</a></p><br>", playerName, 200, 290, 400, 20, 0x1C3C41, 0x1C3C41, 1)
  561. ui.addTextArea(5, [[<p align='center'><font size='20'>Shop</font></p>
  562. <p>Spawns a cannon instead of rune when you click</p>
  563. <p>A tower spawn runes in random directions</p>
  564. <p>A tower spawn cannons in random directions </p>
  565. <p>You can spawn items twice as fast </p>]], playerName , 200, 50, 400, 225, 0x1C3C41, 0x1C3C41, 1)
  566. ui.addTextArea(11, "<p align='center'><a href='event:closeHelp'>Buy for 25</a></p><br>", playerName, 500, 135, 100, 20, 0x0E242D, 0x0E242D, 1)
  567. ui.addTextArea(12, "<p align='center'><a href='event:closeHelp'>Buy for 100</a></p><br>", playerName, 500, 170, 100, 20, 0x0E242D, 0x0E242D, 1)
  568. if players[playerName].shamanObject == 32 and doubleSpeed == false then
  569. ui.addTextArea(7, "<p align='center'><a href='event:closeHelp'>Buy for 100</a></p><br>", playerName, 500, 100, 100, 20, 0x0E242D, 0x0E242D, 1)
  570. ui.addTextArea(13, "<p align='center'><a href='event:closeHelp'>Buy for 250</a></p><br>", playerName, 500, 205, 100, 20, 0x0E242D, 0x0E242D, 1)
  571. elseif players[playerName].shamanObject == 19 and doubleSpeed == false then
  572. ui.addTextArea(7, "<p align='center'>Bought</p><br>", playerName, 500, 100, 100, 20, 0x0E242D, 0x0E242D, 1)
  573. ui.addTextArea(13, "<p align='center'><a href='event:closeHelp'>Buy for 250</a></p><br>", playerName, 500, 205, 100, 20, 0x0E242D, 0x0E242D, 1)
  574. elseif players[playerName].shamanObject == 19 and doubleSpeed == true then
  575. ui.addTextArea(7, "<p align='center'>Bought</p><br>", playerName, 500, 100, 100, 20, 0x0E242D, 0x0E242D, 1)
  576. ui.addTextArea(14, "<p align='center'>Bought</p><br>", playerName, 500, 205, 100, 20, 0x0E242D, 0x0E242D, 1)
  577. elseif players[playerName].shamanObject == 32 and doubleSpeed == true then
  578. ui.addTextArea(7, "<p align='center'><a href='event:closeHelp'>Buy for 100</a></p><br>", playerName, 500, 100, 100, 20, 0x0E242D, 0x0E242D, 1)
  579. ui.addTextArea(14, "<p align='center'>Bought</p><br>", playerName, 500, 205, 100, 20, 0x0E242D, 0x0E242D, 1)
  580. end
  581. elseif textAreaId == 6 then
  582. closeShop(0)
  583. elseif textAreaId == 7 then
  584. if players[playerName].cash >= 100 then
  585. players[playerName].cash = players[playerName].cash - 100
  586. players[playerName].shamanObject = 19
  587. players[playerName].friendlySpeed = 0
  588. ui.removeTextArea(7, playerName)
  589. ui.addTextArea(8, "<p align='center'><a href='event:closeHelp'>Bought</a></p><br>", playerName, 500, 100, 100, 20, 0x0E242D, 0x0E242D, 1)
  590. end
  591. elseif textAreaId == 11 and players[playerName].cash >= 25 then
  592. players[playerName].cash = players[playerName].cash - 25
  593. closeShop(0)
  594. towerBuildingMode = true
  595. towerBuilder = playerName
  596. towerObjectPicker = 32
  597. elseif textAreaId == 12 and players[playerName].cash >= 100 then
  598. players[playerName].cash = players[playerName].cash - 100
  599. closeShop(0)
  600. towerBuildingMode = true
  601. towerBuilder = playerName
  602. towerObjectPicker = 19
  603. elseif textAreaId == 13 then
  604. if players[playerName].cash >= 250 then
  605. players[playerName].cash = players[playerName].cash - 250
  606. doubleSpeed = true
  607. ui.removeTextArea(13, playerName)
  608. ui.addTextArea(14,"<p align='center'><a href='event:closeHelp'>Bought</a></p><br>", playerName, 500, 205, 100, 20, 0x0E242D, 0x0E242D, 1)
  609. end
  610. end
  611. if textAreaId == 101 then
  612. ui.addTextArea(102, [[<p align='center'><font size='20'>Welcome to Shaman Defence</font></p>
  613. <p align='center'>Made by Ordboka</p><p></p>
  614. <p align='center'><font size = '16'>How to play</font></p>
  615. <p align ='center'>Shaman Defence is a game where you use shaman objects to try and prevent the enemy shaman objects from reaching the top of the map. There are two teams, and the team that can survive the longest wins. You shoot by clicking on the screen on a yellow field and you use your arrow keys/WASD to decide what direction they are going when they spawn. For every object you can get outside of the red area you get a point. You can use these points to purchase upgrades like constant shooters and better weapons. You can see how many points by looking at the number next to your name where shamanpoints would usually be.</p><br>]],
  616.  playerName, 1000, 50, 400, 275, 0x1C3C41, 0x1C3C41, 1)
  617. ui.addTextArea(103, "<p align='center'><a href='event:closeHelp'>I got it, let me play</a></p><br>", playerName, 1000, 340, 400, 20, 0x1C3C41, 0x1C3C41, 1)
  618. elseif textAreaId == 103 then
  619. ui.removeTextArea(102, playerName)
  620. ui.removeTextArea(103, playerName)
  621. elseif textAreaId == 104 then
  622. ui.addTextArea(106, "<p align='center'><a href='event:closeHelp'>Close</a></p><br>", playerName, 1000, 290, 400, 20, 0x1C3C41, 0x1C3C41, 1)
  623. ui.addTextArea(105, [[<p align='center'><font size='20'>Shop</font></p>
  624. <p>Spawns box instead of rune when you click</p>
  625. <p>A tower spawn runes in random directions</p>
  626. <p>A tower spawn cannons in random directions </p>
  627. <p>You can spawn items twice as fast </p>]], playerName , 1000, 50, 400, 225, 0x1C3C41, 0x1C3C41, 1)
  628. ui.addTextArea(111, "<p align='center'><a href='event:closeHelp'>Buy for 25</a></p><br>", playerName, 1300, 135, 100, 20, 0x0E242D, 0x0E242D, 1)
  629. ui.addTextArea(112, "<p align='center'><a href='event:closeHelp'>Buy for 100</a></p><br>", playerName, 1300, 170, 100, 20, 0x0E242D, 0x0E242D, 1)
  630. if players[playerName].shamanObject == 32 and doubleSpeed == false then
  631. ui.addTextArea(107, "<p align='center'><a href='event:closeHelp'>Buy for 100</a></p><br>", playerName, 1300, 100, 100, 20, 0x0E242D, 0x0E242D, 1)
  632. ui.addTextArea(113, "<p align='center'><a href='event:closeHelp'>Buy for 250</a></p><br>", playerName, 1300, 205, 100, 20, 0x0E242D, 0x0E242D, 1)
  633. elseif players[playerName].shamanObject == 19 and doubleSpeed == false then
  634. ui.addTextArea(107, "<p align='center'>Bought</p><br>", playerName, 1300, 100, 100, 20, 0x0E242D, 0x0E242D, 1)
  635. ui.addTextArea(113, "<p align='center'><a href='event:closeHelp'>Buy for 250</a></p><br>", playerName, 1300, 205, 100, 20, 0x0E242D, 0x0E242D, 1)
  636. elseif players[playerName].shamanObject == 19 and doubleSpeed == true then
  637. ui.addTextArea(107, "<p align='center'>Bought</p><br>", playerName, 1300, 100, 100, 20, 0x0E242D, 0x0E242D, 1)
  638. ui.addTextArea(113, "<p align='center'><a href='event:closeHelp'>Bought</a></p><br>", playerName, 1300, 205, 100, 20, 0x0E242D, 0x0E242D, 1)
  639. elseif players[playerName].shamanObject == 32 and doubleSpeed == true then
  640. ui.addTextArea(107, "<p align='center'><a href='event:closeHelp'>Buy for 100</a></p><br>", playerName, 1300, 100, 100, 20, 0x0E242D, 0x0E242D, 1)
  641. ui.addTextArea(113, "<p align='center'><a href='event:closeHelp'>Bought</a></p><br>", playerName, 1300, 205, 100, 20, 0x0E242D, 0x0E242D, 1)
  642. end
  643. elseif textAreaId == 106 then
  644. closeShop(100)
  645. elseif textAreaId == 107 then
  646. if players[playerName].cash >= 100 then
  647. players[playerName].cash = players[playerName].cash - 100
  648. players[playerName].shamanObject = 19
  649. players[playerName].friendlySpeed = 0
  650. ui.removeTextArea(107, playerName)
  651. ui.addTextArea(108, "<p align='center'><a href='event:closeHelp'>Bought</a></p><br>", playerName, 1300, 100, 100, 20, 0x0E242D, 0x0E242D, 1)
  652. end
  653. elseif textAreaId == 111 and players[playerName].cash >= 25 then
  654. players[playerName].cash = players[playerName].cash - 25
  655. closeShop(100)
  656. towerBuildingMode = true
  657. towerBuilder = playerName
  658. towerObjectPicker = 32
  659. elseif textAreaId == 112 and players[playerName].cash >= 100 then
  660. players[playerName].cash = players[playerName].cash - 100
  661. closeShop(100)
  662. towerBuildingMode = true
  663. towerBuilder = playerName
  664. towerObjectPicker = 19
  665. end
  666. if players[playerName].cash >= 250 then
  667. players[playerName].cash = players[playerName].cash - 250
  668. doubleSpeed = true
  669. ui.removeTextArea(113, playerName)
  670. ui.addTextArea(114, "<p align='center'><a href='event:closeHelp'>Bought</a></p><br>", playerName, 1300, 205, 100, 20, 0x0E242D, 0x0E242D, 1)
  671. end
  672. end
  673.  
  674. function closeShop(num)
  675. ui.removeTextArea(5+num, playerName)
  676. ui.removeTextArea(6+num, playerName)
  677. ui.removeTextArea(7+num, playerName)
  678. ui.removeTextArea(8+num, playerName)
  679. ui.removeTextArea(10+num, playerName)
  680. ui.removeTextArea(11 +num, playerName)
  681. ui.removeTextArea(12 + num, playerName)
  682. ui.removeTextArea(13 + num, playerName)
  683. ui.removeTextArea(14 + num, playerName)
  684. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement