Page 1 of 1

Making object disappear?

Posted: Sat Oct 06, 2012 11:07 am
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

Re: Making object disappear?

Posted: Sat Oct 06, 2012 2:45 pm
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.

Re: Making object disappear?

Posted: Sat Oct 06, 2012 2:55 pm
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.

Re: Making object disappear?

Posted: Sat Oct 06, 2012 7:28 pm
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.?

Re: Making object disappear?

Posted: Sat Oct 06, 2012 8:16 pm
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.

Re: Making object disappear?

Posted: Sun Oct 07, 2012 5:12 pm
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.