Using the KillObject callback

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

Using the KillObject callback

Post 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.
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: Using the KillObject callback

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

Re: Using the KillObject callback

Post 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.
RepSharpshooter
Gametoast Staff
Gametoast Staff
Posts: 1351
Joined: Tue Jul 10, 2007 4:10 pm

Re: Using the KillObject callback

Post 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.
Ace_Azzameen_5
Jedi
Jedi
Posts: 1119
Joined: Sat Apr 23, 2005 8:52 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Re: Using the KillObject callback

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