OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: laggy on 14 May 2009, 22:19:46

Title: Splitting a group in half and back successfully
Post by: laggy on 14 May 2009, 22:19:46
Hello my dear friends,

Want this:

Option (i.e action) to split a 10 unit group into two 5 unit groups.
Original group has leader AND also a potential leader.
Potential leader gets the option to "unjoin" himself and 4 more guys to form a new 5 unit group.
Original leader AND the new (potential) leader both get options to join both groups again.

Tried different ways, but they ALL failed in MP.

HOW?  ???

Laggy
Title: Re: Splitting a group in half and back successfully
Post by: Sparticus76 on 15 May 2009, 11:03:02
Probably a stupid question (and I cringe everytime I say that), but have you tried something like this...warning..sqs to follow, I'm lazy at the moment and this is an old script I dug up.

call.sqs
Code: [Select]
_man = _this select 0
_group = [_man] call splitgroup 
_evengroup = _group select 0
_oddgroup = _group select 1
_oddgroup move getmarkerpos "one"
@unitready (leader _oddgroup)


~10
{[_x] join (leader _evengroup)} foreach units _oddgroup

~10
_splitminor join group _man

exit

splitgroup.sqf
Code: [Select]
private ["_Ldrgrp","_grp","_oddPeople","_Oddldr","_numg","_v"];
_Ldrgrp = _this select 0;
_grp    = units _Ldrgrp;
_numg   = count _grp;
_Oddldr = _grp select 1;
_oddPeople = [];

for [{ _v = 1 }, {_v < _numg}, {_v = _v + 2}] do
{
    _oddPeople = _oddPeople + [_grp select _v];
};
_oddPeople join (createGroup (side _Oddldr));
[_Ldrgrp, group _Oddldr];

This takes "man"s group, divides it evenly, then splits the group in two, moves on group to a marker, then rejoins the groups after 10 seconds. If this worked, they'd join from created actions instead of by the 10s timers.
Title: Re: Splitting a group in half and back successfully
Post by: Trexian on 15 May 2009, 18:45:53
Does only the #2 guy have the addaction?  And, does it matter which of the remaining guys he gets?  And, I assume #2 will be a human player (although, come to think of it, you could maybe set it up so that you could go to the "action" menu item and trigger it for AI)?