Jump to content

Recommended Posts

Posted

Hi all,

 

last days I was struggling to understand how event handler works, and thanks to SNAFU’s examples I figured out how to use them a little. Also, with some search on the forum I found that:

 

- S_EVENT_SHOT, as an event, contain (or generate) a table that track a weapon release of any weapon except gun’s shells. I can access to this table gathering info about who fired, what ordnance has been fired, and track ordnance position.

- If ordnance are fired in couple or multiple (i.e. rockets) is impossible to track every single rocket of the couple.

- In the single player debriefing log that is shown at the end of the mission, a rapid succession of shot events (i.e. 3 couple of rockets fired in fast sequence by three keypress) is displayed as a single event with, between bracket, the total amount of rockets fired. While, instead, a weapon tracking function will track every single couple no matter how fast are delivered from the helicopter.

- I don’t know how a single-press rocket salvo is read by a script (have to test it).

 

So, have anyone some experience about this event and how to track single rockets even if fired in couples?

 

 

 

PS to moderator:

 

It’s not my purpose to double this thread:

http://forums.eagle.ru/showthread.php?t=124421

 

This forum has already been proven it’s fantastic effort to help newbie like me, so I assume that 160 read and 0 reply mean that nobody really has the answer or, maybe, the question has been asked badly.

 

Instead here I want to discuss how to use the event handler when multiple ordnance launch is in effect: If you think that this thread could be intended as a carbon-copy of the previous one, please delete the other and leave this one in place.

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Posted (edited)

Yes it does, but the problem comes out when you fire rockets, cause you must fire a salvo of 2 together each time, and I can't track both the rockets fired: And it's what I need cause I would like to

1: have the measure of both the rockets fired from the targets

2: count how many rockets falls into a determined range from the targets

 

So, for a single release of 2 rockets, if I look at any shot event, it founds only one event. I'm confident that it's not a problem of overlapping text, cause I put every shot's collected data in a table, that is read few seconds after the impact Printing a text message for every entry of the table, which is removed immediately after Printing it.

 

Also, for debug purposes, I added a counter of the shot events and seems that every couple of rockets are recorded as "1".

 

So I'm trying to understand if it's possible to track ordnance data as it spawns in the world, instead that relying on the shot event.

 

PS: if you want to take a look at the code, it's in the other thread I linked in the first post.

Edited by chromium
added details and explanation

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Posted

This morning I started to think in a reverse way about tracking rockets... so, if it could be possible to track an hit on a zone (2D or 3D, I could Always assign a land.getHeight + 1 value to y axis) by HIT event, I could solve at least the "number of hit in proximity" problem.

 

What do you think?

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Posted
This morning I started to think in a reverse way about tracking rockets... so, if it could be possible to track an hit on a zone (2D or 3D, I could Always assign a land.getHeight + 1 value to y axis) by HIT event, I could solve at least the "number of hit in proximity" problem.

 

What do you think?

 

 

But does the HIT event fire when the rocket only hit the ground? Also, does it fire for each individual rocket?

 

As for your main question, AFAIK there is no way to find spawned objects (eg weapons) by script other than using the event-method.

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Posted

that's a good question. Maybe I can create a small debug script that prints out the "hit" count and fire some rockets... I'll see this evening. To me it could be ok that the event is fired when the rocket hit the ground (than I may need to find a way to check if the impact point is in a particoular area...).

 

About tracking weapons, I may ask (to the universe, in this case) how the number of rockets are correctly counted in the debrief log at the end of a single player mission :(

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Posted

Here it is a first try, copy/pasting xcom code:

 


local counter = 0
local eHandler = {}

function eHandler:onEvent(e)

 if e.id == world.event.S_EVENT_HIT
 
 counter = counter + 1
 trigger.action.outText("counter: " .. counter,3)
 
 end

end
world.addEventHandler(eHandler)

 

surely that would be an overlapping problem firing salvo, but:

1-it should print out the last one, so the maximum count

2-at most I can fire a 5 couple salvo, ignoring the message, than fire a single cuople and see if it prints "11" or "12": that would confirm a correct counting maths.

 

Instead, if it doesn't print out anything and the code is correct, it may mean that HIT event fires only when something is actually hit (map object? user object?)

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Posted

Hit events have to have a target I think, I'm not sure if ground hits are generated.

Just fire at some big hanger with a few rockets in salvo, you should get your answer from the events that are generated out.

 

I wonder if maybe the event table for salvo rockets has some more information than a regular event table, like a few units.

 

Also, you should know that at the moment there seems to be an issue with e.initiator.ID_ or e.target.ID_

It seems it is not unique, so I would watch not to rely on it too much.

Posted
Also, you should know that at the moment there seems to be an issue with e.initiator.ID_ or e.target.ID_

It seems it is not unique, so I would watch not to rely on it too much.

 

This could be a very important information, thanks!

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Posted

Sadly no hit event if rockets goes on free terrain whitout object :(

 

I accept any other suggestion: I'm stucked at now.

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Posted (edited)
did you try to fire at some object like I suggested? like a hanger for example.

This way the hit events will generate.

 

Yes it will, but I finally need to fire at terrain: I don't look at an "hit count", but at a "density within range". Direct hit on target could be a secondary results only.

 

Or you're suggesting to investigate how the hit event is composed?

 

thanks!

Edited by chromium
typo

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Posted
yes, for example, catch the hit events and then try to get info from the weapon table.

 

something like -

mist.utils.tableshow(e.weapon)

 

Understood: I will give a try.

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...