Jump to content
Sign in to follow this  
jakerod

Problem with createGroup (Group not being Created)

Recommended Posts

So I have a problem where I am creating a group and then units into the group. The units aren't being created and I am fairly sure that it is because the group isn't being created. I can't join the group nor can I have an AI join the group. I feel that [The] problem might be [is]because I am defining the side of the group (which should be east) with a variable. See the first snippet below.

After typing that I realized that the problem is as I describe it. I use _factionside = east and then do _l1_squad = createGroup _factionside. That apparently is not acceptable (reserved variable?). Is there a way around this that I can't think of?

There are two snippets of code below that I find to be most relevant but the entire thing is found below those.

if (_factionselection == 0) then {_factionside = east; _rifPosPos = _tkm_rifPosPos; _atPosPos = _tkm_atPosPos; _mgPosPos = _tkm_mgPosPos; _atmgPosPos = _tkm_atmgPosPos; _snipPosPos = _tkm_snipPosPos};

///Create Squad
_L1_squad = createGroup _factionside; ///Create Group
///Create Member 0
if (random 1 <= _percentPosGar) then {_HL1_pos00Unit createUnit [position player, _L1_squad,"L1_squad_mem_00 = this;", _unitskill, _unitrank]};

///Create Member 1
if (random 1 <= _percentPosGar) then {_HL1_pos01Unit createUnit [position player, _L1_squad,"L1_squad_mem_01 = this;", _unitskill, _unitrank]};  

///Create Member 2
if (random 1 <= _percentPosGar) then {_HL1_pos02Unit createUnit [position player, _L1_squad,"L1_squad_mem_02 = this;", _unitskill, _unitrank]};
{_x enableattack false} forEach units _L1_squad;
{dostop _x} foreach units _L1_squad;

/// [marker name, radius, Percent of Buildings Occupied, Percent of Men in Building, Lowest Skill, Highest Skill, Faction Select]

_markername = _this select 0;
_radius_check = _this select 1;
_percentBuildGar = _this select 2; ///Percent of Buildings spawned with men
_percentPosGar = _this select 3; ///Percent of Total Men in Building Spawned
_minSkillValue = _this select 4; ///Lowest Skill of Units
_maxSkillValue = _this select 5; ///Highest Skill of Units

///-----------------------------------------------------------------------------------------
///Skill Ground Value

_maxSkillRangeV = round(random _maxvalue * 100);
_minSkillRangeV = round(random _minvalue * 100);
_actualSkill = ((_maxSkillRangeV - _minSkillRangeV)/100);
_unitskill = _actualSkill;
///End Skill Ground Value
///-----------------------------------------------------------------------------------------

///-----------------------------------------------------------------------------------------
/// Faction Selection Characteristics

_factionselection = _this select 6; ///The Faction Selection, possible values, 0 = tkm,
_rifPosPos = 0;
_atPosPos = 0;
_mgPosPos = 0;
_atmgPosPos = 0;
_snipPosPos = 0;
_unitrank = "Corporal";

///End Faction Selection Characteristics
///-----------------------------------------------------------------------------------------

hint format ["%1", "Building Detection"]; /// This is a Debug Line ***********************************************************
_buildinglist = (getmarkerpos _markername) nearObjects ["house", _radius_check];
_HL_1_list = (getmarkerpos _markername) nearObjects ["Land_House_L_1_EP1", _radius_check];
_HL_3_list = (getmarkerpos _markername) nearObjects ["Land_House_L_3_EP1", _radius_check];
_HL_4_list = (getmarkerpos _markername) nearObjects ["Land_House_L_4_EP1", _radius_check];
_HL_6_list = (getmarkerpos _markername) nearObjects ["Land_House_L_6_EP1", _radius_check];
_HL_7_list = (getmarkerpos _markername) nearObjects ["Land_House_L_7_EP1", _radius_check];
_HL_8_list = (getmarkerpos _markername) nearObjects ["Land_House_L_8_EP1", _radius_check];

///-----------------------------------------------------------------------------------------
hint format ["%1", "Unit Library"]; /// This is a Debug Line ***********************************************************
///Start Unit Library

///Takistan Militia

_tkm_rifPosPos = ["TK_INS_Soldier_EP1","TK_INS_Soldier_4_EP1","TK_INS_Soldier_3_EP1","TK_INS_Soldier_TL_EP1","TK_INS_Soldier_Sniper_EP1","TK_INS_Soldier_AAT_EP1"];
_tkm_atPosPos = ["TK_INS_Soldier_EP1","TK_INS_Soldier_AT_EP1","TK_INS_Soldier_4_EP1","TK_INS_Soldier_3_EP1","TK_INS_Soldier_TL_EP1","TK_INS_Soldier_Sniper_EP1","TK_INS_Soldier_AAT_EP1"];
_tkm_mgPosPos = ["TK_INS_Soldier_EP1","TK_INS_Soldier_MG_EP1","TK_INS_Soldier_4_EP1","TK_INS_Soldier_3_EP1","TK_INS_Soldier_TL_EP1","TK_INS_Soldier_Sniper_EP1","TK_INS_Soldier_AAT_EP1"];
_tkm_atmgPosPos = ["TK_INS_Soldier_EP1","TK_INS_Soldier_MG_EP1","TK_INS_Soldier_AT_EP1","TK_INS_Soldier_4_EP1","TK_INS_Soldier_3_EP1","TK_INS_Soldier_TL_EP1","TK_INS_Soldier_Sniper_EP1","TK_INS_Soldier_AAT_EP1"];
_tkm_snipPosPos = ["TK_INS_Soldier_EP1","TK_INS_Soldier_4_EP1","TK_INS_Soldier_3_EP1","TK_INS_Soldier_TL_EP1","TK_INS_Soldier_Sniper_EP1","TK_INS_Soldier_AAT_EP1"];

///-----------------------------------------------------------------------------------------
///Start Faction Select

///Takistan Militia
if (_factionselection == 0) then {_factionside = east; _rifPosPos = _tkm_rifPosPos; _atPosPos = _tkm_atPosPos; _mgPosPos = _tkm_mgPosPos; _atmgPosPos = _tkm_atmgPosPos; _snipPosPos = _tkm_snipPosPos};

///Counts the Number of Possible Men (Subtracts one due to array being base 0 and count being base 1)

_rifPosPosNum = ((count _rifPosPos) - 1);
_atPosPosNum = ((count _atPosPos) - 1);
_mgPosPosNum = ((count _mgPosPos) - 1);
_atmgPosPosNum = ((count _atmgPosPos) - 1);
_snipPosPosNum = ((count _snipPosPos) - 1);

///-----------------------------------------------------------------------------------------

///Start of House Library ----------------------------------

///House_L_1
_H_L_1_pos_00_A = [0.871826,-1.55762,-0.616486];
_H_L_1_pos_01_A =  [-0.468628,-1.91333,-0.610672];
_H_L_1_pos_02_A =  [-0.265747,0.536377,-0.597946];


///End Start of House Library ----------------------------------

///Squad for House L_1 Relevant ----------------------------------

{
_H_L_1_pos_00 = _x modelToWorld _H_L_1_pos_00_A;
_H_L_1_pos_01 = _x modelToWorld _H_L_1_pos_01_A;
_H_L_1_pos_02 = _x modelToWorld _H_L_1_pos_02_A;
///Possible Units
_HL1_pos00Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL1_pos01Unit = _rifPosPos select (round(random _rifPosPosNum)); 
_HL1_pos02Unit = _rifPosPos select (round(random _rifPosPosNum)); 

_L1_squad = createGroup _factionside; ///Create Group

///Create Squad

///Create Member 0
if (random 1 <= _percentPosGar) then {_HL1_pos00Unit createUnit [position player, _L1_squad,"L1_squad_mem_00 = this;", _unitskill, _unitrank]};

///Create Member 1
if (random 1 <= _percentPosGar) then {_HL1_pos01Unit createUnit [position player, _L1_squad,"L1_squad_mem_01 = this;", _unitskill, _unitrank]};  

///Create Member 2
if (random 1 <= _percentPosGar) then {_HL1_pos02Unit createUnit [position player, _L1_squad,"L1_squad_mem_02 = this;", _unitskill, _unitrank]};
{_x enableattack false} forEach units _L1_squad;
{dostop _x} foreach units _L1_squad;

/// Skill Section -------------------------------------------------------

{_x setskill 1} foreach units _L1_squad;
///(_maxskillrange = round(random _maxvalue * 100)); (_minskillrange = round(random _minvalue * 100));((_maxskillrange - _minskillrange)/100)

/// Set Unit Attributes -------------------------------------------------------

_L1_squad_members = units _L1_squad;
L1_squad_mem_00 setunitpos "up"; L1_squad_mem_00 setPosATL _H_L_1_pos_00;
L1_squad_mem_01 setunitpos "up"; L1_squad_mem_01 setPosATL _H_L_1_pos_01; 
L1_squad_mem_02 setunitpos "up"; L1_squad_mem_02 setPosATL _H_L_1_pos_02;

} foreach _HL_1_list;
hint format ["%1", group player];

Share this post


Link to post
Share on other sites

I'm fairly sure it might be this....

Add this and try it.

[b][color="Red"]_factionside = west;[/color][/b]
if (_factionselection == 0) then {_factionside = east; _rifPosPos = _tkm_rifPosPos; _atPosPos = _tkm_atPosPos; _mgPosPos = _tkm_mgPosPos; _atmgPosPos = _tkm_atmgPosPos; _snipPosPos = _tkm_snipPosPos}; 

Share this post


Link to post
Share on other sites
I'm fairly sure it might be this....

Add this and try it.

[b][color="Red"]_factionside = west;[/color][/b]
if (_factionselection == 0) then {_factionside = east; _rifPosPos = _tkm_rifPosPos; _atPosPos = _tkm_atPosPos; _mgPosPos = _tkm_mgPosPos; _atmgPosPos = _tkm_atmgPosPos; _snipPosPos = _tkm_snipPosPos}; 

Thanks, that was it. Why does that have to be there?

Share this post


Link to post
Share on other sites

_factionside might be an undefined variable, and thus the group never gets created. Sometimes it happens where undefined variables simply do nothing instead of actually giving an error... Make sure you properly define it!

Share this post


Link to post
Share on other sites
If a local variable is initialized within a Control Structures (i.e. if, for, switch, while) its scope will stay within this structure (i.e. outside of the structure it will still be seen as undefined).

are you defining any variables inside an if/for/while or switch statement?

Share this post


Link to post
Share on other sites
are you defining any variables inside an if/for/while or switch statement?

Yes. I suppose that would be why then.

I have another problem now. My script stops abruptly for no apparent reason with no error or anything like that.

The code below seems to be the culprit. The Hint Alpha 7 7 7 7 hits but Bravo never does. The only thing in between them is the " { ". That has to be there or the script errors. You may notice that a lot of the scripting is repeated with small alterations to numbers. All of those repetitions have the { but for some reason this one just breaks and I don't get why. I tried looking for other stuff too but I can't find anything wrong. The full code is at the bottom.

///8 Positions
hint format ["%1", "Alpha 7 7 7 7"]; /// This is a Debug Line ***********************************************************
{
hint format ["%1", "Bravo 7 7 7 7"]; /// This is a Debug Line ***********************************************************
///House Positions
_H_L_6_pos_00 = _x modelToWorld _H_L_6_pos_00_A;
_H_L_6_pos_01 = _x modelToWorld _H_L_6_pos_01_A;
_H_L_6_pos_02 = _x modelToWorld _H_L_6_pos_02_A;
_H_L_6_pos_03 = _x modelToWorld _H_L_6_pos_03_A;
_H_L_6_pos_04 = _x modelToWorld _H_L_6_pos_04_A;
_H_L_6_pos_05 = _x modelToWorld _H_L_6_pos_05_A;
_H_L_6_pos_06 = _x modelToWorld _H_L_6_pos_06_A;
_H_L_6_pos_07 = _x modelToWorld _H_L_6_pos_07_A;
hint format ["%1", "House 6 Positions"]; /// This is a Debug Line 

/// [marker name, radius, Percent of Buildings Occupied, Percent of Men in Building, Lowest Skill, Highest Skill, Faction Select]

_markername = _this select 0;
_radius_check = _this select 1;
_percentBuildGar = _this select 2; ///Percent of Buildings spawned with men
_percentPosGar = _this select 3; ///Percent of Total Men in Building Spawned
_minSkillValue = _this select 4; ///Lowest Skill of Units
_maxSkillValue = _this select 5; ///Highest Skill of Units
_initialSpawn = _this select 7; ///Marker the units spawn at

///-----------------------------------------------------------------------------------------
///Skill Ground Value

_maxSkillRangeV = round(random _maxSkillvalue * 100);
_minSkillRangeV = round(random _minSkillvalue * 100);
_actualSkill = ((_maxSkillRangeV - _minSkillRangeV)/100);
_unitskill = _actualSkill;

///End Skill Ground Value
///-----------------------------------------------------------------------------------------

///-----------------------------------------------------------------------------------------
/// Faction Selection Characteristics

_factionselection = _this select 6; ///The Faction Selection, possible values, 0 = tkm,
_rifPosPos = 0;
_atPosPos = 0;
_mgPosPos = 0;
_atmgPosPos = 0;
_snipPosPos = 0;
_unitrank = "Corporal";

///End Faction Selection Characteristics
///-----------------------------------------------------------------------------------------

hint format ["%1", "Building Detection"]; /// This is a Debug Line ***********************************************************
_buildinglist = (getmarkerpos _markername) nearObjects ["house", _radius_check];
_HL_1_list = (getmarkerpos _markername) nearObjects ["Land_House_L_1_EP1", _radius_check];
_HL_1d_list = (getmarkerpos _markername) nearObjects ["Land_House_L_1_dam_EP1", _radius_check];
_HL_3_list = (getmarkerpos _markername) nearObjects ["Land_House_L_3_EP1", _radius_check];
_HL_3d_list = (getmarkerpos _markername) nearObjects ["Land_House_L_3_dam_EP1", _radius_check];
_HL_4_list = (getmarkerpos _markername) nearObjects ["Land_House_L_4_EP1", _radius_check];
_HL_4d_list = (getmarkerpos _markername) nearObjects ["Land_House_L_4_dam_EP1", _radius_check];
_HL_6_list = (getmarkerpos _markername) nearObjects ["Land_House_L_6_EP1", _radius_check];
_HL_6d_list = (getmarkerpos _markername) nearObjects ["Land_House_L_6_dam_EP1", _radius_check];
_HL_7_list = (getmarkerpos _markername) nearObjects ["Land_House_L_7_EP1", _radius_check];
_HL_7d_list = (getmarkerpos _markername) nearObjects ["Land_House_L_7_dam_EP1", _radius_check];
_HL_8_list = (getmarkerpos _markername) nearObjects ["Land_House_L_8_EP1", _radius_check];
_HL_8d_list = (getmarkerpos _markername) nearObjects ["Land_House_L_8_dam_EP1", _radius_check];

///-----------------------------------------------------------------------------------------
hint format ["%1", "Unit Library"]; /// This is a Debug Line ***********************************************************
///Start Unit Library

///Takistan Militia

_tkm_rifPosPos = ["TK_INS_Soldier_EP1","TK_INS_Soldier_4_EP1","TK_INS_Soldier_3_EP1","TK_INS_Soldier_TL_EP1","TK_INS_Soldier_Sniper_EP1","TK_INS_Soldier_AAT_EP1"];
_tkm_atPosPos = ["TK_INS_Soldier_EP1","TK_INS_Soldier_AT_EP1","TK_INS_Soldier_4_EP1","TK_INS_Soldier_3_EP1","TK_INS_Soldier_TL_EP1","TK_INS_Soldier_Sniper_EP1","TK_INS_Soldier_AAT_EP1"];
_tkm_mgPosPos = ["TK_INS_Soldier_EP1","TK_INS_Soldier_MG_EP1","TK_INS_Soldier_4_EP1","TK_INS_Soldier_3_EP1","TK_INS_Soldier_TL_EP1","TK_INS_Soldier_Sniper_EP1","TK_INS_Soldier_AAT_EP1"];
_tkm_atmgPosPos = ["TK_INS_Soldier_EP1","TK_INS_Soldier_MG_EP1","TK_INS_Soldier_AT_EP1","TK_INS_Soldier_4_EP1","TK_INS_Soldier_3_EP1","TK_INS_Soldier_TL_EP1","TK_INS_Soldier_Sniper_EP1","TK_INS_Soldier_AAT_EP1"];
_tkm_snipPosPos = ["TK_INS_Soldier_EP1","TK_INS_Soldier_4_EP1","TK_INS_Soldier_3_EP1","TK_INS_Soldier_TL_EP1","TK_INS_Soldier_Sniper_EP1","TK_INS_Soldier_AAT_EP1"];

///-----------------------------------------------------------------------------------------
///Start Faction Select
_factionside = west;
///Takistan Militia
if (_factionselection == 0) then {_factionside = east; _rifPosPos = _tkm_rifPosPos; _atPosPos = _tkm_atPosPos; _mgPosPos = _tkm_mgPosPos; _atmgPosPos = _tkm_atmgPosPos; _snipPosPos = _tkm_snipPosPos};

///Counts the Number of Possible Men (Subtracts one due to array being base 0 and count being base 1)
_rifPosPosNum = ((count _rifPosPos) - 1);
_atPosPosNum = ((count _atPosPos) - 1);
_mgPosPosNum = ((count _mgPosPos) - 1);
_atmgPosPosNum = ((count _atmgPosPos) - 1);
_snipPosPosNum = ((count _snipPosPos) - 1);


///-----------------------------------------------------------------------------------------
///Start of House Library

///House_L_1
_H_L_1_pos_00_A = [0.871826,-1.55762,-0.616486];
_H_L_1_pos_01_A = [-0.468628,-1.91333,-0.610672];
_H_L_1_pos_02_A = [-0.265747,0.536377,-0.597946];


///House_L_3
_H_L_3_pos_00_A = [2.47095,2.23193,-0.222473];
_H_L_3_pos_01_A = [0.26416,0.171143,-0.222473];
_H_L_3_pos_02_A = [2.61646,0.507813,-0.222473];
_H_L_3_pos_03_A = [-6.02686,1.77661,-0.229202];
_H_L_3_pos_04_A = [-5.7417,0.234619,-0.172028];
_H_L_3_pos_05_A = [-2.88672,0.0483398,-0.246185];
_H_L_3_pos_06_A = [-4.65039,1.53516,2.64725];
_H_L_3_pos_07_A = [1.1842,0.563477,2.22406];

///House_L_4
_H_L_4_pos_00_A = [-4.9248,0.795898,-1.34981];
_H_L_4_pos_01_A = [0.29541,-0.552368,-1.33388];
_H_L_4_pos_02_A = [6.14819,1.62915,-1.06708];
_H_L_4_pos_03_A = [-3.52319,3.36365,0.768433];
_H_L_4_pos_04_A = [-4.23145,0.80127,1.72308];

///House_L_6
_H_L_6_pos_00_A = [-3.10278,-1.99298,-1.53476];
_H_L_6_pos_01_A = [-3.15869,0.68222,-1.52507];
_H_L_6_pos_02_A = [6.81128,2.18054,-1.509];
_H_L_6_pos_03_A = [3.89819,-1.98239,-1.50899];
_H_L_6_pos_04_A = [6.76025,2.09421,1.28101];
_H_L_6_pos_05_A = [3.60205,-0.866547,1.28099];
_H_L_6_pos_06_A = [3.42529,-0.0309448,1.28101];


///House_L_7
_H_L_7_pos_00_A = [-0.447754,-3.17737,-0.97998];
_H_L_7_pos_01_A = [-2.8252,-6.08374,-0.931091];
_H_L_7_pos_02_A = [-5.09717,2.96655,-0.647263];
_H_L_7_pos_03_A = [-3.92456,3.10986,-0.651184];
_H_L_7_pos_04_A = [0.5625,2.16357,-0.261154];
_H_L_7_pos_05_A = [5.13916,-0.493408,-0.165512];


///House_L_8
_H_L_8_pos_00_A = [5.31592,5.72583,0.440201];
_H_L_8_pos_01_A = [0.53125,5.56653,1.71164];
_H_L_8_pos_02_A = [-1.43726,5.44019,1.67599];
_H_L_8_pos_03_A = [-3.18311,0.695557,1.65121];
_H_L_8_pos_04_A = [-3.38647,-4.27258,1.32121];
_H_L_8_pos_05_A = [-1.90845,-6.01123,1.32121];
_H_L_8_pos_06_A = [3.79834,5.56799,1.72716];
_H_L_8_pos_07_A = [4.87573,3.19666,1.73621];
_H_L_8_pos_08_A = [5.24243,3.61133,1.73621];
_H_L_8_pos_09_A = [4.51929,3.89258,-0.773804];
_H_L_8_pos_10_A = [1.19531,0.245728,-1.01575];
_H_L_8_pos_11_A = [-2.98706,2.46497,-1.01575];
_H_L_8_pos_12_A = [-1.41406,5.46545,-0.993652];
_H_L_8_pos_13_A = [0.989746,5.41211,-1.01489];
_H_L_8_pos_14_A = [4.06152,0.920898,-1.07404];
_H_L_8_pos_15_A = [-2.81055,-1.93311,-1.54376];

///House_L_9
_H_L_9_pos_00_A = [1.10815,0.421875,-0.506271];
_H_L_9_pos_01_A = [1.10815,0.421875,-0.506271];
_H_L_9_pos_02_A = [-1.54468,-0.114136,-0.458908];

///House_K_1
_H_K_1_pos_00_A = [-0.366638,4.03809,1.56625];
_H_K_1_pos_01_A = [-3.11285,1.49536,1.60863];
_H_K_1_pos_02_A = [-3.49854,3.7019,1.54504];
_H_K_1_pos_03_A = [1.40958,3.53564,1.56625];
_H_K_1_pos_04_A = [3.71457,3.01953,1.56625];

///House_K_3
_H_K_3_pos_00_A = [-4.6958,-2.12619,-0.795319];
_H_K_3_pos_01_A = [-0.43042,-2.65918,-0.790298];
_H_K_3_pos_02_A = [1.70874,0.0116577,-0.790314];
_H_K_3_pos_03_A = [-0.104492,5.75488,-0.537674];
_H_K_3_pos_04_A = [1.2771,5.4859,-0.537674];
_H_K_3_pos_05_A = [-2.08569,5.74408,-0.537674];
_H_K_3_pos_06_A = [1.35156,5.76053,2.8172];
_H_K_3_pos_07_A = [-0.601074,5.0582,2.8172];
_H_K_3_pos_08_A = [2.07397,1.9064,2.98969];
_H_K_3_pos_09_A = [-2.13403,0.289764,2.98969];
_H_K_3_pos_10_A = [-1.67236,0.710266,2.98969];
_H_K_3_pos_11_A = [1.75073,-0.582886,3.04831];

///House_K_5
_H_K_5_pos_00_A = [-1.14258,1.85571,1.52243];
_H_K_5_pos_01_A = [1.32349,1.95978,1.54776];
_H_K_5_pos_02_A = [2.24414,3.94958,1.72903];
_H_K_5_pos_03_A = [4.77734,2.79785,2.37181];
_H_K_5_pos_04_A = [4.20483,-0.0202637,2.40567];
_H_K_5_pos_05_A = [-6.69385,-2.33386,0.556442];

///House_K_6

_H_K_6_pos_00_A = [3.77872,5.33203,-1.60779];
_H_K_6_pos_01_A = [1.22369,4.83667,-1.60793];
_H_K_6_pos_02_A = [-0.0609741,0.880615,-1.52161];
_H_K_6_pos_03_A = [4.36929,-1.37158,-1.60799];
_H_K_6_pos_04_A = [0.334595,-1.88477,-1.60799];
_H_K_6_pos_05_A = [1.28922,4.81055,1.47142];
_H_K_6_pos_06_A = [1.08121,-2.49048,1.4705];
_H_K_6_pos_07_A = [-2.50858,-1.86963,1.48848];
_H_K_6_pos_08_A = [-4.46823,-0.855957,1.55824];
_H_K_6_pos_09_A = [-4.46686,2.36377,1.48524];
_H_K_6_pos_10_A = [-2.38812,1.7915,1.48848];
_H_K_6_pos_11_A = [4.37427,4.93896,4.42143];
_H_K_6_pos_12_A = [2.86694,4.79517,4.42143];
_H_K_6_pos_13_A = [0.578125,4.70215,4.42143];
_H_K_6_pos_14_A = [1.40213,-2.49927,4.42146];
_H_K_6_pos_15_A = [-2.23779,-0.897461,4.42339];
_H_K_6_pos_16_A = [-1.99829,3.8457,4.40755];
_H_K_6_pos_17_A = [-3.20447,1.9248,4.41515];


///House_K_7

_H_K_7_pos_00_A = [-7.63452,1.83044,-0.218369];
_H_K_7_pos_01_A = [-0.537598,4.14795,-0.218369];
_H_K_7_pos_02_A = [-7.45581,3.11414,-0.218369];
_H_K_7_pos_03_A = [-5.47266,3.60999,-0.218369];
_H_K_7_pos_04_A = [-2.39453,3.88123,-0.218369];
_H_K_7_pos_05_A = [-0.71582,1.70496,-0.218369];
_H_K_7_pos_06_A = [-2.9751,0.459717,1.12976];
_H_K_7_pos_07_A = [-0.688965,0.917969,3.23355];
_H_K_7_pos_08_A = [-1.78516,3.67505,3.33363];
_H_K_7_pos_09_A = [-4.34424,0.71936,3.29033];
_H_K_7_pos_10_A = [-6.74683,1.42041,3.29033];
_H_K_7_pos_11_A = [-0.187012,4.09521,3.29031];
_H_K_7_pos_12_A = [-2.92554,-1.13062,3.20523];
_H_K_7_pos_13_A = [0.55127,-1.54089,3.20523];


///House_K_8

_H_K_8_pos_00_A = [-0.804688,-1.44373,-2.55338];
_H_K_8_pos_01_A = [2.66724,-1.16748,-2.57321];
_H_K_8_pos_02_A = [2.71436,-3.04028,-2.56226];
_H_K_8_pos_03_A = [-2.32959,-0.335083,-2.54623];
_H_K_8_pos_04_A = [-1.13818,3.39648,-2.59065];
_H_K_8_pos_05_A = [1.47705,3.35498,-2.59489];
_H_K_8_pos_06_A = [2.71924,-0.784668,0.248505];
_H_K_8_pos_07_A = [1.93066,1.6228,0.254028];
_H_K_8_pos_08_A = [2.68262,3.93335,0.254303];
_H_K_8_pos_09_A = [-1.81958,3.69189,0.250885];
_H_K_8_pos_10_A = [-3.87231,3.5282,0.23053];
_H_K_8_pos_11_A = [1.36084,-0.387329,0.250153];
_H_K_8_pos_12_A = [-2.47119,-0.330688,0.250092];
_H_K_8_pos_13_A = [-1.42651,-0.763794,0.251373];
_H_K_8_pos_14_A = [-0.174072,3.26477,3.35995];
_H_K_8_pos_15_A = [-2.30103,-0.827148,3.35992];
_H_K_8_pos_16_A = [-2.48413,-0.723145,3.35992];
_H_K_8_pos_17_A = [-1.16089,-0.63501,3.43097];
_H_K_8_pos_18_A = [0.0507813,1.91443,3.35999];
_H_K_8_pos_19_A = [2.04175,3.65515,3.35999];




///End of House Library

///-----------------------------------------------------------------------------------------

///Start of Squad Library
hint format ["%1", "Squad Library"]; /// This is a Debug Line ***********************************************************

///-------------------------------------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///Start Squad for House L_1  ----------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------

{
///House Positions
_H_L_1_pos_00 = _x modelToWorld _H_L_1_pos_00_A;
_H_L_1_pos_01 = _x modelToWorld _H_L_1_pos_01_A;
_H_L_1_pos_02 = _x modelToWorld _H_L_1_pos_02_A;
///Possible Units
_HL1_pos00Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL1_pos01Unit = _rifPosPos select (round(random _rifPosPosNum)); 
_HL1_pos02Unit = _rifPosPos select (round(random _rifPosPosNum)); 

_L1_squad = createGroup _factionside; ///Create Group

///Create Squad

///Create Member 0
if (random 1 <= _percentPosGar) then {_HL1_pos00Unit createUnit [getmarkerpos _initialSpawn, _L1_squad,"L1_squad_mem_00 = this;", _unitskill, _unitrank]};

///Create Member 1
if (random 1 <= _percentPosGar) then {_HL1_pos01Unit createUnit [getmarkerpos _initialSpawn, _L1_squad,"L1_squad_mem_01 = this;", _unitskill, _unitrank]};  

///Create Member 2
if (random 1 <= _percentPosGar) then {_HL1_pos02Unit createUnit [getmarkerpos _initialSpawn, _L1_squad,"L1_squad_mem_02 = this;", _unitskill, _unitrank]};
///End of Create Squad-------------------
///--------------------------------------
///Start of Squad Attributes
{_x enableattack false} forEach units _L1_squad;
{dostop _x} foreach units _L1_squad;

/// Skill Section -------------------------------------------------------

{_x setskill 1} foreach units _L1_squad;
///(_maxskillrange = round(random _maxvalue * 100)); (_minskillrange = round(random _minvalue * 100));((_maxskillrange - _minskillrange)/100)

/// Set Unit Attributes -------------------------------------------------------

_L1_squad_members = units _L1_squad;
L1_squad_mem_00 setunitpos "up"; L1_squad_mem_00 setPosATL _H_L_1_pos_00;
L1_squad_mem_01 setunitpos "up"; L1_squad_mem_01 setPosATL _H_L_1_pos_01; 
L1_squad_mem_02 setunitpos "up"; L1_squad_mem_02 setPosATL _H_L_1_pos_02;
} foreach _HL_1_list;

///-------------------------------------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///End of Squad for House L_1----------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------

///-------------------------------------------------------------------Squad Divider Line----------------------------------------
hint format ["%1", "House 3"]; /// This is a Debug Line ***********************************************************
///-------------------------------------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///Start Squad for House L_3  ----------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///8 Positions
{
///House Positions
_H_L_3_pos_00 = _x modelToWorld _H_L_3_pos_00_A;
_H_L_3_pos_01 = _x modelToWorld _H_L_3_pos_01_A;
_H_L_3_pos_02 = _x modelToWorld _H_L_3_pos_02_A;
_H_L_3_pos_03 = _x modelToWorld _H_L_3_pos_03_A;
_H_L_3_pos_04 = _x modelToWorld _H_L_3_pos_04_A;
_H_L_3_pos_05 = _x modelToWorld _H_L_3_pos_05_A;
_H_L_3_pos_06 = _x modelToWorld _H_L_3_pos_06_A;
_H_L_3_pos_07 = _x modelToWorld _H_L_3_pos_07_A;
///Possible Units
_HL3_pos00Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL3_pos01Unit = _rifPosPos select (round(random _rifPosPosNum)); 
_HL3_pos02Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL3_pos03Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL3_pos04Unit = _rifPosPos select (round(random _rifPosPosNum)); 
_HL3_pos05Unit = _rifPosPos select (round(random _rifPosPosNum)); 
_HL3_pos06Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL3_pos07Unit = _rifPosPos select (round(random _rifPosPosNum)); 


_L3_squad = createGroup _factionside; ///Create Group

///Create Squad

///Create Member 0
if (random 1 <= _percentPosGar) then {_HL3_pos00Unit createUnit [getmarkerpos _initialSpawn, _L3_squad,"L3_squad_mem_00 = this;", _unitskill, _unitrank]};

///Create Member 1
if (random 1 <= _percentPosGar) then {_HL3_pos01Unit createUnit [getmarkerpos _initialSpawn, _L3_squad,"L3_squad_mem_01 = this;", _unitskill, _unitrank]};  

///Create Member 2
if (random 1 <= _percentPosGar) then {_HL3_pos02Unit createUnit [getmarkerpos _initialSpawn, _L3_squad,"L3_squad_mem_02 = this;", _unitskill, _unitrank]};

///Create Member 3
if (random 1 <= _percentPosGar) then {_HL3_pos03Unit createUnit [getmarkerpos _initialSpawn, _L3_squad,"L3_squad_mem_03 = this;", _unitskill, _unitrank]};

///Create Member 4
if (random 1 <= _percentPosGar) then {_HL3_pos04Unit createUnit [getmarkerpos _initialSpawn, _L3_squad,"L3_squad_mem_04 = this;", _unitskill, _unitrank]};

///Create Member 5
if (random 1 <= _percentPosGar) then {_HL3_pos05Unit createUnit [getmarkerpos _initialSpawn, _L3_squad,"L3_squad_mem_05 = this;", _unitskill, _unitrank]};

///Create Member 6
if (random 1 <= _percentPosGar) then {_HL3_pos06Unit createUnit [getmarkerpos _initialSpawn, _L3_squad,"L3_squad_mem_06 = this;", _unitskill, _unitrank]};

///Create Member 7
if (random 1 <= _percentPosGar) then {_HL3_pos07Unit createUnit [getmarkerpos _initialSpawn, _L3_squad,"L3_squad_mem_07 = this;", _unitskill, _unitrank]};


///End of Create Squad-------------------
///--------------------------------------
///Start of Squad Attributes
{_x enableattack false} forEach units _L3_squad;
{dostop _x} foreach units _L3_squad;

/// Skill Section -------------------------------------------------------

{_x setskill 1} foreach units _L3_squad;
///(_maxskillrange = round(random _maxvalue * 100)); (_minskillrange = round(random _minvalue * 100));((_maxskillrange - _minskillrange)/100)

/// Set Unit Attributes -------------------------------------------------------

_L3_squad_members = units _L3_squad;
L3_squad_mem_00 setunitpos "up"; L3_squad_mem_00 setPosATL _H_L_3_pos_00;
L3_squad_mem_01 setunitpos "up"; L3_squad_mem_01 setPosATL _H_L_3_pos_01; 
L3_squad_mem_02 setunitpos "Middle"; L3_squad_mem_02 setPosATL _H_L_3_pos_02;
L3_squad_mem_03 setunitpos "up"; L3_squad_mem_03 setPosATL _H_L_3_pos_03;
L3_squad_mem_04 setunitpos "up"; L3_squad_mem_04 setPosATL _H_L_3_pos_04; 
L3_squad_mem_05 setunitpos "Middle"; L3_squad_mem_05 setPosATL _H_L_3_pos_05;
L3_squad_mem_06 setunitpos "Down"; L3_squad_mem_06 setPosATL _H_L_3_pos_06;
L3_squad_mem_07 setunitpos "Down"; L3_squad_mem_07 setPosATL _H_L_3_pos_07;

} foreach _HL_3_list;
///-------------------------------------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///End of Squad for House L_3-----------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------

///-------------------------------------------------------------------Squad Divider Line----------------------------------------
hint format ["%1", "House 4"]; /// This is a Debug Line ***********************************************************
///-------------------------------------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///Start Squad for House L_4  ----------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///5 Positions
{
///House Positions
_H_L_4_pos_00 = _x modelToWorld _H_L_4_pos_00_A;
_H_L_4_pos_01 = _x modelToWorld _H_L_4_pos_01_A;
_H_L_4_pos_02 = _x modelToWorld _H_L_4_pos_02_A;
_H_L_4_pos_03 = _x modelToWorld _H_L_4_pos_03_A;
_H_L_4_pos_04 = _x modelToWorld _H_L_4_pos_04_A;

///Possible Units
_HL4_pos00Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL4_pos01Unit = _rifPosPos select (round(random _rifPosPosNum)); 
_HL4_pos02Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL4_pos03Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL4_pos04Unit = _rifPosPos select (round(random _rifPosPosNum)); 



_L4_squad = createGroup _factionside; ///Create Group

///Create Squad

///Create Member 0
if (random 1 <= _percentPosGar) then {_HL4_pos00Unit createUnit [getmarkerpos _initialSpawn, _L4_squad,"L4_squad_mem_00 = this;", _unitskill, _unitrank]};

///Create Member 1
if (random 1 <= _percentPosGar) then {_HL4_pos01Unit createUnit [getmarkerpos _initialSpawn, _L4_squad,"L4_squad_mem_01 = this;", _unitskill, _unitrank]};  

///Create Member 2
if (random 1 <= _percentPosGar) then {_HL4_pos02Unit createUnit [getmarkerpos _initialSpawn, _L4_squad,"L4_squad_mem_02 = this;", _unitskill, _unitrank]};

///Create Member 3
if (random 1 <= _percentPosGar) then {_HL4_pos03Unit createUnit [getmarkerpos _initialSpawn, _L4_squad,"L4_squad_mem_03 = this;", _unitskill, _unitrank]};

///Create Member 4
if (random 1 <= _percentPosGar) then {_HL4_pos04Unit createUnit [getmarkerpos _initialSpawn, _L4_squad,"L4_squad_mem_04 = this;", _unitskill, _unitrank]};


///End of Create Squad-------------------
///--------------------------------------
///Start of Squad Attributes
{_x enableattack false} forEach units _L4_squad;
{dostop _x} foreach units _L4_squad;

/// Skill Section -------------------------------------------------------

{_x setskill 1} foreach units _L4_squad;
///(_maxskillrange = round(random _maxvalue * 100)); (_minskillrange = round(random _minvalue * 100));((_maxskillrange - _minskillrange)/100)

/// Set Unit Attributes -------------------------------------------------------

_L4_squad_members = units _L4_squad;
L4_squad_mem_00 setPosATL _H_L_4_pos_00;
L4_squad_mem_01 setPosATL _H_L_4_pos_01;
L4_squad_mem_02 setPosATL _H_L_4_pos_02;
L4_squad_mem_03 setPosATL _H_L_4_pos_03;
L4_squad_mem_04 setPosATL _H_L_4_pos_04;
L4_squad_mem_00 setUnitPos "Middle";
L4_squad_mem_01 setUnitPos "Middle";
L4_squad_mem_02 setUnitPos "Middle";
L4_squad_mem_03 setUnitPos "Up";
L4_squad_mem_04 setUnitPos "Down";

} foreach _HL_4_list;
///-------------------------------------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///End of Squad for House L_4-----------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------

///-------------------------------------------------------------------Squad Divider Line----------------------------------------


///-------------------------------------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///Start Squad for House L_6  ----------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///8 Positions
hint format ["%1", "Alpha 7 7 7 7"]; /// This is a Debug Line ***********************************************************
{
hint format ["%1", "Bravo 7 7 7 7"]; /// This is a Debug Line ***********************************************************
///House Positions
_H_L_6_pos_00 = _x modelToWorld _H_L_6_pos_00_A;
_H_L_6_pos_01 = _x modelToWorld _H_L_6_pos_01_A;
_H_L_6_pos_02 = _x modelToWorld _H_L_6_pos_02_A;
_H_L_6_pos_03 = _x modelToWorld _H_L_6_pos_03_A;
_H_L_6_pos_04 = _x modelToWorld _H_L_6_pos_04_A;
_H_L_6_pos_05 = _x modelToWorld _H_L_6_pos_05_A;
_H_L_6_pos_06 = _x modelToWorld _H_L_6_pos_06_A;
_H_L_6_pos_07 = _x modelToWorld _H_L_6_pos_07_A;
hint format ["%1", "House 6 Positions"]; /// This is a Debug Line ***********************************************************
///Possible Units
_HL6_pos00Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL6_pos01Unit = _rifPosPos select (round(random _rifPosPosNum)); 
_HL6_pos02Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL6_pos03Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL6_pos04Unit = _rifPosPos select (round(random _rifPosPosNum)); 
_HL6_pos05Unit = _rifPosPos select (round(random _rifPosPosNum)); 
_HL6_pos06Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL6_pos07Unit = _rifPosPos select (round(random _rifPosPosNum)); 
hint format ["%1", "House 6 End Positions"]; /// This is a Debug Line *********************************************************** 

_L6_squad = createGroup _factionside; ///Create Group
hint format ["%1", "House 6 Group"]; /// This is a Debug Line ***********************************************************
///Create Squad
hint format ["%1", "House 6 Create Units"]; /// This is a Debug Line ***********************************************************
///Create Member 0
if (random 1 <= _percentPosGar) then {_HL6_pos00Unit createUnit [getmarkerpos _initialSpawn, _L6_squad,"L6_squad_mem_00 = this;", _unitskill, _unitrank]};

///Create Member 1
if (random 1 <= _percentPosGar) then {_HL6_pos01Unit createUnit [getmarkerpos _initialSpawn, _L6_squad,"L6_squad_mem_01 = this;", _unitskill, _unitrank]};  

///Create Member 2
if (random 1 <= _percentPosGar) then {_HL6_pos02Unit createUnit [getmarkerpos _initialSpawn, _L6_squad,"L6_squad_mem_02 = this;", _unitskill, _unitrank]};

///Create Member 3
if (random 1 <= _percentPosGar) then {_HL6_pos03Unit createUnit [getmarkerpos _initialSpawn, _L6_squad,"L6_squad_mem_03 = this;", _unitskill, _unitrank]};

///Create Member 4
if (random 1 <= _percentPosGar) then {_HL6_pos04Unit createUnit [getmarkerpos _initialSpawn, _L6_squad,"L6_squad_mem_04 = this;", _unitskill, _unitrank]};

///Create Member 5
if (random 1 <= _percentPosGar) then {_HL6_pos05Unit createUnit [getmarkerpos _initialSpawn, _L6_squad,"L6_squad_mem_05 = this;", _unitskill, _unitrank]};

///Create Member 6
if (random 1 <= _percentPosGar) then {_HL6_pos06Unit createUnit [getmarkerpos _initialSpawn, _L6_squad,"L6_squad_mem_06 = this;", _unitskill, _unitrank]};

///Create Member 7
if (random 1 <= _percentPosGar) then {_HL6_pos07Unit createUnit [getmarkerpos _initialSpawn, _L6_squad,"L6_squad_mem_07 = this;", _unitskill, _unitrank]};

///End of Create Squad-------------------
///--------------------------------------
hint format ["%1", "House 6 Squad Attributes"]; /// This is a Debug Line ***********************************************************
///Start of Squad Attributes
{_x enableattack false} forEach units _L6_squad;
{dostop _x} foreach units _L6_squad;

/// Skill Section -------------------------------------------------------

{_x setskill .25} foreach units _L6_squad;
///(_maxskillrange = round(random _maxvalue * 100)); (_minskillrange = round(random _minvalue * 100));((_maxskillrange - _minskillrange)/100)

/// Set Unit Attributes -------------------------------------------------------
hint format ["%1", "House 6 Attributes"]; /// This is a Debug Line ***********************************************************
_L6_squad_members = units _L6_squad;
L6_squad_mem_00 setPosATL _H_L_6_pos_00;
L6_squad_mem_01 setPosATL _H_L_6_pos_01;
L6_squad_mem_02 setPosATL _H_L_6_pos_02;
L6_squad_mem_03 setPosATL _H_L_6_pos_03;
L6_squad_mem_04 setPosATL _H_L_6_pos_04;
L6_squad_mem_05 setPosATL _H_L_6_pos_05;
L6_squad_mem_06 setPosATL _H_L_6_pos_06;
L6_squad_mem_07 setPosATL _H_L_6_pos_07;
L6_squad_mem_00 setUnitPos "Middle";
L6_squad_mem_01 setUnitPos "Middle";
L6_squad_mem_02 setUnitPos "Middle";
L6_squad_mem_03 setUnitPos "Middle";
L6_squad_mem_04 setUnitPos "Up";
L6_squad_mem_05 setUnitPos "Up";
L6_squad_mem_06 setUnitPos "Middle";
L6_squad_mem_07 setUnitPos "Middle";'
} foreach _HL_6_list;

///-------------------------------------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///End of Squad for House L_6-----------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------

///-------------------------------------------------------------------Squad Divider Line----------------------------------------
hint format ["%1", "House 7"]; /// This is a Debug Line ***********************************************************
///-------------------------------------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///Start Squad for House L_7  ----------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///6 Positions
{
///House Positions
_H_L_7_pos_00 = _x modelToWorld _H_L_7_pos_00_A;
_H_L_7_pos_01 = _x modelToWorld _H_L_7_pos_01_A;
_H_L_7_pos_02 = _x modelToWorld _H_L_7_pos_02_A;
_H_L_7_pos_03 = _x modelToWorld _H_L_7_pos_03_A;
_H_L_7_pos_04 = _x modelToWorld _H_L_7_pos_04_A;
_H_L_7_pos_05 = _x modelToWorld _H_L_7_pos_05_A;

///Possible Units
_HL7_pos00Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL7_pos01Unit = _rifPosPos select (round(random _rifPosPosNum)); 
_HL7_pos02Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL7_pos03Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL7_pos04Unit = _rifPosPos select (round(random _rifPosPosNum)); 
_HL7_pos05Unit = _rifPosPos select (round(random _rifPosPosNum));


_L7_squad = createGroup _factionside; ///Create Group

///---------Create Squad---------

///Create Member 0
if (random 1 <= _percentPosGar) then {_HL7_pos00Unit createUnit [getmarkerpos _initialSpawn, _L7_squad,"L7_squad_mem_00 = this;", _unitskill, _unitrank]};

///Create Member 1
if (random 1 <= _percentPosGar) then {_HL7_pos01Unit createUnit [getmarkerpos _initialSpawn, _L7_squad,"L7_squad_mem_01 = this;", _unitskill, _unitrank]};  

///Create Member 2
if (random 1 <= _percentPosGar) then {_HL7_pos02Unit createUnit [getmarkerpos _initialSpawn, _L7_squad,"L7_squad_mem_02 = this;", _unitskill, _unitrank]};

///Create Member 3
if (random 1 <= _percentPosGar) then {_HL7_pos03Unit createUnit [getmarkerpos _initialSpawn, _L7_squad,"L7_squad_mem_03 = this;", _unitskill, _unitrank]};

///Create Member 4
if (random 1 <= _percentPosGar) then {_HL7_pos04Unit createUnit [getmarkerpos _initialSpawn, _L7_squad,"L7_squad_mem_04 = this;", _unitskill, _unitrank]};

///Create Member 5
if (random 1 <= _percentPosGar) then {_HL7_pos05Unit createUnit [getmarkerpos _initialSpawn, _L7_squad,"L7_squad_mem_05 = this;", _unitskill, _unitrank]};


///---------End of Create Squad-------------------
///--------------------------------------
///---------Start of Squad Attributes---------

{_x enableattack false} forEach units _L7_squad;
{dostop _x} foreach units _L7_squad;

///--------- Skill Section -------------------------------------------------------

{_x setskill 1} foreach units _L7_squad;
///(_maxskillrange = round(random _maxvalue * 100)); (_minskillrange = round(random _minvalue * 100));((_maxskillrange - _minskillrange)/100)

///---------Set Unit Attributes -------------------------------------------------------

_L7_squad_members = units _L7_squad;
L7_squad_mem_00 setunitpos "Middle"; L7_squad_mem_00 setPosATL _H_L_7_pos_00;
L7_squad_mem_01 setunitpos "Up"; L7_squad_mem_01 setPosATL _H_L_7_pos_01; 
L7_squad_mem_02 setunitpos "Up"; L7_squad_mem_02 setPosATL _H_L_7_pos_02;
L7_squad_mem_03 setunitpos "Up"; L7_squad_mem_03 setPosATL _H_L_7_pos_03;
L7_squad_mem_04 setunitpos "Middle"; L7_squad_mem_04 setPosATL _H_L_7_pos_04; 
L7_squad_mem_05 setunitpos "Middle"; L7_squad_mem_05 setPosATL _H_L_7_pos_05;


} foreach _HL_7_list;
///-------------------------------------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///End of Squad for House L_7-----------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------

///-------------------------------------------------------------------Squad Divider Line----------------------------------------

///-------------------------------------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///Start Squad for House L_8  ----------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///8 Positions
{
///House Positions
_H_L_8_pos_00 = _x modelToWorld _H_L_8_pos_00_A;
_H_L_8_pos_01 = _x modelToWorld _H_L_8_pos_01_A;
_H_L_8_pos_02 = _x modelToWorld _H_L_8_pos_02_A;
_H_L_8_pos_03 = _x modelToWorld _H_L_8_pos_03_A;
_H_L_8_pos_04 = _x modelToWorld _H_L_8_pos_04_A;
_H_L_8_pos_05 = _x modelToWorld _H_L_8_pos_05_A;
_H_L_8_pos_06 = _x modelToWorld _H_L_8_pos_06_A;
_H_L_8_pos_07 = _x modelToWorld _H_L_8_pos_07_A;
_H_L_8_pos_08 = _x modelToWorld _H_L_8_pos_08_A;
_H_L_8_pos_09 = _x modelToWorld _H_L_8_pos_09_A;
_H_L_8_pos_10 = _x modelToWorld _H_L_8_pos_10_A;
_H_L_8_pos_11 = _x modelToWorld _H_L_8_pos_11_A;
_H_L_8_pos_12 = _x modelToWorld _H_L_8_pos_12_A;
_H_L_8_pos_13 = _x modelToWorld _H_L_8_pos_13_A;
_H_L_8_pos_14 = _x modelToWorld _H_L_8_pos_14_A;
_H_L_8_pos_15 = _x modelToWorld _H_L_8_pos_15_A;
///Possible Units
_HL8_pos00Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL8_pos01Unit = _rifPosPos select (round(random _rifPosPosNum)); 
_HL8_pos02Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL8_pos03Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL8_pos04Unit = _rifPosPos select (round(random _rifPosPosNum)); 
_HL8_pos05Unit = _rifPosPos select (round(random _rifPosPosNum)); 
_HL8_pos06Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL8_pos07Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL8_pos08Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL8_pos09Unit = _rifPosPos select (round(random _rifPosPosNum)); 
_HL8_pos10Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL8_pos11Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL8_pos12Unit = _rifPosPos select (round(random _rifPosPosNum)); 
_HL8_pos13Unit = _rifPosPos select (round(random _rifPosPosNum)); 
_HL8_pos14Unit = _rifPosPos select (round(random _rifPosPosNum));
_HL8_pos15Unit = _rifPosPos select (round(random _rifPosPosNum));  


_L8_squad = createGroup _factionside; ///Create Group

///Create Squad

///Create Member 0
if (random 1 <= _percentPosGar) then {_HL8_pos00Unit createUnit [getmarkerpos _initialSpawn, _L8_squad,"L8_squad_mem_00 = this;", _unitskill, _unitrank]};

///Create Member 1
if (random 1 <= _percentPosGar) then {_HL8_pos01Unit createUnit [getmarkerpos _initialSpawn, _L8_squad,"L8_squad_mem_01 = this;", _unitskill, _unitrank]};  

///Create Member 2
if (random 1 <= _percentPosGar) then {_HL8_pos02Unit createUnit [getmarkerpos _initialSpawn, _L8_squad,"L8_squad_mem_02 = this;", _unitskill, _unitrank]};

///Create Member 3
if (random 1 <= _percentPosGar) then {_HL8_pos03Unit createUnit [getmarkerpos _initialSpawn, _L8_squad,"L8_squad_mem_03 = this;", _unitskill, _unitrank]};

///Create Member 4
if (random 1 <= _percentPosGar) then {_HL8_pos04Unit createUnit [getmarkerpos _initialSpawn, _L8_squad,"L8_squad_mem_04 = this;", _unitskill, _unitrank]};

///Create Member 5
if (random 1 <= _percentPosGar) then {_HL8_pos05Unit createUnit [getmarkerpos _initialSpawn, _L8_squad,"L8_squad_mem_05 = this;", _unitskill, _unitrank]};

///Create Member 6
if (random 1 <= _percentPosGar) then {_HL8_pos06Unit createUnit [getmarkerpos _initialSpawn, _L8_squad,"L8_squad_mem_06 = this;", _unitskill, _unitrank]};

///Create Member 7
if (random 1 <= _percentPosGar) then {_HL8_pos07Unit createUnit [getmarkerpos _initialSpawn, _L8_squad,"L8_squad_mem_07 = this;", _unitskill, _unitrank]};

///Create Member 8
if (random 1 <= _percentPosGar) then {_HL8_pos08Unit createUnit [getmarkerpos _initialSpawn, _L8_squad,"L8_squad_mem_08 = this;", _unitskill, _unitrank]};

///Create Member 9
if (random 1 <= _percentPosGar) then {_HL8_pos09Unit createUnit [getmarkerpos _initialSpawn, _L8_squad,"L8_squad_mem_09 = this;", _unitskill, _unitrank]};  

///Create Member 10
if (random 1 <= _percentPosGar) then {_HL8_pos10Unit createUnit [getmarkerpos _initialSpawn, _L8_squad,"L8_squad_mem_10 = this;", _unitskill, _unitrank]};

///Create Member 11
if (random 1 <= _percentPosGar) then {_HL8_pos11Unit createUnit [getmarkerpos _initialSpawn, _L8_squad,"L8_squad_mem_11 = this;", _unitskill, _unitrank]};

///Create Member 12
if (random 1 <= _percentPosGar) then {_HL8_pos12Unit createUnit [getmarkerpos _initialSpawn, _L8_squad,"L8_squad_mem_12 = this;", _unitskill, _unitrank]};

///Create Member 13
if (random 1 <= _percentPosGar) then {_HL8_pos13Unit createUnit [getmarkerpos _initialSpawn, _L8_squad,"L8_squad_mem_13 = this;", _unitskill, _unitrank]};

///Create Member 14
if (random 1 <= _percentPosGar) then {_HL8_pos14Unit createUnit [getmarkerpos _initialSpawn, _L8_squad,"L8_squad_mem_14 = this;", _unitskill, _unitrank]};

///Create Member 15
if (random 1 <= _percentPosGar) then {_HL8_pos15Unit createUnit [getmarkerpos _initialSpawn, _L8_squad,"L8_squad_mem_15 = this;", _unitskill, _unitrank]};


///End of Create Squad-------------------
///--------------------------------------
///Start of Squad Attributes
{_x enableattack false} forEach units _L8_squad;
{dostop _x} foreach units _L8_squad;

/// Skill Section -------------------------------------------------------

{_x setskill 1} foreach units _L8_squad;
///(_maxskillrange = round(random _maxvalue * 100)); (_minskillrange = round(random _minvalue * 100));((_maxskillrange - _minskillrange)/100)

/// Set Unit Attributes -------------------------------------------------------

_L8_squad_members = units _L8_squad;
L8_squad_mem_00 setunitpos "Middle"; L8_squad_mem_00 setPosATL _H_L_8_pos_00;
L8_squad_mem_01 setunitpos "Up"; L8_squad_mem_01 setPosATL _H_L_8_pos_01; 
L8_squad_mem_02 setunitpos "Down"; L8_squad_mem_02 setPosATL _H_L_8_pos_02;
L8_squad_mem_03 setunitpos "Middle"; L8_squad_mem_03 setPosATL _H_L_8_pos_03;
L8_squad_mem_04 setunitpos "Middle"; L8_squad_mem_04 setPosATL _H_L_8_pos_04; 
L8_squad_mem_05 setunitpos "Middle"; L8_squad_mem_05 setPosATL _H_L_8_pos_05;
L8_squad_mem_06 setunitpos "Up"; L8_squad_mem_06 setPosATL _H_L_8_pos_06;
L8_squad_mem_07 setunitpos "Middle"; L8_squad_mem_07 setPosATL _H_L_8_pos_07;
L8_squad_mem_08 setunitpos "Up"; L8_squad_mem_08 setPosATL _H_L_8_pos_08;
L8_squad_mem_09 setunitpos "Up"; L8_squad_mem_09 setPosATL _H_L_8_pos_09; 
L8_squad_mem_10 setunitpos "Middle"; L8_squad_mem_10 setPosATL _H_L_8_pos_10;
L8_squad_mem_11 setunitpos "Middle"; L8_squad_mem_11 setPosATL _H_L_8_pos_11;
L8_squad_mem_12 setunitpos "Middle"; L8_squad_mem_12 setPosATL _H_L_8_pos_12; 
L8_squad_mem_13 setunitpos "Middle"; L8_squad_mem_13 setPosATL _H_L_8_pos_13;
L8_squad_mem_14 setunitpos "Middle"; L8_squad_mem_14 setPosATL _H_L_8_pos_14;
L8_squad_mem_15 setunitpos "Middle"; L8_squad_mem_15 setPosATL _H_L_8_pos_15;

} foreach _HL_8_list;
///-------------------------------------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///End of Squad for House L_8-----------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------
///-------------------------------------------------------------


///End of Squad Library


hint format ["%1", "Script Finished"]; /// This is a Debug Line ***********************************************************


Share this post


Link to post
Share on other sites

_H_K_8_pos_00_A = [-0.804688,-1.44373,-2.55338];
_H_K_8_pos_01_A = [2.66724,-1.16748,-2.57321];
_H_K_8_pos_02_A = [2.71436,-3.04028,-2.56226];
_H_K_8_pos_03_A = [-2.32959,-0.335083,-2.54623];
_H_K_8_pos_04_A = [-1.13818,3.39648,-2.59065];
_H_K_8_pos_05_A = [1.47705,3.35498,-2.59489];
_H_K_8_pos_06_A = [2.71924,-0.784668,0.248505];
_H_K_8_pos_07_A = [1.93066,1.6228,0.254028];
_H_K_8_pos_08_A = [2.68262,3.93335,0.254303];
_H_K_8_pos_09_A = [-1.81958,3.69189,0.250885];
_H_K_8_pos_10_A = [-3.87231,3.5282,0.23053];
_H_K_8_pos_11_A = [1.36084,-0.387329,0.250153];
_H_K_8_pos_12_A = [-2.47119,-0.330688,0.250092];
_H_K_8_pos_13_A = [-1.42651,-0.763794,0.251373];
_H_K_8_pos_14_A = [-0.174072,3.26477,3.35995];
_H_K_8_pos_15_A = [-2.30103,-0.827148,3.35992];
_H_K_8_pos_16_A = [-2.48413,-0.723145,3.35992];
_H_K_8_pos_17_A = [-1.16089,-0.63501,3.43097];
_H_K_8_pos_18_A = [0.0507813,1.91443,3.35999];
_H_K_8_pos_19_A = [2.04175,3.65515,3.35999]; 

Dude. Learn to friggin array. An array is a list. If nothing is in your list, that list is empty. You put something in a list, then that list has a size of 1 (count _list) and you access that item in that list with _list select 0, since the index of a list starts by zero. Thus, the index of the last item in a list is ((count _list) - 1), given that list is not empty.


_emptyList = [];

_listOfOnePosition = [
  [1.47705,3.35498,-2.59489]
];

_listOfPositions = [
  [-2.30103,-0.827148,3.35992],
  [-1.81958,3.69189,0.250885],
  [1.47705,3.35498,-2.59489]
];

// let's add another position to that list
_listOfPositions set [
  (count listOfPositions), // next free index
  [2.66724,-1.16748,-2.57321] // new position/item
];

_listOfHousesAndStuff = [
  [
     _obj21, // reference to some house/ingame-object
     false, // some flag for something...
     [
        [-2.30103,-0.827148,3.35992],
        [-1.81958,3.69189,0.250885],
        [1.47705,3.35498,-2.59489]
     ] // positions of that house
  ],
  // ...
  [
     _obj7, // reference to some house/ingame-object
     true, // some flag for something...
     [
        [5.30103,1.227148,3.14492],
        [0.27301,7.55498,3.21489]
     ] // positions of that house
  ]
];

// and so on...

Then, we you put all your stuff into a list - instead of giving each friggin list item it's own varibale, global or not - you may do some funny tricks like:

private ["_closest", "_distance", "_dist"];
_closest = [0,0,0];
_distance = (player distance _closest);

{
  _dist = player distance _x;
  if (_dist < _distance) then
  {
      _closest = _x;
     _distance = _dist;
  };
} forEach _list;

// voila, _closest is the closest position to the player,
// out of ALL given positions in that _list.

That's just an example (and there are other ways to do that particular task; for example you could sort the list by that distance and then simply pick the first element - which would be way faster to write, given you already have written your sort function, you're going to use all the time anyway...), which should show you, that you absolutely need to put your friggin stuff into an array - if you're stuff belongs together.

Everything else is just... uhm, ... baroque :D

Share this post


Link to post
Share on other sites

The "{" there is the source of the problem. Try figuring out what causes the error, as according to what you seem to be trying to do it *shouldn't* be there.

And yes, learn to use arrays, your like will become much much easier. It is perfectly fine to have an array of arrays!

Share this post


Link to post
Share on other sites

I don't think I'm going to switch the positions over to arrays. I do agree that it would be easier for some things but I am constantly going back and need the position references found in the variable name to change things around. It is much easier for me to keep track of the positions that way. Although now that I think about it I suppose there will be less editing when I copy and paste the squad placement part for the next house. Hmm, I'll give it some more thought.

Well so the problem was apparently that there was a ' after one of the ; at the end of a line. Odd though that it didn't show up when I pasted it here since I used Ctrl + A to select the entire thing in notepad.

Make sure the side exists before creating a group:

http://community.bistudio.com/wiki/createCenter

There was a unit on the map that was of the same side but thank you. I think I'm going to go ahead and use createcenter within the script so that you don't have to have anyone on the map. Cancel that. I would have to use the setFriend command and I want to leave that up to the mission maker. Putting a single guy on the map isn't that hard to do anyway.

Two questions;

1.) Do you guys use any programs when you script other than notepad?

2.) Do you guys know how to find a random value between two numbers? For example if I wanted a random number between the variables of _minvalue and _maxvalue. I was trying to figure out some mathematical operation for doing it but I haven't found one yet and I wasn't sure if there is a way to do it just using the random command or not.

Edited by Jakerod

Share this post


Link to post
Share on other sites

1) squint

2) _min + (random (_max - _min))

Share this post


Link to post
Share on other sites
1) squint

2) _min + (random (_max - _min))

Thanks! That works.

Share this post


Link to post
Share on other sites

It's really important that you get your head around arrays....you're going to be needing them a lot!

Share this post


Link to post
Share on other sites
It's really important that you get your head around arrays....you're going to be needing them a lot!

Any recommendations on how to learn more about them? I've read that beginner's guide to arrays on the forum several times now. Anything beyond that?

Share this post


Link to post
Share on other sites
Anything beyond that?

Anything beyond actually using them? UNPBO. Read code from guys you think they know what they're doing and learn from that. Reading code is always rewarding - even if it's bad code (though it's a bit dangerous if you don't recognize how bad that code really is, hahaha).

And then you could read about data structures and algorithms in general, since this topic isn't bound to some particular language... There are tons of books about that and there is certainly more than enough free information too; google will tell you where.

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  

×