Page 1 of 1

Using the KillObject callback

Posted: Mon Nov 05, 2007 4:29 pm
by Maveritchell
Basically, I want to be able to kill and respawn props.

I know that the KillObject callback doesn't work on props. I also know that it works on commandposts. I'd prefer not to turn my ClassLabel'ed props into commandposts. How would I go about setting a proper classlabel so that the KillObject callback works on props (or something with the appearance of a prop)?

Note: I've tried using the DestroyEntity() callback on props, with no success. I've also tried changing my props into ClassLabel = "armedbuilding" (although that was all I changed) with a similar lack of success.

Re: Using the KillObject callback

Posted: Tue Nov 06, 2007 10:09 am
by [RDH]Zerted
Everything in ZE can be considered an entity, so I assume props are entities. Are props objects? KillObject only works on objects...

Re: Using the KillObject callback

Posted: Tue Nov 06, 2007 10:50 am
by Maveritchell
BF2 Documentation wrote:All Objects are Entities, though not all Entities are Objects (some are Props, for example).
Yeah, props are entities, but no, they're not objects. That's why KillObject doesn't work on them.

Re: Using the KillObject callback

Posted: Tue Nov 06, 2007 7:30 pm
by RepSharpshooter
I don't think props can be destroyed, but I learn new things everyday.

I've seen this before in the Geonosis Campaign lua:

Code: Select all

--set max health on droids so player can't repair them before the objective
	SetProperty("ammo_pad", "MaxHealth", 9999999999)
	SetProperty("health_pad", "MaxHealth", 9999999999)
	SetProperty("ammo_pad", "CurHealth", 0)
	SetProperty("health_pad", "CurHealth", 0)
	--and this kills them so they have to be repaired
	KillObject("ammo_pad")
	KillObject("health_pad")
health pad is com_item_healthrecharge which has a class label of "powerupstation"

I'm sure it's possible to mimic this without being a powerup station. There may be another class that does this, but this is the only one I know about. I'm not sure about "destructablebuilding" but it seems plausible, these were used on mygeeto as the shield generators.

Re: Using the KillObject callback

Posted: Wed Nov 07, 2007 4:54 pm
by Ace_Azzameen_5
Yes, but that code is for building class and its off-shoots anyway. They will still have health bars if you set their health to anything. I'm not sure if that above code is entirely relevant. It takes the ammo droid, and gives it a ridiculously high amount of health, then kills it, so that you can't repair it without standing there for at least a year.

Later in the mission, after the engineer is unlocked, the health is set back to normal.

Maybe, though, if you SetProperty Health = "" , there will be no health bar.