Jump to content

Recommended Posts

A safe zone where you can't shoot or throw grenades. When the player leaves the zone, he can shoot and throw grenades. If the player died and slept in the area of this zone, he again can not shoot in it until he leaves it. If the player left the zone and came back, he can not shoot in its territory.

Share this post


Link to post
Share on other sites

Hello, welcome on forum. This topic has been already discussed if you search on forum. You can find some hints, looking for Arma safe zone.
There are multiple ways like making units/vehicles undestroyable, or handling damages, while units/vehicle are inside an area.

 

If I read your goal, you want that any player (multiplayer) can't shoot or throw grenades...

You could remove all magazines/grenades and re-add them when out of area... That doesn't mean player(s) couldn't find some weapons/ammos in this area.

 

Another way could be deleting all projectiles once entering the area.

something like, for a trigger area, let's say named trig1 :

{
    _x addEventHandler ["FiredMan", {
        params ["", "", "", "", "", "", "_projectile"];
        _projectile spawn {
            params ["_projectile"];
            waitUntil {!isnull _projectile};
            waitUntil {isnull _projectile or _projectile inArea trig1};
            deleteVehicle _projectile;
        };
    }];
} forEach playableUnits+switchableUnits;

(switchableUnits is for SP work)

You need to run this code in init.sqf or inside a trigger set to TRUE as condition (so firing at start) , or even any init field of any object (just one)!
This script is made for players (played or not) and one trigger (trig1) only. So players can be killed by AIs (NPCs).

 

If you want more safe areas like this, some failures may occur due to synchronization and lags. Anyway:

 

Let's say you want to make safe trig1, trig2 and trig3 areas:

 

{
    _x addEventHandler ["FiredMan", {
        params ["", "", "", "", "", "", "_projectile"];
        _projectile spawn {
            params ["_projectile"];
            waitUntil {!isnull _projectile};
            waitUntil {isnull _projectile or [trig1,trig2,trig3] findIf {_projectile inArea _x} >-1};
            deleteVehicle _projectile;
        };
    }];
} forEach allUnits;

Here I code for 3 named triggers, and applied the code for deleting any fired projectile incoming (or passing thru) the area.
It's an example. That can lag, especially in MP, because I apply the code for any unit. Feel free to keep playableUnits instead of allUnits if you are aiming players only.
 

For all units, furthermore, you need to apply this EH ("firedman") on spawned ones as well, (if you don't want any kill in the area).
 

 

 

 

 

  • Like 1
  • Thanks 1

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

×