Page 1 of 1

How to make a destructable object respawn?

Posted: Sat Jan 05, 2008 10:34 pm
by theITfactor
I am trying to get an object to respawn with no success.

I have tried setting it to "destructablebuilding" and "powerupstation" with a RespawnTime, but it just isn't working.

Any ideas on how I can make the object destructable, then have it respawn in 30 seconds?

EDIT:

Azzameen said this would make it respawn instantly, but suggested I use a timer to delay it 30 seconds. How would I add the timer :?

Code: Select all

OnObjectKillName(
function()
local ObjectMatrix = GetEntityMatrix("OBJECTNAME")
DeleteEntity("OBJECTNAME")
CreateEntity("odfname", ObjectMatrix, "OBJECTNAME")
end,
"OBJECTNAME"
)

Re: How to make a destructable object respawn?

Posted: Sat Jan 05, 2008 11:24 pm
by Maveritchell
Don't use DeleteEntity. Use SetProperty("OBJECTNAME", "CurHealth", 0) to kill it and SetProperty("OBJECTNAME", "CurHealth", whatevernumberthemaxhealthis) to respawn it. Make sure it doesn't have any kind of AddHealth property, or make sure to disable it through the .lua first.