Jump to content
Sign in to follow this  
F2kSel

Can Eventhandler check for Object  Damage

Recommended Posts

I'm am trying to find out if an ammo crate has be shot or damaged by using this line placed in the init of the object, it then calls a script and goes bang but it dosn't.

"amo1 addEventHandler [""hit"",{[amo1,4,""Sh_105_HE""] exec ""DamSmoke.sqs""}]";

};

Would get damage work and can I use that in an Eventhandler?

Share this post


Link to post
Share on other sites

I'm a rookie:

Can you check ammo crate (or more objects) after some time the mission is working and the 'init' fields can still check it?

If i'm kicking the english language... i'll try to say the same in another way...

I think 'init fields' its only to put something when the object is 'spawning' for its very first time... just when mission is starting... then maybe can be checked when a new player is joining the server, because he will 'launch' that line again, i suppose.

Right? Wrong?

huh.gif  huh.gif  huh.gif

Share this post


Link to post
Share on other sites

Not quite correct I think an EventHandler is a bit like an (If command or a trigger ) that is attatched to an object.

The command I used does work but not when I use it with an Ammo crate if I use it with a man it does work and blows him up when shot.

Share this post


Link to post
Share on other sites

Soooorrry... sry sry, i was not thinking about that 'init field' where Event Handler, i was thinking you saying 'init' where 'init fields' when putting 'units' via Mission Editor.

And then, i was thinking you trying to declare that Event Handler in that 'init fields'.

If i'm wrong... and you thinking about put Event Handlers in the 'init fields' of objects-soldiers-vehicles (via Mission Editor, as example) is what i decided to write my previous post, just because i think the place you wrote that Event Handler... in that case (the exact case that you are trying to make it work)... is wrong. I guess. Not sure. And my previous post i was saying why i was thinking you are in a mistake.

I need urgently English lessons  rofl.gif

Sry again...

Share this post


Link to post
Share on other sites

Maybe you have to change the kind of ammo that is causing the explosion. Try something more powerful... (maybe GBU as maximum, and then, from that beast-bomb to less power ammo).

Surely, not only ammo crates cant be 'exploded'. Try a fence, as an example.

Well, if you with a car, crashing it against an ammo crate... what is happening? ammo crates moving? if not, i understand that ArmA doesn't allow to move it in a 'natural' way.

Now crash another car against another one. Hum... the 3rd car is moving a little... hum ... hum... cars behaviour is not the same as ammo crates behaviour when some kind of issues happening on it.

I hope one fine day ArmA giving all scripters the hidden role of soldier W_Crash_Test_Dummie, and under the rest of sides too heheheh

I think ArmA doing 'reallistic' the way how a soldier is hit by a Tank, GBU, etc... but maybe they didn't want to simulate explosions in some kind of objects... just to reduce the whole code inside when you playing, to enhance all in a balanced way.

I noticed too that some fuel tanks into ground in some places of the map, can't explode... the object is persistent, ArmA 'only' is simulating the burning 'effect'. Maybe i'm wrong.

As the main problem with ammo crates is the explosion... make it jump... lol... litterally.

Maybe with setPos or some kind of stuff like this.

Maybe change HE tank ammo by 3 satchels, forming a triangle, and in the center of the triangle, the ammo crate.

Share this post


Link to post
Share on other sites
I'm am trying to find out if an ammo crate has be shot or damaged by using this line placed in the init of the object, it then calls a script and goes bang but it dosn't.

"amo1 addEventHandler [""hit"",{[amo1,4,""Sh_105_HE""] exec ""DamSmoke.sqs""}]";

};

Would get damage  work and can I use that in an Eventhandler?

What's your ammo crate's armor value? The hit command only fires when the hit causes significant damage to the object. If the crate has too much armor then being hit from a rifle round won't cause enough damage for the eventhandler to fire.

Share this post


Link to post
Share on other sites

Are you sure about that Hit command...I was doing Global, local tests on the popup target....

Hit being local...

Damaged being Global....

and I had the stop the test on the popup because it didn't recieve

damage....but did register a hit.

Share this post


Link to post
Share on other sites

KyleSarnik

Even setting the armour to 0 still won't let the hit command trigger if only slight damaged is being caused.

The crate will burn so damage is being done and this can be detected by a trigger.

Using a trigger I can cause an explosion when the damage is greater than 0.98.

I set the damage in the init line of the object first.

I would have liked to have don it with a handler though.

Squ33z3

I still don't get the global local thing and as I don't have two PC I really carn't get into it.

Squ33z3 are you seeing the target go down on one PC and not on the other?

I have seen things like that years ago in OFP.

Share this post


Link to post
Share on other sites

I don't have 2 ArmA pc's also so global, local is hard to learn about.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addEventHandler["hit","_this select 0 setdamage 0"]

add that line to a crate will detect if it's hit and also revive it.....not test in MP yet but should work.

someone else posted this in a thread.....I had to print a copy,

?(local server):hint" I am NOT the server pc"

?!(local server):hint" I am the server pc"

?(local player):hint" I am the player pc"

?!(local player):hint" I am a dedicated server pc"

I've also added a line to this for myself because player is all clients and I only wanted a rule for only one player....so

I name all my soldiers eg: S1

init: r=[s1]execVM"run this code only for this solider ifa player.sqf"

_unit = _this select o;

?!(local _unit):hint" Iam NOT this soldier pc"

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> this addEventHandler["hit","_this select 0 setdamage 0"]

I don't think this does anything, I can set damage to 0.98 and if I put a shot into the crate it starts to burn, if the code was working nothing should happen if I understand it right apart from it being undamaged.

Share this post


Link to post
Share on other sites

It stops idiots from destroying ammo crates at spawn points in MP games.

Share this post


Link to post
Share on other sites

But it dosn't not on my pc anyhow SP.

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  

×