Home   Help Search Login Register  

Author Topic: detecting near explosion  (Read 2958 times)

0 Members and 1 Guest are viewing this topic.

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
detecting near explosion
« on: 08 Nov 2007, 01:06:57 »
i have tried the looping while detecting but that doesnt seem to work.  then i tried using the hit event handler because it would hopefully give the exact time the explosion would go off.

i know explosions are objects which effective delete themselves the moment they appear, so how do i detect them?

i cant use a method of detecting incoming projectiles because not all the explosions are being fired by something.  does it have something to do with the unit or object which did the damage (causedBy: Object - Object that caused the damage).

does anyone know the answer?

edit: an easy way would be to detect is the 'hit' was an explosion, i'd be happy with that.
« Last Edit: 08 Nov 2007, 01:16:17 by Surdus Priest »
Campaigns are hard, I'll stick with scripting for now!

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: detecting near explosion
« Reply #1 on: 08 Nov 2007, 01:40:45 »
Explosions (the part that you see) are particles, not objects. Do you mean projectiles/ammunition that is exploding because they have hit something or vehicles that are exploding because they have taken too much damage? I can't quite understand what you are asking.

Quote from: Surdus Priest
i cant use a method of detecting incoming projectiles because not all the explosions are being fired by something
Now here I really haven't a clue what you mean, unless you mean the explosion might be caused by a satchel rather than a projectile?

Quote from: Surdus Priest
edit: an easy way would be to detect is the 'hit' was an explosion, i'd be happy with that.
Do you mean whether the damage taken was direct, from being hit, or splash/explosion damage? Or do you just mean was a vehicle hit by HE rather than armour-piercing ammo?
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: detecting near explosion
« Reply #2 on: 08 Nov 2007, 01:43:49 »
Now here I really haven't a clue what you mean, unless you mean the explosion might be caused by a satchel rather than a projectile?

i mean some of the explosions are made by the createvehicle command.

Do you mean whether the damage taken was direct, from being hit, or splash/explosion damage? Or do you just mean was a vehicle hit by HE rather than armour-piercing ammo?

basically, by being hit by an explosion rather than anything else, any kind of explosion. so long as it damages you in some way.
Campaigns are hard, I'll stick with scripting for now!

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: detecting near explosion
« Reply #3 on: 08 Nov 2007, 01:58:23 »
Do you mean:
Code: [Select]
_bomb = "bomb" createVehicle _pos;
_bomb setDammage 1;
or do you mean something else, which would be a technique I'd really like to know about (I really can't think how else you'd create an explosion and if you were using createVehicle like this in a script, then you'd know exactly when it exploded anyway!). Alternatively, are you just creating explosive ammo and allowing it to detonate itself (which isn't really "creating an explosion").

Whatever you are meaning, though, if you use a hit or damaged handler, then any "explosions" affecting (damaging) that object, either directly or indirectly, will cause an event and you have no problems. Is perhaps your problem that you can't tell the difference between being in an explosion and getting shot?

[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: detecting near explosion
« Reply #4 on: 08 Nov 2007, 02:05:40 »
_exp = "M_Strela_AA" createvehicle getpos _position

that creates an explosion on _position, which could be a gamelogic, a unit or co-ordinates.

but i need this to work for both that, and is a unit throws a grenade at you (and doesnt kill you) etc.
Campaigns are hard, I'll stick with scripting for now!

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: detecting near explosion
« Reply #5 on: 08 Nov 2007, 02:10:55 »
That is creating an AA missile that will explode when it hits the ground (so you aren't "creating an explosion" as such). It is no different creating it this way than firing it from a launcher, except that, since no-one is responsible for firing it, the causedBy value in the HIT event will be nullObj rather than an actual person). Hmm, or if the hit handler isn't actually triggered by this (I haven't tested it), try the DAMMAGED handler...
« Last Edit: 08 Nov 2007, 02:19:07 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: detecting near explosion
« Reply #6 on: 08 Nov 2007, 02:17:12 »
so is there a way of doing this?
Campaigns are hard, I'll stick with scripting for now!

Offline [seven]

  • Members
  • *
Re: detecting near explosion
« Reply #7 on: 08 Nov 2007, 06:02:42 »
so is there a way of doing this?

It seems to me the question has already been answered.  Yes, it is possible.  Just use the DAMMAGED eventhandler.  If this still does not solve your problem then you'll need to give a bit more information about what exactly it is you are trying to accomplish.

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: detecting near explosion
« Reply #8 on: 08 Nov 2007, 07:37:33 »
You're not being overly helpful, actually. :D And clearly haven't worked very much with neither the "hit" or "dammaged" eventhandlers : neither of these are capable of telling you what munition was used to damage the other party. They can tell you what UNIT did it, but not how or using what weapon.

I'm afraid I can't help you here, sadly. I -suppose- some overly complicated system where every potential enemy unit has a "fired" eventhandler attached which checks for shooting simultaneously with a "hit" eventhandler on the target, and then you somehow extrapolate that yes - that unit shot that weapon and it hit the other unit after X seconds so it's probable that the damage was caused by weapon Y. Alternatively some kind of veryfast looping nearestObject-type command that checks for all incoming munition, and if it fits into the "explosives" range monitor where it lands and if it can damage you. Or something.  :dry:

In short, I'm afraid it won't work. MAYBE you could also somehow detect particles - can you do that at all? Does anyone know? If you can, then maybe you can pick up some of those - however as soon as a custom mod is used that changes the names of the particles or adds them where there were none before or somesuch...well, d'oh.

What is it for anyway? That might give us some more insight to help you foh' real? :)

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: detecting near explosion
« Reply #9 on: 08 Nov 2007, 11:24:30 »
As far as I could tell, Surdus didn't actually want to know what munition was being used. What I eventually understood the question to be was, "If I use a HIT handler, then I detect when I am hit by a projectile fired from a weapon, but I don't detect when I am hit by an explosive ammunition that I have createVehicle-d. How do I know if I am hit by either normal or createVehicle-d ammo effects?". I suggested trying a DAMMAGED handler instead.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: detecting near explosion
« Reply #10 on: 08 Nov 2007, 13:15:07 »
edit: i need the base names for all forms of weapons; missilebase, rocketbase, bulletbase etc

and if there is a direct core for these weapons, please tell me.
« Last Edit: 08 Nov 2007, 18:06:37 by Surdus Priest »
Campaigns are hard, I'll stick with scripting for now!

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: detecting near explosion
« Reply #11 on: 08 Nov 2007, 18:14:58 »
Approach this from the projectile point of view.

If you use a script to createVehicle a projectile upon it's destruction check for nearby objects with one of the nearestObject commands, find out which suites you the best, I would use nearestObjects [pos,["type"],radius] since you can limit the type of objects to search for.
On every man found check if it's a player and use the say command to add the tinnitus.
If this is for SP only use the fadesound to fade the sounds and play the tinnitus as music.

Same goes for projectiles fired by entities, you just have to use the fired eventHandler to catch the projectile and do the above.


Just a thought... :scratch:
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: detecting near explosion
« Reply #12 on: 08 Nov 2007, 18:45:43 »
i have what i want, i just need to find a universal class name for explosive projectiles
Campaigns are hard, I'll stick with scripting for now!

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: detecting near explosion
« Reply #13 on: 09 Nov 2007, 13:29:16 »
The root classes for ammo (taken from ArmA\addons\weapons.pbo:config.bin, if you want to check them) are:
- BulletCore
- TimeBombCore
- MineCore
- Laserbeam (used by the SOFLAM laser marker)
- FuelExplosion
- Grenade (but one of its grandchildren is SmokeShell, which isn't an explosive)
- MissileCore
- RocketCore
- FlareCore
- ShellCore (this is root for all the HE and SABOT round classes though)

I'll leave it for you to work out which are explosives (the universal root class for ammo is "default", but that is the root for all ammo types) ;P

Rather than using this method to detect what is or isn't an explosive, you could use:
Code: [Select]
_ammoConfig = configFile >> "CfgAmmo" >> (typeOf _ammo);;

_isExplosive = (getNumber (_ammoConfig >> "indirectHitRange")) > 0.2;

(note that you can't just use indirectHitRange > 0, because smoke grenades (indirectHitRange = 0.2) and some other non-explosive projectiles actually have a small indirectHitRange defined! I haven't suggested checking whether explosive > 0, because that doesn't seem to be consistent with our definition of an explosive).
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: detecting near explosion
« Reply #14 on: 09 Nov 2007, 13:33:20 »
Quote
and some other non-explosive projectiles actually have a small indirectHitRange defined!

i assume you mean it would trigger when you get indirectly shot, or is the smoke from a smoke shell is within range.

i'll stick with the class names and input the correct grenades manually, theres only about 4 or 5.

thanks

surdus
« Last Edit: 09 Nov 2007, 13:51:41 by Surdus Priest »
Campaigns are hard, I'll stick with scripting for now!