 sreV                prefix z\fpz\addons\api  CfgEventHandlers.hpp                   config.bin     ¦          ¦  Fog.fsm     ’!          ’!  functions\default_settings.sqf     P          P  functions\fnc_attachAresFunctions.sqf     �
          �
  functions\fnc_attachZenFunctions.sqf     
          
  functions\fnc_fog.sqf     C           C   functions\fnc_init.sqf                 functions\fnc_registerZone.sqf     ˆ          ˆ  functions\fnc_spawnHorde.sqf     4          4  functions\script_component.hpp     3           3   script_component.hpp                 XEH_preInit.sqf     _           _   XEH_PREP.hpp     x           x   XEH_preStart.sqf     <           <                        class Extended_PreStart_EventHandlers {
    class ADDON {
        init = QUOTE(call COMPILE_FILE(XEH_preStart));
    };
};

class Extended_PreInit_EventHandlers {
    class ADDON {
        init = QUOTE(call COMPILE_FILE(XEH_preInit));
    };
};
 raP       ¢    CfgPatches k    Extended_PreStart_EventHandlers Û    Extended_PreInit_EventHandlers ?    fpz_api z    units  weapons  requiredVersion ÍÌÌ=requiredAddons  fpz_main author  Cuel  authorUrl    fpz_api ê     init call compile preprocessFileLineNumbers '\z\fpz\addons\api\XEH_preStart.sqf'   fpz_api N    init call compile preprocessFileLineNumbers '\z\fpz\addons\api\XEH_preInit.sqf'     /*
Fog script v1.62
Made by Rockhount[BAfH] (visit us on http://www.bafh.eu/ )

Install:
Open the editor, create a new unit/object and put the example into the init of the unit, after that save the mission.
Then open the folder .../Dokuments/ArmA 2 Other Profiles/Nickname/missions/misisonsname and copy the script into the folder.

example: null=[l1,100,11,10,3,7,-0.3,0.1,0.5,1,1,1,13,12,15,true,2,2.1,0.1,4,6,0,3.5,17.5] execFSM "Fog.fsm";
l1 = name of unit (use "" for markers and when you on a  multiplayer session only want to set the fog around the player: run the script once! with 'Player' (not 'this' and not 'name of the unit/object'!!!), example: null=[Player,200,10,... )
If the unit/building was destroyed/died or the marker was deleted, the script will exit automatically!
100 = Maximumdistance
11 = Minimumdistance
10 = Count of clouds
3 = Minimumsize of clouds
7 = Maximumsize of clouds
-0.3 = Height of clouds (must be a bit below the ground to look realistic)
0.1 = Respawntime of clouds
0.5 = Transparency
1,1,1 = Color of clouds
13 = Remove-speed of clouds
12 = Minimumlifetime of clouds
15 = Maximumlifetime of clouds
true = The fog will be effected by wind (for no wind effect: false)
2 = Windstrength (acts only when the wind effect is 'true')
2.1 = Random-direction-period(in seconds) (acts only when the wind effect is 'true')
0.1 = Random-direction-intensity (acts only when the wind effect is 'true')
4,6,0 = Move-direction-speed (x,y,z) - same effect as wind, but constant and adjustable(acts only when the wind effect is 'false')
3.5 = Stardaytime (the fog will spawn when the ingametime is 03:30)
17.5 = Enddaytime (the fog will spawn when the ingametime is 17:30)
RandomDirectionPeriod 2.1 with RandomDirectionIntensity 0.1 means that 0.1 will be added to the direction-speed (x,y,z-randomized) of a moving-cloud every 2.1 seconds.

An example for norrins revive-script:
revive_init.sqf:
NORRNCustomExec1 ="null=[Player,100,11,10,3,7,-0.3,0.1,0.5,1,1,1,13,12,15,true,1,2.1,0.1,4,6,0,0,24] execFSM ""Fog.fsm"";"; // Exec1 occurs following being revived
NORRNCustomExec3 ="null=[Player,100,11,10,3,7,-0.3,0.1,0.5,1,1,1,13,12,15,true,1,2.1,0.1,4,6,0,0,24] execFSM ""Fog.fsm"";"; // Exec3 occurs when you spawn at base
*/
class FSM
{
  fsmName = "Fog";
  class States
  {
    class Start
    {
      name = "Start";
      init = "private [""_Center"",""_xdistanz"",""_mdistanz"",""_dichte"",""_msize"",""_xsize"",""_height"",""_zeit"",""_transparency"",""_col1"",""_col2"",""_col3"",""_mlifetime"",""_xlifetime"",""_spawn"",""_wind"",""_windstrength"",""_forward2"",""_right2"",""_up"",""_dirPeroid"",""_dirIntensity"",""_mtime"",""_xtime""];" \n
       "_Center = _this select 0;" \n
       "_xdistanz = if (count _this > 1) then {_this select 1} else {80};" \n
       "_mdistanz = if (count _this > 2) then {_this select 2} else {10};" \n
       "_dichte = if (count _this > 3) then {_this select 3} else {10};" \n
       "_msize = if (count _this > 4) then {_this select 4} else {3};" \n
       "_xsize = if (count _this > 5) then {_this select 5} else {7};" \n
       "_height = if (count _this > 6) then {_this select 6} else {-0.3};" \n
       "_zeit = if (count _this > 7) then {_this select 7} else {0.1};" \n
       "_transparency = if (count _this > 8) then {_this select 8} else {0.5};" \n
       "_col1 = if (count _this > 9) then {_this select 9} else {1};" \n
       "_col2 = if (count _this > 10) then {_this select 10} else {1};" \n
       "_col3 = if (count _this > 11) then {_this select 11} else {1};" \n
       "_spawn = if (count _this > 12) then {_this select 12} else {15 + (random 1)};" \n
       "_mlifetime = if (count _this > 13) then {_this select 13} else {8 + (random 1)};" \n
       "_xlifetime = if (count _this > 14) then {_this select 14} else {15 + (random 1)};" \n
       "_wind = if (count _this > 15) then {_this select 15} else {true};" \n
       "_windstrength = if ((count _this > 16) && _wind) then {_this select 16} else {1};" \n
       "_dirPeroid =  if ((count _this > 17) && _wind) then {_this select 17} else {0};" \n
       "_dirIntensity =  if ((count _this > 18) && _wind) then {_this select 18} else {0};" \n
       "_forward2 = if ((count _this > 19) && (!(_wind))) then {_this select 19} else {0};" \n
       "_right2 = if ((count _this > 20) && (!(_wind))) then {_this select 20} else {0};" \n
       "_up = if ((count _this > 21) && (!(_wind))) then {_this select 21} else {0};" \n
       "_mtime =  if (count _this > 22) then {_this select 22} else {0};" \n
       "_xtime =  if (count _this > 23) then {_this select 23} else {24};";
      precondition = "";
      class Links
      {
        class isDedicated
        {
          priority = 0.000000;
          to="End";
          precondition = "";
          condition="isDedicated";
          action="";
        };
        class not_isDedicated
        {
          priority = 0.000000;
          to="Fog";
          precondition = "";
          condition="!(isDedicated)";
          action="";
        };
      };
    };
    class Fog
    {
      name = "Fog";
      init = "private [""_time"",""_zeit"",""_x"",""_height"",""_radius"",""_size"",""_msize"",""_xsize"",""_randomdir"",""_CC"",""_Center"",""_xdistanz"",""_mdistanz"",""_dichte"",""_transparency"",""_col1"",""_col2"",""_col3"",""_Pos"",""_lifetime"",""_mlifetime"",""_xlifetime"",""_spawn"",""_wind"",""_windstrength"",""_right"",""_forward"",""_up"",""_forward2"",""_right2"",""_dirPeroid"",""_dirIntensity"",""_mtime"",""_xtime""];" \n
       "_time = time + _zeit;" \n
       "if (typename _Center == typename """") then {_Pos = getMarkerpos _Center} else {_Pos = getPos _Center};" \n
       "if (_wind) then {_right = (wind select 0) * _windstrength;_forward = (wind select 1) * _windstrength} else {_right = _right2;_forward = _forward2};" \n
       "if ((daytime > _mtime) && (daytime < _xtime)) then {" \n
       "for [{_x=1},{_x<=_dichte},{_x=_x+1}] do {" \n
       "_radius= _mdistanz + random (_xdistanz - _mdistanz);" \n
       "_CC = [_col1,_col2,_col3,.3*_transparency];" \n
       "_size = _msize + random (_xsize - _msize);" \n
       "_randomdir = random 360;" \n
       "_lifetime = _mlifetime + random (_xlifetime - _mlifetime);" \n
       "drop [""\A3\data_f\cl_basic"","""",""Billboard"",_spawn,_lifetime,[(_Pos select 0)+_radius*sin _randomdir,(_Pos select 1)+_radius*cos _randomdir,_height],[_right,_forward,_up],5,0.2,0.1568,0,[_size],[[_col1,_col2,_col3,0],_CC,_CC,_CC,_CC,_CC,_CC,[_col1,_col2,_col3,0]],[0],_dirPeroid,_dirIntensity,"""", """",""""];" \n
       "};" \n
       "} else { " \n
       "_time = time + 5;" \n
       "};";
      precondition = "";
      class Links
      {
        class if_object
        {
          priority = 0.000000;
          to="dummy";
          precondition = "";
          condition="!(typename _Center == typename """")";
          action="";
        };
        class if_marker
        {
          priority = 0.000000;
          to="dummy_1";
          precondition = "";
          condition="typename _Center == typename """"";
          action="";
        };
      };
    };
    class End
    {
      name = "End";
      init = "";
      precondition = "";
      class Links
      {
      };
    };
    class dummy
    {
      name = "dummy";
      init = "";
      precondition = "";
      class Links
      {
        class wait
        {
          priority = 0.000000;
          to="Fog";
          precondition = "";
          condition="time > _time";
          action="";
        };
        class if_object_or_unit
        {
          priority = 0.000000;
          to="End";
          precondition = "";
          condition="!(alive _Center)";
          action="";
        };
      };
    };
    class dummy_1
    {
      name = "dummy_1";
      init = "";
      precondition = "";
      class Links
      {
        class wait
        {
          priority = 0.000000;
          to="Fog";
          precondition = "";
          condition="time > _time";
          action="";
        };
        class if_marker_not_ex
        {
          priority = 0.000000;
          to="End";
          precondition = "";
          condition="((getMarkerPos _Center select 0) == 0) && ((getMarkerPos _Center select 1) == 0)";
          action="";
        };
      };
    };
  };
  initState="Start";
  finalStates[] =
  {
    "End",
  };
};
#define SETTING(X,DEF) missionNamespace setVariable [QUOTE(X), missionNamespace getVariable [QUOTE(X), DEF]]

SETTING(fpz_maxAliveZombies,120);
SETTING(fpz_spawnDistanceMin,150);
SETTING(fpz_spawnDistanceMax,300);
SETTING(fpz_despawnDistance,400);
SETTING(fpz_maxChaseDistance,250);

SETTING(fpz_defaultDensity,40);
SETTING(fpz_aggroRangeInterval,[ARR_2(30,70)]);

SETTING(fpz_vehicleAggroMultiplier,2);
SETTING(fpz_zombieDamageMultiplier,1);
SETTING(fpz_showLootSparkle,true);
SETTING(fpz_rvgSounds,true);

if (isNil "fpz_zombieTypes") then {
  fpz_zombieTypes = [
    "zombie_walker", 0.5,
    "zombie_bolter", 0.25,
    "zombie_runner", 0.25
  ];
};

if (isNil "fpz_onZombieInit") then {
  fpz_onZombieInit = {
    params ["_zombie", "_pos"];

    _zombie forceAddUniform selectRandom [
      "U_I_G_Story_Protagonist_F",
      "U_C_Poor_1",
      "U_C_Poor_2",
      "U_C_WorkerCoveralls",
      "U_Rangemaster",
      "U_OrestesBody",
      "U_C_HunterBody_grn",
      "U_BG_leader",
      "U_BG_Guerilla3_1",
      "U_BG_Guerilla2_3",
      "U_BG_Guerilla2_1",
      "U_BG_Guerilla2_2",
      "U_BG_Guerilla1_1",
      "U_C_Poloshirt_salmon",
      "U_C_Poloshirt_blue",
      "U_BG_Guerrilla_6_1",

      // apex
      "U_I_C_Soldier_Bandit_4_F",
      "U_I_C_Soldier_Bandit_1_F",
      "U_I_C_Soldier_Bandit_2_F",
      "U_I_C_Soldier_Bandit_5_F",
      "U_I_C_Soldier_Bandit_3_F",
      "U_I_C_Soldier_Para_5_F",
      "U_I_C_Soldier_Para_4_F",
      "U_I_C_Soldier_Para_1_F",
      "U_C_Man_casual_4_F",
      "U_C_Man_casual_5_F"
    ];
  };
};
#include "script_component.hpp"


if (!hasInterface || {RETDEF(GVAR(ares),false)} || {isNil "Ares_fnc_RegisterCustomModule"}) exitWith {false};
GVAR(ares) = true;
private _cat = "FP Zombies";

[_cat, "Create zone", {
  params ["_pos"];

  private _opt1 = [-1, 10, 20, 30, fpz_defaultDensity];
  private _opt2 = [20, 50, 100, 200, 300, 500];
  private _opt3 = [-1, 5, 10, 20, 30, 50];

  private _args = ["Create zone settings", [
      ["Density", ["Infinite (respawning)"] + (_opt1 select [1, count _opt1] apply {str _x + " zombies"}), count _opt1, true],
      ["Size of zone", _opt2 apply {str _x + "m"}, 2, true],
      ["Max active zombies in zone", ["None (distance based)"] + (_opt3 select [1, count _opt3] apply {str _x}), 0, true]
  ]] call Ares_fnc_ShowChooseDialog;
  if (count _args == 0) exitWith {};

  _args params ["_c1", "_c2", "_c3"];
  private _density = _opt1 select _c1;
  private _radius = _opt2 select _c2;
  private _maxActive = _opt3 select _c3;

  ([_pos, "AREA:", [_radius, _radius, 0, true]] call CBA_fnc_createTrigger) params ["_trigger"];
  [_trigger, _density, -1, -1, _maxActive] remoteExecCall [QFUNC(registerZone), 2];
}] call Ares_fnc_RegisterCustomModule;

[_cat, "Spawn wandering", {
  params ["_pos"];

  private _opt1 = [1, 5, 10, 15, 20];
  private _opt2 = [5, 10, 20, 50, 100, 200];

  private _args = ["Spawn wandering zombies", [
      ["Amount", _opt1 apply {str _x + " zombies"}, 1, true],
      ["Random radius", _opt2 apply {str _x + "m"}, 0, true]
  ]] call Ares_fnc_ShowChooseDialog;
  if (count _args == 0) exitWith {};

  _args params ["_c1", "_c2"];
  private _amount = _opt1 select _c1;
  private _radius = _opt2 select _c2;

  for "_i" from 1 to _amount do {
    private _z = [] call EFUNC(zombies,spawnZombie);
    if (!isNull _z) then {
      private _rpos = [_pos, _radius] call CBA_fnc_randPos;
      [_z, _rpos] call EFUNC(zombies,zombieInit);
    };
  };
}] call Ares_fnc_RegisterCustomModule;

[_cat, "Spawn horde", {
  params ["_pos"];

  private _opt1 = [5, 10, 15, 20];
  private _args = ["Spawn zombie horde", [
      ["Amount", _opt1 apply {str _x + " zombies"}, 0, true],
      ["Spawn yell", ["No", "Yes"], 0, true],
      ["Force spawn (ignore max zed)", ["No", "Yes"], 0, true]
  ]] call Ares_fnc_ShowChooseDialog;
  if (count _args == 0) exitWith {};

  _args params ["_c1", "_c2", "_c3"];
  private _amount = _opt1 select _c1;
  private _sound = [false, true] select _c2;
  private _ignoreMaxZombies = [false, true] select _c3;

  [_pos, _amount, _sound, _ignoreMaxZombies] call FUNC(spawnHorde);
}] call Ares_fnc_RegisterCustomModule;

true
#include "script_component.hpp"


if (!hasInterface || {RETDEF(GVAR(zen),false)} || {isNil "zen_custom_modules_fnc_register"}) exitWith {false};
GVAR(zen) = true;
private _cat = "FP Zombies";

[_cat, "Create zone", {
  params ["_pos"];

  private _opt1 = [-1, 10, 20, 30, fpz_defaultDensity];
  private _opt2 = [20, 50, 100, 200, 300, 500];
  private _opt3 = [-1, 5, 10, 20, 30, 50];

  ["Create zone settings", [
      ["COMBO", "Density", [_opt1, ["Infinite (respawning)"] + (_opt1 select [1, count _opt1] apply {str _x + " zombies"})]],
      ["COMBO", "Size of zone", [_opt2, _opt2 apply {str _x + "m"}, 2]],
      ["COMBO", "Max active zombies in zone", [_opt3, ["None (distance based)"] + (_opt3 select [1, count _opt3] apply {str _x})]]
    ], {
      params ["_dialog", "_args"];
      _dialog params ["_density", "_radius", "_maxActive"];
      _args params ["_pos"];

      ([_pos, "AREA:", [_radius, _radius, 0, true]] call CBA_fnc_createTrigger) params ["_trigger"];
      [_trigger, _density, -1, -1, _maxActive] remoteExecCall [QFUNC(registerZone), 2];
  }, {}, [_pos]] call zen_dialog_fnc_create;
}] call zen_custom_modules_fnc_register;

[_cat, "Spawn wandering", {
  params ["_pos"];

  private _opt1 = [1, 5, 10, 15, 20];
  private _opt2 = [5, 10, 20, 50, 100, 200];

  ["Spawn wandering zombies", [
      ["COMBO", "Amount", [_opt1, _opt1 apply {str _x + " zombies"}, 1]],
      ["COMBO", "Random radius", [_opt2, _opt2 apply {str _x + "m"}, 0]]
    ], {
      params ["_dialog", "_args"];
      _dialog params ["_amount", "_radius"];
      _args params ["_pos"];
      for "_i" from 1 to _amount do {
        private _z = [] call EFUNC(zombies,spawnZombie);
        if (!isNull _z) then {
          private _rpos = [_pos, _radius] call CBA_fnc_randPos;
          [_z, _rpos] call EFUNC(zombies,zombieInit);
        };
      };
  }, {}, [_pos]] call zen_dialog_fnc_create;
}] call zen_custom_modules_fnc_register;

[_cat, "Spawn horde", {
  params ["_pos"];

  private _opt1 = [5, 10, 15, 20];
  ["Spawn zombie horde", [
      ["COMBO", "Amount", [_opt1, _opt1 apply {str _x + " zombies"}, 0]],
      ["CHECKBOX", "Spawn yell"],
      ["CHECKBOX", "Force spawn (ignore max zed)"]
    ], {
      params ["_dialog", "_args"];
      _dialog params ["_amount", "_sound", "_ignoreMaxZombies"];
      _args params ["_pos"];

      [_pos, _amount, _sound, _ignoreMaxZombies] call FUNC(spawnHorde);
  }, {}, [_pos]] call zen_dialog_fnc_create;
}] call zen_custom_modules_fnc_register;

true
#include "script_component.hpp"
_this execFSM QPATHTOF(Fog.fsm);
#include "script_component.hpp"

if (RETDEF(GVAR(initialized),false)) exitWith {false};
GVAR(initialized) = true;

#include "default_settings.sqf"

[] call FUNC(attachAresFunctions);
[] call FUNC(attachZenFunctions);

[EFUNC(zombies,zombiePfh), 0] call CBA_fnc_addPerFrameHandler;
[{
  EGVAR(zombies,targets) = allUnits select {_x call EFUNC(zombies,isValidVictim)};
}, 1] call CBA_fnc_addPerFrameHandler;

if (hasInterface) then {
  if (fpz_showLootSparkle) then {
    [EFUNC(zombies,lootSparklePfh), 0.5] call CBA_fnc_addPerFrameHandler;
  };
  ["ace_firedPlayer", {_this call EFUNC(zombies,fired)}] call CBA_fnc_addEventHandler;
  ["ace_firedPlayerVehicle", {_this call EFUNC(zombies,firedVehicle)}] call CBA_fnc_addEventHandler;
};

["ace_firedPlayerNonLocal", {_this call EFUNC(zombies,fired)}] call CBA_fnc_addEventHandler;
["ace_firedNonPlayer", {_this call EFUNC(zombies,fired)}] call CBA_fnc_addEventHandler;
["ace_firedPlayerVehicleNonLocal", {_this call EFUNC(zombies,firedVehicle)}] call CBA_fnc_addEventHandler;
["ace_firedNonPlayerVehicle", {_this call EFUNC(zombies,firedVehicle)}] call CBA_fnc_addEventHandler;

// TODO: HC support
if (isServer) then {
    [{
      EGVAR(zones,players) = allPlayers select {
        alive _x &&
        {!(_x isKindOf "VirtualMan_F")} &&
        {!(_x getVariable [QEGVAR(zombies,ignore), false])} &&
        {simulationEnabled _x}
      };
    }, 2] call CBA_fnc_addPerFrameHandler;

    [EFUNC(zones,zonePfh), 0.03] call CBA_fnc_addPerFrameHandler;
};

true


#include "script_component.hpp"
params [
  ["_zone", objNull, [objNull]],
  ["_amount", fpz_defaultDensity, [0]],
  ["_activateDistance", -1, [0]],
  ["_radius", -1, [0]],
  ["_maxActiveInZone", -1, [0]]
];

if (_zone in EGVAR(zones,zones)) exitWith {};

if (_amount isEqualTo -1) then {
  _amount = fpz_defaultDensity;
  _zone setVariable [QEGVAR(zones,infinite), true];
};

if (_radius isEqualTo -1) then {
  private _tr = triggerArea _zone;
  _radius = (_tr select 0) max (_tr select 1);
};

if (_activateDistance isEqualTo -1) then {
  _activateDistance = sqrt(_radius ^ 2 * 2);
};
_activateDistance = _activateDistance max fpz_spawnDistanceMax;

_zone setVariable [QEGVAR(zones,amount), abs round _amount];
_zone setVariable [QEGVAR(zones,radius), abs round _radius];
_zone setVariable [QEGVAR(zones,activateDistance), abs round _activateDistance];
_zone setVariable [QEGVAR(zones,zombies), []];
_zone setVariable [QEGVAR(zones,maxActiveInZone), _maxActiveInZone];

TRACE_4("Registering zone",_zone, abs round _amount, abs round _radius, abs round _activateDistance, _maxActiveInZone);
EGVAR(zones,zones) pushBack _zone;
#include "script_component.hpp"

params [
  ["_pos", []],
  ["_amount", 6, [0]],
  ["_sound", true],
  ["_ignoreMaxZombies", false]
];

private _zombies = [];
for "_i" from 1 to _amount do {
  private _rnd = if (_pos isEqualType objNull && {_pos isKindOf "EmptyDetector"}) then {
    [_pos] call CBA_fnc_randPosArea;
  } else {
    (_pos call CBA_fnc_getPos) getPos [random 10, random 360];
  };

  private _zombie = [selectRandom ["zombie_bolter", "zombie_runner"], _ignoreMaxZombies] call EFUNC(zombies,spawnZombie);
  if (!isNull _zombie) then {
    _zombies pushBack _zombie;
    [_zombie, _rnd, true] call EFUNC(zombies,zombieInit);
    if (_sound && {_i >= _amount} && {!isNull _zombie}) then {
      [_zombie, ["fpz_yell", 1200, 1]] remoteExecCall ["say", 0];
    };
  };
};

_zombies
#include "\z\fpz\addons\api\script_component.hpp"
#define COMPONENT api
#include "\z\fpz\addons\main\script_mod.hpp"

// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS

#include "\z\fpz\addons\main\script_macros.hpp"
#include "script_component.hpp"

ADDON = false;

#include "XEH_PREP.hpp"

ADDON = true;
PREP(attachAresFunctions);
PREP(attachZenFunctions);
PREP(fog);
PREP(init);
PREP(registerZone);
PREP(spawnHorde);
#include "script_component.hpp"

#include "XEH_PREP.hpp"
 _uÌþÏa�¼NÀ"\H*jŸ