Jump to content
Sign in to follow this  
colonel_klink

What the feck!!!

Recommended Posts

Ok this is in line with detecting the amount of damage a projectile does to a vehicle.

In order to make realistic (as possible) damage textures for choppers, etc. I am trying to find out how to detect what weapon was fired at it and what ammunition hit it.

For example if I made a damage texture for a chopper with bullet holes in it, it wouldn't look too realistic if the weapon fired at it was an RPG or missile. And vice versa, missile damage textures won't look right if the vehicle was hit by small arms fire.

So the conundrum is:

1. How to detect what weapon was fired at the vehicle; e.g. m16, m60, law, etc so that user class weapons are also detected.

2. How to determine the type of ammo fired from the cfgammo base classes e.g. bullet, explosivebullet, rpg, AT3, etc, so that it will aslos determine user made weapon classes.

3. Determine the amount of damage incurred by these so that appropriate damage textures can be applied.

Now I know how the dammage eventhandler works so that isn't a problem, but I have never completely understood how the hit eventhandler is implemented.

Share this post


Link to post
Share on other sites

I have no clue how to archive what you want, but one note from me is that I would check for basic classes like "MGun" or "LAWLauncher" (both directly come after "default"). But if you are not completely stupid (what I know you ain't wink_o.gif ) you probably know this yourself.

blues.gif

Share this post


Link to post
Share on other sites

Hi PSC. Yep have that figured.

The hit eventhandler looks like the one to use, but I haven't found any reference to anybody thats used it. From what i can gather the hit eventhandler can determine the amount of damage caused by a weapon. I presume the eventhandler could run a script that somehow(??) detects the weapon and ammo used.

Share this post


Link to post
Share on other sites

I think you'd need to place eventhandlers to all units that would follow projectiles they fire and check what unit they hit... propably not worth the trouble

Share this post


Link to post
Share on other sites
Quote[/b] ]Event handlers

   Event handlers can be defined in unit config or by function addEventHandler. Multiple handlers can be attached at one time. Event handler types are defined below. Each handler receives arguments in _this, argument types and meaning are defined below.

   

   "Killed" object:killer

   "Hit" object:causedBy,scalar:howMuch

   "Engine" bool:engineState

   

   "GetIn" string:position (1),object:unit

   "GetOut" string:position (1),object:unit

   

   "Fired" string:weapon,string:muzzle,string:mode,string:ammo

   "IncomingMissile" string:ammo,object:whoFired

   "Dammaged" string:selectionName,scalar:howMuch

   "Gear" bool:gearState

   "Fuel" bool:fuelState

   

   "Init" No arguments

   

   (1) position can be "driver", "gunner", "commander", "cargo"

   

   MP notes: "Killed" and "Hit" event handlers are executed where given unit is local. All other event handlers are executed on all computers. Events added by addEventHandler may be different on each computer.

How I love the ComRef  tounge_o.gif

EDIT: Remember first entry (this select 0) is always the vehicle

Share this post


Link to post
Share on other sites

Heyas Klink, I was doing similiar things but the problem that I encountered was the fact that "hit" and "dammage" are only activated with a substantial hit

Appears small arms fire will barely activate the hit eventhandler and that causes problems if you want bullet holes (same thing I was doing)

Suppose it would be ok if you wanted to display LAW and Tank Round hits as they seem to activate the eventhandlers fine

Share this post


Link to post
Share on other sites

Kegetys: Yeah I guess you're right about that. The only other way would be to check nearestobject and loop throught the ammo types. Pain in the neck as the script would be running continuously.

Hardrock. Yep been through them several times. Comref can be fun smile_o.gif

Bratty: Its strange that small arms doesn't activate the hit eventhandler. I guess in the whole scope of things an m16 round just doesn't do much damage unless you hit something important, or send enough rounds to inflict damage. Guess this might be a no go area in ofp once again. smile_o.gif

Thanks guys.

Share this post


Link to post
Share on other sites

Don't get me wrong tho ,"hit" and "dammaged" require a substantial hit but will still sorta work

Plane could still get shot down and not display bullet holes before its death,if none registered,but it will work some of the time

The " Ace Kill System " that I use on the Corsair and Zero ,I was going to register who did the most damage and give them the kill, but like I said , not all hits register.

So I used the "killed" eventhandler and the killer gets the kills,the last one to finish it off

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  

×