Jump to content

DayZ Style Morphine in A3E


Grahame

Recommended Posts

In vanilla Epoch 1.1 the use of morphine basically is just as an FAK with a different name... it heals all damage with a couple of side effects on toxicity, stamina and blood pressure. I rather liked the old dayz where morphine was specifically required to fix a broken leg... so I changed some code here and added some there and... voila! Now you can have morphine that will only fix a broken leg and First Aid Kits that will not!

First let's ensure that First Aid Kits do not heal broken legs. This is done by making them completely heal all body parts except for broken legs, which they will heal to a damage minumum of 0.51 (a broken leg in ARMA3 and Epoch is one damaged greater than 0.5). So, let's change the interaction for FAKs so that they will do this. Change lines 337-362 in epoch_code/compile/EPOCH_consumeItem.sqf from:

	case 13: { //Heal Player
		_vehicles = player nearEntities[["Epoch_Male_F", "Epoch_Female_F"], 6];
		_vehicle = cursorTarget;
		if !(_vehicle in _vehicles) then {
			_vehicle = player;
		};
		if (damage _vehicle != 0 || {_x > 0} count ((getallhitpointsdamage _vehicle) select 2) > 0) then {
			if (_item call _removeItem) then {
				[_vehicle] spawn {
					params ["_vehicle"];
					if (player == vehicle player) then {
						closeDialog 0;
						player playMove 'AinvPknlMstpSnonWrflDnon_medic0';
						player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd';
						uisleep 5;
					};
					[_vehicle,["ALL",0],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2];
					if (_vehicle isEqualTo player) then {
						["Healed yourself", 5] call Epoch_message;
					} else {
						["Healed other player", 5] call Epoch_message;
					};
				};
			};
		};
	};

to:

    case 13: { //Heal Player
        _vehicles = player nearEntities[["Epoch_Male_F", "Epoch_Female_F"], 6];
        _vehicle = cursorTarget;
        if !(_vehicle in _vehicles) then {
            _vehicle = player;
        };

        if (damage _vehicle != 0 || {_x > 0} count ((getallhitpointsdamage _vehicle) select 2) > 0) then {
            if (_item call _removeItem) then {
                [_vehicle] spawn {
                    params ["_vehicle"];
                    if (player == vehicle player) then {
                        closeDialog 0;
                        player playMove 'AinvPknlMstpSnonWrflDnon_medic0';
                        player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd';
                        uisleep 5;
                    };
                    _currentDMG = 0;
                    {
                        _currentDMG = _x;
                        if (_forEachIndex != 10) then {
                            [_vehicle,[[_forEachIndex,0]],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2];
                        } else {
                            if (_currentDMG > 0.5) then {
                                [_vehicle,[[_forEachIndex,0.51]],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2];                            
                            } else {
                                [_vehicle,[[_forEachIndex,0]],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2];
                            };
                        };
                    }forEach ((getAllHitPointsDamage _vehicle) param [2,[]]);
                    if (_vehicle isEqualTo player) then {
                        ["Healed yourself", 5] call Epoch_message;
                    } else {
                        ["Healed other player", 5] call Epoch_message;
                    };
                };
            };
        };
    };

Now if you have a broken leg and you use a First Aid Kit then it will still be broken. If your leg was not broken you will be fully healed.

So, with that done, let's turn to the morphine. All this now will do is heal a broken leg... nothing else. If your leg is not broken you will get a message informing you of that and you'll keep the injector. Change lines 383-414 in epoch_code/compile/EPOCH_consumeItem.sqf from:

	case 16: { // Morphine
		_vehicle = player;
		if (damage _vehicle != 0 || {_x > 0} count ((getallhitpointsdamage _vehicle) select 2) > 0) then {
			if (call _unifiedInteract) then {
				[_vehicle,_item] spawn {
					params ["_vehicle","_item"];
					if (player == vehicle player) then {
						closeDialog 0;
						player playMove 'AinvPknlMstpSnonWrflDnon_medic0';
						player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd';
						uisleep 5;
					};
					private _out = [];
					{
						if (_x > 0) then {
							_out pushback [_foreachindex,((_x - 0.2) min 0.45) max 0];
						};
					}forEach ((getAllHitPointsDamage _vehicle) param [2,0]);
					if (_out isequalto []) then {
						if ((damage _vehicle) > 0) then {
							_out = ["ALL",0];
						};
					};
					if !(_out isequalto []) then {
						[_vehicle,_out,player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2];
					};
					[format["Used %1 on yourself",_item call EPOCH_itemDisplayName], 5] call Epoch_message;
				};
			};
		} else {
			[format["%1 is not needed at this time",_item call EPOCH_itemDisplayName], 5] call Epoch_message;
		};
	};

to:

	case 16: { // Morphine
		_vehicles = player nearEntities[["Epoch_Male_F", "Epoch_Female_F"], 6];
		_vehicle = cursorTarget;
		if !(_vehicle in _vehicles) then {
			_vehicle = player;
		};

		_legDamage = _vehicle getHitPointDamage "HitLegs";
		if (_legDamage > 0.5) then {
			if (_item call _removeItem) then {
				[_vehicle] spawn {
					params ["_vehicle"];
					if (player == vehicle player) then {
						closeDialog 0;
						player playMove 'AinvPknlMstpSnonWrflDnon_medic0';
						player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd';
						uisleep 5;
					};
					[_vehicle,[["HitLegs",0.5]],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2];

					if (_vehicle isEqualTo player) then {
						["Injected yourself with morphine", 5] call Epoch_message;
					} else {
						["Injected other player with morphine", 5] call Epoch_message;
					};
				};
			};
		} else {
			["Nothing needs morphine at this time... shame!", 5] call Epoch_message;
		};
	};

You will need to subsequently use a First Aid Kit to remove that last 0.5 of damage on your legs... the morphine just makes it feel like you are healed fully, and boy, does it!

That's it... DayZ Style morphine with two simple changes.

Link to comment
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
  • Advertisement
  • Discord

×
×
  • Create New...