Jump to content

spell.cast() at end if dialogue line


XEscaflowneX

Recommended Posts

Edit: The title is supposed to say "at end of dialogue line".

 

I'm new to modding skyrim and papyrus but what I want to do seems very simple yet I can't get it to work.

 

I have a new quest with some dialogue and at the end of one of the responses from the NPC I want a script to cast a custom spell (which only opens a message box) on myself.

 

Because I want it to cast the spell as the npc finishes talking I tried to write the script into the middle box at the bottom of the topic info window with the title "End:".

 

 

spell.cast(ObjectReference akSource, ObjectReference akTarget)

 

What do I have to fill into the collums if I want myself to cast the spell either without target or on myself?

 

And I think replacing "spell" with the spell ID isnt enough right? Do I have to create a property or variable or anything?

Edited by XEscaflowneX
Link to comment
Share on other sites

You need to create a property for your spell. But Papyrus options in dialogue are very limited, so the best solution is probably to make a quest stage containing a function that casts the spell and then just move the quest from your dialogue.

 

Try MySpell.Cast(Game.GetPlayer()) in a quest stage (add the property MySpell and set it to your spell - you'll need to create the property using the Property window before typing the cast command or you can't compile it).

 

In your dialogue you'd then put something like GetOwningQuest().SetStage(999) for your new stage. If you don't enter anything in the log field or the objectives, the player won't notice.

Link to comment
Share on other sites

Thanks for the tip.

 

In the Quest window I went to the script tab and added a new script with a property linking to the spell. For example I called the property SpellTest and it links to the spell with the ID _SpellTest

 

now I have this line in the script : SPELL Property SpellTest Auto

 

Now when I add the line you recommended like this: SpellTest.Cast(Game.GetPlayer())

 

I get this error when trying to save : "no viable alternative at input '.'"

 

 

And in the Quest Stage tab the Papyrus Fragment tab is greyed out even when I have a stage selected.

Edited by XEscaflowneX
Link to comment
Share on other sites

  • Recently Browsing   0 members

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