Jump to content

Possible Problem With Mod


Recommended Posts

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
End

When 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

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
End
If 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 by forli
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...