Jump to content

Recommended Posts

Posted
Yep, learned a lot from this! I'll be sure to credit you when I finish this mod. Now I need to just figure out how to set it up to run via quest or something; I'll update this thread if I need further help.
  • Replies 59
  • Created
  • Last Reply

Top Posters In This Topic

Posted (edited)

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:

 

  Reveal hidden contents

 

 

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
Posted (edited)

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

  Reveal hidden contents


sample 2 - use arrays to shrink script size -

  Reveal hidden contents

 

Edited by ReDragon2013
Posted (edited)

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.

 

  Quote

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...

 

 

  Quote

;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
Posted (edited)

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
Posted (edited)

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
Posted (edited)
  On 6/18/2019 at 5:32 PM, ReDragon2013 said:

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.

 

 

  Quote

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
Posted (edited)

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

 

 

  Reveal hidden contents

 

 

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
Posted (edited)

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
Posted

... 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?

 

  Reveal hidden contents

 

 

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...