Jump to content
Sign in to follow this  
Amazed

Add "hit" eventhandler to arbitrary objects (like a char eg) - That possible?

Recommended Posts

Hey!

I am trying to add "hit" EventHandlers to arbitrary objects to monitor for damage/hits received.

What I tried:

init line of object:

this addEventHandler ["Hit", {_this execVM "hint.sqf"}]

hint.sqf:

hint "hit";

Works on pop-up targets but won't work on a barrel.

What am I doing wrong?

Thanks in advance!

Edited by Amazed

Share this post


Link to post
Share on other sites

Some objects don't have a damage model (afaik no objects listed in Objects (Small) have any damage model whatsoever) so you will not be able to monitor damage on them. A regular or red barrel should be no issue however.

Share this post


Link to post
Share on other sites

Yup red barrel works.

init barrel:

this addEventHandler ["HandleDamage", {_this execVM "hint.sqf"}];

hint.sqf:

hint "damage";
sleep 2;
hint "";
_this setDamage 0;

But execution halts after I use "_this".

So the same script written like this only works up the the "_this":

hint "damage";
_this setDamage 0;
sleep 2;
hint "";

Why is that?

Oh also what is the smallest object you know that has a hit model? :)

Share this post


Link to post
Share on other sites
Some objects don't have a damage model (afaik no objects listed in Objects (Small) have any damage model whatsoever) so you will not be able to monitor damage on them. A regular or red barrel should be no issue however.

not quit right some small objects (skeet disk and evidence stuff) can have a hit eventhandler on them.

I did think about attaching the skeet disk to the front of the speaker cone to detect damage.

Skeet disk is the smallest I think.

Share this post


Link to post
Share on other sites

small objects

this is why it isn't working

hint "damage";
sleep 1;
hint str _this;// this shows you that it is an array of information.

(_this select 0) setDamage 0; // this selects the correct item from the array
sleep 2;
hint "";

Edited by F2k Sel

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  

×