if i want to do something with a monster when it spawns, is there any other way than onCreatureAppear?
iright now i have script="spawn.lua" in the creatures xml files, and in spawn.lua
where self:getId() would return the monster unique id, so i could do like
global table[self:getId()] = {...} which is working for me, but when a monster with onCreatureAppear spawns it goes through every single other monster of that type also, so if i had like
it would print out the id of every single monster of that type, however with a
but if i have say 1000 demons out on the map, and spawn another it would have to check table[self:getId] 1000 times, which doesnt seem good for performance..
is there any way to use a monsters unique id when it spawns other than using onCreatureAppear which iterates through all monsters of the same type?
iright now i have script="spawn.lua" in the creatures xml files, and in spawn.lua
Code:
function onCreatureAppear(self, creature)
...
end
global table[self:getId()] = {...} which is working for me, but when a monster with onCreatureAppear spawns it goes through every single other monster of that type also, so if i had like
Code:
function onCreatureAppear(self, creature)
print(self:getId())
end
Code:
if table[self:getId] ~= nil then
return
is there any way to use a monsters unique id when it spawns other than using onCreatureAppear which iterates through all monsters of the same type?
Last edited: