Prevent Zombie Spawning

Discussion in 'Scripting Discussions' started by xxlsebi, Mar 25, 2013.

  1. xxlsebi

    xxlsebi New Member

    Joined:
    Dec 5, 2012
    Messages:
    15
    Likes Received:
    0
    Hi,

    I searched a long time for a script which allows me to set a region where zeds cant spawn..
    I tested everything what was posted here in this forum, but nothing worked .. :/

    How can I prevent Zed-spawning on my base?
    e.g radius of 200m or sth. else..

    Greetings!
     
  2. UrbanSkaters

    UrbanSkaters Valued Member!

    Joined:
    Jan 20, 2013
    Messages:
    473
    Likes Received:
    65
    Create a marker in the middle of your base and use this in your condition: (Hint, the 50 is your radius)

    Code:
    while {yourconditionhere} do
    {
        _pos = getMarkerPos "MarkerOne";
        _zombies = _pos nearEntities ["zZombie_Base",50];
        _count = count _zombies;
        for "_i" from 0 to (_count -1) do
        {
            _zombie = _zombies select _i;
            deleteVehicle _zombie;
        };
        sleep 0.5;
    };
     
    CraftLourens likes this.
  3. xxlsebi

    xxlsebi New Member

    Joined:
    Dec 5, 2012
    Messages:
    15
    Likes Received:
    0
    Hi,

    thank you for your reply ;)

    Does it work if I set the condition to this:
    (player distance "MarkerBlabla") < 400

    I think the script only have to run if someone is near like 400 meters.
    The radius will be set to 200 I think
     
  4. UrbanSkaters

    UrbanSkaters Valued Member!

    Joined:
    Jan 20, 2013
    Messages:
    473
    Likes Received:
    65
    You could create a trigger so when the player steps into it, the code is executed? I haven't tried either out myself yet, that was just from memory , as an example of what might be possible.

    Obviously the trigger could be any size you choose :)
     
  5. xxlsebi

    xxlsebi New Member

    Joined:
    Dec 5, 2012
    Messages:
    15
    Likes Received:
    0
    Sth. like:
    expActiv="nul = [] execVM ""scripts\removeZeds.sqf"";";

    on the trigger?
     
  6. UrbanSkaters

    UrbanSkaters Valued Member!

    Joined:
    Jan 20, 2013
    Messages:
    473
    Likes Received:
    65
    yep! Remember to disable the script after the players leaves the trigger. I'm not sure if anyone knows a better way to do this, as the trigger method could result in serious lag if say 10 or more players are in that trigger. Like I said before I've not tested this myself, and not being a professional arma 2 script editor I can't guarantee anything.
     
  7. Seven

    Seven Moderator Staff Member

    Joined:
    Dec 16, 2012
    Messages:
    277
    Likes Received:
    86
    it would be better to run your checks in the spawn zombie code rather than cleaning up after they spawn. Kill it before it happens. much less strain.
     
    ebay likes this.
  8. xxlsebi

    xxlsebi New Member

    Joined:
    Dec 5, 2012
    Messages:
    15
    Likes Received:
    0
    Tried it before.. but it didnt worked..

    player_SpawnCheck.sqf:
    around line 157

    Code:
                           
    if (_age > 3) then {
      _xy_inNoZedZone = (TDC distance _position) < 200;                           
      if(!_xy_inNoZedZone){  // zed-free zone
           _x setVariable ["zombieSpawn",_dateNow,true];
          [_x] call building_spawnZombies;
      };                         
    };
    
    result: no loot, no zeds
     
  9. McKeighan

    McKeighan Well-Known Member

    Joined:
    Jan 8, 2013
    Messages:
    103
    Likes Received:
    6
    Try fixing this in your building_spawnzombies, instead of your player_spawncheck.sqf

    the spawncheck addresses both zeds and loot I believe.
     
  10. Sabbath

    Sabbath Member

    Joined:
    Feb 2, 2013
    Messages:
    74
    Likes Received:
    3
    Yea i have messed around with stuff in those files, even the maxlocalspawn in Variable.sqf from 40 to 10 but still nothin. i cant seem to find how to tone down the rediculous respawn rate and amount of zombies (running Panthera), can barely make it out of a barracks now haha, and if you do you most likely went through all your ammo you just found to do it lol, also been trying to locate the aggro radius for hearing shots fired, seems like shooting a sidearm like a makarov now aggros everything within 150-200m.

    Although it is a zombie mod, the idea of jsut increasing damage/spawnrate/aggro/amount while ignoring the base issues like zombies walking and hitting players through objects/walls. I would rather break the zombies to a low count/respawn and aggro radius and just add AI, because in their current state they are fairly broken. I know everyone enjoys trying to take-off in helicopters now while zombies are hitting you from 20 ft away after you jsut got finished clearing the pad before lift off.
     
  11. felixberndt

    felixberndt Member

    Joined:
    Dec 16, 2012
    Messages:
    63
    Likes Received:
    1
    The problem is,that zeds are spawned client-side, so Meat (a friend of mine) and me tried to do st else than prevent zeds from spawning to clear a certain area...
    What about just teleport them immediatly after spawning to another location???


    //executed in init:
    Code:
    zombieshield=true;
     
    while {zombieshield} do {
     
     
    _pos = getPos Basis_West;
    _zombies = _pos nearEntities ["zZombie_Base",150];
    _count = count _zombies;
     
     
    for "_i" from 0 to (_count -1) do
    {
    _zombie = _zombies select _i;
    _zombie setpos [-3367.739,-120.84577,-8247.0625];
    };
     
    };

    We are not sure if it would be better to make a loop every 10 seconds, or to execute it only when a player enters that area...on first try the server crashed... :(

    now we have set the loop every 10 sec and everything seems to work fine:

    Code:
    zombieshield=true;
     
    while {zombieshield} do {
    sleep 10;
    _pos = getPos Basis_West;
    _zombies = _pos nearEntities ["zZombie_Base",150];
    _count = count _zombies;
     
     
    for "_i" from 0 to (_count -1) do
    {
    _zombie = _zombies select _i;
    _zombie setpos [-3367.739,-120.84577,-8247.0625];
    };
     
    };
    ( we've not already tested this out with a server population of 60 players)

    Maybe someone has got a better idea for a modification of that to decrease laggs and server performance...
     
  12. kikyou2

    kikyou2 Valued Member!

    Joined:
    Nov 12, 2012
    Messages:
    227
    Likes Received:
    31
  13. felixberndt

    felixberndt Member

    Joined:
    Dec 16, 2012
    Messages:
    63
    Likes Received:
    1
    copy+paste ? lol
     
  14. kikyou2

    kikyou2 Valued Member!

    Joined:
    Nov 12, 2012
    Messages:
    227
    Likes Received:
    31
    Yes I thought that it didn't worked for you, so I tested it with integrating in the safezone.sqf. Sorry if it seemed like I wanna claim you work as my own this wasn't what was intended.

    I only try to help :)
     
  15. thebes

    thebes New Member

    Joined:
    Feb 17, 2013
    Messages:
    15
    Likes Received:
    0
    guys hope you can help me out I've tried the above suggestion and cant make a zombie free zone for love of money please could you help me out.
    I'm trying to implement the code through a script sqf, the trigger is working but zombies still spawning i only want the trigger to activate once so it looks like the NPC soilders have cleared an area.
    cheers thebes
     
  16. Cam Am

    Cam Am New Member

    Joined:
    Apr 10, 2013
    Messages:
    12
    Likes Received:
    0
    can someone give me a step by step on making this trigger work?
     
  17. syphron

    syphron New Member

    Joined:
    Aug 31, 2013
    Messages:
    3
    Likes Received:
    0
    I would also like a step by step guide since I have almost no knowledge of arma scripting.
    I am willing to pay money if someone could get it to work for me.
     
  18. DAKA

    DAKA New Member

    Joined:
    May 19, 2014
    Messages:
    11
    Likes Received:
    0
    how can I include this to remove roaming ai from DZAI or WAI? is there a way?
     

Share This Page