Alice Kingsleigh : hier nochmal eine geänderte Version, falls Du lust und zeit hast können wir uns das heute abend gemeinsam anschauen.
Code
#include "..\..\script_macros.hpp"
/*
File: fn_dropItems.sqf
Author: moeck
Description:
Called on death, Player drops any 'virtual' items and items. They are stored in a plastic case.
*/
private ["_obj","_unit","_item","_value"];
private _unit = _this select 0;
private _pos = _unit modelToWorld[0,3,0];
_pos = [(_pos select 0),(_pos select 1),0];
private _obj = "Land_PlasticCase_01_small_F" createVehicle _pos;
clearWeaponCargoGlobal _obj;
clearItemCargoGlobal _obj;
clearMagazineCargoGlobal _obj;
clearBackpackCargoGlobal _obj;
private _trunk =[];
private _weight = 0;
{
private _value = 0;
private _iweight = 0;
private _itemName= "";
if (_x isEqualType "") then {_item = _x;} else {_item = configName _x};
if (_item isEqualTo "life_cash") then {
_value = CASH;
_itemName = "CASH";
} else {
_value = ITEM_VALUE(_item);
_iweight = (([_item] call life_fnc_itemWeight) * _value);
_itemName = ITEM_VARNAME(_item);
};
_weight = _weight +_iweight;
_trunk pushBack [_item,_value];
missionNamespace setVariable [_itemName,0];
} forEach (("true" configClasses (missionConfigFile >> "VirtualItems")) + ["life_cash"]);
diag_log format ["V-Items: %1",str(_trunk)];
_obj setVariable["Trunk",[_trunk,_weight],true];
if (!(uniform _unit isEqualTo "")) then {
{_obj addItemCargoGlobal [_x, 1];diag_log format ["Uniform: %1",_x];} forEach (uniformItems _unit);
};
if (!(backpack _unit isEqualTo "")) then {
{_obj addItemCargoGlobal [_x, 1];diag_log format ["Backpack: %1",_x]} forEach (backpackItems _unit);
};
if (!(vest _unit isEqualTo "")) then {
{_obj addItemCargoGlobal [_x, 1];diag_log format ["Vest: %1",_x]} forEach (vestItems _unit);
};
if (count (primaryWeaponItems _unit) > 0) then {
{_obj addItemCargoGlobal [_x, 1];diag_log format ["Weaponitems: %1",_x]} forEach (primaryWeaponItems _unit);
};
if (count (handgunItems _unit) > 0) then {
{_obj addItemCargoGlobal [_x, 1];diag_log format ["Pistolitems: %1",_x]} forEach (handGunItems _unit);
};
if !(primaryWeapon _unit isEqualTo "") then {_obj addItemCargoGlobal [(primaryWeapon _unit), 1];diag_log format ["Weapon: %1",(primaryWeapon _unit)];};
if !(handgunWeapon _unit isEqualTo "") then {_obj addItemCargoGlobal [(handgunWeapon _unit), 1];diag_log format ["Pistol: %1",(handgunWeapon _unit)];};
removeAllWeapons _unit;
{player removeMagazine _x;} forEach (magazines _unit);
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeGoggles _unit;
removeHeadGear _unit;
{
_unit unassignItem _x;
_unit removeItem _x;
} forEach (assignedItems _unit);
if (hmd _unit != "") then {
_unit unlinkItem (hmd _unit);
};
Alles anzeigen