[Documentation Updated for 2.1] Weapon firing is not calling the corresponding callbacks

Any issues, problems or troubleshooting topics related to the additional features present in the Prepar3D Professional Plus client application.
minime
Posts: 1198
Joined: Mon Jun 10, 2013 4:33 pm

Postby minime » Thu Jan 09, 2014 5:21 am

Now I have been firing weapons for some time, but now I finally wanted to fix the AI to shoot as well.



Thus I hooked the callbacks (C#):



conn.OnRecvEventCountermeasure += conn_OnRecvEventCountermeasure;

conn.OnRecvEventObjectDamagedByWeapon += conn_OnRecvEventObjectDamagedByWeapon;

conn.OnRecvEventWeapon += conn_OnRecvEventWeapon;



Basicly, they never get called, whatever I do. I have my own aircraft fire guns and missiles and I have an SA-2 firing its missiles, and none of those actions trigger the callbacks. This is in freeflight, not multiplayer.



So am I correct to assume that the callbacks are broken and there is currently no way to work with weapons that are shot?


Adam Breed
Lockheed Martin
Posts: 1385
Joined: Mon Sep 20, 2010 6:17 pm

Postby Adam Breed » Thu Jan 09, 2014 2:17 pm

Hi minime,



    conn.OnRecvEventCountermeasure += conn_OnRecvEventCountermeasure;

- Should be triggered when a countermeasure is fired.



    conn.OnRecvEventObjectDamagedByWeapon += conn_OnRecvEventObjectDamagedByWeapon;

- Should be triggered when an object is hit with a weapon (with damage)



    conn.OnRecvEventWeapon += conn_OnRecvEventWeapon;

- Should be triggered when a weapon is fired.



We will have to investigate more, but they should work as expected.
Prepar3D® Engineering Project Manager

minime
Posts: 1198
Joined: Mon Jun 10, 2013 4:33 pm

Postby minime » Fri Jan 10, 2014 6:07 am

No, they are not, sorry. :P



Maybe they work from C++ SimConnect, but not from C#.



None of them are triggering, and all of the other callbacks I am using are. My software also is stable enough that I am quite sure not to have made any totally stupid mistakes (Well it's C# so its pretty hard to completely screw up anyway).



I was shooting missiles from AI as well as from my ownship and flaring and chaffing like hell, there is nothing triggering. Obviously it may be something on my machine, but I have no idea what it could be.



All the other weapon stuff is working, so it can't be a license problem either. I do have computers with other licenses but this one definitely is running Plus.



Edit: I will check out if it works from C++ on the weekend. I will edit this post when I know.

minime
Posts: 1198
Joined: Mon Jun 10, 2013 4:33 pm

Postby minime » Fri Jan 10, 2014 10:54 am

The C++ version of SimConnect also does not work.



Neither of the events are sent when you shoot missiles or countermeasures:



SIMCONNECT_RECV_ID_EVENT_WEAPON

SIMCONNECT_RECV_ID_EVENT_COUNTERMEASURE

SIMCONNECT_RECV_ID_EVENT_OBJECT_DAMAGED_BY_WEAPON



Most probably a license validation issue?



Just to try I just re-activated a Professional Plus installation with a different developer license, but it did not change anything. The callbacks are definitely dead in the water.



If it works for some people somewhere, maybe check if the "developer" part of the license disables the callbacks? :P



I will do a lot, but not buy a full license for 2300$ to check if it works there. ;)

Adam Breed
Lockheed Martin
Posts: 1385
Joined: Mon Sep 20, 2010 6:17 pm

Postby Adam Breed » Fri Jan 10, 2014 2:01 pm

Hi,



We will investigate more early next week and let you know what we find.



Thank you for providing the additional information,

Prepar3D® Engineering Project Manager

Adam Breed
Lockheed Martin
Posts: 1385
Joined: Mon Sep 20, 2010 6:17 pm

Postby Adam Breed » Mon Jan 13, 2014 12:39 pm

Hello,



I can confirm the code works correctly. The documentation was missing a piece about registering for the correct callbacks.



Make sure to register for these system callbacks:

WeaponFired - Request a notification when a detachable weapon is fired. Refer also to the SIMCONNECT_RECV_EVENT_WEAPON structure.

WeaponDetonated - Request a notification when a detachable weapon is detonated or destroyed. Refer also to the SIMCONNECT_RECV_EVENT_WEAPON structure.

CountermeasureFired - Request a notification when a countermeasure is deployed. Refer also to the SIMCONNECT_RECV_EVENT_COUNTERMEASURE structure.

ObjectDamagedByWeapon - Request a notification when an object is damaged by a weapon. Refer also to the SIMCONNECT_RECV_EVENT_OBJECT_DAMAGED_BY_WEAPON structure.



If you look at the PauseMonitor example in the Prepar3D SDK SimConnect samples, you will see how these calls can be created.
Prepar3D® Engineering Project Manager

minime
Posts: 1198
Joined: Mon Jun 10, 2013 4:33 pm

Postby minime » Mon Jan 13, 2014 4:41 pm



Quote:

Quote from Adam Breed on January 13, 2014, 12:39

Hello,



I can confirm the code works correctly. The documentation was missing a piece about registering for the correct callbacks.



Make sure to register for these system callbacks:

WeaponFired - Request a notification when a detachable weapon is fired. Refer also to the SIMCONNECT_RECV_EVENT_WEAPON structure.

WeaponDetonated - Request a notification when a detachable weapon is detonated or destroyed. Refer also to the SIMCONNECT_RECV_EVENT_WEAPON structure.

CountermeasureFired - Request a notification when a countermeasure is deployed. Refer also to the SIMCONNECT_RECV_EVENT_COUNTERMEASURE structure.

ObjectDamagedByWeapon - Request a notification when an object is damaged by a weapon. Refer also to the SIMCONNECT_RECV_EVENT_OBJECT_DAMAGED_BY_WEAPON structure.



If you look at the PauseMonitor example in the Prepar3D SDK SimConnect samples, you will see how these calls can be created.




Hehe yeah... I know how these calls are created, but without the exact string it does not work. :P



I got it now.



Actually I had the last one working because I guessed the string right, but it seems like nothing ever got damaged when I was looking.



Thx a lot...



Minime


Return to “Prepar3D Professional Plus Client Application Questions”

Who is online

Users browsing this forum: No registered users and 5 guests