Jump to content

Photo

What's wrong with this Addspell script?


  • Please log in to reply
8 replies to this topic

#1
antstubell

antstubell

    Faithful poster

  • Supporter
  • PipPipPipPip
  • 1,123 posts
What am I doing wrong here?

Spell property Spell2Add auto
if Whodid == Game.GetPlayer()
Addspell(Spell2Add)
endif

Won't compile.

Thanks.

#2
JanusForbeare

JanusForbeare

    For Morrowind! For Dres!

  • Members
  • PipPipPipPip
  • 1,545 posts
Most obvious error is that "Whodid" is not Papyrus syntax.

What triggers the addspell effect? Does it happen when the player reads a book? Kills a boss? Eats a sweetroll? Without knowing what you're attaching the script to, and what action triggers the addspell function, it's not possible to give you a precise answer.

#3
antstubell

antstubell

    Faithful poster

  • Supporter
  • PipPipPipPip
  • 1,123 posts

Most obvious error is that "Whodid" is not Papyrus syntax.

What triggers the addspell effect? Does it happen when the player reads a book? Kills a boss? Eats a sweetroll? Without knowing what you're attaching the script to, and what action triggers the addspell function, it's not possible to give you a precise answer.

When player takes a MISC object

Edited by antstubell, 27 October 2012 - 09:00 PM.


#4
JanusForbeare

JanusForbeare

    For Morrowind! For Dres!

  • Members
  • PipPipPipPip
  • 1,545 posts
Try this:

spell property spell2add auto
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
       if (akNewContainer == Game.GetPlayer()) && ((Game.Getplayer().HasSpell(Spell2Add)) == 0)
                (Game.Getplayer()).addspell(spell2add)
       endif
endevent

EDIT: Oh, by the way, this gets attached to the object being picked up.

Edited by JanusForbeare, 27 October 2012 - 09:07 PM.


#5
acidzebra

acidzebra

    Snark Wrangler

  • Premium Member
  • 2,298 posts
Antstubell, I highly recommend setting up notepad++ or another text editor with papyrus syntax - it will help you a lot in deciphering and writing code.

External Text Editors

#6
antstubell

antstubell

    Faithful poster

  • Supporter
  • PipPipPipPip
  • 1,123 posts

Antstubell, I highly recommend setting up notepad++ or another text editor with papyrus syntax - it will help you a lot in deciphering and writing code.

External Text Editors

I've been meaning to do that for some time but as soon as I get into CK I just forget about it and use the compiler there. I'll make a note to do it.
The script works perfectly and its a script I've used many times before, don't know why I didn't think of it. When spell is added I get a notification, if I remember correctly (I've been modding for so long haven't played the game in ages) doesn't a big message saying you've learnt blah, blah appear?

#7
JanusForbeare

JanusForbeare

    For Morrowind! For Dres!

  • Members
  • PipPipPipPip
  • 1,545 posts

When spell is added I get a notification, if I remember correctly (I've been modding for so long haven't played the game in ages) doesn't a big message saying you've learnt blah, blah appear?


I'm pretty sure that only happens for Word Walls (though, like you, I mod more than play). I think that a notification for a new spell is standard procedure.

#8
antstubell

antstubell

    Faithful poster

  • Supporter
  • PipPipPipPip
  • 1,123 posts


When spell is added I get a notification, if I remember correctly (I've been modding for so long haven't played the game in ages) doesn't a big message saying you've learnt blah, blah appear?


I'm pretty sure that only happens for Word Walls (though, like you, I mod more than play). I think that a notification for a new spell is standard procedure.

Ok then, would be nice if a sound effect played too like the drum beat when a quest is added just in case player is not looking. Thanks for your help.

#9
JanusForbeare

JanusForbeare

    For Morrowind! For Dres!

  • Members
  • PipPipPipPip
  • 1,545 posts
My pleasure, glad it's working!




IPB skins by Skinbox
Page loaded in: 0.955 seconds