Jump to content
Sign in to follow this  
snkman

Simulate impacts beside player

Recommended Posts

Hey Guy's,

just wondering is it possible to detect, if a grenade explodes beside a player?

I wanna to make some effect's like in Call of Duty if a grenade explodes right beside you you get a strange beeeeeep and a blackout for some secounds. smile_o.gif

So i thought would be cool to have this in ArmA too.

Share this post


Link to post
Share on other sites

Yeah that's what i was thinking about too.

I still did some stuff with eventHandlers but i don't know how to find out if a player was damaged by a grenade or impact...

So may with the eventHandler "Hit" or "Dammaged" but what should i put in the condition of the eventHandler? crazy_o.gif

Share this post


Link to post
Share on other sites

Actually I dont even know how to assign an EH to something whistle.gif But hey:

Quote[/b] ]Triggered when the unit is hit/damaged.

Is not always triggered when unit is killed by a hit.

Most of the time only the killed event handler is triggered when a unit dies from a hit.

The hit EH will not necessarily fire if only minor damage occurred (e.g. firing a bullet at a tank), even though the damage increased.

Isnt that enough?

Share this post


Link to post
Share on other sites

Yes but the "Hit" eventHandler also trigges if a unit is hit by a bullet but i need something it only triggers if a unit was wounded by a grenade and or impact.

Share this post


Link to post
Share on other sites

Wouldnt it be possible to check this by the

# causedBy: Object - Object that caused the damage.

Contains the unit itself in case of collisions.

parm? Just a guess you may check which class the object belongs to.

Share this post


Link to post
Share on other sites

Hmm... Yes sounds good wink_o.gif well now the only think i have to do is to find out how to script that. smile_o.gif

If there are any suggestions plz let me know!

Share this post


Link to post
Share on other sites

To "trace debug" the whole thing, have the player chat the object

Passed array: [unit, causedBy, damage]

* unit: Object - Object the event handler is assigned to

* causedBy: Object - Object that caused the damage.

Contains the unit itself in case of collisions.

* damage: Number - Level of damage caused by the hit

e.g.

player groupChat format["causedBy: %1",_causedBy];

I'll make an example later if needed.

Share this post


Link to post
Share on other sites

Yes plz this would be very cool becouse i really don't understand how to use the causedBy thing.

I think there also should some ammo types definied in the eventhandler like: GrenadeHand, G_40mm_HE, Sh_125_HE so the eventhandler knows when he should be exec.

Share this post


Link to post
Share on other sites

It seems this is not what you are looking for confused_o.gif

in the initline of the unit:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addEventHandler["hit",{nil = _this spawn compile preprocessFile "roflcopter.sqf"}];

(maybe the wrong way to access the script-file?)

roflcopter.sqf

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unit = _this select 0;

_causedBy = _this select 1;

_damage = _this select 2;

player sideChat format["_unit:%1, causedBy:%2, damage:%3",_unit,_causedBy,_damage];

unit:

returns the fellow who took damage.

causedBy:

returns the one throwing a grenade, firing a bullet and etc..

damage:

The amount of damage taken by unit.

Share this post


Link to post
Share on other sites

Well nope that's not what im looking for. smile_o.gif

But anyway thanks for the example i think i now do understand it a bit more. wink_o.gif

Share this post


Link to post
Share on other sites

You need to use the fired event handle.

Here is an example mission and scripts that allow you to execute a script or code, when a Grenade is thrown. You can test for a Grenade landing within a specified range of a player.

UNN_GrenadeImpact.zip

Adjust the value for the blast proximity in UNNGrenadeImpact.sqs. You need to add the EventHandler for all Players and AI that can thow Grenades, in a single or multiplayer mission.

ATM it's only setup for the default BIS grenade. If you want to add more, just update this line in the init.sqf:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">UNN_GRENADECLASSES=["GrenadeHandTimed"];

Share this post


Link to post
Share on other sites

Hey UNN and thank you very much for the script. thumbs-up.gif

It work's very well and it's coded very clean with examples to all lines. wink_o.gif

Really great.

Well so this is the only way to get this working? Just if i add a eventHandler to each unit, which can throw grenades?

I think on big map's with many unit's this can cause lag if i add a eventhandler to each unit.

Don't get me wrong the script is really greate but if there's an easyer way i would be very happy.

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  

×