[Release] BDC's Taunt Nearby Zombies (pwnzor0z 1.7.7.1)

BDC

Well-Known Member
In teaming up with my wife, during times when it was just us, I'd find myself wanting to figure out an easy way to aggro the nearby zed and/or come up with a way to try and pull aggro off of her so aggro could be mitigated a bit better while she flays the lot of them (that are then chasing me) with her M249 SAW. So, I came up with an idea that I hope is a balanced one that takes on a tactic I feel would be a realistic one given the apocalyptic setting: Slice yourself with a knife (to create a hopefully attractive-to-zed bleeding wound) and start yelling at the top of your lungs.

"Taunt Nearby Zombies" is the end product of a couple of days of work and tweaking to hopefully achieve that. When coming up to a live zombie, when the player gets within 35 meters of the target, a red-coloured "Taunt Nearby Zombies (Bleed and Scream)" option will appear in the scroll-bar list. From there, it's pretty simple. The script will induce a bleeding wound of minor to moderate blood loss with your player, depending upon gender (as determined by the outfit "skin" that is worn, unfortunately), also producing screaming that repeats a few times in a couple of second intervals. There is a small random chance of the player accidentally cutting his or herself severely which will produce twice the aggro spamming, plus multiply the point-blank area of radius out, as well as yield a much greater degree of bleeding.

This add-on modifies fn_selfActions.sqf, compiles.sqf (to point to an extracted fn_selfActions.sqf file), and adds a new script file called player_tauntnearbyzed.sqf.

There are a few options that are configurable in the script towards the very top for admins directly under the "// Configurable variables" section.

Check this thread for any updates or tweaks I may do. I am also taking suggestions via PM on any modifications I should perform.

On to the installation.

Step 1) Modify fn_selfActions.sqf

Note: For those unfamiliar with modifying fn_selfActions.sqf to add more options to the scrollbar, please PM me.

On or around line 42, there will be a section of code about 10 lines or so long starting with the comment, "//Grab Flare". Directly below that section, add this (which enables our Taunt option to appear):

Code:
// Taunt Nearby Zombies if player has hunting knife and has a "live" zombie targeted (35 or less distance to player)
    if ((cursorTarget isKindOf "zZombie_base") and (alive cursorTarget) and !_inVehicle and _canDo and (player distance CursorTarget < 36)) then {
      if (s_player_tauntzed < 0) then {
        if (!_hasKnife) then {
          s_player_tauntzed = player addAction [("<t color=""#A0A0A0"">" + ("Taunt nearby zombies (Bleed and Scream)") + "</t>"), "fixes\player_tauntnearbyzed.sqf",[], 1, false, true, "", ""];
        } else {
          s_player_tauntzed = player addAction [("<t color=""#FF3232"">" + ("Taunt nearby zombies (Bleed and Scream)") + "</t>"), "fixes\player_tauntnearbyzed.sqf",[], 1, false, true, "", ""];
        };
      };
      } else {
      player removeAction s_player_tauntzed;
      s_player_tauntzed = -1;
    };

Step 2) Download the file player_tauntnearbyzed.sqf here -> http://www.mediafire.com/?dkb2uluc0b9its8


Note: If for some reason there's a problem with the Mediafire link, check the next post for a complete copy of the player_tauntnearbyzed.sqf file that can be re-created.

Place your newly-downloaded player_tauntnearbyzed.sqf file into a folder of your choosing (by default, I use "fixes" as reflected in the two options listed above in the code section for file fn_selfActions.sqf) within the folder \dayzinstallfolder\MPMissions\dayz_1.Chernarus. Several add-ons use the subfolders "fixes", "custom", and "scripts". Please use accordingly.

Need help? Visit the help thread here: http://opendayz.net/threads/bdcs-script-addon-help-thread.13295/

That should be it! Pretty simple.
 
Here's a complete copy of the player_tauntnearbyzed.sqf in case of problem with download link:

Code:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Player_TauntNearbyZed.SQF
// Taunt Nearby Zombies - by BDC - Aug 14 2013, for DayZ 1.7.7.1
//
// BDC's Sanctuary Private DayZ Server - RaidCall group 6824535
// This script allows the player, while wielding a hunting knife, to injure his or herself, creating a bleeding wound,
// combined with a loud scream, in an attempt to gather the aggro of any zombies nearby to a high percentage. There
// are three looped rounds of point-blank area of effect taunts made based upon the bleeding wound to keep said aggro (or
// gain new aggro) in two-second intervals. A modifier to this is the possibility of a severe and painful wound (18%
// chance that will create 6 rounds of aggro instead of three.
//
// This option will only activate itself if the player has a zombie targeted (cursorTarget) and that zombie target is within a distance of 35m.
//
// Called directly from a modification done to fn_SelfActions.SQF with a portion borrowed from player_alertZombies.sqf
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
private["_FemalePanic","_MalePanic","_LoopCount","_SevereWound","_SevereWoundMultiplier","_SeverelyWounded","_isFemale","_hit","_wound","_damage","_hasKnife","_firstMaleScream","_secondMaleScream","_firstFemaleScream","_secondFemaleScream","_AggroDist","_listTalk","_pos","_target","_targets","_chanceToAggro","_zombie"];
 
// Core variables
_hasKnife = "ItemKnife" in items player;
_MaleScream = "scream"; // scream_short_0 // z_scream_0  z_scream0_0
_FemaleScream = "screamw"; // scream_woman_4
_MalePanic = "panic";
_FemalePanic = "panicw";
_SeverelyWounded = false;
 
// Configurable variables
_AggroDist = 35; // distance in meters to attract zombies when screaming and bleeding (default: 35)
_SevereWoundMultiplier = 1.5; // Multiplier of _AggroDist when player accidentally severely wounds his or herself (default: 1.5)
 
// Initial Disqualifications
if (!_hasKnife) exitwith { cutText [format["You must have a hunting knife to perform this action."], "PLAIN DOWN"]; };
 
// Grab gender type (currently based upon the outfit "skin")
_isFemale = ((typeOf player == "SurvivorW2_DZ")||(typeOf player == "BanditW1_DZ"));
 
// Slight delay at beginning to allow player to stand up from crouch or prone position 
  sleep 0.25;
 
// Determine if self-injury is moderate or is more severe and painful 
_SevereWound = random 1;
if (_SevereWound >= 0.82) then { // 18% chance to cause very bad cut
  _damage = 2.00;
  r_player_inpain = true;
  player setVariable["USEC_inPain",true,true];
  _SeverlyWounded = true;
  _AggroDist = (_AggroDist * _SevereWoundMultiplier); // Set multiplier to aggro distance variable to increase aggro range
  _LoopCount = 6;
  cutText [format["You accidentally cause a very painful, severely bleeding wound and start screaming uncontrollably!"], "PLAIN DOWN"];
} else {
  _damage = 0.70;
  _LoopCount = 3;
  cutText [format["You create a moderate bleeding wound and start screaming."], "PLAIN DOWN"];
};
 
//Create the Bleeding Wound
_hit = "body";
_wound = _hit call fnc_usec_damageGetWound;
r_player_blood = r_player_blood - (_damage * 1);
player setVariable["USEC_BloodQty",r_player_blood,true];
player setVariable["hit_"+_wound,true,true];
PVDZ_hlt_Bleed = [player,_wound,_damage];
publicVariable "PVDZ_hlt_Bleed";
[player,_wound,_hit] spawn fnc_usec_damageBleed;
dayz_sourceBleeding = player;
r_player_injured = true;
player setVariable["USEC_injured",true,true];
player setVariable["medForceUpdate",true,true];
 
// Start waves of point-blank area of effect taunt
for "_x" from 1 to _LoopCount do {
 
    // Player screams
    if (_isFemale) then {
        [player,_FemaleScream,0,false,_AggroDist] call dayz_zombieSpeak;
    } else {
        [player,_MaleScream,0,false,_AggroDist] call dayz_zombieSpeak;
    };
 
    // Grab player position and list of zombies nearby (taken from player_alertZombies.sqf and modified
    _pos = (getPosATL player);
    _listTalk = _pos nearEntities ["zZombie_Base",_AggroDist];
    {
        _zombie = _x;
        _targets = _zombie getVariable ["targets",[]];
        _chanceToAggro = random 1;
        if (_SeverelyWounded) then { _chanceToAggro = 1; }; // If severely wounded, aggro chance = 100%
        if (_chanceToAggro > 0.22) then { // 78% chance to grab aggro if regular wound
            if (!(player in _targets)) then {
                _targets set [count _targets, player];
                _zombie setVariable ["targets",_targets, true];
            };
        };
    } forEach _listTalk;
 
    // Slight pause
    sleep 2.25;
};
 
// Final panic sounds from severely wounded folk'
if (_SeverelyWounded) then {
    if (_isFemale) then {
        [player,_FemalePanic,0,false,_AggroDist] call dayz_zombieSpeak;
    } else {
        [player,_MalePanic,0,false,_AggroDist] call dayz_zombieSpeak;
    };
};
 
// Prevent Taunt option from re-appearing for a bit
sleep 25;
 
// Completion - reset taunt flags for fn_selfActions
player removeAction s_player_tauntzed;
s_player_tauntzed = -1;
 
Back
Top