Forum Jump :

Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 61
In-game name: Kobayashi Maru

 
#184895 Posted at 2015-12-31 08:38        
     
Or... if you don't want to depend on addons but script yourself, you should learn how to spawn groups.
You can imagine how to randomize your groups, their skills, their numbers, something like:
_my_prefered_units = [all class units you want here but belonging to your configfile/cfgVehicles (depending on your addons) "B_Soldier_AT","B_Medic_F"...]; I don't know the classes of Arma2 but that's the principle.
Randomize a position also, depending on triggers, markers, or locations. The easiest way is to place triggers or markers on map editor, name them, make a list (array) and randomize as well (of course you can have different lists for different sides).

Randomization:
- With an array, say of n elements (0 to n-1), the best way to pick one at random:
_my_randomized_element = _my_array select floor random n;
NB: At this time selectRandom is in dev branch.
- for a value from 0 to 1 with lower & upper limits (0.1 to 0.5 here) : {_x setskill ((floor random 6)/10) max 0.1} forEach units _first_group;

For example:
_my_prefered_units = [n classes of units like "rhsusf_usmc_marpat_d_rifleman" (RHS addon)];
_my_positions = [N positions of markers on your map like "marker1"...];

Say you want a group of 4 to 10 units:
_first_group = [];
For "_i" from 4 to (4 + floor random 7) do {
_first_group pushback _my_prefered_units select _i;
};
_the_group_position = _my_positions select floor random N;
NB: If your want a mandatory officer or else: initialize the variable as: _first_group = ["B_officer_F"]; then dim down the randomization (for "_i" from 3 to (3 + floor random 7)...

then your spawning group should look like:
[_the_group_position, east (or other sides), _first_group, [], [], [], [], [], 0] call BIS_fnc_spawnGroup ;
NB: side is important and overwhelm the type of unit (you can have a red group with blufor or resistance units!)

So, as you can see, this is a first step for custom randomized mission.
Next step is to place tasks, like in this example:
_tsk1 = ["task1", [west,resistance], ["You must clear this area first","Establish your FOB",""],_the_group_position, "ASSIGNED", 1, true, true,"",true] call BIS_fnc_setTask;
waitUntil {sleep 0.5; ([_tsk1] call BIS_fnc_taskState) == "Succeeded"};
// your code here!

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS