Advertisement
secondcoming

CreateTriggers.sqf

Sep 23rd, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 3.83 KB | None | 0 0
  1. // ExileZ 2.0 by Patrix87 of http:\\multi-jeux.quebec //
  2.  
  3. //Variable declaration
  4. private ["_tempTriggerPosition","_triggerPosition","_trigger","_nearestLocation","_groupSize","_triggerRadius","_activationDelay","_spawnDelay","_respawnDelay","_showTriggerOnMap","_zMarkerColor","_zMarkerAlpha","_vestGroup","_lootGroup","_zombiegroup","_lootBox","_avoidTerritory","_zMarkerText","_mission","_marker","_marker2","_zMarkerBrush","_missionLRadius"];
  5.  
  6.  
  7. //Current spawner position
  8.  
  9. _triggerPosition        = _this select 0;
  10. _triggerRadius          = _triggerPosition select 2;
  11. _triggerPosition        = [_triggerPosition select 0,_triggerPosition select 1];
  12. _groupSize              = (_this select 1) Select 2;
  13. _activationDelay        = (_this select 1) Select 3;
  14. _spawnDelay             = (_this select 1) Select 4;
  15. _respawnDelay           = (_this select 1) Select 5;
  16. _showTriggerOnMap       = (_this select 1) Select 6;
  17. _zMarkerColor           = (_this select 1) Select 7;
  18. _zMarkerBrush           = (_this select 1) Select 8;
  19. _zMarkerAlpha           = (_this select 1) Select 9;
  20. _zMarkerText            = (_this select 1) Select 10;
  21. _vestGroup              = (_this select 1) Select 11;
  22. _lootGroup              = (_this select 1) Select 12;
  23. _zombieGroup            = (_this select 1) Select 13;
  24. _avoidTerritory         = (_this select 1) Select 14;
  25. _missionLRadius         = (_this select 1) Select 15;
  26. _mission                = (_this select 1) Select 16;
  27. _lootBox                = (_this select 1) Select 17;
  28.  
  29. _nearestLocation        = text nearestLocation [_triggerPosition, ""];
  30.  
  31. _validLocation = false;
  32. if (_missionLRadius > 0) then {
  33.     while {!_validLocation} do
  34.     {
  35.         _tempTriggerPosition = [_triggerPosition,0,_missionLRadius] call GetRandomLocation;
  36.         _validLocation = [_tempTriggerPosition,_avoidTerritory,true] call VerifyLocation;
  37.         sleep 0.05;
  38.     };
  39.     _triggerPosition = _tempTriggerPosition;
  40. };
  41.  
  42. //Create trigger area
  43. _trigger = createTrigger["EmptyDetector", _triggerPosition];
  44. _trigger setTriggerArea[_triggerRadius, _triggerRadius, 0, true];   //this is a sphere
  45. _trigger setTriggerTimeout [_activationDelay, _activationDelay, _activationDelay, false];
  46. _trigger setTriggerActivation["ANY", "PRESENT", TRUE];    //Only Exile player can trigger
  47. _trigger setTriggerStatements["this && {isplayer vehicle x}count thislist > 0 || this && {side x == EAST }count thislist > 0 || this && {side x == CIVILIAN }count thislist > 0", "nul = [thisTrigger] spawn TriggerLoop;", ""];
  48.  
  49.  
  50. if (_showTriggerOnMap) then {
  51.     //circle
  52.     _marker = createmarker [format["Zombies-pos-%1,%2",(_triggerPosition select 0),(_triggerPosition select 1)], _triggerPosition];
  53.     _marker setMarkerShape "ELLIPSE";
  54.     _marker setMarkerSize [_triggerRadius, _triggerRadius];
  55.     _marker setMarkerAlpha _zMarkerAlpha;
  56.     _marker setMarkerColor _zMarkerColor;
  57.     _marker setMarkerBrush _zMarkerBrush;
  58.     //dot and text
  59.     if !(_zMarkerText == "") then
  60.     {
  61.         _marker2 = createmarker [format["Zombies-pos-%1,%2-2",(_triggerPosition select 0),(_triggerPosition select 1)], _triggerPosition];
  62.         _marker2 setMarkerShape "ICON";
  63.         _marker2 setMarkerType "mil_dot";
  64.         _marker2 setMarkerText _zMarkerText;
  65.     };
  66. };
  67.  
  68.  
  69. if (Debug) then {
  70.     diag_log format["ExileZ 2.0: Creating Trigger   |   Position : %1   |   Radius : %2m    |   Near : %3 ",_triggerPosition,_triggerRadius,_nearestLocation];
  71. };
  72.  
  73. // Store Variables in the trigger.
  74.  
  75. _trigger setvariable ["groupSize", _groupSize, False];
  76. _trigger setvariable ["avoidTerritory",_avoidTerritory, False];
  77.  
  78. _trigger setvariable ["vestGroup",_vestGroup, False];
  79. _trigger setvariable ["lootGroup",_lootGroup, False];
  80. _trigger setvariable ["zombieGroup",_zombieGroup, False];
  81.  
  82. _trigger setvariable ["spawnDelay",_spawnDelay, False];
  83. _trigger setvariable ["respawnDelay",_respawnDelay, False];
  84.  
  85.  
  86. // Spawn Mission sqf
  87. if !(isnil "_mission") then {
  88.     nul = [] spawn _mission;
  89. };
  90.  
  91. // Spawn loot box
  92. if !(isnil "_lootBox") then {
  93.     nul = [_triggerPosition] spawn _lootBox;
  94. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement