Naiss 28 Posted August 9, 2014 (edited) okey so i know there is a way to sethit but is there a way to gethit?? like if the player is shoot in the legs i can do like a hint gethit and it will tell me where the player is hit at in the hint Edited August 9, 2014 by lifemanlive Share this post Link to post Share on other sites
Grumpy Old Man 3549 Posted August 9, 2014 In the units init field: this addEventhandler ["HitPart",{hint str _this}]; for more info: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers cheers Share this post Link to post Share on other sites
Naiss 28 Posted August 9, 2014 okey, but how would i make a function to like if i got shoot in the head it will run another function? Share this post Link to post Share on other sites
das attorney 858 Posted August 9, 2014 In init line: this addEventHandler ["hitpart", {if ("head" in (_this select 0 select 5)) then {RUN_YOUR_FUNCTION_HERE}}]; Share this post Link to post Share on other sites
Naiss 28 Posted August 9, 2014 that worked but what if i want to have head,legs,hands and chest XD Share this post Link to post Share on other sites
das attorney 858 Posted August 9, 2014 Then modify the condition. I'm not going to code it for you. Share this post Link to post Share on other sites
Naiss 28 Posted August 9, 2014 okey just wanted to make sure im doing right :P ---------- Post added at 12:45 ---------- Previous post was at 12:44 ---------- if you minde me ask do you think this would work this addEventHandler ["hitpart", {if ("head","Hands","Legs", in (_this select 0 select 5)) then {RUN_YOUR_FUNCTION_HERE}}]; Share this post Link to post Share on other sites
das attorney 858 Posted August 9, 2014 this addEventHandler ["hitpart", {if ("head" in (_this select 0 select 5) or {"hands" in (_this select 0 select 5)} or {"legs" in (_this select 0 select 5)}) then {RUN_YOUR_FUNCTION_HERE}}]; You would be better off passing _this to the function and checking there. Share this post Link to post Share on other sites
Naiss 28 Posted August 9, 2014 dude thanks!! ---------- Post added at 13:41 ---------- Previous post was at 13:12 ---------- okey so i tryed to add diffirent functions for every hit part but i just can't get it to work this is what i tryed to do: player addEventHandler ["hitpart", {if ("head" in (_this select 0 select 5) then {_this execVM "Head.sqf"} else {"hands" in (_this select 0 select 5) then {_this execVM "Hands.sqf"} else {"chest" in (_this select 0 select 5) then {_this execVM "Chest.sqf"} else {"legs" in (_this select 0 select 5)) then {_this execVM "Legs.sqf"}}]; Share this post Link to post Share on other sites
Grumpy Old Man 3549 Posted August 9, 2014 dude thanks!!---------- Post added at 13:41 ---------- Previous post was at 13:12 ---------- okey so i tryed to add diffirent functions for every hit part but i just can't get it to work this is what i tryed to do: player addEventHandler ["hitpart", {if ("head" in (_this select 0 select 5) then {_this execVM "Head.sqf"} else {"hands" in (_this select 0 select 5) then {_this execVM "Hands.sqf"} else {"chest" in (_this select 0 select 5) then {_this execVM "Chest.sqf"} else {"legs" in (_this select 0 select 5)) then {_this execVM "Legs.sqf"}}]; Uh maybe I'm pointing out the obvious but that "if then else then else then else then" structure is absolutely messed up. Share this post Link to post Share on other sites
Naiss 28 Posted August 9, 2014 ye i where thinking that it where abit messed up but where not sure how i would have done that, first time im working with eventhandler ---------- Post added at 14:09 ---------- Previous post was at 14:07 ---------- any ida how i would set this up? already tested everythink i can think about Share this post Link to post Share on other sites
das attorney 858 Posted August 9, 2014 At least he's trying :) Too many people won't try anything and post up on this forum saying "what if I did.......?". As if trying some wrong code would break their PC. In the units initbox: this addEventHandler ["hitpart", {(_this select 0) call YOURFUNCTIONNAME}]; In init.sqf: YOURFUNCTIONNAME = { _selectionArr = _this select 5; systemChat format ["%1", _selectionArr]; call { if ("head" in _selectionArr) exitWith { // some code }; if ("chest" in _selectionArr) exitWith { // different code }; if ("hands" in _selectionArr) exitWith { // other code }; }; }; BTW - I think the selection names you have put in there like "chest" and "hands" might not work. You will need to test by reading the systemChat text and seeing what they are actually called when you shoot the unit. Share this post Link to post Share on other sites
Naiss 28 Posted August 9, 2014 wow,thank you so mutch you dont know how long i have been trying to get this done xD love you (no homo XD) Share this post Link to post Share on other sites
Caiden 1 Posted August 10, 2014 Lifeman, scripting is not your thing buddy. You're better off stealing other people's stuff like you usually do... Share this post Link to post Share on other sites
Naiss 28 Posted August 10, 2014 i hope you understand that i dont steal stuff!? im new to evenhandler so thats why i did not understand how to do it. Share this post Link to post Share on other sites