Zoe Skandinavia
Member
- Joined
- Jul 18, 2014
- Messages
- 193
- Solutions
- 2
- Reaction score
- 15
Hi, i was making this new script for a quest but when i want to use the towers to teleport myself to the right position, in console appears
towersbosses.lua:14: attempt to index a nil value
This is my script: (IT'S TFS 1.2)
Please help
Thanks.
towersbosses.lua:14: attempt to index a nil value
This is my script: (IT'S TFS 1.2)
Code:
function onUse(player, fromPosition, item, toPosition, itemEx)
local undergrounds = {
[4567] = {newPos = {x = 246, y = 116, z = 11}, creature = "Red Undergrounder", creaturepos = {x = 241, y = 116, z = 11}},
[4568] = {newPos = {x = 283, y = 116, z = 11}, creature = "Green Undergrounder", creaturepos = {x = 277, y = 116, z = 11}},
[4569] = {newPos = {x = 312, y = 116, z = 11}, creature = "Yellow Undergrounder", creaturepos = {x = 304, y = 116, z = 11}},
[4560] = {newPos = {x = 360, y = 116, z = 11}, creature = "Blue Undergrounder", creaturepos = {x = 354, y = 113, z = 11}}
}
local finalboss = {
[4562] = {newPos = {x = 360, y = 116, z = 11}, creature = "Undergrounder", creaturepos = {x = 354, y = 113, z = 11}}
}
if player:getStorageValue(undergrounds[item.actionid]) < 1 then
player:teleportTo(undergrounds[item.actionid].newPos)
doCreatureSay(cid, "Muahahaha!...", TALKTYPE_ORANGE_1)
if getGlobalStorageValue(undergrounds[item.actionid]) < 1 then
doSummonCreature(undergrounds[item.actionid].creature, undergrounds[item.actionid].creaturepos)
setGlobalStorageValue(undergrounds[item.actionid], 1)
end
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The cave looks bad, you can't pass there any more.")
end
if player:getStorageValue(finalboss[item.uid]) < 1 and player:getStorageValue(undergrounds[item.actionid]) == 2 then
player:teleportTo(finalboss[item.uid].newPos)
doCreatureSay(cid, "Death Sentence...", TALKTYPE_ORANGE_1)
if getGlobalStorageValue(finalboss[item.uid]) < 1 then
doSummonCreature(finalboss[item.uid].creature, finalboss[item.uid].creaturepos)
setGlobalStorageValue(finalboss[item.uid], 1)
end
elseif player:getStorageValue(finalboss[item.uid]) == 2 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The Undergrounder has been defeated. You can't pass there any more.")
end
return true
end
Please help

Thanks.