Jump to content
Sign in to follow this  
HaZZarD

How to .. Entire side surrender ?

Recommended Posts

hi all : )

I would like to have one area to clear and when the enemies in that area are less than , let's say 15 , I want them to surrender ( surrender can be an animation or them drop their weapons or stop firing )

how I do it ? : )

all I have for now is this

({(side _x) == east} count allUnits) <= 15

Share this post


Link to post
Share on other sites
hi all : )

I would like to have one area to clear and when the enemies in that area are less than , let's say 15 , I want them to surrender ( surrender can be an animation or them drop their weapons or stop firing )

how I do it ? : )

all I have for now is this

({(side _x) == east} count allUnits) <= 15

I think something like this should work (untested code):

{
  if ( side _x == east ) then
  {
_x playerMoveNow "AmovPercMstpSsurWnonDnon";
_x setCaptive true;
_x disableAI "ANIM";

  };
} forEach allUnits;

Share this post


Link to post
Share on other sites
I think something like this should work (untested code):

{
  if ( side _x == east ) then
  {
_x playerMoveNow "AmovPercMstpSsurWnonDnon";
_x setCaptive true;
_x disableAI "ANIM";

  };
} forEach allUnits;

thanks mate , the script look like what I wanted with the animation and setcaptive , great

how I combine the two scripts now ? so that when they are less than 20 they surrender ?

can I put that in a trigger ?

Share this post


Link to post
Share on other sites
thanks mate , the script look like what I wanted with the animation and setcaptive , great

how I combine the two scripts now ? so that when they are less than 20 they surrender ?

can I put that in a trigger ?

Yea a trigger should work, I tested the following code and it seemed to work fine, I placed 3 enemy units and after killing one the other two surrender:

_trig = createTrigger ["EmptyDetector", [0,0,0]]; 
_trig setTriggerArea [0, 0, 0, false];
_trig setTriggerActivation ["NONE", "present", true];
_trig setTriggerStatements ["({(side _x) == east} count allUnits) <= 2", "{if(side _x == east) then { _x playMoveNow 'AmovPercMstpSsurWnonDnon'; _x disableAI 'ANIM'; _x setCaptive true;}} foreach allUnits;", ""];

Share this post


Link to post
Share on other sites
Yea a trigger should work, I tested the following code and it seemed to work fine, I placed 3 enemy units and after killing one the other two surrender:

_trig = createTrigger ["EmptyDetector", [0,0,0]]; 
_trig setTriggerArea [0, 0, 0, false];
_trig setTriggerActivation ["NONE", "present", true];
_trig setTriggerStatements ["({(side _x) == east} count allUnits) <= 2", "{if(side _x == east) then { _x playMoveNow 'AmovPercMstpSsurWnonDnon'; _x disableAI 'ANIM'; _x setCaptive true;}} foreach allUnits;", ""];

oh nice , I have some questions :)

can I put this whole code in the Init true ?

your code already create a trigger that cover the whole map I guess , so I no more have to create a trigger that cover a certain area ?

Share this post


Link to post
Share on other sites
oh nice , I have some questions :)

can I put this whole code in the Init true ?

your code already create a trigger that cover the whole map I guess , so I no more have to create a trigger that cover a certain area ?

I am not an expert (I got the trigger code from this forums and just added your code to it), but I think the trigger doesn't cover the whole map, it doesn't cover anything because it has no size, and its placed on the position [0, 0, 0] which I guess is a map corner. And since the activation is when "NONE" is "present" then it will always activate, but will only run the code when the conditions are met.

I only worked on scripts as text, outside the editor. But I can say all you need to get it working is putting the code on your init.sqf file (or anywhere you want as long as it gets executed), so I guess you don't need any other trigger related to this.

Share this post


Link to post
Share on other sites
I am not an expert (I got the trigger code from this forums and just added your code to it), but I think the trigger doesn't cover the whole map, it doesn't cover anything because it has no size, and its placed on the position [0, 0, 0] which I guess is a map corner. And since the activation is when "NONE" is "present" then it will always activate, but will only run the code when the conditions are met.

I only worked on scripts as text, outside the editor. But I can say all you need to get it working is putting the code on your init.sqf file (or anywhere you want as long as it gets executed), so I guess you don't need any other trigger related to this.

well you are not an expert but I tried and ... it works great ! GG

last question now : )

how I add a variable in the code ? I would like to add that when those condition are true I have for example "win = true " so that I can then have the task completed .

Share this post


Link to post
Share on other sites
well you are not an expert but I tried and ... it works great ! GG

last question now : )

how I add a variable in the code ? I would like to add that when those condition are true I have for example "win = true " so that I can then have the task completed .

You can add it on the second parameter of setTriggerStatements, something like:

_trig setTriggerStatements ["({(side _x) == east} count allUnits) <= 2", "{if(side _x == east) then { _x playMoveNow 'AmovPercMstpSsurWnonDnon'; _x disableAI 'ANIM'; _x setCaptive true;}} foreach allUnits; win = true;", ""];

Edited by wok

Share this post


Link to post
Share on other sites
You can add it on the second parameter of setTriggerStatements, something like:

_trig setTriggerStatements ["({(side _x) == east} count allUnits) <= 2", "{if(side _x == east) then { _x playMoveNow 'AmovPercMstpSsurWnonDnon'; _x disableAI 'ANIM'; _x setCaptive true;}} foreach allUnits; win = true;", ""];

with this you made 90% of my mission XD thanks ++REP

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  

×