Jump to content
pognivet

How to detect when an AI has thrown any thrown weapon?

Recommended Posts

Long story short: Making an insurgency mission. I want a lot of people dressed up like civs. They're setcaptive and look normal from a distance, but if you get too close they'll throw molotovs or rocks at you or maybe even take out grandpa's revolver and bust a few shots off. This adds tension in dealing with the civs.

 

What I have so far for the init line of these insurgent units:

this setCaptive true;

this addEventHandler ["FiredNear", "this setCaptive false;"];

_h = this spawn { 
waitUntil {!(currentWeapon _this == "")}; 
_this setCaptive false; 
};

 

The only problem is that when they throw anything at all they remain as captives. It's the same withe ACE throwing, vanilla throwing and so on and so forth.

 

Is there a way to detect if a unit has fired the "throw" weapon or whatever it's called? The invisible weapon whereby you throw grenades, grenades being just magazines for this invisible weapon?

 

I looked for 2 hours online and couldn't find any way to do this. Please someone help me. Thank you.

Share this post


Link to post
Share on other sites
45 minutes ago, pognivet said:

this addEventHandler ["FiredNear", "this setCaptive false;"];

 

Should be:

this addEventHandler ["FiredNear", 
{
params ["_unit", "_firer", "_distance", "_weapon", "_muzzle", "_mode", "_ammo", "_gunner"]; 

_unit setCaptive false;

}];

 

Edit: If I understand correctly what your trying to do, I'd suggest using "Fired" EH instead

  • Like 1

Share this post


Link to post
Share on other sites
15 hours ago, gc8 said:

 

Should be:


this addEventHandler ["FiredNear", 
{
params ["_unit", "_firer", "_distance", "_weapon", "_muzzle", "_mode", "_ammo", "_gunner"]; 

_unit setCaptive false;

}];

 

Edit: If I understand correctly what your trying to do, I'd suggest using "Fired" EH instead

I tried Fired, FiredNear, FiredMan. All give the same result. Tried throwing grenades using both vanilla and ace throwing methods. No dice. I'll try copy-pasting your code and see if some magic happens.

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

×