Hi,
like is said in the title, is there some way to destroy spawned object? Simple de/activate method doesnt work for my purposes.
How to destroy spawned teleport?
-
- Posts: 366
- Joined: Tue Jan 15, 2013 3:26 am
- Location: Oregon
Re: How to destroy spawned teleport?
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)
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?
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