UpInSmoke
Supreme Ruler
- Joined
- Nov 16, 2008
- Messages
- 303
- Reaction score
- 21
So im trying to create a boss script.
Im having trouble identifying if the boss is dead or not.
heres the script:
error:
I know it has to do with the GetCreatureHealth .. but i dont know how i would identify the creature in the script.
help, rep++
Im having trouble identifying if the boss is dead or not.
heres the script:
Code:
local config = {
temporaryArea = {
{x = 1036, y = 1037, z = 7}, -- northwest corner of area where players must stand in order to join the event
{x = 1048, y = 1047, z = 7} -- south east corner
},
arenaArea = {
{x = 1045, y = 1012, z = 7}, -- nw corner of arena
{x = 1060, y = 1025, z = 7}, -- se corner of arena
{x = 1053, y = 1018, z = 7} -- center of arena
},
minPlayers = 1,
prize = {2159}, -- rewards
monster = "cat",
monsterPos = {x = 1053, y = 1021, z = 7},
temple = {x = 1017, y = 1044, z = 7}
}
function onThink(interval, lastExecution, thinkInterval)
local players, arenaPlayers = {}, {}
for x = (config.temporaryArea)[1].x, (config.temporaryArea)[2].x do
for y = (config.temporaryArea)[1].y, (config.temporaryArea)[2].y do
for z = (config.temporaryArea)[1].z, (config.temporaryArea)[2].z do
if(isPlayer(getTopCreature({x = x, y = y, z = z}).uid)) then
table.insert(players, getTopCreature({x = x, y = y, z = z}).uid)
end
end
end
end
for x = (config.arenaArea)[1].x, (config.arenaArea)[2].x do
for y = (config.arenaArea)[1].y, (config.arenaArea)[2].y do
for z = (config.arenaArea)[1].z, (config.arenaArea)[2].z do
if(isPlayer(getTopCreature({x = x, y = y, z = z}).uid)) then
table.insert(arenaPlayers, getTopCreature({x = x, y = y, z = z}).uid)
end
end
end
end
if(table.maxn(players) >= config.minPlayers) then
for i = 1, #players do
doTeleportThing(players[i], (config.arenaArea)[3])
doSendMagicEffect((config.arenaArea)[3], CONST_ME_TELEPORT)
doPlayerSendTextMessage(players[i], MESSAGE_STATUS_WARNING, "Kill the cat!")
doCreateMonster(cid, config.monster, config.monsterPos)
if getCreatureHealth(cid) <= 0 then
for a = 1, #arenaPlayers do
doTeleportThing(arenaPlayers[a], config.temple)
doPlayerSendTextMessage(arenaPlayers[a], MESSAGE_STATUS_CONSOLE_BLUE, "You have slain the cat and recived your reward.")
doPlayerAddItem(arenaPlayers[a], config.prize,5)
end
end
end
end
return true
end
Code:
[03/06/2013 01:52:43] [Error - GlobalEvent Interface]
[03/06/2013 01:52:43] data/globalevents/scripts/bosses/catFight.lua:onThink
[03/06/2013 01:52:43] Description:
[03/06/2013 01:52:43] (luaGetCreatureHealth) Creature not found
[03/06/2013 01:52:43] [Error - GlobalEvent Interface]
[03/06/2013 01:52:43] data/globalevents/scripts/bosses/catFight.lua:onThink
[03/06/2013 01:52:43] Description:
[03/06/2013 01:52:43] data/globalevents/scripts/bosses/catFight.lua:44: attempt to compare boolean with number
[03/06/2013 01:52:43] stack traceback:
[03/06/2013 01:52:43] data/globalevents/scripts/bosses/catFight.lua:44: in function <data/globalevents/scripts/bosses/catFight.lua:18>
[03/06/2013 01:52:43] [Error - GlobalEvents::think] Couldn't execute event: catfight
help, rep++
Last edited: