Chris_37 0 Posted March 23, 2018 Im wanting to use BIS_fnc_holdActionAdd however im struggling to add it to a dead player body any ideas? i can easily do a addaction but cant seem to work out what the target: Object - Object the action is attached to" would be for a players dead body. Share this post Link to post Share on other sites
lordfrith 401 Posted March 23, 2018 you could use the "onPlayerKilled.sqf" event script and it would add it to player unit when the player dies? Share this post Link to post Share on other sites
HazJ 1289 Posted March 23, 2018 Another way is addEventHandler command. https://community.bistudio.com/wiki/Arma_3:_Event_Handlers player addEventHandler ["Killed", { params ["_unit", "_killer"]; // add BIS_fnc_holdActionAdd to _unit }]; Share this post Link to post Share on other sites
Chris_37 0 Posted March 24, 2018 T 13 hours ago, HazJ said: Another way is addEventHandler command. https://community.bistudio.com/wiki/Arma_3:_Event_Handlers player addEventHandler ["Killed", { params ["_unit", "_killer"]; // add BIS_fnc_holdActionAdd to _unit }]; 14 hours ago, lordfrith said: you could use the "onPlayerKilled.sqf" event script and it would add it to player unit when the player dies? Thanks guys really helped however can you not use getVariable in the Condition for the action to be shown? Share this post Link to post Share on other sites
lordfrith 401 Posted March 24, 2018 3 minutes ago, Chris_37 said: Thanks guys really helped however can you not use getVariable in the Condition for the action to be shown? how were you trying to use it and what variable? it should be possible i think as long as the syntax is right... could you maybe post an example of what you're trying to do Share this post Link to post Share on other sites
Grumpy Old Man 3545 Posted March 24, 2018 31 minutes ago, Chris_37 said: T Thanks guys really helped however can you not use getVariable in the Condition for the action to be shown? Of course you can, in the conditionShow parameter, take a look at the wiki. Cheers Share this post Link to post Share on other sites
Wiki 1558 Posted March 24, 2018 I did it in my mission Fallen Angel. put a unit name it (eg man1) put a trigger condition of the trigger : !alive man1 activation of the trigger : put the holdaction code (https://community.bistudio.com/wiki/BIS_fnc_holdActionAdd) Share this post Link to post Share on other sites
Chris_37 0 Posted March 24, 2018 45 minutes ago, lordfrith said: how were you trying to use it and what variable? it should be possible i think as long as the syntax is right... could you maybe post an example of what you're trying to do player addEventHandler ["Killed", { params ["_unit", "_killer"]; [ _unit, // Object the action is attached to "Harvest Organs", // Title of the action "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", // Idle icon shown on screen "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", // Progress icon shown on screen "_target getVariable ["Organs",false];", // Condition for the action to be shown "_caller distance _target < 3", // Condition for the action to progress {}, // Code executed when action starts {}, // Code executed on every progress tick {hint "test";}, // Code executed on completion {}, // Code executed on interrupted [], // Arguments passed to the scripts as _this select 3 12, // Action duration 0, // Priority true, // Remove on completion false // Show in unconscious state ] remoteExec ["BIS_fnc_holdActionAdd", [0,2] select isDedicated, _unit]; not sure if i should be using _target or not? i also get this error 12:18:03 Error in expression "_target getVariable ["Organs",false];", 12:18:03 Error position: <Organs",false];", 12:18:03 Error Missing ] Share this post Link to post Share on other sites
lordfrith 401 Posted March 24, 2018 39 minutes ago, Chris_37 said: not sure if i should be using _target or not? i also get this error 12:18:03 Error in expression "_target getVariable ["Organs",false];", 12:18:03 Error position: <Organs",false];", 12:18:03 Error Missing ] in this case _unit is what you're using for _target, see if changing that helps. Share this post Link to post Share on other sites
Chris_37 0 Posted March 24, 2018 thanks not getting any errors now however i am getting no action on the body? Share this post Link to post Share on other sites
lordfrith 401 Posted March 24, 2018 1 hour ago, Chris_37 said: "_caller distance _target < 3", same problem here in that _caller won't be defined, use _killer (or add the _instigator param as that always returns a unit, see event handlers wiki above for details) Share this post Link to post Share on other sites
lordfrith 401 Posted March 24, 2018 Spoiler this addEventHandler ["Killed", //changed to this as i was messing about with one unit in editor { params ["_unit", "_killer", "_instigator"]; [ _unit, "Harvest Organs", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "true", "true", {}, {}, {hint "test";}, {}, [], 12, 0, true, false ] remoteExec ["BIS_fnc_holdActionAdd",[0,2] select isDedicated, _unit];} ]; so... i got this working by placing a civilian unit on editor, pasting your code in, tweaking it till it worked. there were some bracket issues, mostly and i could only get it to work once i'd replaced condition with "true", still going to have a look at the conditions but this should maybe help some syntax issues. Share this post Link to post Share on other sites
Chris_37 0 Posted March 24, 2018 _unit getVariable ["Organs",false] seems to work but its a little temperamental......... also how does the BIS_fnc_holdActionRemove because whats the id? Share this post Link to post Share on other sites
lordfrith 401 Posted March 24, 2018 my bad, i'd not noticed something in the wiki : Quote condShow: String - Condition for the action to be shown. Special variables passed to the script code are _target (unit to which action is attached to) and _this (caller/executing unit) condProgress: String - Condition for the action to progress.If false is returned action progress is halted; arguments passed into it are: _target, _caller, _id, _arguments so _target is fine! sorry mate :D its a lot to absorb in one go... anyways heres the latest test that seems to work as intended. note it only worked when i set "organs" to true... Spoiler this setVariable ["Organs", true]; //using 'this' as testing on placed civ unit this addEventHandler ["Killed", { params ["_unit", "_killer", "_instigator"]; //added _instigator through force of habit... don't think its neccisary ;) [ _unit, "Harvest Organs", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "_target getVariable ['Organs',false]", //organs is already in quotes so use single ' "_target distance _caller < 3", {}, {}, {hint "test";}, {}, [], 12, 0, true, false ] remoteExec ["BIS_fnc_holdActionAdd",[0,2] select isDedicated, _unit];} ]; Share this post Link to post Share on other sites
Chris_37 0 Posted March 24, 2018 26 minutes ago, lordfrith said: my bad, i'd not noticed something in the wiki : so _target is fine! sorry mate :D its a lot to absorb in one go... anyways heres the latest test that seems to work as intended. note it only worked when i set "organs" to true... Hide contents this setVariable ["Organs", true]; //using 'this' as testing on placed civ unit this addEventHandler ["Killed", { params ["_unit", "_killer", "_instigator"]; [ _unit, "Harvest Organs", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "_target getVariable ['Organs',false]", //organs is already in quotes so use single ' "_target distance _caller < 3", {}, {}, {hint "test";}, {}, [], 12, 0, true, false ] remoteExec ["BIS_fnc_holdActionAdd",[0,2] select isDedicated, _unit];} ]; thanks for the help any idea how i could remove that action after a certain amount of time? Share this post Link to post Share on other sites
Wiki 1558 Posted March 24, 2018 Just check my answer. Share this post Link to post Share on other sites
Grumpy Old Man 3545 Posted March 24, 2018 3 hours ago, Chris_37 said: thanks for the help any idea how i could remove that action after a certain amount of time? Keep track of the ID of the action, spawn a function that removes the action from the object after some time, similar to this: //player dies, add some random action to the dead body _ID = [holdactionstuffandparameters] call BIS_fnc_holdActionAdd; _delay = [_ID,player] spawn { params ["_ID","_object"]; sleep 30; _remove = [_object,_ID] call BIS_fnc_holdActionRemove; }; Cheers Share this post Link to post Share on other sites