forli Posted November 26, 2016 Share Posted November 26, 2016 Another way: scn SomeQuestScript Begin MenuMode 1044 If GetGameRestarted SetEventHandler "PostLoadGame" PostLoadGameHandler EndIf End scn PostLoadGameHandler short LoadSucceed Begin Function { LoadSucceed } If LoadSucceed If FileExists "Data\Ini\ArmorRatingSettings.ini" RunBatchScript "Data\Ini\ArmorRatingSettings.ini" EndIf EndIf EndWhen the game reach the main menu (1044) for the first time in the session (GetGameRestarted) you register an event handler:every time the game is loaded, the function PostLoadGameHandler is called and run whatever initialization you need to do. No GameMode, no continuous check (event handlers are "attached" to their respective game events, so they run automatically when the event fire), run once per game load.A script running every 5 seconds in the Main menu... you may have more than 1000 of them without paying a single FPS. Link to comment Share on other sites More sharing options...
avalon2260 Posted November 29, 2016 Share Posted November 29, 2016 (edited) * Edited December 10, 2016 by avalon2260 Link to comment Share on other sites More sharing options...
forli Posted November 29, 2016 Share Posted November 29, 2016 (edited) So do you need to re-read the ini file continuously? That may cripple your FPS! Every line of code you write in the ini must be compiled on the fly (it's not a very heavy operation, but it's still something you should avoid). A solution may be: add a spell you can cast at any time:Begin ScriptEffectStart Call PostLoadGameHandler 1 EndIf you don't like spells, you can use a MenuMode script which wait for the player to press a key (so you must open the inventory, and again, no GameMode script)Begin MenuMode 1002 ;in inventory If OnKeyDown <X> Call PostLoadGameHandler 1 EndIf End Edited November 29, 2016 by forli Link to comment Share on other sites More sharing options...
avalon2260 Posted November 29, 2016 Share Posted November 29, 2016 (edited) * Edited December 10, 2016 by avalon2260 Link to comment Share on other sites More sharing options...
Recommended Posts