Jump to content
Sign in to follow this  
starstreams

How do you make a unit immortal?

Recommended Posts

How do you make a unit immortal?

I’ve had some replies on this but it’s getting very complicated and I’m not able to do what I need to so I thought I would post this in the main section of this forum.

What I’m trying to do is, I want to set up a group of AI tanks as extra support to guard both bases from air assaults. (known as Base killing)

I don’t want these Ai units to ever be killed as they are only there to protect the bases.

I’ve tried respawsing groups but when the tanks come back there are no men inside them. The reason I want the tanks to be immortal is because people keep killing them with guided missiles and then they start attacking bases which is totally lame.

I do not like using kill zones either I think it’s much more natural having tanks guard bases.

Can anyone help me find a simple solution to get this to work? Something simple though

Thanks in advance.

Share this post


Link to post
Share on other sites

Simple yet a little bit tedious.

Name all the crew and all the tanks.

In a trigger make sure it's set on repeatedly.

Condition: Getdammage unitname >=.01

OnActivation: unitname setdammage 0

Yes it's a bit tedious but it's a very easy way to keep AI alive and kicking and coming back from the dead.

Share this post


Link to post
Share on other sites

You can use event handler. Just make sure tanks are in "combat" behaviour.

Put in init field of each tank :

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addEventHandler ["hit",{{_x setDamage 0} forEach [_this select 0]+crew (_this select 0)}]<span id='postcolor'>

Share this post


Link to post
Share on other sites

Thanks for your replies.

To Bart.Jan, this is exactly what I was looking for, you are the master. I’m hoping this will work online But I’m sure it will.

By the way, will these units ever run out of ammo?

I can't tell ya how huge this is!!!!! This made my night!!! smile.gif

I hope more people start using Shikas and Vulcan’s to guard their bases rather then kill zones. It is so much more real doing it this way!

Share this post


Link to post
Share on other sites

Hay Bart, I just tired it online and it works great. It’s nice because I only had to use one group of Ai tanks for each side so my map didn’t get slowed down too much from having AI in there. It was kind of funny because people kept trying to kill the AI but they would not die and finally they gave up and focused on what the game was really about: “Capturing the flagâ€

Anyway I’m really glad that worked because I’ve always hated Kill zones. At least with this new way it feels so much more real when you are being attacked by entering enemy air space just like in a real war.

Like I said I hope more and more people start using Immortal AI to guard their bases!

I don’t know how you figured that out but I wish I understood the science of scripting. I’m just glad it worked! smile.gif

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (starstreams @ Mar. 14 2003,03:15)</td></tr><tr><td id="QUOTE">I don’t know how you figured that out but I wish I understood the science of scripting. I’m just glad it worked! smile.gif<span id='postcolor'>

It's not so difficult as it looks. It's about knowledge of OFP scripting commands.

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

this addEventHandler ["hit",{{_x setDamage 0} forEach [_this select 0]+crew (_this select 0)}]<span id='postcolor'>

Immortal unit -> unit take no damage -> but unit always take damage after hit so unit (tank and its crew) must be healed after hit.

after hit -> event handler "hit" -> addEventHandler

healed -> setDamage 0

helaing for tank and its crew -> forEach command

unit (tank) -> first parameter of event "hit" : _this select 0

crew of tank -> crew command -> crew of tank : crew (_this select 0)

Share this post


Link to post
Share on other sites

Wow it looks pretty deep man. I’m not even sure what an addEventHandler is? I’m guessing it’s some kind of built in component that requires an Acton or parameters.

Either way where did start learning this? I mean is there some kind of tutorial that walks you though all the different Parameters?

By the way I’ve been putting this line in some of my ammo boxes.

For WEST:

---

this addmagazinecargo ["LAWLauncher",200]

Funny thing is I get the law when the game starts but when I die and come back, it’s never in the ammo box. So if I grab a new LAW launcher it only comes with one law shell? Any ideas on why this is?

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (starstreams @ Mar. 15 2003,16:54)</td></tr><tr><td id="QUOTE">Wow it looks pretty deep man. I’m not even sure what an addEventHandler is? I’m guessing it’s some kind of built in component that requires an Acton or parameters. Either way where did start learning this? I mean is there some kind of tutorial that walks you though all the different Parameters?<span id='postcolor'>

I'm sure there are good english scripting tutorials somewhere but I prefer czech tutorials. But generally very useful are :

- official comref

-Unofficial Operation Flashpoint Command Reference Manual (slightly out of date but still useful)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×