Page 1 of 1

[Solved] How to script the difficulty?

Posted: 13 Jul 2019, 23:30
by dlshcbmuipmam
I am trying to understand how to implement a script to scale the difficulty with the character level. It can be done in tes3mp [1], seems like a simple lua script will do the job. However, the wiki page of scripting [2] is not that clear. And the documentation [3] on scripting in openmw-cs is non-existent.


I guess I just have to write a simple lua/python script, than load it by aliasing openmw to openmw script-run=... . Here are my questions -

System: Windows 10, normally I use MSYS2(mingw64) shell to manage dependencies.

1. The script in [1] doesn't have the omw prefix mentioned in [2], could anyone provide the correct lua script that works with script-run=...?
2. What exactly are the required dependencies? Must I have lua5.1? What about lua5.3? Can openmw (built by MSVC) use the lua library in the MSYS2 repo(which means it should be built by mingw)?
3. Can I do this without external lua scripting? It seems like I can create a simple mod for this, if so, can anyone provide some simple instructions?

[1]: https://www.reddit.com/r/tes3mp/comment ... _level_up/
[2]: https://wiki.openmw.org/index.php?title ... ion#Github
[3]: https://openmw.readthedocs.io/en/stable ... index.html

Re: How to script the difficulty?

Posted: 14 Jul 2019, 02:32
by AnyOldName3
OpenMW only has MWScript - the experimental Lua and Python bindings were only a proof-of-concept and weren't very useful, so never got merged.

You can either implement what you want in MWScript (which may turn out to be difficult or impossible as it's generally considered to be an awful language with more gotchas than even JavaScript) or implement it in TES3MP Lua. When OpenMW eventually gets Lua support, it will be either very similar or identical to TES3MP Lua, so you can consider that a prototype for what we'll have in the future.

Re: How to script the difficulty?

Posted: 14 Jul 2019, 09:02
by dlshcbmuipmam
AnyOldName3 wrote: 14 Jul 2019, 02:32 OpenMW only has MWScript - the experimental Lua and Python bindings were only a proof-of-concept and weren't very useful, so never got merged.

You can either implement what you want in MWScript (which may turn out to be difficult or impossible as it's generally considered to be an awful language with more gotchas than even JavaScript) or implement it in TES3MP Lua. When OpenMW eventually gets Lua support, it will be either very similar or identical to TES3MP Lua, so you can consider that a prototype for what we'll have in the future.
Thanks for the clarification. In that case, it is easier to add a setting and modify the apps/openmw/mwmechanics/difficultyscaling.cpp directly. I think it works quite well. Should I submit a PR on this or just keep it personal?

Re: How to script the difficulty?

Posted: 17 Jul 2019, 13:04
by lysol
I would guess it's better to keep it personal for now since it will probably just get replaced once Lua gets added. But correct me if I'm wrong anyone. Thanks for the thought anyway. I'm marking this as solved for now.

Re: [Solved] How to script the difficulty?

Posted: 18 Feb 2022, 13:39
by mym
Hello,
I would also love to have such a mod.
Now openmw 0.48 has some lua scripting maybe it could be done?
We could take inspiration from MWSE lua scripts here: https://www.nexusmods.com/morrowind/mods/45710