Jump to content
dabrowskipl

How to activate trigger if unit is surrendering?

Recommended Posts

I'm making a mission about Polish police where you need to chase criminals. I've placed Surrender Module so after some time of chasing, criminals stopping their cars, getting out them and surrendering. That's a perfect moment for mission to end. How to make a trigger that activates by their surrendering?

 

Thanks! 2015-08-13.jpg

Share this post


Link to post
Share on other sites

https://community.bistudio.com/wiki/Surrender

 

 

"Soldiers surrendering will be setCaptivedisableAI "move", will leave their group, will disembark from their vehicle if they have one and won't be able to climb in another"

if (captive _unit) then [your code here];

Cant find out how to check if "move" has been disabled, but evaluate only captive will do this too.

Share this post


Link to post
Share on other sites

https://community.bistudio.com/wiki/Surrender

 

 

"Soldiers surrendering will be setCaptivedisableAI "move", will leave their group, will disembark from their vehicle if they have one and won't be able to climb in another"

if (captive _unit) then [your code here];

Cant find out how to check if "move" has been disabled, but evaluate only captive will do this too.

 

Thank you! So I need to place a trigger and put "if (captive _suspect)" in On Condition? 

UPD: "Local variable in global space"

Share this post


Link to post
Share on other sites

Thank you! So I need to place a trigger and put "if (captive _suspect)" in On Condition? 

UPD: "Local variable in global space"

 

It means your _suspect needs a Global variable name, not a _local variable name.

Editor triggers don't use local variables unless contained within a scope, like a forEach command.

Scripted triggers can use local variables though.

 

for an editor trigger you would just use "captive Suspect" in the Condition field.  The Condition field itself is "if ( __ )", and the On Activation field is "then { __ }".  The code goes in the On Activation field. 

Share this post


Link to post
Share on other sites

It means your _suspect needs a Global variable name, not a _local variable name.

Editor triggers don't use local variables unless contained within a scope, like a forEach command.

Scripted triggers can use local variables though.

for an editor trigger you would just use "captive Suspect" in the Condition field. The Condition field itself is "if ( __ )", and the On Activation field is "then { __ }". The code goes in the On Activation field.

Thanks. That seems to work but I got an another problem. First, when I was making the first mission, suspect's car was stopping after 2 or 3 minutes of chasing and driver was getting out and surrendering. Now for some reason in the second mission driver won't surrender even if I block his way with my police car and even when I shoot it's wheels. He just getting out and starting running away. And the second problem is when I name suspect a "suspect", games thinks that suspect is car, not the driver. That's weird. Car can't surrender.

Then I came up with an idea, I remember some old script for ArmA Armed Assault where you could capture a unit in action list when you're enough close to him. So can you give me this script? For example, when suspect leaves car and running away, you just coming near him, choosing "Handcuff" from the action list and he being setCaptive and handcuffed animation.

Share this post


Link to post
Share on other sites

To your last problem:

 

 

Add this to your suspect's init:

handcuffAction = this addAction ['HANDCUFF','handcuffScript.sqf','',1,true,true,'','((_target distance _this) < _range)']

Where you have to replace _range with the distance you want to be able to catch the suspect (try with 4).

 

 

 

Create in your mission folder: handcuffScript.sqf

 
_suspect = _this select 0;
_police = _this select 1;
_action = _this select 2;
 
_suspect disableAI "MOVE";
///_suspect setCaptive true;
_suspect removeAction _action;
 
hint "SUSPECT IN CUSTODY";

As far as you chase civilian units, you wont need to set them to captive because they are neutral to anyone anyway.

If this is the case, just delete this line in the script, otherwise delete "///"!

Share this post


Link to post
Share on other sites

To your last problem:

 

 

Add this to your suspect's init:

handcuffAction = this addAction ['HANDCUFF','handcuffScript.sqf','',1,true,true,'','((_target distance _this) < _range)']"

Where you have to replace _range with the distance you want to be able to catch the suspect (try with 4).

 

 

 

Create in your mission folder: handcuffScript.sqf

 
_suspect = _this select 0;
_police = _this select 1;
_action = _this select 2;
 
_suspect disableAI "MOVE";
///_suspect setCaptive true;
_action removeAction _suspect;
 
hint "SUSPECT IN CUSTODY";

As far as you chase civilian units, you wont need to set them to captive because they are neutral to anyone anyway.

If this is the case, just delete this line in the script, otherwise delete "///"!

 

Hmm, strange, can't put this script into init of the suspect, it's says "Missing ;" no matter if I change _range to 4 or not. 

ArmA2OA%2B2015-08-14%2B12-54-31-025.png

handcuffAction = this addAction ['HANDCUFF','handcuffScript.sqf','',1,true,true,'','((_target distance _this) < _range)'](error appers here)"

Share this post


Link to post
Share on other sites

Also I'm not sure if I got this error by placing this script in init, but this showed up when I closed the game

screen.PNG

Share this post


Link to post
Share on other sites

Sorry, there was a redundant quotation mark.

handcuffAction = this addAction ["HANDCUFF","handcuffScript.sqf","",1,true,true,"","((_target distance _this) < 4)"]

You can always look this up on your own at:

https://community.bistudio.com/wiki/Category:Scripting_Commands_ArmA2

 

Search for addAction and look up the syntax and the examples.

  • Like 1

Share this post


Link to post
Share on other sites

Try with this, I didnt look up the syntax rightly as well ;)

_suspect = _this select 0;
_police = _this select 1;
_action = _this select 2;
 
_suspect disableAI "MOVE";
_suspect removeAction _action;
 
hint "SUSPECT IN CUSTODY";

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

×