I. Mission testing
........
JTD_intCam.sqf
JTD_intCamInit.sqf
- these initiate an internal camera from an addaction
- usage - initiate addaction, then mapclick, then it selects the nearest unit for the internal camera
........
JTD_remCam.sqf
JTD_remCamInit.sqf
- these initiate a remote free camera from an addaction
- usage - initiate addaction, then mapclick, then it selects the nearest object to start a free camera
........
JTD_heloCall.sqf
JTD_heloCallInit.sqf
- these spawn a UH-1Y from an addaction
- usage - initiate addaction, then mapclick, then it selects an appropriate area to spawn a UH-1Y
........
JTD_teleport.sqf
- simple script, from an addaction, to teleport to location of mapclick
........
II. Mission functions
........
JTD_fnc_dirNormal.sqf
- normalizes a number to a 0-360 degree reference
........
JTD_fnc_randPos.sqf
- selects a random position from a center point, optionally in a specific direction
........
JTD_fnc_randVector.sqf
- selects random vector within offset from given vector
........
JTD_fnc_randGroup.sqf
- spawns random group from specified faction at specified position from config type
........
I'll post the code to this last one - it is pretty slick, if I do say so myself.
Code: Select all
/*
JTD_fnc_randGroup.sqf
by Trexian
Purpose: spawn a random group from specified config types at specified location.
Implementation: from a call.
ooooooooooooooooooooooooooooooooooooooooooooooooooo
Credit:
Spooner's config posts - http://www.ofpec.com/forum/index.php?topic=31961.0
DM for math
OFPEC
ooooooooooooooooooooooooooooooooooooooooooooooooooo
Information
Elements received:
0 = position (pos array)
1 = faction (Str faction) - default is CIV
2 = type (String or Array of strings)? Maybe just array
Return:
spawned group
ooooooooooooooooooooooooooooooooooooooooooooooooooo
Version history
01a -
proof of concept
ooooooooooooooooooooooooooooooooooooooooooooooooooo
TTD
*/
private ["_pos", "_faction", "_types", "_cfgGroups", "_side", "_cfgPath", "_grpPath", "_i", "_class", "_groupR", "_ret"];
// get initial stuff
_pos = _this select 0;
_faction = _this select 1;
_types = _this select 2;
_cfgGroups = [];
// error checking -- need to make sure types are valid?
if !(_faction in ["USMC", "CDF", "RU", "INS", "GUE", "CIV"]) then
{
_faction = "CIV"; // spawns civ if faction is invalid
};
if (count _types == 0) then
{
_types = ["Infantry"]; // defaults to infantry if nothing specified
};
// set up config path
switch (_faction) do
{
case "USMC":
{
_side = west;
_cfgPath = configFile >> "cfgGroups" >> "West";
};
case "CDF":
{
_side = west;
_cfgPath = configFile >> "cfgGroups" >> "West";
};
case "RU":
{
_side = east;
_cfgPath = configFile >> "cfgGroups" >> "East";
};
case "INS":
{
_side = east;
_cfgPath = configFile >> "cfgGroups" >> "East";
};
case "GUE":
{
_side = resistance;
_cfgPath = configFile >> "cfgGroups" >> "Guerilla";
};
case "CIV":
{
_side = civilian;
_cfgPath = configFile >> "cfgGroups" >> "Civilian";
};
default
{
_side = civilian;
_cfgPath = configFile >> "cfgGroups" >> "Civilian";
};
};
// Compile pool of the types
{
//Find all groups defined for various subtypes.
_grpPath = _cfgPath >> _faction >> _x;
//diag_log text format ["path = %1", _grpPath];
for "_i" from 0 to ((count _grpPath) - 1) do
{
_class = _grpPath select _i;
//Only take actual classes.
if (isClass (_class)) then
{
_cfgGroups = _cfgGroups + [_class];
};
};
} forEach _types;
//diag_log text format ["count types = %1", count _cfgGroups];
_groupR = _cfgGroups call BIS_fnc_selectRandom;
_ret = [_pos, _side, _groupR, [], [], [], []] call BIS_fnc_spawnGroup;
// return the groupInfo, which should represent the names of the various groups
_ret
_groupR = [_pos, "INS", ["Infantry", "Motorized", "Mechanized"]] call JTD_fnc_rGrp;
It will spawn a random group of Insurgent infantry, motorized, or mechanized groups.
