Comrades in Arms Discussion Board

Full Version: Upcoming Mission: The Wilderness
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Maybe you can use parts of this onPlayerDisconnect script by MadMax?
It checks for connected players and remove disconnected players AIs.
Use
Quote: ? (_unit == player):
So you end trigger would be done by a script which would run from the beginning and look something like this:

Quote:_players = []
end1 = false
end2 = false

? (s1 == player):_players= _players+s1
? (s2 == player):_players= _players+s2
? (s3 == player):_players= _players+s3

#loop
? !(alive s1):_players = _players - s1
? !(alive s2):_players = _players - s2
? !(alive s3):_players = _players - s3
_alive = count _players
? (_alive = 0):end1 = true;exit
? (_alive == escaped):end2 = true;exit
~5
goto "loop"

Where:
escaped is the name of the trigger they all have to get into.
end 1 and end 2 are variables in a separate trigger conditions for either endings
s# is the name of each unit.

Thats pretty much the way id do it, although it may need a couple of functions in it to work properly. The other way to do the escaped trigger is have it remove each unit from the array _players as they enter the end zone and when its empty end it, but that check would have to come before the _alive bit.
Thanks for typing that up MJ. How will it work, though? It seems to me that it will simply cause each node to add its own "player" unit to an array contained only on the node, and nothing else. You can't publicvariable arrays, so they won't be synchronized between server and clients. So when we get to here, for example:

Code:
? (_alive = 0):end1 = true;exit

it will cause the mission to end once one player dies! (Cause _alive would be 1, at most).

What I have so far is this:

Code:
_grpit = 0
_it = 0
_grparray = [mainloons1, mainloons2, mainloons3, mainloons4]
#selectgroup
? _grpit == 4 : [] exec "formhumansarray.sqs"; exit
~2
_grp = _grparray select _grpit
_doesntexist = true
? count units _grp > 0 : _doesntexist = false
? _doesntexist : _it = 0; _grpit = _grpit +1; goto "selectgroup"

#playeringroup
~2
? _it == count (units _grp) : _it = 0; _grpit = _grpit +1; goto "selectgroup"
? player == ((units _grp) select _it): _it = _it + 1; goto (format ["loons%1human",_grpit + 1])
_it = _it + 1
goto "playeringroup"

#loons1human
? !(mainloons1human) : mainloons1human = true
publicvariable "mainloons1human"
? !(local server) : exit
goto "playeringroup"

#loons2human
? !(mainloons2human) : mainloons2human = true
publicvariable "mainloons2human"
? !(local server) : exit
goto "playeringroup"

#loons3human
? !(mainloons3human) : mainloons3human = true
publicvariable "mainloons3human"
? !(local server) : exit
goto "playeringroup"

#loons4human
? !(mainloons4human) : mainloons4human = true
publicvariable "mainloons4human"
? !(local server) : exit
goto "playeringroup"

Then, in formhumansarray.sqs :

Code:
? !(local server) : exit
allhumans = []

? mainloons1human : allhumans = allhumans + (units mainloons1)
? mainloons2human : allhumans = allhumans + (units mainloons2)
? mainloons3human : allhumans = allhumans + (units mainloons3)
? mainloons4human : allhumans = allhumans + (units mainloons4)
exit

I'm aware that this will mean that AI playables which were in groups containing humans will now be marked as "players." This is to reduce the number of variables that have to be transmitted, and also because if you choose to include AIs in your squad, like it or not they're now your "buddies" and you can't just leave them behind.

The script seems to work, now I've just got to rework my mission to incorporate it. Often easier said than done. ;D
New version should be up soon. All the bugs which were identified should hopefully be fixed. 8)
Latest version is uploaded to the server now. I removed all previous versions including the debugging one.
Pages: 1 2