Lava Titan
Developer
Hey, I got this working fine in other scripts but no idea why it's not working in this one...
I made this script line by line, and I'm using the spectators function correctly I'm sure...
Can someone explain me what am I doing wrong please?
Thanks in advance
Using TFS 1.2
this is the error I'm getting
this is default TFS spectator func in compat.lua (I didn't touch it)
this is my script in movements
I made this script line by line, and I'm using the spectators function correctly I'm sure...
Can someone explain me what am I doing wrong please?
Thanks in advance
Using TFS 1.2
this is the error I'm getting
this is default TFS spectator func in compat.lua (I didn't touch it)
Code:
function getSpectators(centerPos, rangex, rangey, multifloor, onlyPlayers)
local result = Game.getSpectators(centerPos, multifloor, onlyPlayers or false, rangex, rangex, rangey, rangey)
if #result == 0 then
return nil
end
for index, spectator in ipairs(result) do
result[index] = spectator:getId()
end
return result
end
this is my script in movements
Code:
local config = {
-- actionID, level, storage
[13900] = {level = 5000, storage = 13900, storage_value = 1,set_storage = 1,msg_failure = "You must kill all devil's minions before take his throne.", msg_sucess = "Devil Yells:\nBEGONE INTRUDER!"},
[13901] = {level = 5000, storage = 13901, storage_value = 1,set_storage = 0,msg_failure = "You must sit in devil's throne before acess this area.", msg_sucess = "Devil Yells:\nYOU WILL REGRET THIS!"}
}
function onStepIn(player, item, position, fromPosition)
local item_aid = config[item:getActionId()]
if player:getExhaustion(1000) > 0 then
player:teleportTo(fromPosition)
return true
end
if not player:isPlayer() then
return true
end
if(not(item_aid))then
return true
end
local center_pos = player:getPosition()
local spectators = #Game.getSpectators(center_pos, false, false, 5, 5, 5, 5)
local monsters = spectators:getMonsters()
if item_aid.set_storage == 1 then
if monsters == 0 and player:getStorageValue(item_aid.storage) == 0 then
player:say(item_aid.msg_sucess, TALKTYPE_MONSTER_YELL)
player:setStorageValue(item_aid.storage, item_aid.storage_value)
elseif monsters >= 1 and player:getStorageValue(item_aid.storage) == 0 then
player:say(item_aid.msg_failure, TALKTYPE_MONSTER_YELL)
creature:teleportTo(fromPosition)
player:setExhaustion(1000, 3)
elseif monsters == 0 and player:getStorageValue(item_aid.storage) == 1 then
player:say("You can't repeat this action.", TALKTYPE_MONSTER_YELL)
creature:teleportTo(fromPosition)
player:setExhaustion(1000, 3)
end
end
if item_aid.set_storage == 0 then
if player:getStorageValue(item_aid.storage) == item_aid.storage_value then
player:say(item_aid.msg_sucess, TALKTYPE_MONSTER_YELL)
else
player:say(item_aid.msg_failure, TALKTYPE_MONSTER_YELL)
end
end
return true
end
Last edited: