How to destroy spawned teleport?

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
Pecen
Posts: 40
Joined: Sun Jan 20, 2013 3:56 pm

How to destroy spawned teleport?

Post 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.
Ryeath_Greystalk
Posts: 366
Joined: Tue Jan 15, 2013 3:26 am
Location: Oregon

Re: How to destroy spawned teleport?

Post 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
User avatar
Pecen
Posts: 40
Joined: Sun Jan 20, 2013 3:56 pm

Re: How to destroy spawned teleport?

Post 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 ;)
Post Reply