Jump to content

[LE] Retroactive Necromage- need scripting help!


Recommended Posts

  • Replies 59
  • Created
  • Last Reply

Top Posters In This Topic

Ok, new problem.

 

Took me a bit of time, but I've finally figured out how to do what I want, at least theoretically. I'm running the script as a Event OnInit() instead of a Function myF_Test() (both because the compiler throws a "No viable alternative at input FUNCTION" error when I use the Function myF_Test() block as a function block, and to allow the script to directly run in the background via a quest as per the tutorial here.) So, after setting up my CK to actually frakkin' compile scripts and troubleshoot some problem variables (apparently, I need to declare "vampire" as a valid keyword before the script will recognize it), I receive a "too many arguments passed to function" error at line 137, character 15.

 

The relevant block is

;---------------------------------------------
FUNCTION TryToReset_Perk(Actor player, Perk p)
;---------------------------------------------
    IF player.HasPerk(p)
        player.RemovePerk(p)
        Utility.Wait(0.1)                       ; wait a bit
        player.AddPerk(p, False)                ; reset perk
    ENDIF
ENDFUNCTION

and the issue is at the "player.AddPerk(p, False)" command, specifically, where it says "AddPerk"

 

And for context, here's the more-or-less finished script I'm running:

 

 

ScriptName RetroactiveNecromageScript extends Quest

  Perk PROPERTY necromage auto        ; fill with your new created perk
  Perk PROPERTY atronach  auto        ;
  Perk PROPERTY AvoidDeath  auto        ;
  Perk PROPERTY DualFlurry30  auto        ;
  Perk PROPERTY DualFlurry50  auto        ;
  Perk PROPERTY ExtraPockets  auto        ;
  Perk PROPERTY FistsOfSteel  auto        ;
  Perk PROPERTY MagicResistance30  auto        ;
  Perk PROPERTY MagicResistance50  auto        ;
  Perk PROPERTY MagicResistance70  auto        ;
  Perk PROPERTY MuffledMovement  auto        ;
  Perk PROPERTY PowerShot  auto        ;
  Perk PROPERTY QuickReflexes  auto        ;
  Perk PROPERTY QuickShot  auto        ;
  Perk PROPERTY Recovery30  auto        ;
  Perk PROPERTY Recovery50  auto        ;
  Perk PROPERTY Snakeblood  auto        ;
  Perk PROPERTY WindWalker  auto        ;
 
  Spell PROPERTY T01DibellaRewardAbility auto
  Spell PROPERTY PerkMara auto
  Spell PROPERTY MS04Reward auto
  Spell PROPERTY BladesDragonInfusionAbility auto
  Spell PROPERTY TGCrownProfit auto
  Spell PROPERTY dunFrostflowAbyssBoon auto
  Spell PROPERTY NN01Spell auto
  Spell PROPERTY RaceArgonianResistDisease auto
  Spell PROPERTY RaceBreton auto
  Spell PROPERTY RaceDarkElf auto
  Spell PROPERTY RaceImperial auto
  Spell PROPERTY RaceKhajiitClaws auto
  Spell PROPERTY RaceNord auto
  Spell PROPERTY RaceRedguard auto
  Spell PROPERTY RaceWoodElf auto

  Keyword Property vampire auto


Bool ResetOnce	; [default=false]
	; this sets up a variable to prevent the script from constantly resetting perks and abilities once conditions have been met

; https://www.creationkit.com/index.php?title=RemoveSpell_-_Actor
; https://www.creationkit.com/index.php?title=HasPerk_-_Actor
; https://www.creationkit.com/index.php?title=AddPerk_-_Actor
 
;------------------
Event OnInit()
;------------------
    actor player = Game.GetPlayer()                            ; get the internal variable once here

IF ( !ResetOnce )
ELSE
    RETURN    ; - STOP -    player already has had their perks and abilities reset by this script
ENDIF
;---------------------

	
IF player.HasKeyword(vampire)
ELSE

    RETURN    ; - STOP -    player is of human race
ENDIF
;---------------------
IF player.HasPerk(necromage)
ELSE
    RETURN    ; - STOP -    player is a vampire, but does not have the special necromage perk
ENDIF
;---------------------


; selection 1
; ~~~~~~~~~~~
    TryToReset_Spell(player, T01DibellaRewardAbility)
    TryToReset_Spell(player, PerkMara)
    TryToReset_Spell(player, MS04Reward)
    TryToReset_Spell(player, BladesDragonInfusionAbility)
    TryToReset_Spell(player, TGCrownProfit)
    TryToReset_Spell(player, dunFrostflowAbyssBoon)
    TryToReset_Spell(player, NN01Spell)
    TryToReset_Spell(player, RaceArgonianResistDisease)
    TryToReset_Spell(player, RaceBreton)
    TryToReset_Spell(player, RaceDarkElf)
    TryToReset_Spell(player, RaceImperial)
    TryToReset_Spell(player, RaceKhajiitClaws)
    TryToReset_Spell(player, RaceNord)
    TryToReset_Spell(player, RaceRedguard)
    TryToReset_Spell(player, RaceWoodElf)

; selection 2
; ~~~~~~~~~~~
    TryToReset_Perk(player, atronach)
    TryToReset_Perk(player, AvoidDeath)
    TryToReset_Perk(player, DualFlurry30)
    TryToReset_Perk(player, DualFlurry50)
    TryToReset_Perk(player, ExtraPockets)
    TryToReset_Perk(player, FistsOfSteel)
    TryToReset_Perk(player, MagicResistance30)
    TryToReset_Perk(player, MagicResistance50)
    TryToReset_Perk(player, MagicResistance70)
    TryToReset_Perk(player, MuffledMovement)
    TryToReset_Perk(player, PowerShot)
    TryToReset_Perk(player, QuickReflexes)
    TryToReset_Perk(player, QuickShot)
    TryToReset_Perk(player, Recovery30)
    TryToReset_Perk(player, Recovery50)
    TryToReset_Perk(player, Snakeblood)
    TryToReset_Perk(player, WindWalker)
	
;---------------------

    ResetOnce = TRUE 			; switch value of script (from False to TRUE) to prevent constantly resetting

	Debug.MessageBox("Perks and Abilities have been improved!")

EndEvent


;------------------------------------------------
FUNCTION TryToReset_Spell(Actor player, Spell sp)
;------------------------------------------------
    IF player.HasSpell(sp)
	player.RemoveSpell(sp)
        Utility.Wait(0.1)                        ; wait a bit.. How long try it out?
        player.AddSpell(sp, False)               ; reset this ability
    ENDIF
ENDFUNCTION


;---------------------------------------------
FUNCTION TryToReset_Perk(Actor player, Perk p)
;---------------------------------------------
    IF player.HasPerk(p)
        player.RemovePerk(p)
        Utility.Wait(0.1)                       ; wait a bit
        player.AddPerk(p, False)                ; reset perk
    ENDIF
ENDFUNCTION

 

 

 

So, what's the issue and how do I fix it? And, if you feel like troubleshooting the function block, just replace the Event/EndEvent commands with Function myF_Test() and EndFunction commands.

 

-edit- Do not put in line numbers for the code format unless you want the script to run alternating black/white background lines... eeeugh.

Edited by Galcyon
Link to comment
Share on other sites

the issue with

player.AddPerk(p, False) ; reset perk

it should be as follow

player.AddPerk(p)        ; reset perk

I did not check the syntax, it was your code I have used.

Nevertheless I gave you some links to papyrus library, that you should use to find the right syntax. https://www.creationkit.com/index.php?title=AddPerk_-_Actor

 

Do NOT overwhelming the init event with a lot of code !!!

 

sample 1

ScriptName RetroactiveNecromageScript extends Quest

  Keyword PROPERTY vampire auto

  Perk PROPERTY necromage auto          ; fill with your new created perk
  Perk PROPERTY atronach  auto          ;
  Perk PROPERTY AvoidDeath   auto       ;
  Perk PROPERTY DualFlurry30 auto       ;
  Perk PROPERTY DualFlurry50 auto       ;
  Perk PROPERTY ExtraPockets auto       ;
  Perk PROPERTY FistsOfSteel auto       ;
  Perk PROPERTY MagicResistance30 auto  ;
  Perk PROPERTY MagicResistance50 auto  ;
  Perk PROPERTY MagicResistance70 auto  ;
  Perk PROPERTY MuffledMovement auto    ;
  Perk PROPERTY PowerShot       auto    ;
  Perk PROPERTY QuickReflexes   auto    ;
  Perk PROPERTY QuickShot   auto        ;
  Perk PROPERTY Recovery30  auto        ;
  Perk PROPERTY Recovery50  auto        ;
  Perk PROPERTY Snakeblood  auto        ;
  Perk PROPERTY WindWalker  auto        ;
 
  Spell PROPERTY T01DibellaRewardAbility     auto
  Spell PROPERTY PerkMara                    auto        ; PERK ?
  Spell PROPERTY MS04Reward                  auto
  Spell PROPERTY BladesDragonInfusionAbility auto
  Spell PROPERTY TGCrownProfit               auto
  Spell PROPERTY dunFrostflowAbyssBoon       auto
  Spell PROPERTY NN01Spell                   auto
  Spell PROPERTY RaceArgonianResistDisease   auto
  Spell PROPERTY RaceBreton       auto
  Spell PROPERTY RaceDarkElf      auto
  Spell PROPERTY RaceImperial     auto
  Spell PROPERTY RaceKhajiitClaws auto
  Spell PROPERTY RaceNord         auto
  Spell PROPERTY RaceRedguard     auto
  Spell PROPERTY RaceWoodElf      auto

  Bool ResetOnce    ; [default=false]
    ; this sets up a variable to prevent the script from constantly resetting perks and abilities once conditions have been met

; https://www.creationkit.com/index.php?title=RemoveSpell_-_Actor
; https://www.creationkit.com/index.php?title=HasPerk_-_Actor
; https://www.creationkit.com/index.php?title=AddPerk_-_Actor

; https://www.creationkit.com/index.php?title=RegisterForSingleUpdateGameTime_-_Form
; https://www.creationkit.com/index.php?title=OnUpdateGameTime_-_Form


; -- EVENTs -- 2
 
;-------------
EVENT OnInit()
;-------------
    ; keep in mind: Do NOT overwhelming this init event with a lot of code !!!
    RegisterForSingleUpdateGameTime(0.0)        ; trigger next event OnUpdateGameTime() as fast as possible
ENDEVENT


EVENT OnUpdateGameTime()
    myF_Test()
ENDEVENT


; -- FUNCTIONs -- 3

;------------------
FUNCTION myF_Test()
;------------------
IF ( ResetOnce )
    RETURN    ; - STOP -    player already has had their perks and abilities reset by this script
ENDIF
;---------------------
    actor player = Game.GetPlayer()                            ; get the internal variable once here
    
IF player.HasKeyword(vampire)
ELSE

    RETURN    ; - STOP -    player is of human race
ENDIF
;---------------------
IF player.HasPerk(necromage)
ELSE
    RETURN    ; - STOP -    player is a vampire, but does not have the special necromage perk
ENDIF
;---------------------

; selection 1
; ~~~~~~~~~~~
    TryToReset_Spell(player, T01DibellaRewardAbility)
    TryToReset_Spell(player, PerkMara)
    TryToReset_Spell(player, MS04Reward)
    TryToReset_Spell(player, BladesDragonInfusionAbility)
    TryToReset_Spell(player, TGCrownProfit)
    TryToReset_Spell(player, dunFrostflowAbyssBoon)
    TryToReset_Spell(player, NN01Spell)
    TryToReset_Spell(player, RaceArgonianResistDisease)
    TryToReset_Spell(player, RaceBreton)
    TryToReset_Spell(player, RaceDarkElf)
    TryToReset_Spell(player, RaceImperial)
    TryToReset_Spell(player, RaceKhajiitClaws)
    TryToReset_Spell(player, RaceNord)
    TryToReset_Spell(player, RaceRedguard)
    TryToReset_Spell(player, RaceWoodElf)

; selection 2
; ~~~~~~~~~~~
    TryToReset_Perk(player, atronach)
    TryToReset_Perk(player, AvoidDeath)
    TryToReset_Perk(player, DualFlurry30)
    TryToReset_Perk(player, DualFlurry50)
    TryToReset_Perk(player, ExtraPockets)
    TryToReset_Perk(player, FistsOfSteel)
    TryToReset_Perk(player, MagicResistance30)
    TryToReset_Perk(player, MagicResistance50)
    TryToReset_Perk(player, MagicResistance70)
    TryToReset_Perk(player, MuffledMovement)
    TryToReset_Perk(player, PowerShot)
    TryToReset_Perk(player, QuickReflexes)
    TryToReset_Perk(player, QuickShot)
    TryToReset_Perk(player, Recovery30)
    TryToReset_Perk(player, Recovery50)
    TryToReset_Perk(player, Snakeblood)
    TryToReset_Perk(player, WindWalker)
    
;---------------------
    ResetOnce = TRUE             ; switch value of script (from False to TRUE) to prevent constantly resetting

    Debug.MessageBox("Perks and Abilities have been improved!")
ENDFUNCTION


;------------------------------------------------
FUNCTION TryToReset_Spell(Actor player, Spell sp)
;------------------------------------------------
IF player.HasSpell(sp as Form)
ELSE
    RETURN    ; - STOP -    player does not have the spell
ENDIF
;---------------------
    player.RemoveSpell(sp)
    Utility.Wait(0.1)                       ; wait a bit.. How long try it out?
    player.AddSpell(sp, False)              ; reset this ability
ENDFUNCTION


;---------------------------------------------
FUNCTION TryToReset_Perk(Actor player, Perk p)
;---------------------------------------------
    IF player.HasPerk(p)
        player.RemovePerk(p)
        Utility.Wait(0.1)                   ; wait a bit
        player.AddPerk(p)                   ; reset perk
    ENDIF
ENDFUNCTION

 


sample 2 - use arrays to shrink script size -

 

ScriptName RetroactiveNecromage2Script extends Quest

  Keyword PROPERTY vampire   auto
  Perk    PROPERTY necromage auto

  Perk[] PROPERTY myPerkList auto            ; use next perk properties to fill the array
 
 ;Perk PROPERTY atronach  auto
 ;Perk PROPERTY AvoidDeath   auto
 ;Perk PROPERTY DualFlurry30 auto
 ;Perk PROPERTY DualFlurry50 auto
 ;Perk PROPERTY ExtraPockets auto
 ;Perk PROPERTY FistsOfSteel auto
 ;Perk PROPERTY MagicResistance30 auto
 ;Perk PROPERTY MagicResistance50 auto
 ;Perk PROPERTY MagicResistance70 auto
 ;Perk PROPERTY MuffledMovement auto
 ;Perk PROPERTY PowerShot       auto
 ;Perk PROPERTY QuickReflexes   auto
 ;Perk PROPERTY QuickShot   auto
 ;Perk PROPERTY Recovery30  auto
 ;Perk PROPERTY Recovery50  auto
 ;Perk PROPERTY Snakeblood  auto
 ;Perk PROPERTY WindWalker  auto

  Spell[] PROPERTY mySpellList auto            ; use next spell properties to fill the array

 ;Spell PROPERTY T01DibellaRewardAbility     auto
 ;Spell PROPERTY PerkMara                    auto        ; PERK ?
 ;Spell PROPERTY MS04Reward                  auto
 ;Spell PROPERTY BladesDragonInfusionAbility auto
 ;Spell PROPERTY TGCrownProfit               auto
 ;Spell PROPERTY dunFrostflowAbyssBoon       auto
 ;Spell PROPERTY NN01Spell                   auto
 ;Spell PROPERTY RaceArgonianResistDisease   auto
 ;Spell PROPERTY RaceBreton       auto
 ;Spell PROPERTY RaceDarkElf      auto
 ;Spell PROPERTY RaceImperial     auto
 ;Spell PROPERTY RaceKhajiitClaws auto
 ;Spell PROPERTY RaceNord         auto
 ;Spell PROPERTY RaceRedguard     auto
 ;Spell PROPERTY RaceWoodElf      auto

  Bool ResetOnce    ; [default=false]
    ; this sets up a variable to prevent the script from constantly resetting perks and abilities once conditions have been met

; https://www.creationkit.com/index.php?title=RemoveSpell_-_Actor
; https://www.creationkit.com/index.php?title=HasPerk_-_Actor
; https://www.creationkit.com/index.php?title=AddPerk_-_Actor

; https://www.creationkit.com/index.php?title=RegisterForSingleUpdateGameTime_-_Form
; https://www.creationkit.com/index.php?title=OnUpdateGameTime_-_Form


; -- EVENTs -- 2
 
;-------------
EVENT OnInit()
;-------------
    ; keep in mind: Do NOT overwhelming this init event with a lot of code !!!
    RegisterForSingleUpdateGameTime(0.0)      ; trigger next event OnUpdateGameTime() as fast as possible
ENDEVENT


EVENT OnUpdateGameTime()
    myF_Test()
ENDEVENT


; -- FUNCTIONs -- 3

;------------------
FUNCTION myF_Test()
;------------------
IF ( ResetOnce )
    RETURN    ; - STOP -    player already has had their perks and abilities reset by this script
ENDIF
;---------------------
    actor player = Game.GetPlayer()           ; get the return value of method once here and store it to a local variable
    
IF player.HasKeyword(vampire)
ELSE
    RETURN    ; - STOP -    player is of human race
ENDIF
;---------------------
IF player.HasPerk(necromage)
ELSE
    RETURN    ; - STOP -    player is a vampire, but does not have the special necromage perk
ENDIF
;---------------------

    ResetOnce = TRUE                          ; switch value of script (from False to TRUE) to prevent constantly resetting

; selection 1
; ~~~~~~~~~~~
int i = mySpellList.Length
    WHILE (i > 0)
        i = i - 1
        TryToReset_Spell(player, mySpellList[i])
    ENDWHILE


; selection 2
; ~~~~~~~~~~~
    i = myPerkList.Length
    WHILE (i > 0)
        i = i - 1
        TryToReset_Perk(player, myPerkList[i])
    ENDWHILE

;---------------------
    Debug.MessageBox("Perks and Abilities have been improved!")
ENDFUNCTION


;------------------------------------------------
FUNCTION TryToReset_Spell(Actor player, Spell sp)
;------------------------------------------------
IF player.HasSpell(sp as Form)
ELSE
    RETURN    ; - STOP -    player does not have the spell
ENDIF
;---------------------
    player.RemoveSpell(sp)
    Utility.Wait(0.1)                    ; wait a bit.. How long try it out?
    player.AddSpell(sp, False)           ; reset this ability
ENDFUNCTION


;---------------------------------------------
FUNCTION TryToReset_Perk(Actor player, Perk p)
;---------------------------------------------
    IF player.HasPerk(p)
        player.RemovePerk(p)
        Utility.Wait(0.1)                ; wait a bit
        player.AddPerk(p)                ; reset this perk
    ENDIF
ENDFUNCTION

 

 

Edited by ReDragon2013
Link to comment
Share on other sites

Thanks; I didn't realize that syntax use was different between the addspell and addperk commands; I had assumed that they ran similarily. Hence adding in the "false" codifier; for AddSpell, that prevents a notification appearing to the player that the spell in question has been added, and I thought AddPerk would do the same, you just didn't normally see the notification for perks because I had (falsely, see below) assumed that perks aren't given as quest rewards.

 


I did not check the syntax, it was your code I used.

Yeah, bad idea right there. I'll be the first one to admit that I have a questionable grasp on papyrus scripting (as we've seen), so assuming I have things right without double-checking...

 

 


;Spell PROPERTY PerkMara auto ; PERK ?

 

 

Hm, good catch. I'll need to re-edit my lists and double-check the other abilities added to the player. I had assumed it was a Dev Typo- y'know, dev wants it to be a perk, but decides to use it as an ability(spell) instead, so they keep the old name to minimize the subsequent edits. On double-checking the perk list, however, i see an entry for it, Kynareth, and Dibella (though Kynareth's seems to be disabled, so it's not part of the Kyne quest). I *might* get away with using the spell command lines anyway, but I think the perk might just stuff it back in once the ability is removed, and you'd simply end up with a duplicate ability, so I'd need to do even more scripting stuff, so best to alter the perk, not what it gives.

 

One question, though; I thought papyrus (and similar scripting languages) treated things placed after a semicolon as not part of it (hence it being useful for adding notes without the script pitching a fit). This is not the case? It's the only way I can think of that would allow the use of arrays in the manner you used.

Edited by Galcyon
Link to comment
Share on other sites

Ok, small-ish issue. One that was confusing me for a while as to why the damn thing wasn't working.

 

I started the Debugging process on my typical load order, script wasn't working. I disabled everything, and tried again (running only a enb and SKSE, nothing in the load order but the official stuff), and the script still didn't work.

 

So, I started adding debugging boxes at points on the script to see what was going on, and I tracked it down to one of our three true/false checks.

IF player.HasKeyword(vampire)
ELSE

    RETURN    ; - STOP -    player is of human race
ENDIF

THIS is the problem. I used HasKeyword(vampire) because when I was doing research for this project, that was the method Skyrim supposedly used to determine if the player is a vampire. And yes, upscript we're using the following command to define vampirism "keyword property vampire auto"

 

Either this is not how Skyrim detects if the player is a vampire, or I've set it up wrong; I'm staring at my dawnguard vampire test character, and the script doesn't see that my player's a vampire. The test character isn't a vampire lord, and I've even updated the script to require Dawnguard, so that should be out as well. Unless artificially giving the player the Vampire Disease causes keyword issues like this, I need a better way to determine if the player is a vampire or not.

 

My current thought process is to use the"Player.GetRace" command in an ungainly if--elseif--elseif--else--end chain that covers the 10 playable vampire race variants, though this WILL cause compatibility issues with anyone using custom races or vampire races, something I'd rather avoid if at all possible.

 

So, are there any other ways we can detect if the player is a vampire?

Edited by Galcyon
Link to comment
Share on other sites

you wrote: This is not the case? It's the only way I can think of that would allow the use of arrays in the manner you used.

 

No.. no.. you are on the wrong road.

What I meaned what instead of many of spell and perk properties you can prefill all of them with the CK in a single property of array type.

 

 

I do not believe that the player (if he/she is of any vampire race) should not have the keyword "vampire" attached.

Switch on papyrus logging and use Debug.Trace() to observe the script code. I hope you know how that is working.

Keyword PROPERTY Vampire         auto       ; use autofill here, [KYWD:000A82BB] Vampire
Keyword PROPERTY ActorTypeUndead auto       ; use autofill here, [KYWD:00013796] ActorTypeUndead
Perk    PROPERTY necromage       auto       ; use autofill here, [PERK:000581E4] Necromage


;-------------
EVENT OnInit()
;-------------
    ; keep in mind: Do NOT overwhelming this init event with a lot of code !!!
    
    Debug.Trace("OnInit() has been reached.. " +self)
    RegisterForSingleUpdateGameTime(0.0)        ; trigger next event OnUpdateGameTime() as fast as possible
ENDEVENT


EVENT OnUpdateGameTime()
    Debug.Trace("OnUpdateGameTime() has been reached.. " +self)
    myF_Test()
ENDEVENT


;------------------
FUNCTION myF_Test()
;------------------

    ; ..

IF player.HasKeyword(vampire) && player.HasPerk(necromage)
    Debug.Trace("myF_Test(TRUE) - has been reached.. " + player.HasKeyword(vampire) + ", " +player.HasPerk(necromage))
ELSE
    Debug.Trace("myF_Test(False) - has been reached.. " + player.HasKeyword(vampire) + ", " +player.HasPerk(necromage))
    RETURN    ; - STOP -  player is not a vampire or does not have the special necromage perk
ENDIF

    ; ..

ENDFUNCTION

Use the tool Tes5Edit to get faster access to important things like FormIDs or keywords.. the overview in the CK is a mess sometimes

Edited by ReDragon2013
Link to comment
Share on other sites

you wrote: This is not the case? It's the only way I can think of that would allow the use of arrays in the manner you used.

 

No.. no.. you are on the wrong road.

What I meaned what instead of many of spell and perk properties you can prefill all of them with the CK in a single property of array type.

 

Cool. I'll need to check up on how arrays function, then.

 

 

I do not believe that the player (if he/she is of any vampire race) should not have the keyword "vampire" attached.

Switch on papyrus logging and use Debug.Trace() to observe the script code. I hope you know how that is working.

 

I used the debug messagebox; the relevant code was setup as

IF player.HasKeyword(vampire)
    Debug.MessageBox("Player is a vampire!")
ELSE
    Debug.MessageBox("Player is NOT a vampire!")
    RETURN    ; - STOP -    player is of human race
ENDIF

The messagebox I got on loading the save with the mod installed was "Player is NOT a vampire!". When I have more time, I'll run it with your code edits, assuming that my use of debug message boxes won't provide the same results as using the debug trace command+papyrus logging.

 

-EDIT-

Hang on; I relaized I had the USKP running on my test load order. I don't have enough time to rerun it now, but I know the USKP "fixes" the necromage perk so it won't affect a player attempting to use a Necromage Vampire build. I'm not sure how that fix was done, so it's possible that the fix was to remove the "vampire" keyword from the player. If so, that would explain why the script isn't working.

 

... then again, in my full load order test, it still didn't work, and one of the mods was the reversion to the USKP necromage "fix". Hurm, regardless, I'll need to re-run the test again.

Edited by Galcyon
Link to comment
Share on other sites

Just re-ran the test without the USKP. Same results (script returns with "not a vampire"), see spoiler for details.

 

 

 

To set up the test, I downloaded this savefile, which is supposedly clean of mods and the like. I then prepped the charater (manually inserting the dawnguard variant of the vampire disease via console and getting her to level 81 to purchase the relevant perks).

The load order for the setup is as follows:

 

Skyrim.esm

Update.esm

Danguard.esm

HearthFires.esm

Dragonborn.esm

HighRes TexturePack01.esp

HighRes TexturePack02.esp

HighRes TexturePack03.esp

 

I then went to Riverwood, saved in the inn, and waited 3 days for vampirism to kick in, took necromage, then made a 2nd save. I then booted up the mod with the following load order:

 

Skyrim.esm

Update.esm

Danguard.esm

HearthFires.esm

Dragonborn.esm

HighRes TexturePack01.esp

HighRes TexturePack02.esp

HighRes TexturePack03.esp

RetroactiveNecromage.esp

 

The code for bugchecking has been altered to read the following

  Keyword PROPERTY vampire auto

(code stuff not directly relevant to the below if/endif block)

IF player.HasKeyword(vampire)
ELSE
    Debug.MessageBox("Not a vampire")
    RETURN    ; - STOP -    player is of human race
ENDIF

Upon loading the vampire+necromage save, I get the messagebox "Not a vampire", indicating that the script or game does not recognize the player as a vampire, and thus, stops the script from progressing.

 

Unless a mistake has been made in the code snippet above, it appears as though playable vampire races no longer use or do not have "vampire" attached as a keyword, possibly a result of changes introduced by Dawnguard or Update.esm.

 

 

 

So, unless using Debug.Trace and papyrus logging will tell us something different, we need a new way to determine when a player is a vampire.

Edited by Galcyon
Link to comment
Share on other sites

Ok.. keyword "vampire" does not work for player unfortunately! Try to use next to reach your aim.

 

Variant A

  Faction PROPERTY VampirePCFaction auto        ; use autofill [FACT:000C4DE0]    
; should be able to track if player is of vampire race


    IF player.IsInFaction(VampirePCFaction)
        ; player is a vampire
    ENDIF

Variant B

  Quest PROPERTY PlayerVampireQuest auto        ; use autofill [QUST:000EAFD5]    
    ; this quest runs start game enabled and has the script "PlayerVampireQuestScript" attached,

; we get next property from "PlayerVampireQuestScript.psc" directly
; Int PROPERTY VampireStatus auto Conditional
; used to track if the player is a vampire {0 = Not a Vampire, 1 = Vampire, 2,3,4 = Vampire Stage 2,3,4}

;------------------
FUNCTION myF_Test()
;------------------
    ; ..

    int i = myF_IsPlayerVampire()
IF (i < 1)
    RETURN ; - STOP -   player is not a vampire
ENDIF
;--------------------

    ; ..
ENDFUNCTION

;---------------------------------
Int FUNCTION myF_IsPlayerVampire()
;---------------------------------
IF (PlayerVampireQuest) && PlayerVampireQuest.IsRunning()
ELSE
    ; Debug.MessageBox("PlayerVampireQuest is not running!")
    Return -1
ENDIF
;---------
    int i = (PlayerVampireQuest as PlayerVampireQuestScript).VampireStatus
    Return i     ; (i > 0) player is a vampire
ENDFUNCTION

Good luck..

Edited by ReDragon2013
Link to comment
Share on other sites

... It's starting to feel like the game is actively resisting attempts to detect when the player is a vampire. We've already tried the keyword vampire method, that failed. I tried Variant A (checking to see if the PC is in the VampirePCFaction), and that had failed. I've now tried Variant B (borrowing information from the vampire script), and THAT has failed. And it's all failing at the point where we see if the player is a vampire or not.

 

To be double-sure, I'm transposing the current version of the script below. Maybe I mis-typed something somewhere, even though I'm copy/pasting?

 

 

ScriptName RetroactiveNecromageScript extends Quest

    Quest PROPERTY PlayerVampireQuest auto        ; use autofill [QUST:000EAFD5]    
    ; this quest runs start game enabled and has the script "PlayerVampireQuestScript" attached,

; we get next property from "PlayerVampireQuestScript.psc" directly
; Int PROPERTY VampireStatus auto Conditional
; used to track if the player is a vampire {0 = Not a Vampire, 1 = Vampire, 2,3,4 = Vampire Stage 2,3,4}

  Perk PROPERTY necromage auto          ; fill with your new created perk
  Perk PROPERTY atronach  auto          ;
  Perk PROPERTY AvoidDeath   auto       ;
  Perk PROPERTY DualFlurry30 auto       ;
  Perk PROPERTY DualFlurry50 auto       ;
  Perk PROPERTY ExtraPockets auto       ;
  Perk PROPERTY FistsOfSteel auto       ;
  Perk PROPERTY MagicResistance30 auto  ;
  Perk PROPERTY MagicResistance50 auto  ;
  Perk PROPERTY MagicResistance70 auto  ;
  Perk PROPERTY MuffledMovement auto    ;
  Perk PROPERTY PowerShot       auto    ;
  Perk PROPERTY QuickReflexes   auto    ;
  Perk PROPERTY QuickShot   auto        ;
  Perk PROPERTY Recovery30  auto        ;
  Perk PROPERTY Recovery50  auto        ;
  Perk PROPERTY Snakeblood  auto        ;
  Perk PROPERTY WindWalker  auto        ;
  Perk PROPERTY T01DibellaReward  auto  ;
  Perk PROPERTY T02MaraReward  auto     ;
  Perk PROPERTY MQBladesDragonResearch  auto     ;
  Perk PROPERTY dunFrostflowAbyssPerk  auto      ;
  Perk PROPERTY NN01Perk  auto          ;
 
  Spell PROPERTY T01DibellaRewardAbility     auto
  Spell PROPERTY MS04Reward                  auto
  Spell PROPERTY MS04RewardNoDisplay         auto
  Spell PROPERTY TGCrownProfit               auto
  Spell PROPERTY dunFrostflowAbyssBoon       auto
  Spell PROPERTY NN01Spell                   auto
  Spell PROPERTY RaceArgonianResistDisease   auto
  Spell PROPERTY RaceBreton       auto
  Spell PROPERTY RaceDarkElf      auto
  Spell PROPERTY RaceImperial     auto
  Spell PROPERTY RaceKhajiitClaws auto
  Spell PROPERTY RaceNord         auto
  Spell PROPERTY RaceRedguard     auto
  Spell PROPERTY RaceWoodElf      auto

  Bool ResetOnce    ; [default=false]
    ; this sets up a variable to prevent the script from constantly resetting perks and abilities once conditions have been met

; https://www.creationkit.com/index.php?title=RemoveSpell_-_Actor
; https://www.creationkit.com/index.php?title=HasPerk_-_Actor
; https://www.creationkit.com/index.php?title=AddPerk_-_Actor

; https://www.creationkit.com/index.php?title=RegisterForSingleUpdateGameTime_-_Form
; https://www.creationkit.com/index.php?title=OnUpdateGameTime_-_Form


; -- EVENTs -- 2
 
;-------------
EVENT OnInit()
;-------------
    ; keep in mind: Do NOT overwhelming this init event with a lot of code !!!
    RegisterForSingleUpdateGameTime(0.0)        ; trigger next event OnUpdateGameTime() as fast as possible
ENDEVENT


EVENT OnUpdateGameTime()
    myF_Test()
ENDEVENT


; -- FUNCTIONs -- 3

;------------------
FUNCTION myF_Test()
;------------------
IF ( ResetOnce )
    RETURN    ; - STOP -    player already has had their perks and abilities reset by this script
ENDIF
;---------------------
    actor player = Game.GetPlayer()                            ; get the internal variable once here
    
     int i = myF_IsPlayerVampire()

IF (i < 1)
	Debug.MessageBox("Not a vampire")
    RETURN    ; - STOP -    player is of human race
ENDIF
;---------------------
IF player.HasPerk(necromage)
ELSE
    Debug.MessageBox("No Necromage perk")
    RETURN    ; - STOP -    player is a vampire, but does not have the special necromage perk
ENDIF
;---------------------

; selection 1
; ~~~~~~~~~~~
    TryToReset_Spell(player, T01DibellaRewardAbility)
    TryToReset_Spell(player, MS04Reward)
    TryToReset_Spell(player, MS04RewardNoDisplay)
    TryToReset_Spell(player, TGCrownProfit)
    TryToReset_Spell(player, dunFrostflowAbyssBoon)
    TryToReset_Spell(player, NN01Spell)
    TryToReset_Spell(player, RaceArgonianResistDisease)
    TryToReset_Spell(player, RaceBreton)
    TryToReset_Spell(player, RaceDarkElf)
    TryToReset_Spell(player, RaceImperial)
    TryToReset_Spell(player, RaceKhajiitClaws)
    TryToReset_Spell(player, RaceNord)
    TryToReset_Spell(player, RaceRedguard)
    TryToReset_Spell(player, RaceWoodElf)

; selection 2
; ~~~~~~~~~~~
    TryToReset_Perk(player, atronach)
    TryToReset_Perk(player, AvoidDeath)
    TryToReset_Perk(player, DualFlurry30)
    TryToReset_Perk(player, DualFlurry50)
    TryToReset_Perk(player, ExtraPockets)
    TryToReset_Perk(player, FistsOfSteel)
    TryToReset_Perk(player, MagicResistance30)
    TryToReset_Perk(player, MagicResistance50)
    TryToReset_Perk(player, MagicResistance70)
    TryToReset_Perk(player, MuffledMovement)
    TryToReset_Perk(player, PowerShot)
    TryToReset_Perk(player, QuickReflexes)
    TryToReset_Perk(player, QuickShot)
    TryToReset_Perk(player, Recovery30)
    TryToReset_Perk(player, Recovery50)
    TryToReset_Perk(player, Snakeblood)
    TryToReset_Perk(player, WindWalker)
    TryToReset_Perk(player, T01DibellaReward)
    TryToReset_Perk(player, T02MaraReward)
    TryToReset_Perk(player, MQBladesDragonResearch)
    TryToReset_Perk(player, dunFrostflowAbyssPerk)
    TryToReset_Perk(player, NN01Perk)
    
;---------------------
    ResetOnce = TRUE             ; switch value of script (from False to TRUE) to prevent constantly resetting

    Debug.MessageBox("Perks and Abilities have been retroactively altered!")
ENDFUNCTION


;------------------------------------------------
FUNCTION TryToReset_Spell(Actor player, Spell sp)
;------------------------------------------------
IF player.HasSpell(sp)
    player.RemoveSpell(sp)
 
    player.AddSpell(sp, False)              ; reset this ability
ENDIF
ENDFUNCTION


;---------------------------------------------
FUNCTION TryToReset_Perk(Actor player, Perk p)
;---------------------------------------------
    IF player.HasPerk(p)
        player.RemovePerk(p)

        player.AddPerk(p)                   ; reset perk
    ENDIF
ENDFUNCTION

;---------------------------------
Int FUNCTION myF_IsPlayerVampire()
;---------------------------------
IF (PlayerVampireQuest) && PlayerVampireQuest.IsRunning()
ELSE
    ; Debug.MessageBox("PlayerVampireQuest is not running!")
    Return -1
ENDIF
;---------
    int i = (PlayerVampireQuest as PlayerVampireQuestScript).VampireStatus
    Return i     ; (i > 0) player is a vampire
ENDFUNCTION

 

 

 

At this point, I'm wondering if doing something like defining race as property and Functioning them like with the spells/perks will work, or if using Functions isn't the way to go in this case.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...