Last Time we made a basic MCM menu, in this tutorial we will laying the foundation for adding some functionality to it. Every time the player levels up a notification will trigger. With this knowledge you can then trigger nearly any function on level up. You can view the official documentation for the event here: https://www.creationkit.com/index.php?title=OnStoryIncreaseLevel_-_Quest
- First we open the creation kit, ensuring that the correct file is set to active file.
- We then create a new quest object, ill be naming mine “BLUpQ_kx”. You can name it whatever you want tho.
- Under the dropdown menu Event, select Increase level.
- Ensure start game enabled is unticked, while allow repeated stages is ticked.
- Head to the Scripts tab and click “Add”. This will be the script that actually does stuff, based on the settings defined in our MCM script/menu. Ill be calling mine “BLLevelUpS_kx“.
- Open the new script
- First we need to create a quest property. You can name it anything, but ill be naming it the same as our quest LevelUpQuest.
- We need to use the event OnStoryIncreaseLevel(int aiNewLevel). Which executes when this quest is triggered by the “increase level” story manager event, which we will set up later.
- Inside that, we are going to write a simple message letting us know when this executes in game, so we can make sure everything is set up correctly so far.
- Debug.notification(“BLLevelUpS_kx has detected the player has leveled up to level: ” + aiNewLevel + “!”) anything in quotes is a string of characters, by adding the aiNewLevel Variable, it’s value will be displayed directly after the string.
- Below that we need to write a function to end the quest, so it’s ready to run again when the player next levels up.
- LevelUpQ.stop() don’t forget the EndEvent at the bottom.
- Then save the script ensuring it compiles without error.
- Next we need to add our script to the Story Manager Event Node “Increase Level”. SM Event Nodes are found within the quest category.
- Open Increase Level, right click “Stacked Event Node: Increase Level” and select New Quest Node.
- Click on our new quest node and under node properties in the bottom left tick “Shares Event”.
- Right click this new quest node and select “Add Quests”, selecting our custom quest MCMQuestBl.
- Click OK in the top right and save the mod.
- Boot up the game and give it a test.
- The notification should show up after choosing a stat in the level up menu and leaving all menus. If it doesn’t you’ve probably messed up somewhere.
So now any functions you put within the on level up event will trigger when leveling up. In the next tutorial, i will show you how to edit actor values, nameley health, magicka and stamina. Though the concepts work for all actor values. Ill also go over using script functions and variables in other scripts, namely getting the variables from our mcm script and using them in our levelup script.
The completed level up script:
Scriptname BLLevelUpS_kx extends Quest quest Property LevelUpQuest Auto Event OnStoryIncreaseLevel(int aiNewLevel) Debug.notification("BLLevelUpS_kx has detected the player has leveled up to level: " + aiNewLevel + "!") LevelUpQuest.stop() endEvent