Reply To: Mafia 3 Modding (Mega Thread)

Download Mods for the Mafia Games Forums Mod Creation Mafia 3 Modding (Mega Thread) Reply To: Mafia 3 Modding (Mega Thread)

#163190
SladernimoSladernimo
Participant

Is there any way to make a endless loop for code without crashing atm?

There is this note on M3ScriptHook mod page:

“Please be careful with pressing keys, spaming keys / executing the same things too often in a short time period can cause the game to crash!”

 

I made a script that executes code in a loop. To limit the rate I use setTimeout to trigger the script less often like this:

myFunc= [[
CODE TO EXECUTE … ;
setTimeout(“1000”, myFunc);
]]

 

Without limitation the game crashes almost instantly.

But even while waiting 1 – 5 seconds before each code exec the game crashes after a few minutes.

ScriptHook.log doesn’t tell anything about it.

 

Last lines of ScriptHook.log:

Trying to execute:¬†CODE TO EXECUTE … ;

LuaFunctions::DelayBuffer
LuaFunctions::DelayBuffer::<lambda_3e31ca3edde28b6914e6e540dd3f3484>::operator ()
M3ScriptHook::Shutdown
M3ScriptHook::EndThreads
PluginSystem::StopPlugins