How to make a destructable object respawn?

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
theITfactor
Chief Warrant Officer
Chief Warrant Officer
Posts: 327
Joined: Wed Jun 28, 2006 12:56 pm
Projects :: The Pwnfest and Games Complex
Games I'm Playing :: SWTOR
xbox live or psn: You and I Know
Location: The Old Republic
Contact:

How to make a destructable object respawn?

Post 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"
)
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: How to make a destructable object respawn?

Post 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.
Post Reply