Jump to content

CK How to check whether the player has a specific active effect or not?


Recommended Posts

So when the initial value is set to 0.0 on load, and you cast the spell, the normal behaviour works fine. But it will allow you to cast it again because SetValue(1.0) isn't working? But setting it to 1.0 via console beforehand makes the if statement return true?
Link to comment
Share on other sites

So when the initial value is set to 0.0 on load, and you cast the spell, the normal behaviour works fine. But it will allow you to cast it again because SetValue(1.0) isn't working? But setting it to 1.0 via console beforehand makes the if statement return true?

The initial value is set to 0.0 on load, yes. When I cast the spell, all the statements/functions after the

Sprigged.SetValue()

don't work (no 'immersion lines' on the top left like "The woods give you power" and no spriggan armor equipped on the PC). The reason why I came to that conclusion is that if I manually set the value of 'sprigganstate' to 1 via the in game console, I'll get the

"You're already tapping into the power of the woods"

line the next time I cast the spell.

I'm trying to implement this condition check in the first place not to stop the player from casting the spell repeatedly, but to not give/equip the player with the spriggan armor every time they cast the spell.

Edited by nofawkingasianservers
Link to comment
Share on other sites

Okay I've found out the culprit, it's the save game (Dammit! Who wouldda thought?) I loaded my most recent save game (prior to this, I'd been testing on a save 4 hrs back, before I'd got the spell that I'm building in the CK) and now the global variable is updated properly now. :>

 

Oh and Happy New Year to anyone passing through this topic!

Link to comment
Share on other sites

Also for the purpose of knowledge I'll explain why the save was the problem. The script object while active is essentially baked into the save. You're able to change the script and have those changes take effect, but if you add new properties and fill them, those changes won't work on the save. Unless you manually set the properties via script, or the object resets (like stopping and starting a quest back up).

 

You'll find in your script logs that when it was calling GetValue and SetValue, a papyrus error was generating advising that the object your calling is a none value.

 

Edit

 

Pro tip for script developers. Have the Papyrus log file open when running the game to test. The file that represents the current/most recent game launch is Papyrus.0

 

I recommend a program like MTail to keep it open, and when you're testing in-game you'll see any papyrus errors from your script in real-time. Also handy to have debug.trace calls, since those don't get delayed like debug.notification.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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