MyDeadfireModAccount Posted February 1, 2019 Posted February 1, 2019 Hello this is my first post here. I've been modding this game for over a month now, mostly bumbling my way through it, looking through the exported files for examples of how things are implemented, and reading the few tutorials here. The mod I'm doing has kind of turned out to become a massive overhaul of the game sort of mod and I have (estimated) over a hundred scripts in it for all sorts of things. I started out using ModHookScript because it is so simple to implement using IsInActiveScene condition but I had to include a few GlobalScriptCalls to get around looping and timing limitations. Still, 99% of my scripts are ModHookScript because they are so easy and accessible to write. The problem now is, I'm wondering if using and relying on all these ModHookScripts to do the bulk of the script work will have a negative impact on game performance or if they are efficient at all if GlobalScriptCall can do the same thing without the game constantly running them each time a scene is entered. Basically I'm not sure if a ModHookScript is still brought up and runned anyway, even if it had succeeded already, and will not succeed again, on entering a scene given "RunOnlyOnce" = false and "SucceedOnlyOnce" = true. If this is the case, then it seems like a waste of resources and a potential drag on game performance if I have dozens of "succeeded" scripts (that won't and shouldn't succeed again) still running each time the player transitions to a scene with ModHookScripts in it. If my fear is correct then it seems like I need to change course and go with using only a few ModHookScripts that call GlobalScripts, where the bulk of the data is. In my testing it is hard to tell if performance is impacted because I didn't think to or know to consider this aspect at the start. The game is running okay for me in testing but I'm afraid that other players playing with the mod will experience things like crashing if their computer can't handle it.
BMac Posted February 1, 2019 Posted February 1, 2019 The hooks will not continue to run after they have run or succeeded if they have RunOnlyOnce or SucceedOnlyOnce respectively. Of course, SucceedOnlyOnce hooks will be running on each scene transition until they succeed, which could potentially lead to slightly longer load times. I would expect it to be pretty minimal, though (an IsInActiveScene call takes about 0.2-0.3 milliseconds on my machine).Also, I don't know exactly how you're using the GlobalScripts, but to clarify, they won't call themselves. They're intended to be re-usable or organized blocks of scripts you can call from different places; you do still need to call them from, for example, a ModScriptHook.
MyDeadfireModAccount Posted February 2, 2019 Author Posted February 2, 2019 Thankyou for the clarification. I'll keep using the ModHookScripts in that case. And yeah, I am calling the GlobalScripts with ModHookScripts and using a called GlobalScript to call other GlobalScripts where necessary.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now