Page 1 of 1
How to destroy spawned teleport?
Posted: Sun Jun 09, 2013 2:37 pm
by Pecen
Hi,
like is said in the title, is there some way to destroy spawned object? Simple de/activate method doesnt work for my purposes.
Re: How to destroy spawned teleport?
Posted: Sun Jun 09, 2013 4:50 pm
by Ryeath_Greystalk
You should be able to use the destroy function.
The problem with destroying spawned items is if you didn't give it a unique name when you spawned it you won't be able to tell the game which portal to destroy.
Also when using destroy it's a good habit to check the item exists before destroying it or you may crash the game
so something like (not tested)
Code: Select all
function spawnPortal()
spawn("teleporter",5,22,11,0,"Temp_Portal")
Temp_Portal:setTeleportTarget(26,30,0)
end
if Temp_Portal then
Temp_Portal:destroy()
end
Re: How to destroy spawned teleport?
Posted: Sun Jun 09, 2013 10:12 pm
by Pecen
Yes, that is exactly what i was looking for.. i used it in stepcycle, so checking may be not necessary, but i added it for guaranty.. also i like the smoother effect of spawned port instead of activated.. now i hope it still work when i export the mod.. thank you sir
