Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
ZeeSquared

How to make the AI not killable while using an object?

Recommended Posts

Is it possible to make a static machine gun take no damage and also have the AI manning it not killable?

I dropped a machine gun tripod that's manned by the AI and set it to not take damage. The tripod never gets destroyed but the AI manning it can take damage and die. Is there a way to prevent this?

Thanks in advance.

Share this post


Link to post
Share on other sites

Put this in the init line of the machine gun:

(crew this select 0) allowDamage false;

Tested on DshKM only.

Share this post


Link to post
Share on other sites

(crew this select 0) allowDamage false;

That works awesome for the BAF machine gun tripod and anti-aircraft pods. Thank you! I tried putting the code in an AI-manned Jackal which has 3 crewmen but only one of them was not able to be killed. Does it have to do with the 'select' command?

Thanks again! (:

Share this post


Link to post
Share on other sites
Does it have to do with the 'select' command?

Almost. To have every crewman invincible you need this:

{_x allowdamage false} foreach crew myvehicle

Don't know if it works by putting it in the init line. Maybe you need to use a trigger or script etc.

Share this post


Link to post
Share on other sites

If the object is empty first, and you want a unit becoming invincible by manning it, use the getin-eventhandler, putting into the object's init:

this addeventhandler ["getin",{(_this select 2) allowDamage false}];

and, of course, for undoing that, use the getout eventhandler:

this addeventhandler ["getout",{(_this select 2) allowDamage true}];

Edited by Bon

Share this post


Link to post
Share on other sites
Sign in to follow this  

×