Jump to content
Sign in to follow this  
B@nditbe

Execute script only when players are in vehicle

Recommended Posts

Hi all, in my mission on Dr.No i have a slight problem, because teams are kinda coming every were on that small island and that way trigger off almost all triggers i need to now how to prevent players to trigger off the outro script when not needed.

So actually the outro should ONLY start when all players from WEST and RES are in the chopper

Players are  from p1 till p12

Is there a line i could put in the activation field that checks if all players are in "chopper" ?

And what if certain peeps are dead? Will the outro not start if it has counted players in the chopper but is missing the dead ones ?

Thanks...

Share this post


Link to post
Share on other sites

Well, i figured out this works :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">count crew chopper1 == (("alive _x") count units team1)

But problem is, i have 3 teams of 4 men, and 1 of that teams is RES crazy_o.gif

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_ar = [p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12]

_i = 0

_c = true

#l

    ?!alive _ar select _i: _ar - [_ar select _i]

    ?!(_ar select _i in chopper) : _c = false

    ?_i < 11 : _i = _i + 1, goto "l"

    ?_c : calltheoutro,exit

    ~5

    _c = true

    _i = 0

    goto "l"

might work as surveillance script.

Here the script checks every 5 seconds if all man are in the chopper, and takes out killed men.

There might be an easier way... but I just got up;).

Share this post


Link to post
Share on other sites

Nice biggrin_o.gif

But forgive me beeing noobish in scripting, but how would it be by just checking if theyre in chopper, not calling the outro, i do that by another trigger.

would it only the part :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_ar = [p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12]

_i = 0

_c = true

#l

?!alive _ar select _i: _ar - [_ar select _i]

?!(_ar select _i in chopper) : _c = false

?_i < 11 : _i = _i + 1, goto "l"

Thx in advance

Share this post


Link to post
Share on other sites

Instead of calling the outro directly you would set a variable, which the outrotrigger checks for.

Ie: instead of calltheoutro you set a variable:

Calloutro = true, publicvariable "Calloutro" (publicvariable might be needed in mp games)

and the trigger that starts the outro has

condition: Calloutro

of course if you can add more conditions to the outrotrigger, so it doesn't allways start when all ppl are in the chopper, ie missionstart (but make sure then that the variable isnt set true on start and stays there even without the ppl in the chopper).

Share this post


Link to post
Share on other sites

Ok, this is what i've tryed :

I first made a script called "onboardcheck.sqs" in my missionfolder.

Per information, P1 --> P4 is team1, P5 --> p8 is team2, p9 --> p12 is team3. Team1 and 2 are West, Team3 is Resistance.

onboardcheck.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_ar = [p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12]

_i = 0

_c = true

#l

   ?!alive _ar select _i: _ar - [_ar select _i]

   ?!(_ar select _i in chopper) : _c = false

   ?_i < 11 : _i = _i + 1, goto "l"

   ?_c : OBJ_4,exit

   ~5

   _c = true

   _i = 0

   goto "l"

Then in the mission i created a trigger within the activation field :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[] exec "onboardcheck.sqs";

This trigger will go off by the presents of anybody that enters that area.

I made a second trigger with condition :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">OBJ_4

in the activation field i put :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">OutroWin = true;

Third trigger contains in condition :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">OutroWin

and in activation field :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[] exec "OutroWin.sqs";

Hope this helps abit to find a solution crazy_o.gif

Idea is that the script checks if all alive players from the 3 teams are in the evac chopper that flies back to base, if they all are outro should start.

Greetz...

Share this post


Link to post
Share on other sites

Nobody knows a simple solution or simple code to check if all teams are in chopper ? sad_o.gif

Share this post


Link to post
Share on other sites

It's wrong, it has to be

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?_c : OBJ_4 = true;exit

Share this post


Link to post
Share on other sites

to expand on the topic, how do i detect if a unit is in any vehicle at all? i'm editing a bleeding script that i want to stop while the unit is in a vehicle. im a complete scripting newb, so be nice tounge_o.gif

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? _player in _vehicle : playerinvehicle = true

As simple as it gets  tounge_o.gif

edit: ah yeah, you meant ANY vehicle.. then mrzig's suggestion works biggrin_o.gif

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?vehicle player != player : _player_in_vcl = true

Share this post


Link to post
Share on other sites
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?vehicle player != player : _player_in_vcl = true

let me clarify, so this will work with any vehicle? as in the person can get into any vehicle, with or without a name, and this will be activated?

Share this post


Link to post
Share on other sites
I believe so.

ok, ill give it a try

thx  smile_o.gif

also thx Korax for the fast reply

Share this post


Link to post
Share on other sites

Hi everybody,

i am at work so there might be a slight mistake, but try.

{_X countin Vehiclename} foreach units Groupname

that would be the condition.

Hope it helps.

Have a good one.

Day biggrin_o.gif

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  

×