R4IDER 10 Posted February 23, 2014 Hi, Usually when dealing with event handlers you can use select to get the bit for information you require however with the HitPart event handler it seems you can't select individual bits information but instead only everything. What I am trying to do is select the part of the body that was hit but I am not sure how to go about doing this when so much information is returned. this addEventHandler ["HitPart", { _EX1 = _this select 0; hint format["%1", _EX1] }]; Share this post Link to post Share on other sites
champ-1 40 Posted February 23, 2014 Most of the time bullet going through several bodyparts so you recieving like 3 or so values after one hit. You can see it if you use "player globalChat format..." instead of hint. Share this post Link to post Share on other sites
giallustio 770 Posted February 23, 2014 Use this, not this select 0. So u can check what it returns Share this post Link to post Share on other sites
f2k sel 164 Posted February 23, 2014 I think he's trying to isolate one of the elements. Hitpart is new to me and seems to return an array inside an array so to retrieve an element you need to dig a little. The final select is the pointer to the element, change that to the number you require. this addEventHandler ["HitPart", { _EX1 = _this select 0; hint format["%1", _EX1 select 0] }];// returns unit B 1-1-c:1 or unit name if named https://community.bistudio.com/wiki/ArmA_2:_Event_Handlers#HitPart Share this post Link to post Share on other sites
R4IDER 10 Posted February 23, 2014 Using the following line you can see the body part hit. this addEventHandler ["HitPart", { _EX1 = ((_this select 0) select 5); hint format["%1", _EX1] }]; Share this post Link to post Share on other sites
Kydoimos 916 Posted May 12, 2016 Hiya guys, I'm a little rusty on the HitPart eventHandler - how would one check to see if a particular part was hit using the 'if' and '==' commands? I was considering adding an object with the HitPart eventhandler in the init. config, which triggered a script when that part was damaged? Share this post Link to post Share on other sites
Grumpy Old Man 3545 Posted May 12, 2016 Holy necro batman. Works with all eventhandlers: this addeventHandler ["HitPart",{hint str _this}]; Now just shoot at the object to display the relevant hitpart. Then use the hitpart in an if then statement. Cheers Share this post Link to post Share on other sites
Kydoimos 916 Posted May 12, 2016 Holy necro batman. Works with all eventhandlers: this addeventHandler ["HitPart",{hint str _this}];Now just shoot at the object to display the relevant hitpart. Then use the hitpart in an if then statement. Cheers Lol, thanks mate! Much appreciated! Ha ha, nothing like digging up 3 year old threads! :P Share this post Link to post Share on other sites
M1ke_SK 230 Posted January 6, 2017 According to Wiki (https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HitPart) hitpart event should have parameters like this: _object addEventHandler [ "HitPart", { params ["_target","_shooter","_bullet","_position","_velocity","_selection","_ammo","_direction","_radius","_surface","_direct"]; //code } ]; Instead of, it returns this: _object addEventHandler [ "HitPart", { (_this select 0) params ["_target","_shooter","_bullet","_position","_velocity","_selection","_ammo","_direction","_radius","_surface","_direct"]; //code } ]; @killzone_kid any confirmation about this ? Testing on version: 1.66.139586 1 Share this post Link to post Share on other sites
killzone_kid 1329 Posted January 6, 2017 New format of EH page ate the structure and sample that was there a while ago it seems. I added some notes 2 Share this post Link to post Share on other sites
beako 13 Posted July 27, 2018 (edited) On 1/6/2017 at 7:14 AM, M1ke_SK said: According to Wiki (https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HitPart) hitpart event should have parameters like this: I thought you could run the "HitPart" EH by adding it to the shooter according to this; "While you can add "HitPart" handler to a remote unit, the respectful addEventHandler command must be executed on the shooter's PC and will only fire on shooter's PC as well. The event will not fire if the shooter is not local, even if the target itself is local. Additionally, if the unit gets damaged by any means other than shooter's shooting, "HitPart" will not fire. Because of this, this event handler is most suitable for when the shooter needs feedback on his shooting, such as target practicing or hitmarker creation. If so, how to I get the "HitPart" EH to execute? I tried the following for a MP game for each player that is the shooter: onPlayerRespawn.sqf player addMPEventHandler ["HitPart",{hint str _this}]; ..but I assume it does not fire because it is not local? Edited July 27, 2018 by beako to clarify my request Share this post Link to post Share on other sites
Sunith Sunil Mani 0 Posted December 6, 2020 On 5/12/2016 at 5:30 PM, Grumpy Old Man said: Holy necro batman. Works with all eventhandlers: this addeventHandler ["HitPart",{hint str _this}]; Now just shoot at the object to display the relevant hitpart. Then use the hitpart in an if then statement. Cheers Hey does this work with Simple Targets? I'm trying to use hitpart to tell me where on a target my bullet hit. Do you have any idea how to do that? Share this post Link to post Share on other sites