Script Snippets
From ALiVE Wiki
Spawn Group Script By Jman
/* * Filename: * fnc_spawnProfileGroup.sqf * * Locality: * Runs on server * * Description: * Spawns a group faction and sends them to a waypoint. * * Params: * _spawnPosition -> Array. Position to spawn group * _spawnExactLocation -> Boolean. Set to false if you want to spawn it in an exact position. * _destinationPosition -> Array. Position of waypoint destination. * _group -> String. CfgGroups name * _faction -> String. CfgGroups faction * _debug -> Boolean. Enable debug output * * Usage: * * init.sqf: * ALIVE_spawnProfileGroup = compile (preprocessFileLineNumbers "fnc_spawnProfileGroup.sqf"); * * Create a trigger or call in script: * * Syntax: * [array, boolean, array, string, string, boolean] call ALIVE_spawnProfileGroup; * * Example: * [getMarkerPos "nmeGrp01_spawn_pos", false, getMarkerPos "nmeGrp01_dest_pos", "10_men_ME", "caf_ag_me", true] call ALIVE_spawnProfileGroup; * * Credits: ALiVE functions: The ALiVE team. Web: http://www.alivemod.com * Script Created by [KH]Jman * Creation date: 06/02/2014 * Email: [email protected] * Web: http://www.kellys-heroes.eu * * * */ // ==================================================================================== if (!isServer) exitWith {}; // ==================================================================================== private["_spawnposition","_spawnExactLocation","_destinationPosition","_faction","_profile","_profiles","_profileWaypoint","_group","_debug"]; waitUntil {!isNil "ALIVE_profileSystemInit"}; _spawnPosition = _this select 0; _spawnExactLocation = _this select 1; _destinationPosition = _this select 2; _group = _this select 3; _faction = _this select 4; _debug = _this select 5; // DEBUG ------------------------------------------------------------------------------------- if(_debug) then { ["ALIVE_spawnProfileGroup-> _spawnPosition: %1 _spawnExactLocation: %2 _destinationPosition: %3 _group: %4 _faction: %5",_spawnPosition,_spawnExactLocation,_destinationPosition,_group,_faction] call ALIVE_fnc_dump; }; // DEBUG ------------------------------------------------------------------------------------- _profiles = [_group, _spawnposition, random(360), _spawnExactLocation, _faction] call ALIVE_fnc_createProfilesFromGroupConfig; _profile = _profiles select 0; _profileWaypoint = [_destinationPosition, 0] call ALIVE_fnc_createProfileWaypoint; [_profile, "addWaypoint", _profileWaypoint] call ALIVE_fnc_profileEntity; // ====================================================================================