Jump to content

Is it no longer possible to get the position/point from a Unit after the dead event?


shagrat
Go to solution Solved by shagrat,

Recommended Posts

I try to get the point from a Unit that has run into a landmine and exploded.

I want to spawn casualties and an ambush around that point. But it seems I can no longer get the point with Unit.getByName(initiator.name):get point(). Neither with s_event_dead, s_event_kill or s_event_unit_lost. (Did switch to target, where necessary).

Does anyone have any idea how to get the point/coordinates from a dead object? I am at a total loss.

If I am not suffering from dementia this worked with the dead event a couple years ago!

Shagrat

 

- Flying Sims since 1984 -:pilotfly:

Win 10 | i5 10600K@4.1GHz | 64GB | GeForce RTX 3090 - Asus VG34VQL1B  | TrackIR5 | Simshaker & Jetseat | VIRPIL CM 50 Stick & Throttle | VPC Rotor TCS Plus/Apache64 Grip | MFG Crosswind Rudder Pedals | WW Top Gun MIP | a hand made AHCP | 2x Elgato StreamDeck (Buttons galore)

Link to comment
Share on other sites

7 hours ago, shagrat said:

I try to get the point from a Unit that has run into a landmine and exploded.

I want to spawn casualties and an ambush around that point. But it seems I can no longer get the point with Unit.getByName(initiator.name):get point(). Neither with s_event_dead, s_event_kill or s_event_unit_lost. (Did switch to target, where necessary).

Does anyone have any idea how to get the point/coordinates from a dead object? I am at a total loss.

If I am not suffering from dementia this worked with the dead event a couple years ago!

Hi Shagrat,

I've had some issues with s_event_dead since 2.18 IIRC that hasn't been resolved, so I don't think it's you - I think there's been some features removed from these events. 

As a sloppy workaround - if you able to get the position from event-hit you could add (or update) a table for the unit that is hit so that on unit lost - you could scan that table for the unit name and get the last known coordinates that were saved by the hit command. (I haven't tested this, I just throw it out as a potential workaround to consider if you get desperate).

Cheers

DZ

Link to comment
Share on other sites

Thanks. That's brutal. The script should monitor events, as it is intended for MP missions with large amount of randomized patrols that are dynamically spawned. Storing position updates on hit events is incredible inconvenient.

I would rather hope @Eagle Dynamics could fire the s_event_unit_lost, when the unit is still part of the group, position information is in the database and give us time to store the position and other stuff like the parent group in variables, before the data/reference is purged and s_event_dead and/or s_event_kill are fired.

Just give us a chance to store the necessary info with getPoint(), get group() etc. the moment a unit is lost before purging the unit/related data and fire the next event. :notworthy:

Shagrat

 

- Flying Sims since 1984 -:pilotfly:

Win 10 | i5 10600K@4.1GHz | 64GB | GeForce RTX 3090 - Asus VG34VQL1B  | TrackIR5 | Simshaker & Jetseat | VIRPIL CM 50 Stick & Throttle | VPC Rotor TCS Plus/Apache64 Grip | MFG Crosswind Rudder Pedals | WW Top Gun MIP | a hand made AHCP | 2x Elgato StreamDeck (Buttons galore)

Link to comment
Share on other sites

25 minutes ago, shagrat said:

Thanks. That's brutal.

I believe it may be a result of DCS now changing units to static objects when they 'cook off'. Their name remains the same, but they are now static objects. Hence Unit.getByName() no longer works; but StaticObject.getByName() should. So if Unit returns nil, try StaticObject as a fallback. 


Edited by cfrag
  • Thanks 2
Link to comment
Share on other sites

I'll check if this will do the trick. Though I think it would be a brilliant idea for ED to simply fire one of the three events related to dying units before(!) that change happens and thus give us a chance to extract relevant data from the database with the getGroup(), getPoint() etc. functions.

  • Like 1

Shagrat

 

- Flying Sims since 1984 -:pilotfly:

Win 10 | i5 10600K@4.1GHz | 64GB | GeForce RTX 3090 - Asus VG34VQL1B  | TrackIR5 | Simshaker & Jetseat | VIRPIL CM 50 Stick & Throttle | VPC Rotor TCS Plus/Apache64 Grip | MFG Crosswind Rudder Pedals | WW Top Gun MIP | a hand made AHCP | 2x Elgato StreamDeck (Buttons galore)

Link to comment
Share on other sites

2 minutes ago, shagrat said:

Though I think it would be a brilliant idea for ED to simply fire one of the three events related to dying units before(!) that change happens

Definitely. It has been my experience, though, that waiting for ED to correct a bug is an approach that often doesn't lead to success. So I look for work-arounds.

Link to comment
Share on other sites

  • Solution

Could solve it with some help from the guys over at MOOSE. You need to use the eventdata.initiator:getPoint() on the dead event now. Seems the ID still points to the right object.

This still isn't perfect, but good enough for now.

  • Like 1
  • Thanks 1

Shagrat

 

- Flying Sims since 1984 -:pilotfly:

Win 10 | i5 10600K@4.1GHz | 64GB | GeForce RTX 3090 - Asus VG34VQL1B  | TrackIR5 | Simshaker & Jetseat | VIRPIL CM 50 Stick & Throttle | VPC Rotor TCS Plus/Apache64 Grip | MFG Crosswind Rudder Pedals | WW Top Gun MIP | a hand made AHCP | 2x Elgato StreamDeck (Buttons galore)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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