Making object disappear?

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
Locutus
1st Lieutenant
1st Lieutenant
Posts: 420
Joined: Fri Jun 04, 2010 10:08 am
Projects :: Stargate Battlefront Pegasus
Location: Germany
Contact:

Making object disappear?

Post by Locutus »

Hey guys!

Just for fun I was playing around with my HQ mode a little and encountered a problem.

...But let's start from the beginning:
In HQ mode you have a couple of objects which need to be destroyed in order to make the HQ vulnerable. Once you kill the HQ you win the game.
Now, I want players to give the opportunity to repair these vital objects in case they were destroyed by the enemy. That's working so far.

But: I don't want the player to repair this object as soon as it gets destroyed and therefore I'd like the object to disappear for about a minute. How can I achieve this?
(KillObject doesn't work as it only sets the objects energy to zero.)

Thanks in advance.

~Locutus
User avatar
yuke5
Field Commander
Field Commander
Posts: 945
Joined: Wed Jun 29, 2011 10:42 pm
Games I'm Playing :: SWBF2 TF2 RC KOTOR
xbox live or psn: My steam is yuke5.
Location: Vermont

Re: Making object disappear?

Post by yuke5 »

You can kill the object, and then set the total object health to a ridiculously high number, so if the player tries to repair the object, it's useless because it would take hours to repair completely. You can find an example of this in the Geonosis Campaign Script, where the health and ammo droids are destroyed, but the player shouldn't be able to repair them until it becomes an objective.
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Making object disappear?

Post by AQT »

Infinite MaxHealth is represented by the value 1e+37, by the way. Also, in addition to what Yuke suggested, after the object is destroyed use SetProperty on the object to set AINoRepair to 1. At the same time create your one minute timer, and after it is up reset AINoRepair to 0. This will keep the AI from even attempting to fix the infinitely unhealthy object.
User avatar
Locutus
1st Lieutenant
1st Lieutenant
Posts: 420
Joined: Fri Jun 04, 2010 10:08 am
Projects :: Stargate Battlefront Pegasus
Location: Germany
Contact:

Re: Making object disappear?

Post by Locutus »

Thanks for your quick replies.
Yeh, I'm using the infinite health thingy to make the HQs invulnerable unless all of the objects (in fact, these objects are cps) are destroyed.
Problem with this method is that you cannot be sure when the timer has elapsed, ie when you can start to repair the object. Is there any method to make that visible like swapping the meshes or sth.?
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Making object disappear?

Post by AQT »

Ah, I see. Well, you can use SetProperty with IsVisible set to 0 after the object is destroyed, and then once the timer is up reset it to 1. To swap the models, one method is to place two models in the same position and make one visible and the other invisible and vice versa.
User avatar
Locutus
1st Lieutenant
1st Lieutenant
Posts: 420
Joined: Fri Jun 04, 2010 10:08 am
Projects :: Stargate Battlefront Pegasus
Location: Germany
Contact:

Re: Making object disappear?

Post by Locutus »

It works, thank you AQT! :D
Mhh, is there any way to remove collision from the object while being invisible?

Another thing that bothers me are the timers mentioned before.
Is there a possibility to move the position of the timer on screen when using ShowTimer()?
I'd really like to have one for each team.
Post Reply