if(_typeOfCursorTarget in Veh_Med && _isVehicle && !_isMan &&_isAlive && !_isMan && !locked _cursorTarget && !(_cursorTarget isKindOf "Bicycle") && (player distance _cursorTarget < 5)) then {
if (s_player_assign_patient < 0) then {
s_player_assign_patient = player addAction ["<t color='#0059FF'>Get in as Patient</t>", "EPOCHMODS\Medical\patient_loadin.sqf", cursorTarget, 1, false, true, "",""];
};
} else {
player removeAction s_player_assign_patient;
s_player_assign_patient = -1;
};
You might want to edit the Path tho...
Actual patient_loadin.sqf:
// Author: Martin - Thanks to SchwEde (http://epochmod.com/forum/index.php?/user/15060-schwede/)
private ["_i","_tempArr","_veh","_changed","_getArrayPos","_getArrayPosCount","_getArrayPosCountSet","_getVeh","_hasCargoFood","_hasCargoWater","_DaFood","_DaWater","_lastindex","_timeout","_unit","_vehicle","_posCommander","_posCargo","_itemsCargo","_itemsCargoObjects","_itemsCargoCount","_itemsCargoCountSet","_itemsMedical","_itemsDrink","_itemsFood","_removedSuccess"];
disableserialization;
//////////////////////
//Remove Items?///////
_removeItems = true;//
//////////////////////
//Show Message?///////
_showMessage = true;//
//////////////////////
//////////////////////
_unit = player;
_cursorTarget = cursorTarget;
_itemsMedical = ["ItemBandage","ItemEpiniphrine","ItemMorphine","ItemHeatPack","ItemBloodbag","ItemAntibiotic","ItemPainkiller"];
_itemsFood = ["FoodSteakRaw","FoodSteakCooked","FoodCanBakedBeans","FoodCanSardines","FoodCanFrankBeans","FoodCanPasta","FoodmeatRaw","FoodmuttonRaw","FoodchickenRaw","FoodrabbitRaw","FoodbaconRaw","FoodbeefRaw","FoodmeatCooked","FoodmuttonCooked","FoodchickenCooked","FoodbaconCooked","FoodrabbitCooked","FoodbeefCooked","FoodMRE","FoodPistachio","FoodNutmix"];
_itemsDrink = ["ItemWaterbottle","ItemSodaCoke","ItemSodaPepsi","ItemSodaMdew","ItemSodaMtngreen","ItemSodaR4Z0R","ItemSodaClays","ItemSodaSmasht","ItemSodaDrWaste","ItemSodaLemonade","ItemSodaLvg","ItemSodaMzly","ItemSodaRabbit","ItemSodaRbull","ItemSodaOrangeSherbet","ItemWaterbottleBoiled"];
_posCommander = _cursorTarget emptyPositions "Commander";
_posCargo = _cursorTarget emptyPositions "Cargo";
if (_posCommander != 0 || _posCargo != 0) then {
if (_posCommander != 0) then {
_unit assignAsCommander _cursorTarget;
[_unit] orderGetIn true;
_unit moveInCommander _cursorTarget;
} else {
_unit assignAsCargo _cursorTarget;
[_unit] orderGetIn true;
_unit moveInCargo [_cursorTarget,1]; //0 Is the Passenger and 1 is the "invisible" (i think?)
};
_timeout = 10;
while {_timeout > 0} do {
cutText["~~ You are being Healed... ~~\n~~ Please wait ~~","PLAIN",0.5];
sleep 1;
_timeout = _timeout - 1;
if (vehicle player != player) then {
vehicle player lockDriver true;
vehicle player lockCargo true;
vehicle player setVehicleLock "LOCKED";
} else {
_cursorTarget lockDriver true;
_cursorTarget lockCargo true;
_cursorTarget setVehicleLock "LOCKED";
};
};
if (vehicle player != player) then {
_itemsCargo = getMagazineCargo (vehicle player);
} else {
_itemsCargo = getMagazineCargo cursorTarget;
};
_itemsCargoObjects = _itemsCargo select 0;
_itemsCargoCount = _itemsCargo select 1;
_changed = false;
/**
Everything related to BloodBag
(Low Blood, Blurry Screen)
**/
if ("ItemBloodbag" in _itemsCargoObjects) then {
'dynamicBlur' ppEffectAdjust [0];
'dynamicBlur' ppEffectCommit 5;
r_player_blood = r_player_bloodTotal;
r_player_lowblood = false;
player setVariable['USEC_lowBlood',false,true];
player setVariable['USEC_BloodQty',12000,true];
player setdamage 0;
if (_removeItems) then {
//Make sure the Var is Empty
_getArrayPos = 0;
_getArrayPosCount = 0;
_getArrayPosCountSet = 0;
_getArrayPos = _itemsCargoObjects find "ItemBloodbag"; // Testing this instead
_getArrayPosCount = _itemsCargoCount select _getArrayPos; //_result is the Object Count of the Object
_itemsCargoCountSet = _getArrayPosCount - 1;
_itemsCargoCount set [_getArrayPos, _itemsCargoCountSet];
_changed = true;
if (_showMessage) then {
systemChat ("A BloodBag has been removed from the Vehicle Inventory");
};
};
};
/**
Everything related to Painkillers
(Camera Shake)
**/
if ("ItemPainkiller" in _itemsCargoObjects) then {
r_player_inpain = false;
resetCamShake;
player setVariable['USEC_inPain',false,true];
if (_removeItems) then {
//Make sure the Var is Empty
_getArrayPos = 0;
_getArrayPosCount = 0;
_getArrayPosCountSet = 0;
_getArrayPos = _itemsCargoObjects find "ItemPainkiller"; // Testing this instead
_getArrayPosCount = _itemsCargoCount select _getArrayPos; //_result is the Object Count of the Object
_itemsCargoCountSet = _getArrayPosCount - 1;
_itemsCargoCount set [_getArrayPos, _itemsCargoCountSet];
_changed = true;
if (_showMessage) then {
systemChat ("A Pack of Painkillers has been removed from the Vehicle Inventory");
};
};
};
/**
Everything related to Antibiotics
(Coughing, Loosing Blood?)
**/
if ("ItemAntibiotic" in _itemsCargoObjects) then {
r_player_infected = false;
player setVariable['USEC_infected',false,true];
if (_removeItems) then {
//Make sure the Var is Empty
_getArrayPos = 0;
_getArrayPosCount = 0;
_getArrayPosCountSet = 0;
_getArrayPos = _itemsCargoObjects find "ItemAntibiotic"; // Testing this instead
_getArrayPosCount = _itemsCargoCount select _getArrayPos; //_result is the Object Count of the Object
_itemsCargoCountSet = _getArrayPosCount - 1;
_itemsCargoCount set [_getArrayPos, _itemsCargoCountSet];
_changed = true;
if (_showMessage) then {
systemChat ("A Pack of Antibiotics has been removed from the Vehicle Inventory");
};
};
};
/**
Everything related to Bandages
(Loosing Blood)
**/
if ("ItemBandage" in _itemsCargoObjects) then {
dayz_sourceBleeding = objNull;
player setVariable['USEC_injured',false,true];
r_player_injured = false;
_display = uiNameSpace getVariable 'DAYZ_GUI_display';
_control = _display displayCtrl 1303;
_control ctrlShow false;
if (_removeItems) then {
//Make sure the Var is Empty
_getArrayPos = 0;
_getArrayPosCount = 0;
_getArrayPosCountSet = 0;
_getArrayPos = _itemsCargoObjects find "ItemBandage"; // Testing this instead
_getArrayPosCount = _itemsCargoCount select _getArrayPos; //_result is the Object Count of the Object
_itemsCargoCountSet = _getArrayPosCount - 1;
_itemsCargoCount set [_getArrayPos, _itemsCargoCountSet];
_changed = true;
if (_showMessage) then {
systemChat ("A Bandage has been removed from the Vehicle Inventory");
};
};
};
/**
Everything related to Heatpacks
(Being Cold, Coughing?)
**/
if ("ItemHeatPack" in _itemsCargoObjects) then {
dayz_temperatur = 37;
if (_removeItems) then {
//Make sure the Var is Empty
_getArrayPos = 0;
_getArrayPosCount = 0;
_getArrayPosCountSet = 0;
_getArrayPos = _itemsCargoObjects find "ItemHeatPack"; // Testing this instead
_getArrayPosCount = _itemsCargoCount select _getArrayPos; //_result is the Object Count of the Object
_itemsCargoCountSet = _getArrayPosCount - 1;
_itemsCargoCount set [_getArrayPos, _itemsCargoCountSet];
_changed = true;
if (_showMessage) then {
systemChat ("A Heat Pack has been removed from the Vehicle Inventory");
};
};
};
/**
Everything related to Morphine
(Fractures)
**/
if ("ItemMorphine" in _itemsCargoObjects) then {
_selection = 'legs';
_damage = 0;
player setHit[_selection,_damage];
r_fracture_legs = false;
r_fracture_arms = false;
player setVariable['hit_legs',0,true];
player setVariable['hit_hands',0,true];
_display = uiNameSpace getVariable 'DAYZ_GUI_display';
_control = _display displayCtrl 1203;
_control ctrlShow false;
if (_removeItems) then {
//Make sure the Var is Empty
_getArrayPos = 0;
_getArrayPosCount = 0;
_getArrayPosCountSet = 0;
_getArrayPos = _itemsCargoObjects find "ItemMorphine"; // Testing this instead
_getArrayPosCount = _itemsCargoCount select _getArrayPos; //_result is the Object Count of the Object
_itemsCargoCountSet = _getArrayPosCount - 1;
_itemsCargoCount set [_getArrayPos, _itemsCargoCountSet];
_changed = true;
if (_showMessage) then {
systemChat ("A Morphine Injection has been removed from the Vehicle Inventory");
};
};
};
/**
Everything related to Epi Pens
(Unconscious? - You can't really use scroll wheel, if unconscious, so this is probably impossible)
**/
if ("ItemEpiniphrine" in _itemsCargoObjects) then {
r_player_unconscious = false;
player setVariable['NORRN_unconscious',false,true];
player setVariable['unconsciousTime',0,true];
if (_removeItems) then {
//Make sure the Var is Empty
_getArrayPos = 0;
_getArrayPosCount = 0;
_getArrayPosCountSet = 0;
_getArrayPos = _itemsCargoObjects find "ItemEpiniphrine"; // Testing this instead
_getArrayPosCount = _itemsCargoCount select _getArrayPos; //_result is the Object Count of the Object
_itemsCargoCountSet = _getArrayPosCount - 1;
_itemsCargoCount set [_getArrayPos, _itemsCargoCountSet];
_changed = true;
if (_showMessage) then {
systemChat ("A Epinephrine Injection has been removed from the Vehicle Inventory");
};
};
};
/**
Everything related to Food
(Hungry)
**/
_hasCargoFood = false;
{
if (_x in _itemsCargoObjects) exitWith
{
_hasCargoFood = true;
_DaFood = _x;
};
} count _itemsFood;
if (_hasCargoFood) then {
dayz_hunger = 0;
if (_removeItems) then {
//Make sure the Var is Empty
_getArrayPos = 0;
_getArrayPosCount = 0;
_getArrayPosCountSet = 0;
_getArrayPos = _itemsCargoObjects find _DaFood; // Testing this instead
_getArrayPosCount = _itemsCargoCount select _getArrayPos; //_result is the Object Count of the Object
_itemsCargoCountSet = _getArrayPosCount - 1;
_itemsCargoCount set [_getArrayPos, _itemsCargoCountSet];
_changed = true;
if (_showMessage) then {
systemChat (format["%1 has been removed from the Vehicle Inventory", _DaFood]);
};
};
};
/**
Everything related to Water
(Thirsty)
**/
_hasCargoWater = false;
{
if (_x in _itemsCargoObjects) exitWith
{
_hasCargoWater = true;
_DaWater = _x;
};
} count _itemsDrink;
if (_hasCargoWater) then {
dayz_thirst = 0;
if (_removeItems) then {
//Make sure the Var is Empty
_getArrayPos = 0;
_getArrayPosCount = 0;
_getArrayPosCountSet = 0;
_getArrayPos = _itemsCargoObjects find _DaWater; // Testing this instead
_getArrayPosCount = _itemsCargoCount select _getArrayPos; //_result is the Object Count of the Object
_itemsCargoCountSet = _getArrayPosCount - 1;
_itemsCargoCount set [_getArrayPos, _itemsCargoCountSet];
_changed = true;
if (_showMessage) then {
systemChat (format["%1 has been removed from the Vehicle Inventory", _DaWater]);
};
};
};
if (_changed) then {
//This is just a double check...
if (vehicle player != player) then {
_veh = vehicle player;
clearMagazineCargo _veh;
//Format the array and put the items back in
_i = 0;
{
//If the Count is 0, we jump that entry
if ((_itemsCargoCount select _i) == 0) then {_i = _i + 1;};
//Make sure to clear the _tempArr
_tempArr = [];
// Name of Item Count of Item
_tempArr = [(_itemsCargoObjects select _i),(_itemsCargoCount select _i)];
//Actually put it in
_veh addMagazineCargoGlobal _tempArr;
//Add to _i, so we can do this for all items...
_i = _i + 1;
} foreach _itemsCargoObjects;
//Make sure to unlock vehicle again after finish
vehicle player lockDriver false;
vehicle player lockCargo false;
vehicle player setVehicleLock "UNLOCKED";
//Send it to the Hive
PVDZE_veh_Update = [_veh,"gear"];
publicVariableServer "PVDZE_veh_Update";
} else {
clearMagazineCargo cursorTarget;
_i = 0;
{
//If the Count is 0, we jump that entry
if ((_itemsCargoCount select _i) == 0) then {_i = _i + 1;};
//Make sure to clear the _tempArr
_tempArr = [];
// Name of Item Count of Item
_tempArr = [(_itemsCargoObjects select _i),(_itemsCargoCount select _i)];
//Actually put it in
cursorTarget addMagazineCargoGlobal _tempArr;
//Add to _i, so we can do this for all items...
_i = _i + 1;
} foreach _itemsCargoObjects;
//Make sure to unlock vehicle again after finish
_cursorTarget lockDriver false;
_cursorTarget lockCargo false;
_cursorTarget setVehicleLock "UNLOCKED";
//Send it to the Hive
PVDZE_veh_Update = [_cursorTarget,"gear"];
publicVariableServer "PVDZE_veh_Update";
};
} else {
//Nothing changed, unlock the Vehicle
vehicle player lockDriver false;
vehicle player lockCargo false;
vehicle player setVehicleLock "UNLOCKED";
};
sleep 5;
} else {
cutText["~~ No room in target Vehicle! ~~","PLAIN",0.5];
};
Question
Guest
// EDIT: I managed to solve all Problems...
In Variables.sqf add:
This allows you to have a custom List...
In fn_selfActions.sqf, add:
You might want to edit the Path tho...
Actual patient_loadin.sqf:
Link to comment
Share on other sites
20 answers to this question
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now