Jump to content
Sign in to follow this  
Dashers

Multiplayer trigger logic problems.

Recommended Posts

I've got a very annoying problem, like most only happens when dealing with multiplayer missions.

To end my mission correctly I need to know which groups are playing, and as these can be human controlled they might not start at all (AI. turned off). Assigning a trigger to a group using the group tool (F2) won't work, as if the unit you linked with is disabled then it won't be able to locate the group (annoying bug).

So to combat this I decided to make a simple trigger which does the same sort of thing.

I have say (it doesn't matter how many), 6 units in a group. Numbered player1 through to player6. I then have a trigger which is 0x0 and the condition:

(alive player1) || (alive player2) ... and so on

This should activate when any of the players are alive. There is nothing clever here. Duely enough when the game starts it will activate immediately. But (there's always a but), if you then disable one of these characters at the multiplayer rosta screen it will not activate. It doesn't matter which one it is, it just simply doesn't work. In fact it acts exactly how you would expect it to if it was using && instead of || for all entries.

I have also tried setting the trigger to when west present in 5000x5000 and using:

(player1 in thislist) || (player2 in... and so on.

This does not work, not does using 'canmove' instead of 'alive'.

I am about to go potty over this subject so, please, please, please can somebody help me?

Example of bug: ftp://ftp.aligrant.com/logic.Intro.zip (put in your users\<user>\MPMissions\ dir).

Thanks in advance,

Dash.

Share this post


Link to post
Share on other sites

try placing the units in an array, then work with the array in a looping script

maybe count how many alive units are in the array,

then use condition

<=0

or

>0

to jump to a label or run whatever commands you want

Share this post


Link to post
Share on other sites

This is just an example of what Terox means:

:note - in the mission, where i used this example, i have

a 12 men (playable) group, and the commands below

i've put into the init.sqs (which runs automatically at

the start of the mission).

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

"if (alive _x) then {brf_player_array = brf_player_array + [_x]}" foreach [w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12]

brf_leader = brf_player_array select 0

w1grp = group brf_leader

OK, what does it?

first it defines an empty array - brf_player_array

(this is necessary, because i'm adding all alive playable soldiers

into this array, and you can't add something to an array, if

it hasn't been declared to be an array, before).

OK, the second line i think i already explained too now biggrin_o.gif

If you have a look at the foreach statement, you will see

these: w1,w2,.....w12 - these are the unit names of the

12 playable soldiers, i've given them in the editor.

Then i'm assigning brf_leader to the first element of the

created array of existing soldiers - so i can access the leader

at the start of the mission, whoever it is.

And then i'm assigning w1group as the name of brf_leader's

group.

hope this helps

~S~ CD

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  

×