OFPEC Forum
Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: Mr.Peanut on 18 Oct 2010, 20:57:17
-
Is there any way of testing if a side's center already exists before creating one? For example, a script requires a civilian side, but it is unknown whether the mission maker has added civ units or not.
If I "createCenter Civilian" on a map that already has civs, will it break anything?
-
Excellent question. I wonder if the dude who wrote this found out yet:
//TODO: dangerous? What if the mission already did this? Somehow check that.
private ["_centerW", "_centerE", "_centerG", "_centerC"];
_centerW = createCenter west;
_centerE = createCenter east;
_centerG = createCenter resistance;
_centerC = createCenter civilian;
From my experience it's fine to create multiple centers for one side.
-
_group = createGroup civilian;
if (isNull _group) then {
createCenter civilian;
resistance setFriend [east, 0];
} else {
deleteGroup _group;
};
-
thanks. why did you include
resistance setFriend [east, 0];
?
-
Because that code was original for resistance and I forgot to remove it.
That code was added since new created sides are friendly to anyone.