SHARE
TWEET

createRandomSoldier

KRDucky Mar 14th, 2017 (edited) 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ******************************************************************************************
  2. // * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com *
  3. // ******************************************************************************************
  4. //  @file Name: createRandomSoldier.sqf
  5. /*
  6.  * Creates a random civilian soldier.
  7.  *
  8.  * Arguments: [ position, group, init, skill, rank]: Array
  9.  *    position: Position - Location unit is created at.
  10.  *    group: Group - Existing group new unit will join.
  11.  *    init: String - (optional, default "") Command to be executed upon creation of unit. Parameter this is set to the created unit and passed to the code.
  12.  *    skill: Number - (optional, default 0.5)
  13.  *    rank: String - (optional, default "PRIVATE")
  14.  */
  15.  
  16. if (!isServer) exitWith {};
  17.  
  18. private ["_group", "_position", "_rank", "_soldier"];
  19.  
  20.  
  21. _group = _this select 0;
  22. _position = _this select 1;
  23. _rank = param [2, "", [""]];
  24.  
  25. _soldier = _group createUnit [_soldier call randomSoldierLoadOut, _position, [], 0, "NONE"];
  26.  
  27. if (_rank != "") then
  28. {
  29.     _soldier setRank _rank;
  30. };
  31.  
  32. _soldier spawn refillPrimaryAmmo;
  33. _soldier spawn addMilCap;
  34. _soldier call setMissionSkill;
  35.  
  36. _soldier addEventHandler ["Killed", server_playerDied];
  37.  
  38. _soldier
RAW Paste Data
Top