Jump to content
quickdagger

If you kil one AI terrorist, the other shoots the hostage. How to?

Recommended Posts

Hi all,

I want to do a mission with 1 AI hostage and 2 AI terrorists. The terrorists are pointing at the hostage but they don't shoot. When you kill one terrorist, the other shoots the hostage.

I don't want to use triggers detecting bluefor presence because I want to have snipers eliminating the terrorists from long distance, simultaneously. 

How would you make this work?

Share this post


Link to post
Share on other sites

It can be a bit tricky to get them to shoot the hostage, it really depends on your setup. I would recommend that you place both of the terrorists facing the hostage, and  disable movement of both the terrorists, and hostage. I would also setunitpos up for all three so they don't all just go prone when the shooting starts. 

 

In the condition field of your trigger put

Quote

!alive terrorist1 or !alive terrorist2

 

 In the on activation field put

Quote

hostage1 setcaptive false; [hostage1] join createGroup west;

 

Try this, and see if it works.

Share this post


Link to post
Share on other sites

does the player see the snipers or are he one of the snipers.

if player does not see the snipers but only see the hostage and the enemy you can just make a setdamage on the enemy tru a trigger and just before you break the glass in the building. so it looks like the snipers shot.

Share this post


Link to post
Share on other sites

Hi @stburr91,

 

Thank you for the reply, I think you are almost there.

 

I have shot one of the terrorists but he hasn't died and, the other terrorist didn't shoot the hostage. Well, I believe the second one should have shot isn't it?

 

So, I think I should rephrase what I have just asked.

 

Replace:

When you kill one terrorist, the other shoots the hostage.

 

by:

When you shoot or hurt  one terrorist, the other shoots the hostage.

 

🙂

Share this post


Link to post
Share on other sites

Hi @Play3r,

 

The player is a BLUEFOR sniper still kilometers away from the hostage. He and his group will still have to plan the operation and etc. So, they will chose whether to shoot from a distance, get in CQB range, use flashbangs, etc. But, I want everything to be possible.

 

The hostage h1 is an AI BLUEFOR.

The bandits b1 and b2 are AI OPFOR, 5 meters away from the hostage h1.

Share this post


Link to post
Share on other sites
3 hours ago, quickdagger said:

Hi @stburr91,

 

Thank you for the reply, I think you are almost there.

 

I have shot one of the terrorists but he hasn't died and, the other terrorist didn't shoot the hostage. Well, I believe the second one should have shot isn't it?

 

So, I think I should rephrase what I have just asked.

 

Replace:

When you kill one terrorist, the other shoots the hostage.

 

by:

When you shoot or hurt  one terrorist, the other shoots the hostage.

 

🙂

if you want to have the enemy shoot at your hostage when one of them get damaged you have to put in 2 triggers and then in COND you have to put in some script that check if b1 or b2 gets any damage, then if b1 get damage then b2 have to make a Dotarget and b2 to forceWeaponFire https://community.bistudio.com/wiki/forceWeaponFire i don't know how to make the trigger check if b1 or b2 has any damage, maybe someone else can help with that.

Share this post


Link to post
Share on other sites

@quickdagger
You should use eventHandlers.

Put this in the init box of the terrorist:

this addEventHandler ["Dammaged", {
	params ["_unit", "", "", "", "", "_shooter"];
	if (_shooter == player) then {
		hostage setCaptive false //or whatever method you want to use to make him enemy
	};
}]

Adjust the part of the code inside the "if".

Read more here:
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Dammaged

  • Like 1

Share this post


Link to post
Share on other sites

Hey @Leopard20, the result is very weird ... If I shoot the terrorist on the chest, he falls on the ground but doesn't die, then the other terrorist shoots the hostage. Good! It is already an improvement.

However, if I restart the mission and shoot the same terrorist's leg with a pistol then no one shoots the hostage.

 

Does this code has something to do with the total damage per shoot?

 

Sorry I am not a scripter and can't understand very well BI's Wiki's. I need the full explanation for rookies, like create a folder here and name it this, then paste this into the init field and bla bla.

 

I am using ACE and CBA.

Share this post


Link to post
Share on other sites

This is working perfectly every time for me in my testing. It works if either of the terrorists are wounded, or killed, they immediately kill the hostage.  

 

Put this in the init fields of the two terrorists.

 

Quote

this setunitpos "up";  
this reveal hostage1;

this dotarget hostage1; 
this disableAI "MOVE";  
this disableAI "AUTOCOMBAT";                                                       
 
this addEventHandler ["Dammaged", {   
[hostage1] join createGroup west;  
}];

 

 

If you want a slight delay before the terrorists kill the hostage after taking damage, use this.

Adjust the sleep command from 3, to whatever you want.

 

Quote

this setunitpos "up";  
this reveal hostage1;

this dotarget hostage1; 
this disableAI "MOVE";  
this disableAI "AUTOCOMBAT";

 

this addEventHandler ["Dammaged", {  
null = _this spawn { 
sleep 3;  
[hostage1] join createGroup west; 
};  
}];

 

Share this post


Link to post
Share on other sites
2 hours ago, quickdagger said:

Hey @Leopard20, the result is very weird ... If I shoot the terrorist on the chest, he falls on the ground but doesn't die, then the other terrorist shoots the hostage. Good! It is already an improvement.

However, if I restart the mission and shoot the same terrorist's leg with a pistol then no one shoots the hostage.

 

Does this code has something to do with the total damage per shoot?

 

Sorry I am not a scripter and can't understand very well BI's Wiki's. I need the full explanation for rookies, like create a folder here and name it this, then paste this into the init field and bla bla.

 

I am using ACE and CBA.

Try this one

https://www.dropbox.com/sh/b3cpne00pw5uhmg/AADL0_rMxIrkyaOr2AICCly9a?dl=0

 

Maybe this can do it for you

 

Share this post


Link to post
Share on other sites

Hi all, thank you for the ideas, tku @Play3r for the mission.

It is even better than before bust still they don't shoot the hostage if I shoot the terrorists in the leg with a pistol. The leg-pistol combo seems to be the issue.

 

At this point I am using:

 

Init for hostage h1: 

this setcaptive true; doStop this; this disableAI "move"; this setUnitPos "UP";

Init for bandit b1:

doStop this; 
this disableAI "move"; 
this addEventHandler ["Dammaged", { 
 params ["_unit", "", "", "", "", "_shooter"]; 
 if (_shooter == player) then { 
  h1 setCaptive false ;
[] spawn { 
b2 doTarget H1;   
b2 forceWeaponFire [weaponState b2 select 1, weaponState b2 select 2];}; }; 
}];

Init for bandit b2:

doStop this; 
this disableAI "move"; 
this addEventHandler ["Dammaged", { 
 params ["_unit", "", "", "", "", "_shooter"]; 
 if (_shooter == player) then { 
  h1 setCaptive false ;
[] spawn { 
b1 doTarget H1;   
b1 forceWeaponFire [weaponState b1 select 1, weaponState b1 select 2];}; }; 
}];

I have replaced Play3r's Bluefor player by a CSAT Marksman. For testing I have made the player be OPFOR so that I can get closer and shoot a leg with the pistol. Bandits are INDEPENDENT and I have made it be friends with OPFOR. Hostage is BLUEFOR. 

 

Share this post


Link to post
Share on other sites

Forgot to say, this is my mods list:

 

CBA

ACE

KA Virtual Arsenal Anywhere

Lambs Danger

Lambs RPG

VET_Unflipping

Advanced Urban Rappelling

Enhanced Movement

BloodLust

Brown Water Colour Mod

Blastcore

JSRS

Dagger Mod

 

Maybe a conflict with one of these mods? Lambs maybe?

Share this post


Link to post
Share on other sites

try this : 

(? ((damage terrorist1)<0.9) : hostage1 setcaptive false; [hostage1] join createGroup west;) or (
? ((damage terrorist2)<0.9) : hostage1 setcaptive false; [hostage1] join createGroup west;)

there is function "damage" which cheks damage of unit, 

!alive means unit must be dead (damage 100%) to be activated
damage < 0.9 works when unit is hurt (0.9 is 90% health, 10% damage, so after you shoot him probably he has more damage than 10%) 

https://community.bistudio.com/wiki/damage  this function should do your job , look at example - when person is 50% hit, than he calls medic 

the same way your terrorist should work - when one of them is hurt ( argument1) or (argument2) than (action)

 

just matter of how all those "(" ")" will be put in script , i have no idea if "?" must be used or not , but in short way - i recomend to use function "damage" 

 

  • Like 1

Share this post


Link to post
Share on other sites

then you have to try this without any mods because if i shoot on opfor in the foot with a gun the other kills the hostage.

and then just take one mod at the time to see which mod fuc.. up the action.   

 

@quickdagger i have updated the dropboxlink with a video showing that i get a reaction when i shoot one in the foot.

  • Like 2

Share this post


Link to post
Share on other sites

Doesnt ACE have its own Medical system? If so, it may not detect the Foot Shot in the same relative code you are trying to use to see if target is "dammaged". Always best to unload the mods that could direct it first -and then see if the code works

  • Like 2

Share this post


Link to post
Share on other sites
9 hours ago, quickdagger said:

Hi all, thank you for the ideas, tku @Play3r for the mission.

It is even better than before bust still they don't shoot the hostage if I shoot the terrorists in the leg with a pistol. The leg-pistol combo seems to be the issue.

 

At this point I am using:

 

Init for hostage h1: 


this setcaptive true; doStop this; this disableAI "move"; this setUnitPos "UP";

Init for bandit b1:


doStop this; 
this disableAI "move"; 
this addEventHandler ["Dammaged", { 
 params ["_unit", "", "", "", "", "_shooter"]; 
 if (_shooter == player) then { 
  h1 setCaptive false ;
[] spawn { 
b2 doTarget H1;   
b2 forceWeaponFire [weaponState b2 select 1, weaponState b2 select 2];}; }; 
}];

Init for bandit b2:


doStop this; 
this disableAI "move"; 
this addEventHandler ["Dammaged", { 
 params ["_unit", "", "", "", "", "_shooter"]; 
 if (_shooter == player) then { 
  h1 setCaptive false ;
[] spawn { 
b1 doTarget H1;   
b1 forceWeaponFire [weaponState b1 select 1, weaponState b1 select 2];}; }; 
}];

I have replaced Play3r's Bluefor player by a CSAT Marksman. For testing I have made the player be OPFOR so that I can get closer and shoot a leg with the pistol. Bandits are INDEPENDENT and I have made it be friends with OPFOR. Hostage is BLUEFOR. 

 

 

 

 

I think you are over complicating it.  The dotarget/forcefire doesn't work reliably once the unit goes into combat mode, as it tends to ignore the hostage, and looks for who just shot at it. In my testing disabling combat mode was the key to getting the terrorist to reliably kill the hostage.  I also found the EventHandler worked better with out the "shooter" parameter.

 

A couple of other things I learned during testing. It was better to command the terrorist to dotarget H1 first, then disable move, and having the EventHandler only switching the H1 to the West yielded the best results.

 

Have you tried what I posted earlier, it was working 100% of the time for me ( I wasn't using the mod list you mentioned).

 

Try this if you haven't already.

 

This was working for me 100% of the time. 

 

Quote

this setunitpos "up";  
this reveal H1;

this dotarget H1; 
this disableAI "MOVE";  
this disableAI "AUTOCOMBAT";

 

this addEventHandler ["Dammaged", {  
null = _this spawn { 
sleep 1;  
[H1] join createGroup west; 
};  
}];

 

Share this post


Link to post
Share on other sites

Insightful brainstorm @stburr91!

I have followed you line and made a line of many terrorists, each one with a different init script, covering all the ideas that were exposed here.

 

For my selection of mods, the code that produces the fastest reaction was:

 

Init

doStop this; 
this disableAI "move"; 
this setUnitPos "UP"; 
this setBehaviour "COMBAT"; 
this addEventHandler ["Dammaged", {h1 setCaptive false}];

I was impressed by having the combat behavior assigned as well but, if you put in perspective it is not that bad. I mean, if the terrorist finds any BLUEFOR around he will shoot ... it could be. Since his movement is disabled then he is hunting for BLUEFOR all the time and will shoot the hostage at the moment the hostage becomes BLUEFOR. It also creates the tactical option of allowing players using ghillies to crawl closer to the hostage in order to do a better assessment of the situation.

 

 Also, I was thinking about that if (_shooter == player) thing. Then I have thought about a possible scenario where the player doesn't know the hostage is there, calls mortar fire, the explosion damages the terrorist. The terrorist would still shoot the hostage isn't it?

 

I was also thinking about having a trigger to make the the terrorists shoot anyway if the player gets too close but, it is not the case of getting too close. It is a matter of the terrorists finding the BLUEFOR of not.

 

About using ghillies to remain unseen, vanilla ones were not working but the ones in my mod are 🙂

 

Any other evolution ideas?

Share this post


Link to post
Share on other sites

ACE medical handles damage, does it not?  I would think it does so to cause unconscious state or what not.  Can't say if that interferes with your damage event handler or not.  But perhaps you should try using HandleDamage event handler on the bad guys instead.  Check hostage side, if hostage not BluFor then he joins BluFor group; return the received damage.

  • Like 2

Share this post


Link to post
Share on other sites
3 hours ago, opusfmspol said:

ACE medical handles damage, does it not?  I would think it does so to cause unconscious state or what not.  Can't say if that interferes with your damage event handler or not.  But perhaps you should try using HandleDamage event handler on the bad guys instead.  Check hostage side, if hostage not BluFor then he joins BluFor group; return the received damage.

@quickdagger He's right. If you're using ACE, use handleDamage instead.

Be sure to include the damage at the end of the code otherwise the unit won't take any damage.

  • Like 1

Share this post


Link to post
Share on other sites

Thank you guys! That's a nice refinement.

 

So, now we have:

 

Init:

doStop this; 
this disableAI "move"; 
this setUnitPos "UP"; 
this setBehaviour "COMBAT"; 
this addEventHandler ["handleDamage", {h1 setCaptive false}];

And this is working fine for the configuration of mods listed above 🙂

 

  • Thanks 1

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

×