4

I am thinking about making a mod for Skyrim. One thing that this mod hinges on is checking if a player already knows a spell. I have been looking high and low for a script command, but have yet to find one.

Is there a script command somewhere that can check this? For example, something that would allow this:

If player."HasSpell" spellid {
  player.RemoveSpell spellid
} else {
  player.AddSpell spellid
}

...or something to that effect. If there isn't a command, can anyone think of alternatives/workarounds to accomplishing this?

4
  • Hard to propose alternatives when we don't know what you're trying to accomplish.
    – Frank
    Commented Sep 2, 2014 at 22:05
  • @Frank, he's looking for a console command that tells him if the player knows a specific spell or not. At least that's how I understood the question.
    – Nolonar
    Commented Sep 2, 2014 at 22:06
  • @Nolonar Without any inkling of what he's trying to do. I'm merely pointing out that without knowing what it is he's trying to accomplish, we can't very well provide alternatives or workarounds. All we can do is tell him if the command exists or not.
    – Frank
    Commented Sep 2, 2014 at 22:08
  • Sorry, I want a script to run when a book is opened and there to be an if/else event depending on whether or not the player knows a certain spell. Example: If player."hasspell" <spellid> { (player knows spell result) }else{ (player doesn not know spell result) }
    – Cavaticus
    Commented Sep 3, 2014 at 2:04

1 Answer 1

2

Yes. In Papyrus, the player is (usually) represented as just another Actor, and Actor objects have a HasSpell method you can call on them, passing the form of the spell in question. This will return true or false depending on whether or not the actor knows the spell represented by the supplied form.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.