I've just found that eventDestroyed() is called in the following scenarios:
* when you pick-up an oil barrel or artefact
* when you start construction of an oil derrick
In each case, the .player property of the feature object passed in to eventDestroyed() is set to the player who picked up the item or started building on it.
I'm using this to play audio messages, such as "power transferred" when a barrel is picked up, or "construction started" when a derrick is started.
I'm sure there are other uses for this too
Tip: eventDestroyed() - feature objects!
Tip: eventDestroyed() - feature objects!
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
Re: Tip: eventDestroyed() - feature objects!
Ah, and just when I was about to celebrate the many ways in which this stuff could be used, I've just found that eventDestroyed() gets called with a feature object regardless of which player picks up the barrel/artefact or builds on the derrick. And the featureObject.player property == selectedPlayer regardless of who picked up or built on the feature.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
Re: Tip: eventDestroyed() - feature objects!
Sorry about that. When eventDestroyed() is called, that information is no longer available.
I've added another event, eventPickup(feature, droid) that should give you what you need.
I've added another event, eventPickup(feature, droid) that should give you what you need.
Re: Tip: eventDestroyed() - feature objects!
Will eventPickup just be for objects owned by 21, eg. oil drums (barrels) and crates (artefacts)?
I've now created helper functions that determine if, using current 3.1 beta 10 api, a "destroyed" feature was destroyed by one of the player's units. Example code in latest ver of Enhanced SitRep Mod topic in Showcase forum.
I assume that eventDestroyed() will continue to be called even though there is now an eventPickup()? eventDestroyed() will allow me to determine if an oil resource my trucks are heading for has been captured by enemy (via my helper function) and if so I can send them elsewhere.
Also, I note that features don't seem to trigger eventObjectSeen(), which is a great shame as it forces me to rely on enumFeature() to find features I can see, when really I just want to know when a new feature is seen by my sensors/droids.
I've now created helper functions that determine if, using current 3.1 beta 10 api, a "destroyed" feature was destroyed by one of the player's units. Example code in latest ver of Enhanced SitRep Mod topic in Showcase forum.
I assume that eventDestroyed() will continue to be called even though there is now an eventPickup()? eventDestroyed() will allow me to determine if an oil resource my trucks are heading for has been captured by enemy (via my helper function) and if so I can send them elsewhere.
Also, I note that features don't seem to trigger eventObjectSeen(), which is a great shame as it forces me to rely on enumFeature() to find features I can see, when really I just want to know when a new feature is seen by my sensors/droids.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
Re: Tip: eventDestroyed() - feature objects!
eventPickup() only works on pickup-able features, yes.