[Release] Fred's Anti-Zombie Frequency Emitter (AKA Zombie Shield)

Freaking Fred

OpenDayZ Rockstar!
Fred's Anti-Zombie Frequency Emitter
Created By Freaking Fred
Special Thanks To mmmyum


Background Story

It has been over a year since the infection began to spread. Only the strongest and smartest of the survivors remain. A scientist, named mmmyum, has been studying the behavior of the infected and, with the help of a tech savvy survivor named Freaking Fred, has created a device to help defeat them. The device emits a frequency that is fatal to the infected but has no harmful effects on survivors. Word of the new device is quickly spreading across Chernarus.

Blueprints

1 x Engine Parts
1 x Full Jerry Can
1 x Empty Tin Can
1 x Empty Whiskey Bottle


Versions
v 1.0.0- Initial release of Anti-Zombie Frequency Emitter.


Tutorials

This addon will require a custom compiles.sqf and fn_selfActions.sqf to be placed in a fixes folder in your mission folder. If you already have these custom files in your mission folder, skip to the Installation section. If you do not, follow this tutorial.

Open the spoiler for the tutorial.
Step 1:Go to yourarma 2 operation arrowheadinstallation folder on your PC and find your@DayZfolder.

Step 2: In your @DayZ folder, go into the addons folder and find thedayz_code.pbo. Make a copy of dayz_code.pbo on your desktop.

Step 3: Unpack the dayz_code.pbo that you have placed on your desktop. Inside thedayz_code folder find the compile folder.

Step 4: Inside the compile folder you will find the fn_selfActions.sqf. Make a copy of that and place it on your desktop.

Step 5: Back out to the main dayz_code folder and find the init folder. Inside theinitfolder you will find compiles.sqf. Make a copy of that and place it on your desktop.

Step 6: In your server's mission folder, create a fixes folder, if you don't already have one. Move the fn_selfActions.sqf and compiles.sqf from your desktop into this folder.

Step 7: In your compiles.sqf find the following line.
Code:
fnc_usec_selfActions =        compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_selfActions.sqf";        //Checks which actions for self
Change it to
Code:
fnc_usec_selfActions =      compile preprocessFileLineNumbers "fixes\fn_selfActions.sqf";        //Checks which actions for self


Step 8: In your init.sqf find the following line.
Code:
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";              //Compile regular functions
Change it to
Code:
call compile preprocessFileLineNumbers "fixes\compiles.sqf";              //Compile regular functions


Installation

Open the spoiler for installation instructions.
Step 1: In your server's mission folder, create a new folder named scripts, if you don't already have one.

Step 2: In your scripts folder, create a new text document and name it zombieshield.sqf.

Step 3: Copy and paste the following code into zombieshield.sqf.
Code:
private ["_mypos", "_dir", "_createShield", "_sounddist", "_timeplay", "_shield", "_shieldUp", "_timer", "_zombies", "_count", "_zombie", "_soundList"];
 
player playActionNow "Medic";
sleep 1;
titleText ["You are building an Anti-Zombie Frequency Emitter.","PLAIN DOWN"]; titleFadeOut 5;
 
_mypos = getposATL player;
_dir = getdir player;
_mypos = [(_mypos select 0)+2*sin(_dir),(_mypos select 1)+2*cos(_dir), (_mypos select 2)];
_createShield = createVehicle ["SkeetMachine", _mypos, [], 0, "CAN_COLLIDE"];
_createShield setDir _dir;
_createShield setposATL _mypos;
sleep 1;
 
player removeMagazine "TrashJackDaniels";
player removeMagazine "TrashTinCan";
player removeMagazine "PartEngine";
player removeMagazine "ItemJerrycan";
sleep 0.01;
player addMagazine "ItemJerrycanEmpty";
 
titleText ["Device activated.","PLAIN DOWN"]; titleFadeOut 5;
 
_sounddist = 50;
_timeplay = 18;
while {_timeplay > 1} do {
    _shield = nearestObject [player, "SkeetMachine"];
    [nil,_shield,rSAY,["engine_12s", _sounddist]] call RE;
 
    _shieldUp = (alive _shield);
    _timer = time;
    while {_shieldUp} do {
        _zombies = (getPosATL _shield) nearEntities ["zZombie_Base",20];
        _count = count _zombies;
 
        for "_i" from 0 to (_count -1) do {
            _zombie = _zombies select _i;
            _zombie setdamage 1;
            sleep 0.01;
        };
        if ((time - _timer) > 10) exitwith {};
    };
    _soundList = ["PMC_ElectricBlast1","PMC_ElectricBlast2"] call BIS_fnc_selectRandom;
    [nil,_shield,rSAY,[_soundList, _sounddist]] call RE;
    _timeplay = _timeplay - 1;
};
 
sleep 1;
deleteVehicle _createShield;
titleText ["Device deactivated.","PLAIN DOWN"]; titleFadeOut 5;

Step 4: Open your fn_selfActions.sqf and copy and paste the following code to the bottom of the file.
Code:
// ZOMBIE SHIELD START
if (("TrashTinCan" in magazines player) && ("TrashJackDaniels" in magazines player) && ("PartEngine" in magazines player) && ("ItemJerrycan" in magazines player) && ("ItemToolbox" in items player)) then {
    hasShield = true;
} else {
    hasShield = false;
};
if (hasShield) then {
    if (zombieShield < 0) then {
    zombieShield = player addAction [("<t color=""#00c362"">" + ("Anti-Zombie Freq Emitter") +"</t>"),"scripts\zombieshield\zombieshield.sqf","",5,false,true,"",""];
    };
} else {
    player removeAction zombieShield;
    zombieShield = -1;
};
// ZOMBIE SHIELD END


Media

Anti-Zombie Frequency Emitter in action! by andy1978


How To Use

Step 1: Make sure you have the required items in your inventory.

Step 2: Scroll wheel and select the Anti-Zombie Freq Emitter option.

Step 3: The device will kill any zombies that enter 20 meters of it for the next 3 minutes.


FAQ

Q: I have the required items in my inventory but I am not getting the scroll wheel option.
A: Try dropping the required items on the ground and picking them back up. I am currently looking into a permanent fix for the issue.
 
Back
Top