Hi folks,
ever since I play RAVAGE or WW2 missions I wished for a Wirecutter Script. ACE is out of question for me; I don't want to load ACE just for this feature - in fact I've so far almost always found a ready-to-use script or addon solution for all those of the ACE features I actually want to use. Ever since I found the Sapper Tools in IFA3 and ever since I started to build missions using a combo of HEROS SURVIVE and RAVAGE, I wanted to put all those cool items from HEROS to a good use. And this mod has a pliers item, so I thought to myself: "Would be mighty cool if these Sapper Tools or pliers could actually, well, DO something to a barbed wire fence!"
But since I couldn't find a working wirecutter script, I tried my hand at compiling a few lines of code from the BIS WIKI together.
The actual cutting is achieved by the code within
wirecutter.sqf
{ _x hideObjectGlobal true } foreach (nearestObjects [getPos player,["Land_New_WiredFence_5m_F","Land_I44_Buildings_Barbedwire2","Wire"],2]);"SNIPP SNAPP" HintC ["If I can read that and the fence is still standing, I'll have to add the classname to the array LOL"];
Then I add a set of triggers to the mission:
TRIGGER 1
checks if the player has the necessary item for wirecutting in his inventory:
CONDITION:
({_x in (items player + magazines player)}count ["herl_o_pliers"]>=1)
ON ACTIVATION:
pliers=true
ON DEACTICATION:
pliers=false
TRIGGER 2
adds the wirecutting action to the player once he has a set of the required tools in his inventory
CONDITION:
pliers
ON ACTIVATION:
_myaction_2 = player addAction ["Use Wirecutter","scripts\wirecutter.sqf",[],1,false,true] call BIS_fnc_MP;
ON DEACTICATION:
nothing stated
TRIGGER 3
should remove the wirecutting action again once the tools are dropped (this removeAction doesn't work...)
CONDITION:
({_x in (items player + magazines player)}count ["herl_o_pliers"]==0)
ON ACTIVATION:
_myaction_2 = player addAction ["Use Wirecutter","scripts\wirecutter.sqf",[],1,false,true] call BIS_fnc_MP;
ON DEACTICATION:
nothing stated
TRIGGER 3 ALTERNATIVE WAY:
should remove the wirecutting action again once the tools are dropped (this removeAction doesn't work as well...)
CONDITION:
!pliers
ON ACTIVATION:
player removeAction _myaction_2;
ON DEACTICATION:
nothing stated
I have two questions now:
How could I achieve that in a „cleaner“ way without triggers who, AFAIK, can put quite the load on a mission's performance if checked repeatedly?
How could I make the wirecutting action disappear once the player doesn't have the pliers item in his inventory anymore?
THX in Advance for any helpful advice!