1) Open a blank test mission in editor
2) Create OPFOR units in editor with respective unit types (TL, GL, Medic etc)
3) Create the BLUFOR Afrenian army team
4) Save mission
5) Open up mission.sqm and copy all class names from both unit equivalents to a separate document
6) Open actual mission
7) Create UPSMON squads as opfor units used in test mission. (Ie Taki Army TL = Afrenian Army TL)
8) After mission is finished, save mission. Quit editor
9) Open mission.sqm and use CTRL-H to replace all unit types from their Taki models to Afrenian equivalents.
10) Save mission.sqm in notepad and open the mission in the editor. Save from within the editor and export the mission.
Are you making this MP compatible? If not then you could also possibly use the "addSwitchableUnit" and ""selectPlayer" commands to switch into whatever unit you want when the mission is setup.
I did this on one of my campaign missions where I was spawning Dualan civilians (armed) which are by default side "EAST". I was able to spawn them as side "Resistance" by using the probability of presence "0" method via script, make them switchable, addswitchable all the units then play as whoever you want. Perhaps this is also possible with what you are trying to do.
fn_unitSwitchSide.sqf will switch a unit to another side... returns the unit.
fn_grpSwitchSide.sqf will switch a group to another side... returns the group.
fn_facSwitchSide.sqf will switch a faction to another side... returns the list of groups.
The scripts....
fn_unitSwitchSide.sqf:- Spoiler:
Code:
//*******************************************************************
//*******************************************************************
//**
//** Name: fn_unitSwitchSide.sqf
//** Desc: Function to change a units side
//** Use: _unit = [group,WEST] call fn_unitSwitchSide;
//** Returns: New unit
//** TWIRLY - April 10th 2012
//**
//*******************************************************************
//*******************************************************************
private ["_unit","_newside","_newgroup"];
_unit = _this select 0;
_newside = _this select 1;
if (side _unit == _newside) exitWith {hint "fn_unitSwitchSide.sqf\nSame side error!"};
_newgroup = createGroup _newside;
[_unit] joinSilent grpNull;
[_unit] joinSilent _newgroup;
_unit
fn_grpSwitchSide.sqf:- Spoiler:
Code:
//*******************************************************************
//*******************************************************************
//**
//** Name: fn_grpSwitchSide.sqf
//** Desc: Function to switch a group's side to another side
//** Use: _newgrp = [group,WEST] call fn_grpSwitchSide;
//** Returns: New group
//** Author: TWIRLY - April 10th 2012
//**
//*******************************************************************
//*******************************************************************
private ["_group","_newside","_newgroup"];
_group = _this select 0;
_newside = _this select 1;
if (side _group == _newside) exitWith {hint "fn_grpSwitchSide.sqf\nSame side error!"};
_newgroup = createGroup _newside;
{[_x] joinSilent grpNull;[_x] joinSilent _newgroup} foreach units _group;
_newgroup
fn_facSwitchSide.sqf:- Spoiler:
Code:
//*******************************************************************
//*******************************************************************
//**
//** Name: fn_facSwitchSide.sqf
//** Desc: Function to switch a group's entire side to another side
//** Use: _newgrp = [group,WEST] call fn_facSwitchSide;
//** Returns: List of new groups
//** Author: TWIRLY - April 10th 2012
//**
//*******************************************************************
//*******************************************************************
private ["_group","_newside","_faction","_allgrps","_newgrps","_newgrp","_i","_grp"];
_group = _this select 0;
_newside = _this select 1;
_faction = faction leader _group;
if (side _group == _newside) exitWith {hint "fn_facSwitchSide.sqf\nSame side error!"};
_allgrps = allGroups;
_newgrps = [];
_newgrp = [];
for "_i" from 0 to (count _allgrps)-1 do {
_grp = _allgrps select _i;
if (faction leader _grp == _faction and not (_grp in _newgrps)) then {
_newgrp = createGroup _newside;
{[_x] joinSilent grpNull;[_x] joinSilent _newgrp} foreach units _grp;
_newgrps set [count _newgrps,_newgrp];
};
};
_newgrps
Call examples:-
Code:
_unit = [_unit,west] call fn_unitSwitchSide; //switch one unit to WEST
_group = [_group,east] call fn_grpSwitchSide; //switch one group to EAST
_groups = [_group,west] call fn_facSwitchSide; //switch a whole faction to WEST... the function needs a group as input
Hope you... or someone... gets some joy out of them.
You really shouldn't complicate things if all you want is some Afrenians in opfor.
Changing mission.sqm should work, however it will need to be done ever time after you save the mission and before you turn it into a PBO. Not sure if it'll work if you turn it into PBO in-game, you might have to turn it into PBO with an extrenal tool.
What I find easier is simply giving each Afernian group a Takistani leader with probability of presence being 0. Don't place the UPSMON init in the Takistani solider's init line, but rather in the init line of whoever will become the leader once the game decides the Takistani leader will not spawn. In general, that would be the highest ranking soldier in the group, and in case of equal ranks, the one linked first is chosen (so make sure nobody has a higher rank than whoever you want to lead the group, and that you always link the leader to the 0% presence takistani before you link the rest of the group).
If you still can't get either of the above to work, the only thing I can tell you is to post a youtube video to show what the hell you're doing wrong. Because it really should be *that* simple.
If you want to change sides during mission via script (which UPSMON will not like! Unless you do it on units right as they spawn and before you start UPSMON on them!), you will have to create a new EAST group, and have the Afrenians join it using the joinSilent command.
If you want to change sides during mission via script (which UPSMON will not like! Unless you do it on units right as they spawn and before you start UPSMON on them!), you will have to create a new EAST group, and have the Afrenians join it using the joinSilent command.
Which is exactly what one of the functions above does!
@galzohar
I had actually got it to work the way you suggested but it seemed like there should be an easier way particularly if I'm creating 15 different upsmon patrols.