Jump to content

Setplayerlevel


foot89790

Recommended Posts

I mean to include it into an activator, so right now I have?:

 

Event OnActivate(ObjectReference akActionRef)
Player.SetLevel(1)
EndEvent
and I'm getting:
(4,1): variable Player is undefined
(4, 8: none is not a known user-defined script type
Edited by foot89790
Link to comment
Share on other sites

Use Game.GetPlayer().SetLevel(1) instead.

I got (4,18): SetLevel is not a function or does not exist

I think it might be hardcoded in game that you can't lower your level. The console command for lowering your level that worked in skyrim doesn't work in f4 either. Dyou have any ideas on how I could get around that?

Link to comment
Share on other sites

You can make your own SetPlayerLevel without SKSE, or any hackish tricks. You just need a bit of math. Luckily, I had already done this before and found the function I made. I didn't think it was useful to anyone, even for me because of the one thing that makes it bothersome: The xp counter will count forever and ever until it reaches the total exp gained up to that level you set. For example, if you set your level to 50 from level 1, that XP counter is going to keep going until it reaches the exp for level 50. There's no way to stop it. Your level itself is instantly set though.

 

 

 

Scriptname LevelUpScript extends Quest

ActorValue property Experience auto

Actor player

Event OnQuestInit()
    player = Game.GetPlayer()
    Int currentLevel = player.GetLevel()
    SetPlayerLevel(currentLevel, currentLevel + 10)
    ; example purposes. If you're level 1, this will bump you to 10.
EndEvent


Function SetPlayerLevel(Int aiCurrentLevel, Int aiLevelToSet)
    ; Set the player's level.
    Float totalEXPGained = player.GetValue(Experience) as int
    ; xp gained since level 1

    Float calculatedLvl  = (aiLevelToSet - aiCurrentLevel) as Float 
    ; level - desired level to get the level difference

    Float totalXPForDesiredLvl = 37.5 * aiLevelToSet * aiLevelToSet + 87.5 * aiLevelToSet - 124.0
    ; total exp for the desired level
    
    ; Can't go back levels.
    if (aiLevelToSet < aiCurrentLevel)
        return
    endif
    
    player.ModValue(Experience, totalXPForDesiredLvl - totalEXPGained)
EndFunction

 

The formula in there actually has an exponent, but I changed it to avoid using math.pow().

Link to comment
Share on other sites

You can make your own SetPlayerLevel without SKSE, or any hackish tricks. You just need a bit of math. Luckily, I had already done this before and found the function I made. I didn't think it was useful to anyone, even for me because of the one thing that makes it bothersome: The xp counter will count forever and ever until it reaches the total exp gained up to that level you set. For example, if you set your level to 50 from level 1, that XP counter is going to keep going until it reaches the exp for level 50. There's no way to stop it. Your level itself is instantly set though.

 

This is some serious scripting. Its annoying that going back levels is hardcoded into the game though

Link to comment
Share on other sites

  • Recently Browsing   0 members

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