Event OnStoryIncreaseLevel won't trigger?

Post » Wed Jun 20, 2012 11:53 pm

Ok so I have a quest that starts with the game (Start Game Enabled). I have already setup aliases for the npcs. I have a quest script that contains the Event OnStoryIncreaseLevel. Basically does something like this

Event OnStoryIncreaseLevel(int aiNewLevel)	    Debug.Notification("Level up event triggered")	    ReferenceAlias NPC = getAlias(0) as ReferenceAlias	    NPCModifier.DoSomethingToNPC(NPC.GetReference())EndEvent

In the case that the npc is very near the player. So with my testing, the event doesn't even trigger. I leveled up normally, I didn't use the console command advlevel. What am I doing wrong?

Thanks :smile:
User avatar
Angus Poole
 
Posts: 3594
Joined: Fri Aug 03, 2007 9:04 pm

Post » Wed Jun 20, 2012 10:33 pm

Those events don't work like other events do. Think of them kind of like custom "on update" events with custom parameters, meaning they return things like whatever your new level is, or whatever skill you just increased. Like on update, you have to register the script to receive the event.

Unlike on update, you do not register it by using some other function in the script. To get your script to receive those events you have to do two things. First, in your quest, change it from start game enabled to on event level increase. That means uncheck start game enabled and select level increase from the drop down.

The second thing you must do is go to the sm e vent node section of the object window. Find the event node for leveling up. Open it up, and right click and add new quest node. Make sure you name it something unique and make sure "shares event" is checked. Then, right click on your new node and click add quest. Select the quest you want to receive the event, which is the one with your script, and you are done!
User avatar
neil slattery
 
Posts: 3358
Joined: Wed May 16, 2007 4:57 am


Return to V - Skyrim