Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- players={}
- enemies={}
- friends={}
- towers={}
- teamA={}
- teamB={}
- count=0
- newGame = false
- timer=0
- round = 0
- balloonsLeft = 0
- totalBalloons = 0
- row = 0
- spawnCounter = 0
- teamCountA=1
- teamCountB = 1
- towerCount = 201
- speed=0
- endCount = 0
- newRoundTimer = 10
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAfkDeath(true)
- tfm.exec.disableAutoTimeLeft(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoScore(true)
- tfm.exec.newGame("@4356401")
- -- Map = @4356401
- function eventNewGame()
- ui.addTextArea(1, "<p align='center'><a href='event:helpNeeded'>Help</a></p><br>", NIL, 5, 25, 35, 20, 0x1C3C41, 0x1C3C41, 1)
- ui.addTextArea(101, "<p align='center'><a href='event:helpNeeded'>Help</a></p><br>", NIL, 805, 25, 35, 20, 0x1C3C41, 0x1C3C41, 1)
- ui.addTextArea(4, "<p align='center'><a href='event:shopOpened'>Shop</a></p><br>", NIL, 50, 25, 35, 20, 0x1C3C41, 0x1C3C41, 1)
- ui.addTextArea(104, "<p align='center'><a href='event:shopOpened'>Shop</a></p><br>", NIL, 850, 25, 35, 20, 0x1C3C41, 0x1C3C41, 1)
- enemy = 2
- teamPicker = 0
- doubleSpeed = false
- gameWon=false
- for name,player in pairs(tfm.get.room.playerList) do
- system.bindMouse(name, true)
- players[name]={
- shamanObject=32, time = os.time(), team = teamPicker, cash = 0, friendlySpeed = 0
- }
- end
- createTeams()
- newGame = true
- round = 1
- balloonsLeft = 0
- local i = 201
- while i < towerCount do
- ui.removeTextArea(i, NIL)
- i = i + 1
- end
- towerCount = 201
- end
- function eventMouse(name, x,y)
- if towerBuildingMode== true and name == towerBuilder then
- 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
- towers[towerCount]={towerX = x, towerY = y, towerObject = towerObjectPicker}
- if towerObjectPicker == 32 then
- ui.addTextArea(towerCount, "", NIL, x, y, 20, 20, 0x00FFFF, 0x00FFFF, 1)
- elseif towerObjectPicker == 19 then
- ui.addTextArea(towerCount, "", NIL, x, y, 20, 20, 0x0A0A0A, 0x0A0A0A, 1)
- end
- towerCount = towerCount + 1
- towerBuildingMode=false
- end
- else
- if players[name].team==0 then
- if x > 0 and x < 100 or x > 350 and x < 450 or x > 700 and x < 800 then
- if doubleSpeed == false then
- if players[name].time + 1000 < os.time() then
- if tfm.get.room.playerList[name].isFacingRight then
- id=tfm.exec.addShamanObject(players[name].shamanObject, x, y, 0, players[name].friendlySpeed, 0, false)
- table.insert(friends,{id, os.time()})
- players[name].time=os.time()
- else
- id=tfm.exec.addShamanObject(players[name].shamanObject, x, y, 180, players[name].friendlySpeed * -1,0, false)
- table.insert(friends,{id, os.time()})
- players[name].time=os.time()
- end
- end
- elseif doubleSpeed == true then
- if players[name].time + 500 < os.time() then
- if tfm.get.room.playerList[name].isFacingRight then
- id=tfm.exec.addShamanObject(players[name].shamanObject, x, y, 0, players[name].friendlySpeed, 0, false)
- table.insert(friends,{id, os.time()})
- players[name].time=os.time()
- else
- id=tfm.exec.addShamanObject(players[name].shamanObject, x, y, 180, players[name].friendlySpeed * -1,0, false)
- table.insert(friends,{id, os.time()})
- players[name].time=os.time()
- end
- end
- end
- end
- elseif players[name].team==1 then
- if x > 800 and x < 900 or x > 1150 and x < 1250 or x > 1500 and x < 1600 then
- if doubleSpeed == false then
- if players[name].time + 1000 < os.time() then
- if tfm.get.room.playerList[name].isFacingRight then
- id=tfm.exec.addShamanObject(players[name].shamanObject, x, y, 0, players[name].friendlySpeed, 0, false)
- table.insert(friends,{id, os.time()})
- players[name].time=os.time()
- else
- id=tfm.exec.addShamanObject(players[name].shamanObject, x, y, 180, players[name].friendlySpeed * -1,0, false)
- table.insert(friends,{id, os.time()})
- players[name].time=os.time()
- end
- end
- elseif doubleSpeed == true then
- if players[name].time + 500 < os.time() then
- if tfm.get.room.playerList[name].isFacingRight then
- id=tfm.exec.addShamanObject(players[name].shamanObject, x, y, 0, players[name].friendlySpeed, 0, false)
- table.insert(friends,{id, os.time()})
- players[name].time=os.time()
- else
- id=tfm.exec.addShamanObject(players[name].shamanObject, x, y, 180, players[name].friendlySpeed * -1,0, false)
- table.insert(friends,{id, os.time()})
- players[name].time=os.time()
- end
- end
- end
- end
- end
- end
- end
- function eventLoop(time,remaining)
- tfm.exec.setUIShamanName("Round " .. round)
- timer = timer + 1
- if newGame == true then
- if gameWon == true then
- if endCount < 10 then
- if winner == 1 then
- ui.addTextArea(1001, "<p align='center'><font size='42'>You win :)</font></p><br>", NIL, 0, 150, 800, 100, 0x1C3C41, 0x1C3C41, 0)
- ui.addTextArea(1002, "<p align='center'><font size='42'>You lose :(</font></p><br>", NIL, 800, 150, 800, 100, 0x1C3C41, 0x1C3C41, 0)
- end
- if winner == 2 then
- ui.addTextArea(1001, "<p align='center'><font size='42'>You win :)</font></p><br>", NIL, 800, 150, 800, 100, 0x1C3C41, 0x1C3C41, 0)
- ui.addTextArea(1002, "<p align='center'><font size='42'>You lose :(</font></p><br>", NIL, 0, 150, 800, 100, 0x1C3C41, 0x1C3C41, 0)
- end
- if winner == 3 then
- ui.addTextArea(1001, "<p align='center'><font size='42'>You win :)</font></p><br>", NIL, 0, 150, 800, 100, 0x1C3C41, 0x1C3C41, 0)
- ui.addTextArea(1002, "<p align='center'><font size='42'>You win :)</font></p><br>", NIL, 800, 150, 800, 100, 0x1C3C41, 0x1C3C41, 0)
- end
- endCount = endCount + 1
- else
- endCount = 0
- ui.removeTextArea(1001, NIL)
- ui.removeTextArea(1002, NIL)
- gameWon = false
- winner = 0
- tfm.exec.newGame("@4356401")
- end
- else
- if newRoundTimer == 10 then
- if round == 1 then
- if timer >= 4 then
- totalBalloons = 15
- spawnEnemy(-1)
- timer = 0
- balloonsLeft = balloonsLeft + 1
- if balloonsLeft >= totalBalloons then
- newRoundTimer = 0
- round = 2
- balloonsLeft = 0
- end
- end
- end
- if round == 2 then
- if timer >= 3 then
- totalBalloons = 20
- spawnEnemy(-1)
- timer = 0
- balloonsLeft = balloonsLeft + 1
- if balloonsLeft >= totalBalloons then
- newRoundTimer = 0
- round = 3
- balloonsLeft = 0
- end
- end
- end
- if round == 3 then
- if timer >= 3 then
- totalBalloons = 15
- spawnEnemy(-2)
- timer = 0
- balloonsLeft = balloonsLeft + 1
- if balloonsLeft >= totalBalloons then
- newRoundTimer = 0
- round = 4
- balloonsLeft = 0
- end
- end
- end
- if round == 4 then
- for i,balloon in ipairs(enemies) do
- end
- if timer >= 2 then
- totalBalloons = 20
- spawnEnemy(-2)
- timer = 0
- balloonsLeft = balloonsLeft + 1
- if balloonsLeft >= totalBalloons then
- newRoundTimer = 0
- round = 5
- balloonsLeft = 0
- end
- end
- end
- if round == 5 then
- if timer >= 3 then
- totalBalloons = 15
- enemy=28
- spawnEnemy(-1)
- timer = 0
- balloonsLeft = balloonsLeft + 1
- if balloonsLeft >= totalBalloons then
- newRoundTimer = 0
- round = 6
- balloonsLeft = 0
- end
- end
- end
- if round == 6 then
- if timer >= 2 then
- totalBalloons = 20
- enemy=28
- spawnEnemy(-1)
- timer = 0
- balloonsLeft = balloonsLeft + 1
- if balloonsLeft >= totalBalloons then
- round = 7
- balloonsLeft = 0
- end
- end
- end
- if round == 7 then
- if timer >= 3 then
- totalBalloons = 15
- enemy=28
- spawnEnemy(-2)
- timer = 0
- balloonsLeft = balloonsLeft + 1
- if balloonsLeft >= totalBalloons then
- round = 8
- balloonsLeft = 0
- end
- end
- end
- if round == 8 then
- if timer >= 4 then
- totalBalloons = 10
- enemy=10
- spawnEnemy(-1)
- timer = 0
- balloonsLeft = balloonsLeft + 1
- if balloonsLeft >= totalBalloons then
- round = 9
- balloonsLeft = 0
- end
- end
- end
- if round == 9 then
- if timer >= 2 then
- totalBalloons = 20
- enemy=10
- spawnEnemy(-1)
- timer = 0
- balloonsLeft = balloonsLeft + 1
- if balloonsLeft >= totalBalloons then
- round = 10
- balloonsLeft = 0
- end
- end
- end
- if round == 10 then
- if timer >= 4 then
- totalBalloons = 15
- enemy=10
- spawnEnemy(-2)
- timer = 0
- balloonsLeft = balloonsLeft + 1
- if balloonsLeft >= totalBalloons then
- round = 11
- balloonsLeft = 0
- end
- end
- end
- if round == 11 then
- if timer >= 2 then
- totalBalloons = 20
- enemy=10
- spawnEnemy(-2)
- timer = 0
- balloonsLeft = balloonsLeft + 1
- if balloonsLeft >= totalBalloons then
- round = 12
- balloonsLeft = 0
- end
- end
- end
- if round == 12 then
- if timer >= 1 then
- totalBalloons = 30
- enemy=28
- spawnEnemy(-1)
- timer = 0
- balloonsLeft = balloonsLeft + 1
- if balloonsLeft >= totalBalloons then
- round = 13
- balloonsLeft = 0
- end
- end
- end
- if round == 13 then
- if timer >= 4 then
- totalBalloons = 12
- enemy=34
- spawnEnemy(-1)
- timer = 0
- balloonsLeft = balloonsLeft + 1
- if balloonsLeft >= totalBalloons then
- round = 14
- balloonsLeft = 0
- end
- end
- end
- if round == 14 then
- if timer >= 2 then
- totalBalloons = 25
- enemy=34
- spawnEnemy(-1)
- timer = 0
- balloonsLeft = balloonsLeft + 1
- if balloonsLeft >= totalBalloons then
- round = 15
- balloonsLeft = 0
- end
- end
- end
- if round == 15 then
- if timer >= 4 then
- totalBalloons = 15
- enemy=34
- spawnEnemy(-2)
- timer = 0
- balloonsLeft = balloonsLeft + 1
- if balloonsLeft >= totalBalloons then
- round = 16
- balloonsLeft = 0
- end
- end
- end
- if round == 16 then
- if timer >= 2 then
- totalBalloons = 30
- enemy=34
- spawnEnemy(-2)
- timer = 0
- balloonsLeft = balloonsLeft + 1
- if balloonsLeft >= totalBalloons then
- round = 17
- balloonsLeft = 0
- end
- end
- end
- if round == 17 then
- if timer >= 2 then
- totalBalloons = 30
- enemy=10
- spawnEnemy(-2)
- timer = 0
- balloonsLeft = balloonsLeft + 1
- if balloonsLeft >= totalBalloons then
- round = 18
- balloonsLeft = 0
- end
- end
- end
- if round == 18 then
- if timer >= 1 then
- totalBalloons = 50
- enemy=34
- spawnEnemy(-1)
- timer = 0
- balloonsLeft = balloonsLeft + 1
- if balloonsLeft >= totalBalloons then
- round = 19
- balloonsLeft = 0
- end
- end
- end
- if round == 19 then
- if timer >= 1 then
- totalBalloons = 50
- enemy=34
- spawnEnemy(-2)
- timer = 0
- balloonsLeft = balloonsLeft + 1
- if balloonsLeft >= totalBalloons then
- round = 20
- balloonsLeft = 0
- end
- end
- end
- if round == 20 then
- if timer >= 1 then
- totalBalloons = 100
- enemy=10
- spawnEnemy(-3)
- timer = 0
- balloonsLeft = balloonsLeft + 1
- if balloonsLeft >= totalBalloons then
- gameWon=true
- winner = 3
- end
- end
- end
- else
- newRoundTimer = newRoundTimer + 1
- end
- if #enemies > 0 then
- for i,balloon in ipairs(enemies) do
- if tfm.get.room.objectList[balloon[1]].y <= 20 and tfm.get.room.objectList[balloon[1]].y >= -50 then
- gameWon=true
- if tfm.get.room.objectList[balloon[1]].x > 800 then
- winner = 1
- else
- winner = 2
- end
- for i,balloon in ipairs(enemies) do
- table.remove(enemies,i)
- end
- end
- if tfm.get.room.objectList[balloon[1]].x > balloon[3] + 25 or tfm.get.room.objectList[balloon[1]].x < balloon[3] - 25 then
- if balloon[2]+1000<os.time() then
- tfm.exec.removeObject(balloon[1])
- table.remove(enemies,i)
- test = 1
- if balloon[3] < 800 then
- while test < teamCountA do
- players[teamA[test]].cash = players[teamA[test]].cash + 1
- tfm.exec.setPlayerScore(teamA[test], players[teamA[test]].cash, false)
- test = test + 1
- end
- elseif balloon[3] > 800 then
- while test < teamCountB do
- players[teamB[test]].cash = players[teamB[test]].cash + 1
- tfm.exec.setPlayerScore(teamB[test], players[teamB[test]].cash, false)
- test = test + 1
- end
- end
- end
- end
- end
- end
- for i,friend in ipairs(friends) do
- if friend[2] + 2000 < os.time() then
- tfm.exec.removeObject(friend[1])
- table.remove(friends,i)
- end
- end
- local i = 201
- while i < towerCount do
- id=tfm.exec.addShamanObject(towers[i].towerObject, towers[i].towerX, towers[i].towerY, math.random(360), 0,0, false)
- table.insert(friends,{id, os.time()})
- i = i +1
- end
- end
- end
- end
- function createTeams()
- local i = 1
- while i < teamCountA do
- teamA[i] = NIL
- i = i +1
- end
- i=1
- while i < teamCountB do
- teamB[i] = NIL
- i = i +1
- end
- teamCountA=1
- teamCountB = 1
- twoTeams=false
- for name,player in pairs(tfm.get.room.playerList) do
- if teamPicker == 0 then
- players[name].team= teamPicker
- teamA[teamCountA] = name
- teamCountA = teamCountA + 1
- tfm.exec.movePlayer(name, 400, -500, false, 0, 0, false)
- teamPicker = 1
- elseif teamPicker == 1 then
- players[name].team= teamPicker
- teamB[teamCountB] = name
- teamCountB = teamCountB + 1
- tfm.exec.movePlayer(name, 1200, -500, false, 0, 0, false)
- twoTeams = true
- teamPicker = 0
- end
- end
- end
- function spawnEnemy(speed)
- while spawnCounter<2 do
- if spawnCounter == 0 then
- if row == 0 then
- startLocation = 225
- id = tfm.exec.addShamanObject(enemy, startLocation, 400, 0, 0, speed, false)
- table.insert(enemies,{id, os.time(), startLocation})
- spawnCounter = spawnCounter + 1
- elseif row == 1 then
- startLocation = 575
- id = tfm.exec.addShamanObject(enemy, startLocation, 400, 0, 0, speed, false)
- table.insert(enemies,{id, os.time(), startLocation})
- spawnCounter = spawnCounter + 1
- end
- elseif spawnCounter == 1 then
- if twoTeams == true then
- if row == 0 then
- startLocation = 1025
- id = tfm.exec.addShamanObject(enemy, startLocation, 400, 0, 0, speed, false)
- table.insert(enemies,{id, os.time(), startLocation})
- spawnCounter = spawnCounter + 1
- row = 1
- elseif row == 1 then
- startLocation = 1375
- id = tfm.exec.addShamanObject(enemy, startLocation, 400, 0, 0, speed, false)
- table.insert(enemies,{id, os.time(), startLocation})
- spawnCounter = spawnCounter + 1
- row = 0
- end
- else
- spawnCounter = spawnCounter + 1
- if row == 0 then
- row = 1
- elseif row == 1 then
- row = 0
- end
- end
- end
- end
- spawnCounter = 0
- end
- function eventTextAreaCallback(textAreaId, playerName, callback)
- if textAreaId == 1 then
- ui.addTextArea(2, [[<p align='center'><font size='20'>Welcome to Shaman Defence</font></p>
- <p align='center'>Made by Ordboka</p><p></p>
- <p align='center'><font size = '16'>How to play</font></p>
- <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>]],
- playerName, 200, 50, 400, 275, 0x1C3C41, 0x1C3C41, 1)
- 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)
- elseif textAreaId == 3 then
- ui.removeTextArea(2, playerName)
- ui.removeTextArea(3, playerName)
- elseif textAreaId == 4 then
- ui.addTextArea(6, "<p align='center'><a href='event:closeHelp'>Close</a></p><br>", playerName, 200, 290, 400, 20, 0x1C3C41, 0x1C3C41, 1)
- ui.addTextArea(5, [[<p align='center'><font size='20'>Shop</font></p>
- <p>Spawns a cannon instead of rune when you click</p>
- <p>A tower spawn runes in random directions</p>
- <p>A tower spawn cannons in random directions </p>
- <p>You can spawn items twice as fast </p>]], playerName , 200, 50, 400, 225, 0x1C3C41, 0x1C3C41, 1)
- ui.addTextArea(11, "<p align='center'><a href='event:closeHelp'>Buy for 25</a></p><br>", playerName, 500, 135, 100, 20, 0x0E242D, 0x0E242D, 1)
- ui.addTextArea(12, "<p align='center'><a href='event:closeHelp'>Buy for 100</a></p><br>", playerName, 500, 170, 100, 20, 0x0E242D, 0x0E242D, 1)
- if players[playerName].shamanObject == 32 and doubleSpeed == false then
- ui.addTextArea(7, "<p align='center'><a href='event:closeHelp'>Buy for 100</a></p><br>", playerName, 500, 100, 100, 20, 0x0E242D, 0x0E242D, 1)
- ui.addTextArea(13, "<p align='center'><a href='event:closeHelp'>Buy for 250</a></p><br>", playerName, 500, 205, 100, 20, 0x0E242D, 0x0E242D, 1)
- elseif players[playerName].shamanObject == 19 and doubleSpeed == false then
- ui.addTextArea(7, "<p align='center'>Bought</p><br>", playerName, 500, 100, 100, 20, 0x0E242D, 0x0E242D, 1)
- ui.addTextArea(13, "<p align='center'><a href='event:closeHelp'>Buy for 250</a></p><br>", playerName, 500, 205, 100, 20, 0x0E242D, 0x0E242D, 1)
- elseif players[playerName].shamanObject == 19 and doubleSpeed == true then
- ui.addTextArea(7, "<p align='center'>Bought</p><br>", playerName, 500, 100, 100, 20, 0x0E242D, 0x0E242D, 1)
- ui.addTextArea(14, "<p align='center'>Bought</p><br>", playerName, 500, 205, 100, 20, 0x0E242D, 0x0E242D, 1)
- elseif players[playerName].shamanObject == 32 and doubleSpeed == true then
- ui.addTextArea(7, "<p align='center'><a href='event:closeHelp'>Buy for 100</a></p><br>", playerName, 500, 100, 100, 20, 0x0E242D, 0x0E242D, 1)
- ui.addTextArea(14, "<p align='center'>Bought</p><br>", playerName, 500, 205, 100, 20, 0x0E242D, 0x0E242D, 1)
- end
- elseif textAreaId == 6 then
- closeShop(0)
- elseif textAreaId == 7 then
- if players[playerName].cash >= 100 then
- players[playerName].cash = players[playerName].cash - 100
- players[playerName].shamanObject = 19
- players[playerName].friendlySpeed = 0
- ui.removeTextArea(7, playerName)
- ui.addTextArea(8, "<p align='center'><a href='event:closeHelp'>Bought</a></p><br>", playerName, 500, 100, 100, 20, 0x0E242D, 0x0E242D, 1)
- end
- elseif textAreaId == 11 and players[playerName].cash >= 25 then
- players[playerName].cash = players[playerName].cash - 25
- closeShop(0)
- towerBuildingMode = true
- towerBuilder = playerName
- towerObjectPicker = 32
- elseif textAreaId == 12 and players[playerName].cash >= 100 then
- players[playerName].cash = players[playerName].cash - 100
- closeShop(0)
- towerBuildingMode = true
- towerBuilder = playerName
- towerObjectPicker = 19
- elseif textAreaId == 13 then
- if players[playerName].cash >= 250 then
- players[playerName].cash = players[playerName].cash - 250
- doubleSpeed = true
- ui.removeTextArea(13, playerName)
- ui.addTextArea(14,"<p align='center'><a href='event:closeHelp'>Bought</a></p><br>", playerName, 500, 205, 100, 20, 0x0E242D, 0x0E242D, 1)
- end
- end
- if textAreaId == 101 then
- ui.addTextArea(102, [[<p align='center'><font size='20'>Welcome to Shaman Defence</font></p>
- <p align='center'>Made by Ordboka</p><p></p>
- <p align='center'><font size = '16'>How to play</font></p>
- <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>]],
- playerName, 1000, 50, 400, 275, 0x1C3C41, 0x1C3C41, 1)
- 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)
- elseif textAreaId == 103 then
- ui.removeTextArea(102, playerName)
- ui.removeTextArea(103, playerName)
- elseif textAreaId == 104 then
- ui.addTextArea(106, "<p align='center'><a href='event:closeHelp'>Close</a></p><br>", playerName, 1000, 290, 400, 20, 0x1C3C41, 0x1C3C41, 1)
- ui.addTextArea(105, [[<p align='center'><font size='20'>Shop</font></p>
- <p>Spawns box instead of rune when you click</p>
- <p>A tower spawn runes in random directions</p>
- <p>A tower spawn cannons in random directions </p>
- <p>You can spawn items twice as fast </p>]], playerName , 1000, 50, 400, 225, 0x1C3C41, 0x1C3C41, 1)
- ui.addTextArea(111, "<p align='center'><a href='event:closeHelp'>Buy for 25</a></p><br>", playerName, 1300, 135, 100, 20, 0x0E242D, 0x0E242D, 1)
- ui.addTextArea(112, "<p align='center'><a href='event:closeHelp'>Buy for 100</a></p><br>", playerName, 1300, 170, 100, 20, 0x0E242D, 0x0E242D, 1)
- if players[playerName].shamanObject == 32 and doubleSpeed == false then
- ui.addTextArea(107, "<p align='center'><a href='event:closeHelp'>Buy for 100</a></p><br>", playerName, 1300, 100, 100, 20, 0x0E242D, 0x0E242D, 1)
- ui.addTextArea(113, "<p align='center'><a href='event:closeHelp'>Buy for 250</a></p><br>", playerName, 1300, 205, 100, 20, 0x0E242D, 0x0E242D, 1)
- elseif players[playerName].shamanObject == 19 and doubleSpeed == false then
- ui.addTextArea(107, "<p align='center'>Bought</p><br>", playerName, 1300, 100, 100, 20, 0x0E242D, 0x0E242D, 1)
- ui.addTextArea(113, "<p align='center'><a href='event:closeHelp'>Buy for 250</a></p><br>", playerName, 1300, 205, 100, 20, 0x0E242D, 0x0E242D, 1)
- elseif players[playerName].shamanObject == 19 and doubleSpeed == true then
- ui.addTextArea(107, "<p align='center'>Bought</p><br>", playerName, 1300, 100, 100, 20, 0x0E242D, 0x0E242D, 1)
- ui.addTextArea(113, "<p align='center'><a href='event:closeHelp'>Bought</a></p><br>", playerName, 1300, 205, 100, 20, 0x0E242D, 0x0E242D, 1)
- elseif players[playerName].shamanObject == 32 and doubleSpeed == true then
- ui.addTextArea(107, "<p align='center'><a href='event:closeHelp'>Buy for 100</a></p><br>", playerName, 1300, 100, 100, 20, 0x0E242D, 0x0E242D, 1)
- ui.addTextArea(113, "<p align='center'><a href='event:closeHelp'>Bought</a></p><br>", playerName, 1300, 205, 100, 20, 0x0E242D, 0x0E242D, 1)
- end
- elseif textAreaId == 106 then
- closeShop(100)
- elseif textAreaId == 107 then
- if players[playerName].cash >= 100 then
- players[playerName].cash = players[playerName].cash - 100
- players[playerName].shamanObject = 19
- players[playerName].friendlySpeed = 0
- ui.removeTextArea(107, playerName)
- ui.addTextArea(108, "<p align='center'><a href='event:closeHelp'>Bought</a></p><br>", playerName, 1300, 100, 100, 20, 0x0E242D, 0x0E242D, 1)
- end
- elseif textAreaId == 111 and players[playerName].cash >= 25 then
- players[playerName].cash = players[playerName].cash - 25
- closeShop(100)
- towerBuildingMode = true
- towerBuilder = playerName
- towerObjectPicker = 32
- elseif textAreaId == 112 and players[playerName].cash >= 100 then
- players[playerName].cash = players[playerName].cash - 100
- closeShop(100)
- towerBuildingMode = true
- towerBuilder = playerName
- towerObjectPicker = 19
- end
- if players[playerName].cash >= 250 then
- players[playerName].cash = players[playerName].cash - 250
- doubleSpeed = true
- ui.removeTextArea(113, playerName)
- ui.addTextArea(114, "<p align='center'><a href='event:closeHelp'>Bought</a></p><br>", playerName, 1300, 205, 100, 20, 0x0E242D, 0x0E242D, 1)
- end
- end
- function closeShop(num)
- ui.removeTextArea(5+num, playerName)
- ui.removeTextArea(6+num, playerName)
- ui.removeTextArea(7+num, playerName)
- ui.removeTextArea(8+num, playerName)
- ui.removeTextArea(10+num, playerName)
- ui.removeTextArea(11 +num, playerName)
- ui.removeTextArea(12 + num, playerName)
- ui.removeTextArea(13 + num, playerName)
- ui.removeTextArea(14 + num, playerName)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement