Jump to content

Recommended Posts

Radiation_Zone.sqf

Spoiler

//Spawns over Kavala in Altis. To move it just change the grid numbers to wear you want  [3753.826, 12999.547,0].

 

_Rad_Zone_1 = createTrigger ["EmptyDetector", [3753.826, 12999.547,0]];
_Rad_Zone_1 setTriggerArea [1100, 1100, 0, false];  // this is the area the radiation will be
_Rad_Zone_1 setTriggerActivation ["ANY", "PRESENT", true];

_Rad_Zone_1 setTriggerStatements

    [
      "this",
      "
      {
                 [_x,thisTrigger] spawn
                {
                  _unit = _this select 0;
                  _trg  = _this select 1;             

  

                  private ['_timer','_dmg','_GasMask'];

                  _GasMask = ['Mask_M40_OD','Mask_M40','Mask_M50'];

 

                  while {alive _unit && local _unit} do
                  {
                      waitUntil {sleep 0.5; _unit inArea _trg && !(goggles _unit in _GasMask)};

                       if (isPlayer _unit) then
                         {
                             hint parseText format['<t size=""1.10"" font=""PuristaMedium"" color=""#F0133C"">Radiation hazard! Check your equipment</t>'];
                              _unit setVariable ['radiat', ppEffectCreate ['ChromAberration', 200]];
                              (_unit getVariable 'radiat') ppEffectEnable true;
                              (_unit getVariable 'radiat') ppEffectAdjust [0.03, 0.03, true];
                              (_unit getVariable 'radiat') ppEffectCommit 10;

                              _unit setVariable ['radiat2', ppEffectCreate ['ColorInversion', 500]];
                              (_unit getVariable 'radiat2') ppEffectEnable true;
                              (_unit getVariable 'radiat2') ppEffectAdjust [0.0, 0.0, 0.2];
                              (_unit getVariable 'radiat2') ppEffectCommit 10;
                         };

                    _dmg   = getDammage _unit;
                    _timer = diag_tickTime;

                    _dmgTick = 0.2;


                   waitUntil {sleep 0.5; !(_unit inArea _trg) or diag_tickTime > _timer + 3 or (goggles _unit in _GasMask)};
                  if (diag_tickTime > _timer + 3) then {_unit setDamage ((damage _unit) + _dmgTick)};

                   waitUntil {sleep 0.5; !(_unit inArea _trg) or diag_tickTime > _timer + 6 or (goggles _unit in _GasMask)};
                  if (diag_tickTime > _timer + 3) then {_unit setDamage ((damage _unit) + _dmgTick)};

                   waitUntil {sleep 0.5; !(_unit inArea _trg) or diag_tickTime > _timer + 9 or (goggles _unit in _GasMask)};
                  if (diag_tickTime > _timer + 3) then {_unit setDamage ((damage _unit) + _dmgTick)};

                   waitUntil {sleep 0.5; !(_unit inArea _trg) or diag_tickTime > _timer + 12 or (goggles _unit in _GasMask)};
                  if (diag_tickTime > _timer + 3) then {_unit setDamage ((damage _unit) + _dmgTick)};

                   waitUntil {sleep 0.5; !(_unit inArea _trg) or diag_tickTime > _timer + 15 or (goggles _unit in _GasMask)};
                   if (diag_tickTime > _timer + 15) exitWith {_unit setDamage 1};

                   if (isPlayer _unit) then
                   {
                      hint parseText format['<t size=""1.10"" font=""PuristaMedium"" color=""#13F03C"">You are out of contamination</t>'];
                              _unit setVariable ['noradiat', ppEffectCreate ['ChromAberration', 200]];
                              (_unit getVariable 'noradiat') ppEffectEnable true;
                              (_unit getVariable 'noradiat') ppEffectAdjust [0.0, 0.0, true];
                              (_unit getVariable 'noradiat') ppEffectCommit 10;

                              _unit setVariable ['noradiat2', ppEffectCreate ['ColorInversion', 500]];
                              (_unit getVariable 'noradiat2') ppEffectEnable true;
                              (_unit getVariable 'noradiat2') ppEffectAdjust [0, 0, 0];
                              (_unit getVariable 'noradiat2') ppEffectCommit 10;
                   };
                  }
                }
             } forEach allUnits;",
        ""
     ];

_Radiation = _Rad_Zone_1 getRelPos [0,0];
_Rad_Obj_1 = "Land_HelipadEmpty_F" createVehicle _Radiation;

_Warning_Marker = createMarker ["Warning_Marker_1", getPos _Rad_Obj_1];
_Warning_Marker setMarkerShape "ELLIPSE";
_Warning_Marker setMarkerColor "ColorRed";
_Warning_Marker setMarkerSize [1100, 1100];
_Warning_Marker setMarkerBrush "DIAGGRID";

 

//Change [3753.826, 12999.547,0] to where ever you want the radiation to be

_City_marker = createMarker ["Kavala", [3753.826, 12999.547,0]]; 
_City_marker setMarkerType "hd_warning";
_City_marker setMarkerSize [1,1];
_City_marker setMarkerColor "ColorYellow";
_City_marker setMarkerText "Warning";

Change _GasMask = ['Mask_M40_OD','Mask_M40','Mask_M50']; To what ever you want to not get effected by the radiation

 

Or if you want you can place a trigger on the map then add this in the onAct

Spoiler

{
                 [_x,thisTrigger] spawn
                {
                  _unit = _this select 0;
                  _trg  = _this select 1;             

  

                  private ['_timer','_dmg','_GasMask'];

                  _GasMask = ['Mask_M40_OD','Mask_M40','Mask_M50'];

 

                  while {alive _unit && local _unit} do
                  {
                      waitUntil {sleep 0.5; _unit inArea _trg && !(goggles _unit in _GasMask)};

                       if (isPlayer _unit) then
                         {
                             hint parseText format['<t size=""1.10"" font=""PuristaMedium"" color=""#F0133C"">Radiation hazard! Check your equipment</t>'];
                              _unit setVariable ['radiat', ppEffectCreate ['ChromAberration', 200]];
                              (_unit getVariable 'radiat') ppEffectEnable true;
                              (_unit getVariable 'radiat') ppEffectAdjust [0.03, 0.03, true];
                              (_unit getVariable 'radiat') ppEffectCommit 10;

                              _unit setVariable ['radiat2', ppEffectCreate ['ColorInversion', 500]];
                              (_unit getVariable 'radiat2') ppEffectEnable true;
                              (_unit getVariable 'radiat2') ppEffectAdjust [0.0, 0.0, 0.2];
                              (_unit getVariable 'radiat2') ppEffectCommit 10;
                         };

                    _dmg   = getDammage _unit;
                    _timer = diag_tickTime;

                    _dmgTick = 0.2;


                   waitUntil {sleep 0.5; !(_unit inArea _trg) or diag_tickTime > _timer + 3 or (goggles _unit in _GasMask)};
                  if (diag_tickTime > _timer + 3) then {_unit setDamage ((damage _unit) + _dmgTick)};

                   waitUntil {sleep 0.5; !(_unit inArea _trg) or diag_tickTime > _timer + 6 or (goggles _unit in _GasMask)};
                  if (diag_tickTime > _timer + 3) then {_unit setDamage ((damage _unit) + _dmgTick)};

                   waitUntil {sleep 0.5; !(_unit inArea _trg) or diag_tickTime > _timer + 9 or (goggles _unit in _GasMask)};
                  if (diag_tickTime > _timer + 3) then {_unit setDamage ((damage _unit) + _dmgTick)};

                   waitUntil {sleep 0.5; !(_unit inArea _trg) or diag_tickTime > _timer + 12 or (goggles _unit in _GasMask)};
                  if (diag_tickTime > _timer + 3) then {_unit setDamage ((damage _unit) + _dmgTick)};

                   waitUntil {sleep 0.5; !(_unit inArea _trg) or diag_tickTime > _timer + 15 or (goggles _unit in _GasMask)};
                   if (diag_tickTime > _timer + 15) exitWith {_unit setDamage 1};

                   if (isPlayer _unit) then
                   {
                      hint parseText format['<t size=""1.10"" font=""PuristaMedium"" color=""#13F03C"">You are out of contamination</t>'];
                              _unit setVariable ['noradiat', ppEffectCreate ['ChromAberration', 200]];
                              (_unit getVariable 'noradiat') ppEffectEnable true;
                              (_unit getVariable 'noradiat') ppEffectAdjust [0.0, 0.0, true];
                              (_unit getVariable 'noradiat') ppEffectCommit 10;

                              _unit setVariable ['noradiat2', ppEffectCreate ['ColorInversion', 500]];
                              (_unit getVariable 'noradiat2') ppEffectEnable true;
                              (_unit getVariable 'noradiat2') ppEffectAdjust [0, 0, 0];
                              (_unit getVariable 'noradiat2') ppEffectCommit 10;
                   };
                  }
                }
             } forEach allUnits;

You can even make multiple Radiation Zones by just copy and pasting the trigger around your map

 

This will cause abit of lag when loaded but it destroys all buildings and removes trees and bushed from the area. It also kills cars and helicoptors engines when entering the zone.

Spoiler


// Kill Altis Town Kavala

_City_Trig_1 = createTrigger ["EmptyDetector", [3753.826, 12999.547,0]];
_City_Trig_1 setTriggerArea [1100, 1100, 0, false];
_City_Trig_1 setTriggerActivation ["ANY", "PRESENT", true];

_City_Trig_1 setTriggerStatements

            [
                "this",
                 "",
                 ""
            ];

_City = _City_Trig_1 getRelPos [0,0];
_City_Object = "Land_File_F" createVehicle _City;

if (isServer) then
{
    {
        _x hideObject true;
    }
    forEach nearestTerrainObjects
    [
        [3753.826, 12999.547],  // Change this to where you want it
        ["Tree","Bush"],
        1000,
        true
    ];
};

sleep 1;

_buildings = (getPos _City_Object) nearObjects ["Building",1000];
{_x setDamage 1} forEach _buildings;


damageEngine = {
                   {
//                       _x setHitPointDamage ["HitEngine",1];
                       _x setHitPointDamage ["HitBatteries",1];   // Forgot to test this but the HitEngine works
                   }
                   forEach nearestObjects
                   [
                       [3753.826, 12999.547], // Make sure same as above
                       ["Car","Air"],
                       1000
                   ];
               };

[]spawn{
while {true} do {
    {
        if ( (!(_x getVariable ["damag_veh_engine",false])) && ((_x isKindOf "Car")) || ((_x isKindOf "Air")) ) then {
            _x call damageEngine};
            _x setVariable ["damag_veh_engine",true];

            {waitUntil (damage _x == 0 || {canMove _x});
            _x setVariable ["damag_veh_engine",false];
        };
    }forEach vehicles;
  }
};

This one looks like it could be cleaned up abit but it works. Must of forgot to clean it once i got it working

 

Feel free to edit any part of the scripts and use them as you please. Credit would be nice as well. Thank you

 

If you can make any of it better please let me know as i am still learning and these are really my first scripts i have done.

 

Radiation script idea came form a post last year by @pierremgi. Thank you.

  • Like 2
  • Thanks 4

Share this post


Link to post
Share on other sites

When I paste that trigger code into the onAct, i get an error message saying: On activation. Any idea what to do? (yes I know this is a 3 year old post)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×