Jump to content

[TUTORIAL/HOW-TO] Epoch 1.0.5 Custom Self Bloodbag Fix


Uro

Recommended Posts

TUTORIAL/HOW-TO: CUSTOM SELF-BLOODBAG for EPOCH 1.0.5+

 

 

For people using maca134's right click options and wanting to run their own Self Tranfuse / Bloodbag scripts within Epoch 1.0.5 without having "Self Transfuse" & "Self Bloodbag" right click options on Bloodbags.

 

 

Why did I make this guide?

Some of us use custom self blood scripts with features other than in the default one.
Call it OCD but I don't like having duplicate Self Blood options in right click menus!
And also because setting DZE_SelfTransfuse = false; variable in the mission init file disables all right click options on bloodbags.

 

 

The following guide lets you use your own self bloodbag script utilising the existing self-transfuse code within Epoch 1.0.5+

 

 

Difficulty:

Easy/Moderate
 

 

Required:

Notepad++
PBO Manager / PBO tools.
Epoch 1.0.5 dayz_code.pbo
A working custom compiles.sqf in your mission file.
A working self-bloodbag script in your mission file.


Dont have a custom compiles? The forum search function and Google are your friends.


NB: For the benefit of this guide I'm using a folder called \custom\ in my mission file, yours may be different, change the appropriate lines below.
 

 

 

Step 1

In your mission file open up your custom compiles.sqf

Add the following:

player_useMeds =            compile preprocessFileLineNumbers "custom\player_useMeds.sqf";

Save the file.



Step 2


Open up your dayz_code.pbo

Copy this file \dayz_code\actions\player_useMeds.sqf

Paste it in the \custom\ folder in your mission file.



Step 3


Open the player_useMeds.sqf that you just put in your mission file.

Look for the line:
 

    case "ItemBloodbag": {
        _id = [0,0,0,[player]] execVM "\z\addons\dayz_code\medical\self_transfusion.sqf";

Change it to this:
(or whatever your self-bloodbag script is called!)
 

    case "ItemBloodbag": {
        _id = [0,0,0,[player]] execVM "custom\self_bloodbag.sqf";

Save the file.
    

 

Step 4

 

Open the init.sqf in your Mission file.

Scroll down to your DZE_ variables.

Add this line:
 

DZE_SelfTransfuse = true;

Save the file.

Repack your mission file into a PBO.

    

 

Optional:

If you use maca134's right click menu http://epochservers.com/viewtopic.php?f=14&t=13
You can remove the options for Bloodbags.


Open your extra_rc.hpp in Notepad++

Remove these lines:
 

    class ItemBloodbag {
        class UseBB {
            text = "Use Bloodbag";
            script = "execVM 'custom\SelfBB.sqf'";
        };
    };

   
Save the file.

Repack your mission file into a PBO.  

 

 

 

Your self-bloodbag script now uses the built-in Epoch code to run!!

Link to comment
Share on other sites

 

I think you have an extra " in there, din't work until I changed it from

case "ItemBloodbag": {
        _id = [0,0,0,[player]] execVM ""custom\self_bloodbag.sqf";

to

case "ItemBloodbag": {
        _id = [0,0,0,[player]] execVM "custom\self_bloodbag.sqf";

 

 

Thanks fixed!  Must have typo'd an error between posting this on a couple of forums :D

 

 

maca right click doent work on 1.0.5. Can you share your ui_selectSlot for 1.0.5?

 

what exactly doesn't work?

 

I'm using the ui_selectSlot.sqf from \dayz_code\compile\ui_selectSlot.sqf modded with maca's right click menu's.

 

The only thing different between the old file and the new file is line 9

 

Above this line:

if (_button == 1) then {

Add this:

if (!DZE_SelfTransfuse && ((gearSlotData _control) == "ItemBloodBag")) exitWith {};

You really should compare your old and new files when you update incase any have changed, instead of expecting them to be the same. :)

Link to comment
Share on other sites

When I tested this I had a zombies maul me, bandaged and bloodbagged etc fine.

 

Had other players shoot me, bandaged, bloodbagged etc fine

 

All this does is change the source of the bloodbag script using Epoch's own code.

Link to comment
Share on other sites

When I tested this I had a zombies maul me, bandaged and bloodbagged etc fine.

 

Had other players shoot me, bandaged, bloodbagged etc fine

 

All this does is change the source of the bloodbag script using Epoch's own code.

mine was this case "ItemBloodbag": {

_id = [0,0,0,[player]] execVM ""custom\self_bloodbag.sqf";  <---the extra " before custom, once removed it works great

Link to comment
Share on other sites

  • 1 month later...

I followed your instructions to a T, went back and checked everything twice. I still have BOTH Self Transfuse and Self Bloodbag options available. I thought this replaced the Self Transfuse option so we only had one? I use the configurable Bloodbag script that gives bonuses if you are next to ambulances or hospitals.

Link to comment
Share on other sites

  • 2 months later...

I did it so. You need these 2 if conditions to check for the ItemBloodBag item.

private ["_control","_button","_parent","_group","_pos","_item","_conf","_name","_cfgActions","_numActions","_height","_menu","_config","_type","_script","_outputOriented","_compile","_array","_outputClass","_outputType","_key_colors","_ownerKeyId","_itemsPlayer","_hasKey","_objects","_ownerID","_i"];
disableSerialization;
_control = 	_this select 0;
_button =	_this select 1;
_parent = 	findDisplay 106;

//if ((time - dayzClickTime) < 1) exitWith {};
// jahan - self transfusion mit check variable ausschalten
/////if (!DZE_SelfTransfuse && ((gearSlotData _control) == "ItemBloodBag")) exitWith {};

if (_button == 1) then {
	//dayzClickTime = time;
	_group = _parent displayCtrl 6902;
	
	_pos = 		ctrlPosition _group;
	_pos set [0,((_this select 2) + 0.48)];
	_pos set [1,((_this select 3) + 0.07)];
	
	_item = gearSlotData _control;
	
	_conf = configFile >> "cfgMagazines" >> _item;
	if (!isClass _conf) then {
		_conf = configFile >> "cfgWeapons" >> _item;
	};
	_name = getText(_conf >> "displayName"); 
	_cfgActions = _conf >> "ItemActions";
    ///// jahan - if selfbloodpack, sonst geht das menu nicht
    if !((gearSlotData _control) == "ItemBloodBag") then {
	_numActions = (count _cfgActions);
    } else {
    _numActions = 0;
    };
	_height = 0;
	
    ///// jahan - selfbloodpack
    if !((gearSlotData _control) == "ItemBloodBag") then {
	//Populate Menu
	for "_i" from 0 to (_numActions - 1) do 
	{
		_menu = 	_parent displayCtrl (1600 + _i);
		_menu ctrlShow true;
		_config = 	(_cfgActions select _i);
		_type = 	getText	(_config >> "text");
		_script = 	getText	(_config >> "script");
		_outputOriented = 	getNumber	(_config >> "outputOriented") == 1;
		_height = _height + (0.025 * safezoneH);
		_compile =  format["_id = '%2' %1;",_script,_item];
		uiNamespace setVariable ['uiControl', _control];
		if (_outputOriented) then {
			/*
				This flag means that the action is output oriented
				the output class will then be transferred to the script
				&& the type used for the name
			*/			
			_array = 	getArray	(_config >> "output");
			_outputClass = _array select 0;
			_outputType = _array select 1;
			_name = getText (configFile >> _outputType >> _outputClass >> "displayName");
			_compile =  format["_id = ['%2',%3] %1;",_script,_item,_array];
		};
		
		_menu ctrlSetText format[_type,_name];
		_menu ctrlSetEventHandler ["ButtonClick",_compile];
	};
   };
Link to comment
Share on other sites

  • 2 months later...

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
  • Advertisement
  • Discord

×
×
  • Create New...