Jump to content

triggering a script when the player levels up


TheBlob2

Recommended Posts

This quest script should do it:

int iOldLvl
int iNewLvl

Begin GameMode

    ; For initialization purposes if the variable is empty. The first level is 1.
    If iOldLvl == 0
        Set iOldLvl to 1
    EndIf
    
    ; Retrieve the player's level.
    Set iNewLvl to Player.GetLevel
    
    ; Has the player gained a level since last time?
    If iNewLvl > iOldLvl
        Set iOldLvl to iNewLvl
        MessageBoxEx "You have just levelled up!"
    EndIf
End

It will show a message (note that MessageBoxEx is an NVSE function) everytime you gain a level.

 

If you want only a specific level to trigger an event, you can set iOldLvl to that level, change the condition to iNewLvl == iOldLvl, and put a StopQuest command after the message.

Link to comment
Share on other sites

Set a flag variable in MenuMode 1027 and check the value of it in GameMode.

 

This is the solution for doing something once the player is out of the menu.

 

I use MenuMode 1027 regularly for tracking player levels and doing stuff with that info.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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