I knew it! Those pesky NPCs; secretly pulling all kinds of shenanigans. So... I have been writing the hit chance portion of my mod, and ran into a very peculiar crash, where my script worked for a few minutes, then stopped posting any messages. The script kept throwing warnings about attack type being out of range before stopping. Then when I quit the game, on exit I got a a crash and memory error of some kind. I checked the script but there wasn't anything particularly wrong. So I wrote some tracing code to see whats going on. See the image then read on... This was a mobster estimating attack on a yakuza. Let me explain what the text means. "Mode" - refers to my function that determines weapon mode based on atktype. HC - stand for hit chance hook function raw HC - raw hit chance grabbed within HC hook. adjusted - is the changed raw hit chance after the hook modifies the hit chance. (no change for now) So: 1st - "Mode" is reporting that it was called for HC hook. 2nd - hit chance hook is reporting the weapon, the atktype, the determined mode, and the hit chances. 3rd - get_mode is called again from HC hook, but this time its reporting that its been supplied an atktype of 4 (punch) (which is supplied from HC hook by get_sfall_arg_at), and for safety its returning mode 1 since there is no mode for atktype of 4. 4th - HC hook is reporting that an attempt to calculate hit chances was made using weapon "Tommy Gun" and attack type 4 (punch), with mode decided as 1 hit chance is 30. Fucking NPCs. Jokes aside, any idea about what is going on? If the attack type given is unpredictable, then this causes potentially serious issues when needing attack type. Now I've only encountered this from inside the tohit hook script. Is it possible that there is a problem in sfall? Though I doubt that. I got to say I noticed that the AI tries to make multiple estimates using the different modes of the gun, so hit chance gets called several time for each NPC. It checks with both attacktype 2 and 3 and it seems once it decides which mode to use then it tries several attempts from different tiles and chooses best one. I don't understand why its trying to test with atktype 4 though. Kept happening with tommy gun, but not with throwing knife or wakizashi. But I haven't tested enough, and don't plan to.