Jump to content

[LE] Having trouble making a scaling with level spell


JennyPricefield

Recommended Posts

So I'm trying to make a custom race mod, with custom race powers, one of which includes a healing spell. Naturally, there is an issue with setting the healing value so it's both useful in late game and not overpowered in the beginning. However, from my digging around Creation Kit a real long time ago I knew that Serana is using a script that, by the looks of it, replaced her spells with more powerful ones as the games goes. I don't know papyrus but I have a basic understaing of how scripts work from school IT classes so I copied the script and modified the copy to be like this:

Scriptname _BrigitteLindholmSpellLevelingScript extends actor
Event OnInit()
RegisterForUpdateGameTime(24)
EndEvent
Event OnUpdateGameTime()
If IsInCombat() == False
CurrentLevel = GetLevel()
If CurrentLevel > LastLevel
If CurrentLevel >= Stage7
; currently undefined, set LastLevel to shut down
LastLevel = Stage7
ElseIf CurrentLevel >= Stage6
RemoveSpell( _BrigitteLindholmSpellRepairPack50 )
RemoveSpell( _BrigitteLindholmSpellBarrierShield20 )
AddSpell( _BrigitteLindholmSpellRepairPack60 )
AddSpell( _BrigitteLindholmSpellBarrierShield60 )
ElseIf CurrentLevel >= Stage5
RemoveSpell( _BrigitteLindholmSpellRepairPack40 )
AddSpell( _BrigitteLindholmSpellRepairPack50 )
ElseIf CurrentLevel >= Stage4
RemoveSpell( _BrigitteLindholmSpellRepairPack30 )
AddSpell( _BrigitteLindholmSpellRepairPack40 )
ElseIf CurrentLevel >= Stage3
RemoveSpell( _BrigitteLindholmSpellRepairPack20 )
AddSpell( _BrigitteLindholmSpellRepairPack30 )
ElseIf CurrentLevel >= Stage2
RemoveSpell( _BrigitteLindholmSpellRepairPack10 )
RemoveSpell( _BrigitteLindholmSpellBarrierShield )
AddSpell( _BrigitteLindholmSpellRepairPack20 )
AddSpell ( _BrigitteLindholmSpellBarrierShield20 )
ElseIf CurrentLevel >= Stage1
RemoveSpell( _BrigitteLindholmSpellRepairPack0 )
AddSpell( _BrigitteLindholmSpellRepairPack10 )
EndIf
LastLevel = CurrentLevel
EndIf
EndIf
EndEvent
Int Property CurrentLevel Auto
Int Property LastLevel Auto
Int Property Stage1 = 10 Auto
Int Property Stage2 = 20 Auto
Int Property Stage3 = 30 Auto
Int Property Stage4 = 40 Auto
Int Property Stage5 = 50 Auto
Int Property Stage6 = 60 Auto
Int Property Stage7 = 61 Auto
SPELL Property _BrigitteLindholmSpellRepairPack0 Auto
SPELL Property _BrigitteLindholmSpellRepairPack10 Auto
SPELL Property _BrigitteLindholmSpellRepairPack20 Auto
SPELL Property _BrigitteLindholmSpellRepairPack30 Auto
SPELL Property _BrigitteLindholmSpellRepairPack40 Auto
SPELL Property _BrigitteLindholmSpellRepairPack50 Auto
SPELL Property _BrigitteLindholmSpellRepairPack60 Auto
SPELL Property _BrigitteLindholmSpellBarrierShield Auto
SPELL Property _BrigitteLindholmSpellBarrierShield20 Auto
SPELL Property _BrigitteLindholmSpellBarrierShield60 Auto
After that, I first tried creating a magic effect that applies this script to an actor but some kind of error popped up, it was quite some time ago and I don't remember what exactly it said, but the point was to change "extends actor" to "extends magiceffect" or smth like that. Which I did and it seemed okay. But creating a passive racial ability with this effect didn't seem work: I leveled up my character to level 10 via console but nothing happened, I waited for 24 hours but still nothing happened, baseline spell stayed the same and didn't get replaced.
"Okay, maybe this kind of script doesn't work with extends magiceffect". So then I made a quest, created an alias, set it to unique actor - player - and added my script to alias scripts (using this way there would also be a need for a race check so the script is applied only to my race but I left it for later). But again, leveling and waiting had no effect. So I started to think that maybe the problem is with the script. Or maybe I just screwed up with the alias thing since the only kind of modding I'm confident in is re-balancing followers to fit my gameplay style. Anyways, I need two racial spells to be leveld and the two ways of doing it I could think of didn't work. They seemed okay so what did I do wrong? Or if they're not okay how do I make leveled spells for a custom race?
Link to comment
Share on other sites

you wrote: "I leveled up my character to level 10 via console but nothing happened"

 

You forgot the initialization for LastLevel!

 

Maybe something like this: _BrigitteLindholmSpellLevelingScript

 

Scriptname _BrigitteLindholmSpellLevelingScript extends Actor
; https://forums.nexusmods.com/index.php?/topic/9608713-having-trouble-making-a-scaling-with-level-spell/

  Int PROPERTY iLastLevel auto  

; -- EVENTs -- better name: "jpf_ActorLevelingScript"

EVENT OnInit()
    iLastlevel = self.GetLevel()                        ; init the level here
    RegisterForSingleUpdateGameTime(24.0)    ; ***
ENDEVENT


EVENT OnUpdateGameTime()
IF self.GetBaseObject()
ELSE
    RETURN    ; - STOP -    mod as been uninstalled!
ENDIF
;---------------------
IF self.IsInCombat()
    Utility.Wait(1.0)
    RegisterForSingleUpdateGameTime(1.0)    ; * just wait one hour and try again
    RETURN    ; - STOP -
ENDIF
;---------------------
    int i = self.GetLevel()                               ; i = CurrentLevel
    IF (i > iLastLevel)
        iLastLevel = i                                    ; update the level
        myF_Action(i)
        self.EvaluatePackage()    ; --- this could be useful, if you think its bad.. remove this line ---
    ENDIF

    RegisterForSingleUpdateGameTime(24.0)    ; *** wait an ingame day and try again
ENDEVENT


; -- FUNCTION --

  SPELL PROPERTY _BrigitteLindholmSpellRepairPack0  auto  
  SPELL PROPERTY _BrigitteLindholmSpellRepairPack10 auto  
  SPELL PROPERTY _BrigitteLindholmSpellRepairPack20 auto  
  SPELL PROPERTY _BrigitteLindholmSpellRepairPack30 auto  
  SPELL PROPERTY _BrigitteLindholmSpellRepairPack40 auto  
  SPELL PROPERTY _BrigitteLindholmSpellRepairPack50 auto
  SPELL PROPERTY _BrigitteLindholmSpellRepairPack60 auto

  SPELL PROPERTY _BrigitteLindholmSpellBarrierShield   auto  
  SPELL PROPERTY _BrigitteLindholmSpellBarrierShield20 auto  
  SPELL PROPERTY _BrigitteLindholmSpellBarrierShield60 auto

;-------------------------
FUNCTION myF_Action(Int i)
;-------------------------
    self.RemoveSpell( _BrigitteLindholmSpellRepairPack60 )
    self.RemoveSpell( _BrigitteLindholmSpellRepairPack50 )
    self.RemoveSpell( _BrigitteLindholmSpellRepairPack40 )
    self.RemoveSpell( _BrigitteLindholmSpellRepairPack30 )
    self.RemoveSpell( _BrigitteLindholmSpellRepairPack20 )
    self.RemoveSpell( _BrigitteLindholmSpellRepairPack10 )
    self.RemoveSpell( _BrigitteLindholmSpellRepairPack0 )
    
    self.RemoveSpell( _BrigitteLindholmSpellBarrierShield )
    self.RemoveSpell( _BrigitteLindholmSpellBarrierShield20 )
    self.RemoveSpell( _BrigitteLindholmSpellBarrierShield60 )

    Utility.Wait(0.1)
;    -----------------
    IF     (i < 20)
        self.AddSpell( _BrigitteLindholmSpellBarrierShield )
    ELSEIF (i < 60)
        self.AddSpell( _BrigitteLindholmSpellBarrierShield20 )
    ELSE
        self.AddSpell( _BrigitteLindholmSpellBarrierShield60 )
    ENDIF
;    -----------------

IF (i < 10)
    RETURN    ; - STOP -    lower than level 10
ENDIF
;---------------------
IF (i < 20)
    self.AddSpell( _BrigitteLindholmSpellRepairPack10 )
    RETURN    ; - STOP - level 10 .. 19
ENDIF
;---------------------    
IF (i < 30)
    self.AddSpell( _BrigitteLindholmSpellRepairPack20 )
    RETURN    ; - STOP - level 20 .. 29
ENDIF
;---------------------
IF (i < 40)
    self.AddSpell( _BrigitteLindholmSpellRepairPack30 )
    RETURN    ; - STOP - level 30 .. 39
ENDIF
;---------------------
IF (i < 50)
    self.AddSpell( _BrigitteLindholmSpellRepairPack40 )
    RETURN    ; - STOP - level 40 .. 49
ENDIF
;---------------------
IF (i < 60)
    self.AddSpell( _BrigitteLindholmSpellRepairPack50 )
    RETURN    ; - STOP - level 50 .. 59
ENDIF
;--------------------- level 60+
    self.AddSpell( _BrigitteLindholmSpellRepairPack60 )
ENDFUNCTION

 

 

Edited by ReDragon2013
Link to comment
Share on other sites

Sooo I'm looking for an option to reply to a specific person but it either doesn't exist here or I'm blind. Guess I'll just drop a generic post reply in which I'll be adressing two people.

 

ReDragon2013, as I said, I made my script by modifying Serana's script, effectively using the latter as a template because I don't know papyrus. Can't really forget something you don't know, right? But thanks for your version of the script although faomyesque's solution seems to be the better one since the less scripts the better.

 

foamyesque, that's GREAT. Simple but I didn't even think of it. Which is kinda dumb of me since one of the two spells already is using checks, although not for level but for an empty magic effect on target actor that functions as a per target cooldown for the spell. I'll be trying this one first!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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