The maddox.game.world.Strategy.DamagerList object is exposed when an aircraft is "dead" via the OnActorKilled method. Is there some way to expose the maddox.game.world.Strategy.DamagerList for an aircraft that has crash-landed ?
The maddox.game.world.Strategy.DamagerList object is exposed when an aircraft is "dead" via the OnActorKilled method. Is there some way to expose the maddox.game.world.Strategy.DamagerList for an aircraft that has crash-landed ?
Salmo, given you've had access to the source code for almost a year, aren't you the one to answer that??
There's at least two ways I can think of though although I think there was a bug introduced into 4.5 regarding the Oncrashlanded event IIRC raised by someone else.
Thank you for your helpful response that assisted me to find a solution.
Last edited by Salmo; Feb-18-2018 at 22:29.
No problems Salmo. Any time.
I'd hate for anyone to think I was unhelpful, that would be awkward and might lead to people calling me nasty names behind my back and I wouldn't want that, no siree..
In that vein, the two options I was thinking of are:
1) Kill the aircraft via the "normal" despawn methodology, thereby accessing it via the OnActorKilled event per your own post.
2) Edit the strategy dll, change damagerlist from being private, or clone it, and do what you want with it based on the aircraft key. Or indeed, replicate it's methodology within the mission file with calls from the various OnDamaged Events.
The key issue here is that OnAircraftCrashLanded does not appear to be working post the patches, as reported by others. Of course I don't know this for certain as I haven't really played with the scripting side of things since making SoW 4.5 compatible. Without the ability to fire an event when a crash landing occurs then you're jiggered I feel.
I am surprised that with access to the SC within TF (not necessarily you personally, I don't know who has and hasn't got access and that wasn't what my original post meant) that you're asking this openly. Perhaps someone with access could point you in the right direction.
Last edited by SoW Reddog; Feb-19-2018 at 14:16.
I am far from all this, but reading this from the outside it seems that access to the source code has only one person and he is very busy, as usual.
Salmo, can I just ask if this thread is in aid of a solution to the bug raised by ACG on the 2 events no longer firing? Much appreciated if so because it is a showstopper for us, we can't run our campaigns without this hook.
Here. This is a showstopper for ACG in Cliffs as a platform. https://tfbt.nuvturais.de/issues/1052
Yes I believe so Spin. I'm on my phone at the moment so can't check the bugtracker but if I remember right it's #1052 or something like that. We are trying to track the issue down.
Edit: From your second post I see it is 1052.
This thread is related to my own scripting for a new mission. Nothing to do with the 2 events not firing bug. TFS is aware that the bug is causing campaign failures on squadrons servers, & is actively working to try to find why these methods no longer fire events & fix the problem.
OK great that is good to know.
Its just a guess but I would just copy over logics from:
under :Code:public virtual void LogServer_AircraftDead(int missionNumber, string shortName, AiAircraft aircraft) { ArrayList damageInitiators = this.GetDamageInitiators((AiActor)aircraft); Dictionary<DamagerScore, object> dictionary = new Dictionary<DamagerScore, object>(); List<AiDamageInitiator> list = new List<AiDamageInitiator>(); bool? nullable1 = new bool?(); for (int index = 0; index < damageInitiators.Count; ++index) { DamagerScore key = damageInitiators[index] as DamagerScore; if (!dictionary.ContainsKey(key) && key.initiator.Actor != null) { bool? nullable2 = nullable1; if ((!nullable2.GetValueOrDefault() ? 1 : (!nullable2.HasValue ? 1 : 0)) != 0 && key.initiator.Actor != aircraft) nullable1 = new bool?(key.initiator.Actor.Army() != aircraft.Army()); dictionary.Add(key, (object)null); list.Add(key.initiator); } } if (aircraft.IsAirborne()) { if (!nullable1.HasValue) { switch (Strategy.LogServerRnd.nextInt(0, 2)) { case 0: this.GamePlay.gpLogServerBegin((Player[])null, "{0} crashed."); break; case 1: this.GamePlay.gpLogServerBegin((Player[])null, "{0} is no more."); break; case 2: this.GamePlay.gpLogServerBegin((Player[])null, "{0} collided with terrain."); break; } } else { bool? nullable2 = nullable1; if ((nullable2.GetValueOrDefault() ? 0 : (nullable2.HasValue ? 1 : 0)) != 0) { switch (Strategy.LogServerRnd.nextInt(0, 2)) { case 0: this.GamePlay.gpLogServerBegin((Player[])null, "{1} claimed a friendly kill: {0}."); break; case 1: this.GamePlay.gpLogServerBegin((Player[])null, "Friendly fire! {1} destroyed {0}."); break; case 2: this.GamePlay.gpLogServerBegin((Player[])null, "{1} destroyed a friendly {0}."); break; } } else { bool? nullable3 = nullable1; if ((!nullable3.GetValueOrDefault() ? 0 : (nullable3.HasValue ? 1 : 0)) != 0) { switch (Strategy.LogServerRnd.nextInt(0, 4)) { case 0: this.GamePlay.gpLogServerBegin((Player[])null, "{1} shot down {0}."); break; case 1: this.GamePlay.gpLogServerBegin((Player[])null, "{1} destroyed {0}."); break; case 2: this.GamePlay.gpLogServerBegin((Player[])null, "{1} claimed {0}."); break; case 3: this.GamePlay.gpLogServerBegin((Player[])null, "{0} was destroyed by {1}."); break; case 4: this.GamePlay.gpLogServerBegin((Player[])null, "{0} was shot down by {1}."); break; } } } } } else if (!nullable1.HasValue) { if (Strategy.LogServerRnd.nextInt(0, 0) == 0) this.GamePlay.gpLogServerBegin((Player[])null, "{0} crashed."); } else { switch (Strategy.LogServerRnd.nextInt(0, 1)) { case 0: this.GamePlay.gpLogServerBegin((Player[])null, "{1} destroyed {0} on the ground."); break; case 1: this.GamePlay.gpLogServerBegin((Player[])null, "{0} was blown up by {1} before he could take off."); break; } } this.LogServer_VictimArg(true, aircraft, aircraft.Player(aircraft.Carter())); if (nullable1.HasValue) this.LogServer_InitiatorsArg(list); this.GamePlay.gpLogServerEnd(); }
Code:public virtual void LogServer_AircraftCrashLanded(int missionNumber, string shortName, AiAircraft aircraft) { Player player = aircraft.Player(aircraft.Carter()); if (player == null) return; this.GamePlay.gpLogServer((Player[])null, "{0} crash landed.", new object[1] { (object) player }); }
Following logic flow it should work....
Thanks that's interesting. I'll point our guys at that.
~S~
So Salmo, was my post any use? Enquiring minds and all that.
Bookmarks