I can't for the world figure this stuff out.
I'm trying to make a teleport effect occur 5 times (one each second) and then make the monster spawn(on the fifth teleport effect, so after 5 seconds).
This is what i came up with and well, its shit, but i want to prove i tried at least.
This wont work since its trigger isnt unique to one monster and therefor each and every monster will tick the count + 1.
I also now know that I dont know how to return a function true outside a function, is this possible?
I'm trying to make a teleport effect occur 5 times (one each second) and then make the monster spawn(on the fifth teleport effect, so after 5 seconds).
This is what i came up with and well, its shit, but i want to prove i tried at least.
This wont work since its trigger isnt unique to one monster and therefor each and every monster will tick the count + 1.
Lua:
function Monster:onSpawn(position, startup, artificial)
print(count)
addEvent(function() position:sendMagicEffect(11) end, 1000*count)
if count == nil then
local count = 0
end
if hasEventCallback(EVENT_CALLBACK_ONSPAWN) or count < 6 then
count = count + 1
return EventCallback(EVENT_CALLBACK_ONSPAWN, self, position, startup, artificial)
else
count = 0
return true
end
end
I also now know that I dont know how to return a function true outside a function, is this possible?