gnivler / PanicSystem

Simulates mechwarrior panic and automatic ejections
The Unlicense
4 stars 14 forks source link

3.04 soft lock when pilot fails eject save #40

Closed asaguda closed 5 years ago

asaguda commented 5 years ago

Started a new playthrough, somewhat heavily-ish modded. I discovered one mod, Ammo Cookoff, causing errors when I noticed the first failure to eject, and removed that. Posts on that mod's nexus page say the same thing. And it has a funny bug where you can go below 0 heat in 1.2 so in a few turns your mechs have -hundreds of heat.. That's neither here nor there though. Mod's broken, so I removed it.

I am still seeing failures to eject though. And final error in output_log specifically mentions the panic system.

Kintaro attacks Panther
Damage >>> Armor: 57.5 Structure: 114 (46.23%)
Structure damage requires panic save
----------------------------------------------
Factors              |     Change |      Total
----------------------------------------------
Mech health 24.6%    |            |
Pilot injuries       |     16.667 |     16.667
CT                   |     58.154 |     74.821
LT                   |         25 |     99.821
RT                   |     10.638 |    110.459
LL                   |     13.091 |     123.55
Guts and Tactics     |         -6 |     117.55
Resolve 0            |         10 |     127.55
Panic multiplier     |          1 |     127.55
----------------------------------------------
Saving throw         | 128     43 |       Roll
----------------------------------------------
Failed panic save
Condition worsened: Unsetlled
Critical failure on panic save
Base ejection resist |         75 |      52.55
Eject multiplier     |          1 |         53
----------------------------------------------
Saving throw         | 53       2 |       Roll
----------------------------------------------
Failed ejection save: Punchin' Out!!
Ejecting
MessageCenter [ERROR] CRITICAL ERROR, PLEASE REPORT:
Delegate OnAttackComplete - Standard for message type OnAttackComplete failed with exception 
Argument is out of range.
Parameter name: index
at System.Collections.Generic.List`1<string>.get_Item (int) <0x00083>
at PanicSystem.Patches/AttackStackSequenceOnAttackCompletePatch.Prefix (BattleTech.AttackStackSequence,MessageCenterMessage) <0x0075c>
at (wrapper dynamic-method) BattleTech.AttackStackSequence.OnAttackComplete_Patch1 (object,MessageCenterMessage) <0x00027>
at MessageCenter.SendMessagesForType (MessageCenterMessageType,MessageCenterMessage) <0x00186>

At this point I suspected the Injuries hurt mod, because I know both mods would be doing stuff with injuries, so I removed that mod too, but the issue persists with the same error in the log. At this point I've had enough of restarting and fiddling for one day, so I'm putting this here just in case it isn't a conflict and the output_log error makes more sense to someone else, and I'll keep trying to find out if there's a conflict in my mod selection tomorrow.

gnivler commented 5 years ago

Thanks for the detailed report. That definitely points the finger at PanicSystem and I believe I can fix it if so. You're running the newest DLL already, right?

On Sat, Nov 24, 2018 at 9:37 AM asaguda notifications@github.com wrote:

Started a new playthrough, somewhat heavily-ish modded. I discovered one mod, Ammo Cookoff, causing errors when I noticed the first failure to eject, and removed that. Posts on that mod's nexus page say the same thing. And it has a funny bug where you can go below 0 heat in 1.2 so in a few turns your mechs have -hundreds of heat.. That's neither here nor there though. Mod's broken, so I removed it.

I am still seeing failures to eject though. And final error in output_log specifically mentions the panic system.

Kintaro attacks Panther Damage >>> Armor: 57.5 Structure: 114 (46.23%) Structure damage requires panic save

Factors | Change | Total

Mech health 24.6% | | Pilot injuries | 16.667 | 16.667 CT | 58.154 | 74.821 LT | 25 | 99.821 RT | 10.638 | 110.459 LL | 13.091 | 123.55 Guts and Tactics | -6 | 117.55 Resolve 0 | 10 | 127.55 Panic multiplier | 1 | 127.55

Saving throw | 128 43 | Roll

Failed panic save Condition worsened: Unsetlled Critical failure on panic save Base ejection resist | 75 | 52.55 Eject multiplier | 1 | 53

Saving throw | 53 2 | Roll

Failed ejection save: Punchin' Out!! Ejecting

MessageCenter [ERROR] CRITICAL ERROR, PLEASE REPORT: Delegate OnAttackComplete - Standard for message type OnAttackComplete failed with exception Argument is out of range. Parameter name: index at System.Collections.Generic.List`1.get_Item (int) <0x00083> at PanicSystem.Patches/AttackStackSequenceOnAttackCompletePatch.Prefix (BattleTech.AttackStackSequence,MessageCenterMessage) <0x0075c> at (wrapper dynamic-method) BattleTech.AttackStackSequence.OnAttackComplete_Patch1 (object,MessageCenterMessage) <0x00027> at MessageCenter.SendMessagesForType (MessageCenterMessageType,MessageCenterMessage) <0x00186>

At this point I suspected the Injuries hurt mod, because I know both mods would be doing stuff with injuries, so I removed that mod too, but the issue persists with the same error in the log. At this point I've had enough of restarting and fiddling for one day, so I'm putting this here just in case it isn't a conflict and the output_log error makes more sense to someone else, and I'll keep trying to find out if there's a conflict in my mod selection tomorrow.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gnivler/PanicSystem/issues/40, or mute the thread https://github.com/notifications/unsubscribe-auth/ARmQpatB9rWVStZZKuhGAiUBZ1ZHUg1Iks5uyWfVgaJpZM4YxeSe .

asaguda commented 5 years ago

Yessir.

gnivler commented 5 years ago

Just noticed it was in the subject, thanks for that.

I'm not sure where the index is getting out of range so I instead put in an exception handler to see if it will just proceed. Since I haven't had this issue reproducing it may take a lot of time (any suggestions would be great).

I'll attach a 3.13 alpha, just some minor stuff I did pending something worthwhile to release... like a bug fix!

If you wouldn't mind trying it out. For now it will log errors so we see it throwing, post-alpha I'll squelch it.

PanicSystem.zip

asaguda commented 5 years ago

On it. Thanks for being so quick about things!

asaguda commented 5 years ago

Same problem. Also, the mod's log is now permanently empty and it gets lonely in there. Also, just for safety I tried removing all the mods except PanicSystem and enemy mechs still refuse to eject when the mod determines they should.

Is it best to start a new campaign when trying to find if a mod is causing a conflict? Or at least load a save before the battle? I've been using a mid-battle autosave to fiddle with conflicts.. I'll try to start over with just this mod and see where that leads, if anywhere.

asaguda commented 5 years ago

Nope, no dice. BTML 0.6.4, ModTek 0.4.0 with new cache and database, and the previously attached alpha of this mod, on a new campaign, and it still hangs up on pilot ejects and the same error in the output_log.

MessageCenter [ERROR] CRITICAL ERROR, PLEASE REPORT:
Delegate OnAttackComplete - Standard for message type OnAttackComplete failed with exception 
Argument is out of range.
Parameter name: index
at System.Collections.Generic.List`1<string>.get_Item (int) <0x00083>
at PanicSystem.Patches/AttackStackSequenceOnAttackCompletePatch.Prefix (BattleTech.AttackStackSequence,MessageCenterMessage) <0x007f5>
at (wrapper dynamic-method) BattleTech.AttackStackSequence.OnAttackComplete_Patch1 (object,MessageCenterMessage) <0x00027>
at MessageCenter.SendMessagesForType (MessageCenterMessageType,MessageCenterMessage) <0x00186>

EDIT: Also BattleTech 1.2.1.

gnivler commented 5 years ago

Good timing really, was looking for something to do. The mid-battle save is fine AFAIK, and would actually help me test it out, if you could attach it please. The trickiest part is just being able to test it easily after coding changes.

Good to know about the logging being busted, it's been a while since I touched the code so I'll review it further. I'll post another build, hopefully today, hopefully with both bugs fixed.

Thanks!

gnivler commented 5 years ago

I've got working logging with debug turned on the mod.json, can't come up with a reason other than that the mod isn't loading or debug is disabled in mod.json, which it clearly wasn't/isn't... weird.

gnivler commented 5 years ago

Hah woops, wrong button.

asaguda commented 5 years ago

The older set, d86b... and cbf4... is the one that has had a bunch of mods at some point. The newer set, 8ffc... and b524... is the new campaign with only PanicSystem on. Both the mid-battle saves come with accompanying campaign start saves. SGS1.zip

Both of them are autosaves of the first campaign mission just before you stumble upon the two house guards. In all attempts but one while trying to figure this out I've been able to get one of them to try ejecting. I'ma try with the debug flag to true.

gnivler commented 5 years ago

Thanks for those, will check it out and the new campaign method you describe.

I dropped a regular assassination mission and got him to punch out, but no hang. This might replicate your original log, starting from Confident and getting a panic crit to jump to max. It rolls for eject for both of us but completes normally here so far. Just posting for posterity. This is 3.13 alpha too.

EDIT: to clarify this is my own save

##############################################
Hunchback attacks Orion
Damage >>> A: 0 S: 25 (7.66%)
Structure damage requires panic save
----------------------------------------------
Factors              |     Change |      Total
----------------------------------------------
Mech health 17.4%    |            |
Pilot injuries       |       12.5 |       12.5
CT                   |     63.333 |     75.833
LT                   |         25 |    100.833
RT                   |         25 |    125.833
LL                   |      4.078 |    129.912
RL                   |      9.281 |    139.193
Weaponless           |         15 |    154.193
Alone                |          5 |    159.193
Guts and Tactics     |        -12 |    147.193
Resolve 100          |        -10 |    137.193
Panic multiplier     |          1 |    137.193
----------------------------------------------
Saving throw         | 137     30 |       Roll
----------------------------------------------
Failed panic save
Orion condition worsened: Unsettled
Critical failure on panic save
Base ejection resist |         75 |     62.193
Eject multiplier     |          1 |         62
----------------------------------------------
Saving throw         | 62      29 |       Roll
----------------------------------------------
Failed ejection save: Punchin' Out!!
Ejected.  Runtime 99ms
asaguda commented 5 years ago
Centurion attacks Panther
Damage >>> A: 12.5 S: 12.5 (12.44%)
Structure damage requires panic save
----------------------------------------------
Factors              |     Change |      Total
----------------------------------------------
Mech health 21.7%    |            |
Pilot injuries       |     16.667 |     16.667
CT                   |     95.692 |    112.359
LT                   |         25 |    137.359
RT                   |     10.638 |    147.997
LL                   |      2.182 |    150.179
RL                   |      2.182 |    152.361
Alone                |          5 |    157.361
Guts and Tactics     |         -6 |    151.361
Resolve 0            |         10 |    161.361
Panic multiplier     |        0.5 |      80.68
----------------------------------------------
Saving throw         | 81      26 |       Roll
----------------------------------------------
Failed panic save
Critical failure on panic save
Base ejection resist |         75 |     86.361
Eject multiplier     |          1 |         86
----------------------------------------------
Saving throw         | 86      71 |       Roll
----------------------------------------------
Failed ejection save: Punchin' Out!!

This guy was brave. He succeeded in four separate panic rolls before finally deciding to eject. Tickled him with medium lasers to trigger the roll again and again. I feel mean.

On all my previous attempts the last line in the log is 'Ejecting.' In either case, that didn't seem to change, still soft locking. Since it still works for you I am very confused. It's running correctly up until it decides a mech should eject, and.. then nothing. If my saves also work for you I really have no idea. I validated the game files this noon before making one of the campaign saves in that .zip, I re-installed BTML and ModTek and all the mods from scratch..

This makes me scratch my head. Which is a shame. Panicking and ejecting would add a much needed human element to the battling. What all else can I try? A complete reinstall of the game maybe? I'll do that. Gigabit fibre is useful sometimes.

gnivler commented 5 years ago

Seems like everything is right except the result. I'm leaning towards the mod's code by itself, based on the exception you captured. I think the phrase 'Ejecting' probably went with the jump from 3.04 to 3.13, I just reworked some logging so not much concern there. FWIW I'm pretty sure it's unrelated to BTML and ModTek (if the mod loads successfully) so you can maybe save yourself some headache trying reinstalls etc, I think, a futile exercise. It's pretty focused, the code in the mod is ostensibly crashing.

Does it lock every time someone should/does eject?

update: Unfortunately I didn't reproduce the issue using your save.. punched out both of those first mechs. It's acting like a buggy old version, but you've got those bases covered from the sound of it. I'll keep thinking on it but stumped atm.

asaguda commented 5 years ago

I've never seen someone successfully eject as a result of a failed panic roll. When I have the mod installed basically the only way for me to progress is to avoid making enemy pilots panic, which is kinda difficult.

Reinstalling, much like you suggested, didn't help. The mod loads correctly and the log is full of captured damage events, roll results, etc. I've got Janxious' latest forks of BTML and ModTek, your alpha from earlier. I'm on Windows, on Steam, not using any preview or older builds in the beta tab. From where I stand I can see no reason why it wouldn't work.

I'll start a prologue skip campaign so I have more freedom to try ejecting enemy pilots outside of story missions as well as making my own panic and eject. EDIT: Friendly mechs can't eject either. I don't know what other steps I can take from here, so I'm open to suggestion. EDIT2: 30 minutes later and Dekker in his Spider still hasn't ejected. That probably rules out difficulty finding the big red button. :p

gnivler commented 5 years ago

That's even weirder, and terrible. We had this same symptom with earlier bugs but it never effected every ejection. Your setup is practically the same as mine sadly. Any chance you have not already tried deleting/renaming (for backup) the PanicSystemStorage.json and PanicSystem.json files in the mod folder?

On Sun, Nov 25, 2018 at 3:33 AM asaguda notifications@github.com wrote:

I've never seen someone successfully eject as a result of a failed panic roll. When I have the mod installed basically the only way for me to progress is to avoid making enemy pilots panic, which is kinda difficult.

Reinstalling, much like you suggested, didn't help. The mod loads correctly and the log is full of captured damage events, roll results, etc. I've got Janxious' latest forks of BTML and ModTek, your alpha from earlier. I'm on Windows, on Steam, not using any preview or older builds in the beta tab. From where I stand there is no reason it shouldn't work.

I'll start a prologue skip campaign so I have more freedom to try ejecting enemy pilots outside of story missions as well as making my own panic and eject.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/gnivler/PanicSystem/issues/40#issuecomment-441427221, or mute the thread https://github.com/notifications/unsubscribe-auth/ARmQpa3T_AtaJPsz5GMMls1W4vlNW8Brks5uymPXgaJpZM4YxeSe .

asaguda commented 5 years ago

I don't think I kept those once doing my reinstalls and stuff, so they've been recreated multiple times. I tried to delete them and test again just in case, but nothing changes.

MessageCenter [ERROR] CRITICAL ERROR, PLEASE REPORT:
Delegate OnAttackComplete - Standard for message type OnAttackComplete failed with exception 
Argument is out of range.
Parameter name: index
at System.Collections.Generic.List`1<string>.get_Item (int) <0x00083>
at PanicSystem.Patches/AttackStackSequenceOnAttackCompletePatch.Prefix (BattleTech.AttackStackSequence,MessageCenterMessage) <0x007f5>
at (wrapper dynamic-method) BattleTech.AttackStackSequence.OnAttackComplete_Patch1 (object,MessageCenterMessage) <0x00027>
at MessageCenter.SendMessagesForType (MessageCenterMessageType,MessageCenterMessage) <0x00186>
gnivler commented 5 years ago

Damn not so lucky! I'm thinking it's got to be another part of the code, but without being able to replicate the problem I have to ask you again to please give it a whirl. I added exception handlers and inserted extra debug logging to log.txt that will hopefully help isolate it. This version is hard-coded to trigger ejections more quickly (every save failure is a crit).

PanicSystem3.15dev.zip

asaguda commented 5 years ago

I'm happy to be a guinea pig. I'm on it. :D

gnivler commented 5 years ago

Code error in 3.15dev, here's the fix for that mistake. PanicSystem3.16dev.zip

Thanks a bunch for testing

gnivler commented 5 years ago

Sorry about that... tested it after uploading. :|

It makes sense the error would be gone though. I got an ejection on those first mechs, looks like:

##############################################
Kintaro attacks Shadow Hawk
Damage >>> A: 9.75 S: 43.25 (22.29%)
Structure damage requires panic save
----------------------------------------------
Factors              |     Change |      Total
----------------------------------------------
Mech health 22.64%   |            |
Pilot injuries       |     16.667 |     16.667
CT                   |         88 |    104.667
LT                   |     16.818 |    121.485
RT                   |         25 |    146.485
LL                   |      3.474 |    149.959
RL                   |      7.947 |    157.906
Alone                |          5 |    162.906
Guts and Tactics     |         -6 |    156.906
Resolve 0            |         10 |    166.906
Panic multiplier     |        0.5 |     83.453
----------------------------------------------
Saving throw         | 83      33 |       Roll
----------------------------------------------
Failed panic save
Critical failure on panic save
Info - index is 4
Panic save failure requires eject save
----------------------------------------------
Factors              |     Change |      Total
----------------------------------------------
Base ejection resist |         75 |     91.906
Eject multiplier     |          1 |         92
----------------------------------------------
Saving throw         | 92      86 |       Roll
----------------------------------------------
Failed ejection save: Punchin' Out!!
Removing effects
Effects removed
Ejecting
Ejected.  Runtime 66ms
asaguda commented 5 years ago
Spider attacks Spider
Damage >>> A: 0 S: 18.75 (10.07%)
Structure damage requires panic save
----------------------------------------------
Factors              |     Change |      Total
----------------------------------------------
Mech health 31.25%   |            |
Pilot injuries       |     16.667 |     16.667
CT                   |     76.563 |     93.229
LT                   |     11.364 |    104.593
RT                   |         25 |    129.593
RL                   |     14.925 |    144.518
Guts and Tactics     |         -6 |    138.518
Resolve 45           |         -8 |    130.518
Panic multiplier     |        0.5 |     65.259
----------------------------------------------
Saving throw         | 65      34 |       Roll
----------------------------------------------
Failed panic save
Critical failure on panic save
Info - index is 5
Panic save failure requires eject save
----------------------------------------------
Factors              |     Change |      Total
----------------------------------------------
Base ejection resist |         75 |     55.518
Eject multiplier     |          1 |         56
----------------------------------------------
Saving throw         | 56      34 |       Roll
----------------------------------------------
Failed ejection save: Punchin' Out!!
MessageCenter [ERROR] CRITICAL ERROR, PLEASE REPORT:
Delegate OnAttackComplete - Standard for message type OnAttackComplete failed with exception 
Argument is out of range.
Parameter name: index
at System.Collections.Generic.List`1<string>.get_Item (int) <0x00083>
at PanicSystem.Patches/AttackStackSequenceOnAttackCompletePatch.Prefix (BattleTech.AttackStackSequence,MessageCenterMessage) <0x00838>
at (wrapper dynamic-method) BattleTech.AttackStackSequence.OnAttackComplete_Patch1 (object,MessageCenterMessage) <0x00027>
at MessageCenter.SendMessagesForType (MessageCenterMessageType,MessageCenterMessage) <0x00186>

Using 3.16, soft lock on ejection. For clarification, 3.15 seemed to error out of the ejection and managed to skip it.

gnivler commented 5 years ago

Ok excellent data, checking it out. Thanks

asaguda commented 5 years ago

For reference, the 3.15 snippet again:

Shadow Hawk attacks Spider
Damage >>> A: 20 S: 13 (13.02%)
Structure damage requires panic save
----------------------------------------------
Factors              |     Change |      Total
----------------------------------------------
Mech health 41.14%   |            |
Pilot injuries       |      8.333 |      8.333
CT                   |      41.25 |     49.583
RT                   |         25 |     74.583
RL                   |         15 |     89.583
Guts and Tactics     |         -6 |     83.583
Resolve 30           |         -2 |     81.583
Panic multiplier     |          1 |     81.583
----------------------------------------------
Saving throw         | 82      15 |       Roll
----------------------------------------------
Failed panic save
Spider condition worsened: Unsettled
Critical failure on panic save
Info - index is 5
Error - index is 5, abort eject process
gnivler commented 5 years ago

Hrm.. might this be a missing phrases.txt file? I am just looking at my code for loading the file and may have found a problem. Removing my phrases.txt caused the soft lock!

asaguda commented 5 years ago

I did think that at some point, and I did insert an empty phrases.txt upon seeing the "Can't find file" thing, and then that didn't work and I probably removed it again when I redownloaded BattleTech. Maybe I need to have something in the file for it to work? I'll give it a go. Coincidentally I just spent some 5-10 minutes filling the phrases.txt out with random humorous junk. :P

gnivler commented 5 years ago

Lol well that might work out nicely. I think this must be it. If your ejections work now with your custom phrases.txt that'll be definitive. I'm working on the code to make it handle it missing better now, since I can replicate it. It's not handling the file's absence properly, it should be able to work with or without it really... it was just coded poorly (by me!).

asaguda commented 5 years ago

image

So it needed to be there, and also needed to be non-empty. 3.04 is missing the phrases.txt in the download so I never thought it was -that- vital. :o

gnivler commented 5 years ago

Damn, missing in the zip... shit! The file wasn't supposed to be that important fwiw. I've got 3.20 working and ready to upload pending one more test.

asaguda commented 5 years ago

It's a bit of a silly cause, some might have it from the earlier version, which does happen to have a phrases.txt. Still, this back and forth might have saved some other people headaches. Some people would just.. remove the mod and play without it, which is a shame. Thank you again for taking the time!

gnivler commented 5 years ago

You bet, thanks for reporting and helping to fix it. Uploading new release!