- Joined
- Dec 26, 2013
- Messages
- 1,635
- Solutions
- 11
- Reaction score
- 880
Hello, i have this problem:
Code:Lua Script Error: [CreatureScript Interface] data/creaturescripts/scripts/zombie_death.lua:eek:nDeath data/creaturescripts/scripts/zombie_death.lua:5: attempt to index local 'monster' (a nil value) stack traceback: [C]: in function '__index' data/creaturescripts/scripts/zombie_death.lua:5: in function <data/creaturescripts/scripts/zombie_death.lua:3>
My zombie_death.lua is:
Code:dofile('data/zombie_system.lua') function onDeath(cid, corpse, killer, mostDamage, unjustified, mostDamage_unjustified) local monster = Monster(cid) monster:say("I WILL BE BACK!", TALKTYPE_MONSTER_YELL) monster:getPosition():sendMagicEffect(CONST_ME_MORTAREA) doSummonZombie() Game.setStorageValue(zeZombieCountGlobalStorage, Game.getStorageValue(zeZombieCountGlobalStorage) - 1) end function onPrepareDeath(cid, killer) local player = Player(cid) local winner = 0 if player:getStorageValue(zeJoinStorage) == 1 then Game.setStorageValue(zeJoinedCountGlobalStorage, Game.getStorageValue(zeJoinedCountGlobalStorage) - 1) player:teleportTo(player:getTown():getTemplePosition()) player:setStorageValue(zeJoinStorage, 0) player:addHealth(player:getMaxHealth()) if Game.getStorageValue(zeJoinedCountGlobalStorage) <= 1 then --Event ended, someone won! local players = Game.getPlayers() for _, tmpPlayer in ipairs(players) do local stor = tmpPlayer:getStorageValue(zeJoinStorage) if stor == 1 then winner = tmpPlayer:getId() break end end winner = Player(winner) if winner then winner:teleportTo(winner:getTown():getTemplePosition()) local trophy = winner:addItem(zeTrophy, 1) local reward = winner:addItem(zeReward, 1) if trophy then trophy:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, '['.. winner:getName() ..'] has won the Zombie Event.') end broadcastMessage(string.format('%s is the winner of Zombie Event Versus %s Zombies.', winner:getName(), Game.getStorageValue(zeZombieCountGlobalStorage)), MESSAGE_STATUS_WARNING) end doClearZombieArena() resetVariables() end return false end return true end
Thanks for help.
You aren't using 1.0
The problem should be fixed by changing
Code:
function onDeath(cid, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
local monster = Monster(cid)
to
Code:
function onDeath(monster, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)