Jump to content

Get a script to run on level up?


Recommended Posts

Maybe some sort of a combination of OBSE event handlers and commands to track skill up counts would work? Somehow? I cannot test anything at the moment (again), but as an idea, maybe something like the following would work to track when normal skill ups happen. For scripted skill ups, you need to make some other sort of system. Assuming GetPCMajorSkillUps returns the number of advances completed towards the next level (and not the amount of them required for the next level), and assuming that the number is reset to 0 upon leveling up, then maybe adding an event handler in a quest script:

scriptname YourPrefixQuestScript

begin _MenuMode 1044

    if ( GetGameRestarted )
        seteventhandler "OnSkillUp" YourPrefixSkillUpHandler
    endif

end

The menumode thing is from here by forli --> https://forums.nexusmods.com/index.php?/topic/5104120-possible-problem-with-mod/?p=45012990

And event handlers are here --> http://obse.silverlock.org/obse_command_doc.html#Events

 

And the event handler:

scriptname YourPrefixSkillUpHandler

int SkillCode

begin _Function { SkillCode }

    if eval ( !( PlayerRef.IsMajorC SkillCode ) || ( ( GetPCMajorSkillUps ) > 0 ) )
        return ; not a relevant event this one, skipping...
    endif

    MessageBox "Player has leveled up!"

end

Something like that maybe? I have not tested if it works, but it should give you a general idea of one way to maybe go about doing it. Scripted skill ups are a bit tricky, and would require knowledge of how many skill ups are required for the next level up (the event handler is called before the skill ups are applied).

 

Hopefully that helps a bit. Happy modding! :thumbsup:

 

Edit: Thinking about it, maybe a mod like Oblivion XP Update would have, in its scripts, some tricks on how to go about doing that as well (I have not checked it myself, but it looks like a mod that might have something in it) --> http://www.nexusmods.com/oblivion/mods/35333

Edited by Contrathetix
Link to comment
Share on other sites

  • Recently Browsing   0 members

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