Jump to content
Sign in to follow this  
RonnieJ

AI only attack if fired oppon or visible wapons

Recommended Posts

Hey guys... I want some taliban action where you are not considered a danger untill you have a visible weapon or fire oppon the AI patrols... ive made this so far:

removeallweapons this; this setcaptive true; this addEventHandler ["fired", {s14 setcaptive false}];

And that works perfectly but I also want that you cant go with a weapon in your hans up to the AI patrol... I need some way of setting the player captive false if he is seen by the patrol with a weapon... :confused:

Share this post


Link to post
Share on other sites

Anyone? Cant find any threads about it on the forums... maybe a way to see (ACE2) if the player have the weapon on the back?

Share this post


Link to post
Share on other sites

Something like this should work:

If (((_enemy knowsAbout _unit) > 1.0) && (_currentWeapon _unit != "")) then {
   _unit setCaptive false;
};

Share this post


Link to post
Share on other sites

Sounds great but how do you assign that enemy? _enemy... can that be "WEST"?

Share this post


Link to post
Share on other sites

I tried this in the players init line

while {true} do {

_enemy = this findNearestEnemy this;

If (((_enemy knowsAbout this) > 1.0) && (currentWeapon this != "")) then {

this setCaptive false;

} else {

this setCaptive true;

};

};

But it dosent seem to work... any ideas?

Share this post


Link to post
Share on other sites
Something like this should work:

If (((_enemy knowsAbout _unit) > 1.0) && (_currentWeapon _unit != "")) then {
   _unit setCaptive false;
};

The knowsAbout check isn't even really needed. Just toggle captive status on and off when the unit is armed or unarmed, and if an enemy sees him while he's not captive they will engage.

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  

×