Skip to content

Expose commitCrime to Lua API

A UI mod I'm working on needs a way to commit crimes in a way similar to that found in the vanilla game. I believe it's also an issue for other mods, such as deckwind (which, iirc, handles it by spawning in a temporary object and then making the PC take that instead), and "take all" by pwn (which simply prevents using its features on owned containers).

I made an attempt to implement commitCrime in Lua (around 500 LOC for the parts I rewrote) and I believe most of the code is already possible to port. Perhaps it could serve as a starting point for dehardcoding instead if exposing the function itself isn't desired.

Alternatively, one could instead expose the features needed to reimplement commitCrime in Lua. I can make an exhaustive list of what's missing, but it mostly relates to setting flags such as mMurdered on CreatureStats.