Sign in to follow this  

Zombie, Money, Respect and Loot

11 posts in this topic

Hi, I've modified some scripts from these guys :


To create a 2 scripts.

One gives respect and money when you kill a zombie.

The other put loot on zombies.

Both script are working with the default Ryan's zombies spawners but may also work with other spawners, feel free to test it.

The first : ZKilled.sqf

ZKilled.sqf - WIP
WIP Credits to eraser1 and IT07
for their respective onKilled.sqf's (DMS & VEMF)
Modified by Patrix87
private [

_unit           = _this select 0;
_killer         = _this select 1;
_playerObj      = objNull;
_roadKilled     = false;
_respectChange  = 0;
_killerRespectPoints 	= [];
_zombieMoney			= 5;
_zombieRespect			= 10;
_roadKillBonus			= -5;
_minDistance			= 30;
_distanceBonusDivider 	= 10;

//Roadkill or not
if (isPlayer _killer) then
	_veh = vehicle _killer;
	_playerObj = _killer;
	if (!(_killer isKindOf "Exile_Unit_Player") && {!isNull (gunner _killer)}) then
			_playerObj = gunner _killer;

	if (!(_veh isEqualTo _killer) && {(driver _veh) isEqualTo _killer}) then
			_playerObj = driver _veh;
			_roadKilled = true;

_respect = _playerObj getVariable ["ExileScore", 0];
_money = _playerObj getVariable ["ExileMoney", 0];

if ((!isNull _playerObj) && {((getPlayerUID _playerObj) != "") && {_playerObj isKindOf "Exile_Unit_Player"}}) then
	_killerRespectPoints pushBack [(format ["%1",_killMsg]), _zombieRespect];
	if (_roadKilled) then
		_killerRespectPoints pushBack [(format ["%1",_killMsgRoad]), _roadKillBonus];
		_distance = _unit distance _playerObj;
		if (_distance > _minDistance) then
			_distanceBonus = (floor (_distance / _distanceBonusDivider));
			_killerRespectPoints pushBack [(format ["%1m RANGE BONUS", (round _distance)]), _distanceBonus];
	// Calculated killer's respect and money
		_respectChange = (_respectChange + (_x select 1));
	forEach _killerRespectPoints;
	_respect = (_respect + _respectChange);
	_money = (_money + _zombieMoney);
	// Send message
	[_playerObj, "showFragRequest", [_killerRespectPoints]] call ExileServer_system_network_send_to;
	[_playerObj, "moneyReceivedRequest", [str _money, "Killing Zombies"]] call ExileServer_system_network_send_to;
	// Set client's respect and money
	_playerObj setVariable ["ExileScore", _respect];
	_playerObj setVariable ["ExileMoney", _money];
	ExileClientPlayerScore = _respect;
	(owner _playerObj) publicVariableClient "ExileClientPlayerScore";
	ExileClientPlayerScore = nil;
	// Update client database entry
	format["setAccountMoneyAndRespect:%1:%2:%3", _money, _respect, (getPlayerUID _playerObj)] call ExileServer_system_database_query_fireAndForget;

The Second : ZombieLoot.sqf

Credits to READTHESCROLL for his initial script
Modified by Patrix87
_zombie = _this select 0;
_vest = ["V_HarnessOGL_brn","V_HarnessOGL_gry","V_HarnessO_brn","V_HarnessO_gry","V_HarnessOSpec_brn","V_HarnessOSpec_gry","V_TacVest_blk","V_TacVest_blk_POLICE","V_TacVest_brn","V_TacVest_camo","V_TacVest_khk","V_TacVest_oli","V_TacVestCamo_khk","V_TacVestIR_blk","V_Rangemaster_belt"] call BIS_fnc_selectRandom;
_item = ["Exile_Item_InstaDoc","Exile_Item_Catfood","Exile_Item_PlasticBottleFreshWater","Exile_Item_Matches","Exile_Item_DuctTape","Exile_Item_CookingPot","16Rnd_9x21_Mag"] call BIS_fnc_selectRandom;
_zombie addVest _vest;
_zombie addItem _item;

The installation : 

Unpack Ryanzombies.pbo

open zombie.sqf

Add These lines : ...

//Money and respect for killing zombies
_zombie addEventHandler ["Killed",{ [(_this select 0), (_this select 1)] execVM "addons\ZKilled.sqf";}];
//Loot on zombies
[(_this select 0)] execVM "addons\ZombieLoot.sqf";

After these lines ...

if !(isnil "Ryanzombiesinvincible") then {_zombie allowdammage false};
if !(isnil "ryanzombiesdeletion") then {[_zombie] exec "\ryanzombies\delzombies.sqf"};

Repack Ryanzombies.pbo

Unpack your mission PBO

Create a folder named : addons

put ZKilled.sqf and ZombieLoot.sqf

in that folder

Repack your mission PBO


Edited by Patrix87

Share this post

Link to post
Share on other sites

Actually no, the ryanzombies.pbo is on the server side and launch the scripts that are in the mission file addons folder that is on the client side once you joined the game.

It does show a red circle beside ryanzombies though, but player can still join with the vanilla ryanszombies.

Share this post

Link to post
Share on other sites

I would like to find a way to "overwrite" that zombie.sqf with a file in the mission file like you can with exilemod but I don't think it's possible...

Loot is supposed to be coming over to ryanzombies at some point.


It would be nice if Ryanzombies would support addons.

Share this post

Link to post
Share on other sites

That script you edited, isn't that from the missionfile changes within the Exile-Z mod? I know the mission file side has these settings in that.


Why not just grab that and edit it? It's already mission side so the editing shouldn't be too severe.

Share this post

Link to post
Share on other sites

The problem is that I used the ExileZ script to spawn zombies and it did not seem to work properly, The number of zombies was always low, they did not agro properly, they often randomly killed each other even if the setting for that was off.

So I chose to use the default Ryan's zombies spawner that you place with the editor...

The problem is that you can't modify the mod without breaking the signature and there's no "Killed" event handler available to use...

I could not figure out a way to add the handler since what you place in the editor is a spawner and not a unit and I could not find a way to "intercept" the function that spawn zombies for ryanzombies.

Oh and arma 3 uses Killed handler in the unit that was killed and no "Kill" handler in the player that killed a unit. therefor the only way to make that work is to place a killed handler in the zombies that spawns.

My only option is to try to make a serverside mod that spawn the zombies exactly like ryanzombies does... or to hope for the mod to be updated with an open handler.

I'm not so sure about everything that I'm saying since I'm fairly new to arma coding world.

If anyone has an idea it would be greatly appreciated.

PS: One last thing that could be fixed is that when a zombie kill someone it does not have a "name" therefore the game think the played killed himself.

Edited by Patrix87

Share this post

Link to post
Share on other sites

Just to see I've added this line :

["systemChatRequest", [format["%1 was Killed by %2 of type %3 with %4 or %5",(name _victim) , (name _killer), (typeOf _killer), (vehicle _killer), (currentWeapon _killer)]]] call ExileServer_object_player_event_killFeed;

To this file : ExileServer_object_player_event_onMpKilled.sqf

which handles when the player is killed.

The results are attached.

First 3 lines are when I get killed by an NPC

Next three line are when I get killed by a Zombie.

Zombies don't have names, therefor returns nil which is then replaced by the default value -1 which somehow end up being the victims name...

rtp log : 

19:45:04 "params" <> #2: Input value is 'nil' or undefined. Default value "-1" is used instead.
19:45:04 "params" <> #2: Input value is 'nil' or undefined. Default value "-1" is used instead.
19:45:15 WARNING: Function 'name' - Patrix is dead




Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.