Zuerst öffnen wie die Functions.hpp und erstellen dort einen Eintrag bei /core/items
Spoiler anzeigen
class schlaghammer{};
Danach öffnen wir die VItems_Config und tragen einen Eintrag ein
Spoiler anzeigen
class schlaghammer {
variable = "schlaghammer";
displayName = "STR_Item_Schlaghammer";
weight = 1;
buyPrice = 150;
sellPrice = 75;
illegal = true;
edible = -1;
icon = "icons\ico_lockpick.paa";
};
//Nicht vergessen das Item in dem gewünschten Shop einzufügenDanach erstellen wir eine Datei in Core/Items/fn_schlaghammer.sqf
Spoiler anzeigen
#include "..\..\script_macros.hpp"
/*
File: fn_lockpick.sqf
Author: Bryan "Tonic" Boardwine
Weiterentwickelt: Natic
Description:
Script basiert auf Lockpick, wurde aber umgeschrieben!
*/
private ["_curTarget","_distance","_isVehicle","_title","_progressBar","_cP","_titleText","_dice","_badDistance"];
_curTarget = cursorObject;
life_interrupted = false;
if (life_action_inUse) exitWith {};
if (isNull _curTarget) exitWith {}; //Bad type
_distance = ((boundingBox _curTarget select 1) select 0) + 2;
if (player distance _curTarget > _distance) exitWith {}; //Too far
_isVehicle = if ((_curTarget isKindOf "LandVehicle") (_curTarget isKindOf "Ship")
(_curTarget isKindOf "Air")) then {true} else {false};
if (_isVehicle && _curTarget in life_vehicles) exitWith {hint localize "STR_ISTR_Lock_AlreadyHave"};
//More error checks
if (!_isVehicle && !isPlayer _curTarget) exitWith {};
if (!_isVehicle && !(_curTarget getVariable ["restrained",false])) exitWith {};
if (_curTarget getVariable "NPC") exitWith {hint localize "STR_NPC_Protected"};
_title = format [localize "STR_ISTR_hit_Process",if (!_isVehicle) then {"Handcuffs"} else {getText(configFile >> "CfgVehicles" >> (typeOf _curTarget) >> "displayName")}];
life_action_inUse = true; //Lock out other actions
//Setup the progress bar
disableSerialization;
"progressBar" cutRsc ["life_progress","PLAIN"];
_ui = uiNamespace getVariable "life_progress";
_progressBar = _ui displayCtrl 38201;
_titleText = _ui displayCtrl 38202;
_titleText ctrlSetText format ["%2 (1%1)...","%",_title];
_progressBar progressSetPosition 0.01;
_cP = 0.01;
for "_i" from 0 to 1 step 0 do {
if (animationState player != "AinvPknlMstpSnonWnonDnon_medic_1") then {
[player,"AinvPknlMstpSnonWnonDnon_medic_1",true] remoteExecCall ["life_fnc_animSync",RCLIENT];
player switchMove "AinvPknlMstpSnonWnonDnon_medic_1";
player playMoveNow "AinvPknlMstpSnonWnonDnon_medic_1";
};
uiSleep 0.26;
if (isNull _ui) then {
"progressBar" cutRsc ["life_progress","PLAIN"];
_ui = uiNamespace getVariable "life_progress";
_progressBar = _ui displayCtrl 38201;
_titleText = _ui displayCtrl 38202;
};
_cP = _cP + 0.01;
_progressBar progressSetPosition _cP;
_titleText ctrlSetText format ["%3 (%1%2)...",round(_cP * 100),"%",_title];
if (_cP >= 1 !alive player) exitWith {};
if (life_istazed) exitWith {}; //Tazed
if (life_isknocked) exitWith {}; //Knocked
if (life_interrupted) exitWith {};
if (player getVariable ["restrained",false]) exitWith {};
if (player distance _curTarget > _distance) exitWith {_badDistance = true;};
};
//Kill the UI display and check for various states
"progressBar" cutText ["","PLAIN"];
player playActionNow "stop";
if (!alive player life_istazed
life_isknocked) exitWith {life_action_inUse = false;};
if (player getVariable ["restrained",false]) exitWith {life_action_inUse = false;};
if (!isNil "_badDistance") exitWith {titleText[localize "STR_ISTR_Lock_TooFar","PLAIN"]; life_action_inUse = false;};
if (life_interrupted) exitWith {life_interrupted = false; titleText[localize "STR_NOTF_ActionCancel","PLAIN"]; life_action_inUse = false;};
if (!([false,"schlaghammer",1] call life_fnc_handleInv)) exitWith {life_action_inUse = false;};
life_action_inUse = false;
if (!_isVehicle) then {
_curTarget setVariable ["restrained",false,true];
_curTarget setVariable ["Escorting",false,true];
_curTarget setVariable ["transporting",false,true];
} else {
_dice = random(1);
if (_dice < 1) then {
titleText[localize "STR_ISTR_Lock_Success","PLAIN"];
life_vehicles pushBack _curTarget;
if (life_HC_isActive) then {
titleText[localize "STR_ISTR_Lock_Success","PLAIN"];
} else {
titleText[localize "STR_ISTR_Lock_Success","PLAIN"];
};
} else {
if (life_HC_isActive) then {
[0,"STR_ISTR_Lock_FailedNOTF",true,[profileName]] remoteExecCall ["life_fnc_broadcast",west];
titleText[localize "STR_ISTR_Lock_Failed","PLAIN"];
} else {
[0,"STR_ISTR_Lock_FailedNOTF",true,[profileName]] remoteExecCall ["life_fnc_broadcast",west];
titleText[localize "STR_ISTR_Lock_Failed","PLAIN"];;
};
};
};
//ACHTUNG, HIER WURDEN UNNÖTIGE DINGE IM SCRIPT DAGELASSEN