Jump to content
Sign in to follow this  
ffur2007slx2_5

How can I get the exact position when a grenade exploded?

Recommended Posts

I've tried several ways like:

player addeventhandler ["fired",{
if ((_this select 1) == "Throw") then {
nul = [_this select 6] execvm "Pos.sqf";
}; // Suppose I'm throwing a grenade
}];
//Pos.sqf
_Grenade = _this select 0;
WaitUntil {!alive _Grenade};
hint format ["%1",position _Grenade];//No display, nothing happens.

damage _grenade == 0 // It also doesn't work, I can't get the object position.

isNull _Grenade //Seems good but if I use this condition the grenade itself has already been deleted by default which means I can't get it's position as well.

(position _Grenade select 2) == 0//I can get the position only after the grenade is staying on the ground, cannot be syncronized with the explosion.

My purpose is to create heavy dust when a grenade exploded, everything's done except the most important part, so how can i get the exact position when a grenade exploded?

Edited by ffur2007slx2_5

Share this post


Link to post
Share on other sites

pos.sqf returns [0,0,0], because you are trying to retrieve position of object, that already doesn't exist (position _grenade used after _grenade is not longer alive - logical consequence is lack of the position). Try such pos.sqf instead:

_Grenade = _this select 0;

_Gpos = position _grenade;
WaitUntil {if (alive _grenade) then {_Gpos = position _grenade};(!alive _Grenade)};
hint format ["GPos: %1",_Gpos];

Share this post


Link to post
Share on other sites

Hey, thanks mate, I'll try it asap!

---------- Post added at 08:08 AM ---------- Previous post was at 07:36 AM ----------

Fantastic! It works! Thanks mate!

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  

×