Jump to content
Sign in to follow this  
Naiss

get hit location??

Recommended Posts

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 by lifemanlive

Share this post


Link to post
Share on other sites

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

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

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

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

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

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
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

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

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

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

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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×