Zoe Skandinavia
Member
- Joined
- Jul 18, 2014
- Messages
- 193
- Solutions
- 2
- Reaction score
- 15
Hi, im trying to make a script that when you kill some bosses, it gives you a storage value and teleports you to an specific position, but when i kill the boss, nothing happens :/ and i already verified on creaturescripts.xml, on login.lua (register the event) and the script but i cant find the error.
This is the script (IT'S FOR TFS 1.2):
Please help. Thanks
This is the script (IT'S FOR TFS 1.2):
Code:
local bosses = {
['Red Undergrounder'] = {status = 2, storage = 4565},
['Green Undergrounder'] = {status = 2, storage = 4566},
['Yellow Undergrounder'] = {status = 2, storage = 4567},
['Blue Undergrounder'] = {status = 2, storage = 4568}
}
function onKill(creature, target)
local targetMonster = target:getMonster()
if not targetMonster then
return true
end
local bossConfig = bosses[targetMonster:getName():lower()]
if not bossConfig then
return true
end
for pid, _ in pairs(targetMonster:getDamageMap()) do
local attackerPlayer = Player(pid)
if attackerPlayer then
if attackerPlayer:getStorageValue(bossConfig.storage) < bossConfig.status then
attackerPlayer:setStorageValue(bossConfig.storage, bossConfig.status)
Game.setStorageValue(bossConfig.storage, 0)
attackerPlayer:teleportTo({x = 248, y = 115, z = 10})
end
end
end
end
Please help. Thanks