Scripting - no viable alternative at input AddSpell

Post » Mon Nov 19, 2012 5:50 pm

So i have been trying my had at Papyrus scripting. First time doing it. I finally get my code all done, and compile it, and I get a cavalcade of all the same errors, all of which say "no viable alternative at input 'AddSpell' and "required (...)+ loop did not match anything at input" This seems rather odd, as AddSpell seemed like a rather straightforward command. It happens for each instance of AddSpell I have (there is a lot of them, this list is for a companion. As the companion levels, it'll get new spells, and remove old ones, for example replacing Oakflesh with Stoneflesh when it reaches level 4)

Here is a snippet of the script, with the middle removed (don't want to post a big wall o'text):

Scriptname WolfSpellScript extends QuestQuest Property WildWolfSpellQuest  AutoEvent OnStoryIncreaseLevel(int aiNewLevel)  if (aiNewLevel == 4)	WolfArg.AddSpell 0005ad5d	WolfArg.AddSpell 0002f3b8	WolfArg.AddSpell 0004b146	WolfArg.RemoveSpell 0005ad5c  elseif (aiNewLevel == 6)	WolfArg.AddSpell 00012fd0	WolfArg.AddSpell 0002b96c	WolfArg.AddSpell 0002dd29...  endIfENDEVENT

This is only for the first set given. The errors I receive are (again, just for the snippet of code)

WolfSpellScript.psc(7,10): no viable alternative at input 'AddSpell'WolfSpellScript.psc(7,23): required (...)+ loop did not match anything at input 'ad5d'WolfSpellScript.psc(8,10): no viable alternative at input 'AddSpell'WolfSpellScript.psc(8,23): required (...)+ loop did not match anything at input 'f3b8'WolfSpellScript.psc(9,10): no viable alternative at input 'AddSpell'WolfSpellScript.psc(9,23): required (...)+ loop did not match anything at input 'b146'WolfSpellScript.psc(10,10): no viable alternative at input 'RemoveSpell'WolfSpellScript.psc(10,26): required (...)+ loop did not match anything at input 'ad5c'WolfSpellScript.psc(12,10): no viable alternative at input 'AddSpell'WolfSpellScript.psc(12,24): required (...)+ loop did not match anything at input 'fd0'WolfSpellScript.psc(13,10): no viable alternative at input 'AddSpell'WolfSpellScript.psc(13,23): required (...)+ loop did not match anything at input 'b96c'WolfSpellScript.psc(14,10): no viable alternative at input 'AddSpell'WolfSpellScript.psc(14,23): required (...)+ loop did not match anything at input 'dd29'WolfSpellScript.psc(16,10): no viable alternative at input 'AddSpell'

I did notice that the error starts the moment it encounters a letter in the spell's FormID. Later on in the code, I try to add the FormID 000b62ef, and it spits out an error of 'b62ef'. Any help with this would be much appreciated!
User avatar
Jamie Lee
 
Posts: 3415
Joined: Sun Jun 17, 2007 9:15 am

Post » Tue Nov 20, 2012 12:49 am

Make spell properties for all the 7 spells you add, use these names on the spells you add and link the properties to the actual spells.
You don't use formid like in Oblivion
User avatar
IsAiah AkA figgy
 
Posts: 3398
Joined: Tue Oct 09, 2007 7:43 am

Post » Tue Nov 20, 2012 5:25 am

Also you need to put the parameters for the functions in parentheses.
User avatar
Jason Wolf
 
Posts: 3390
Joined: Sun Jun 17, 2007 7:30 am

Post » Tue Nov 20, 2012 12:17 am

Spell Properties? Despite all my googling, I'm not able to find a way to make properties for a spell. Can anyone help out with this? I know how to make a reference on something that has been placed in the world. As well, what would I attach this script to in order for it to work? Would I make a quest to place in the Story Manager Event Node Increase Level? Sorry for all the question, but I'm a complete and total newbie to all this.

On the other hand, doing this has made me realize just how hard it was to make a mod that allowed followers to learn spells from spell books.
User avatar
Hannah Whitlock
 
Posts: 3485
Joined: Sat Oct 07, 2006 12:21 am

Post » Tue Nov 20, 2012 12:03 am

Look here for attaching properties to papyrus scripts. You have to link everything from the script to the objects in the CK. That includes spells.

http://tesalliance.org/forums/index.php?/topic/4697-class-1-start-here-for-basics/

This covers adding 'message' properties. You add 'spell' properties the same way.
User avatar
Lucie H
 
Posts: 3276
Joined: Tue Mar 13, 2007 11:46 pm

Post » Tue Nov 20, 2012 3:51 am

Excellent, thanks! The script compiles successfully. I just have one last question...now that i have a working script, do I just make a quest, and plunk that quest into the Increase Level SM Event Node? Do I need to put anything special into the quest, or can it just go in being blank?
User avatar
Ross
 
Posts: 3384
Joined: Thu Aug 10, 2006 7:22 pm

Post » Mon Nov 19, 2012 7:03 pm

I don't know what your trying to accomplish. There are many ways to force a script to run, and one is a quest. Another could be a lever/button, or perhaps walking through a triggerzone. It really depends on what your trying to accomplish. Like 'when' and 'where'?
User avatar
Teghan Harris
 
Posts: 3370
Joined: Mon Mar 05, 2007 1:31 pm

Post » Tue Nov 20, 2012 3:55 am

I want the script to be triggered on the player character leveling up. So that every time the character levels up, the script is run to check for spells to be added/removed from the NPC. That's it.

So...the "where" is everywhere, and the "When" is "When the PC reaches a new level"
User avatar
Nuno Castro
 
Posts: 3414
Joined: Sat Oct 13, 2007 1:40 am

Post » Mon Nov 19, 2012 9:19 pm

Okay then!

Attach to your script you just compiled to your quest (we'll call it 'MyQuest' for this)
On the quest data tab, select the 'event' drop down to make your quest a 'Increase Level Event'

then follow http://www.creationkit.com/Bethesda_Tutorial_Story_Manager to hook up your quest to an SM event node. Then whenever the player levels up, your quest will be called.
User avatar
Lyndsey Bird
 
Posts: 3539
Joined: Sun Oct 22, 2006 2:57 am

Post » Mon Nov 19, 2012 10:41 pm

Aternatively, you could
WolfArg.AddSpell(Game.GetFormFromFile(0x0005ad5d, "Skyrim.ESM") As Spell)
but properties are better so long as Skyrim.ESM is a master of the plugin.
User avatar
hannaH
 
Posts: 3513
Joined: Tue Aug 15, 2006 4:50 am

Post » Tue Nov 20, 2012 5:16 am

Oh snap, thank you guys. Fishy sticks for all of you for helping me.
User avatar
Stacy Hope
 
Posts: 3391
Joined: Thu Jun 22, 2006 6:23 am

Post » Tue Nov 20, 2012 3:03 am

Okay, I spoke too soon. After plunking the script into the quest, plunking the quest into the SM Node...the NPC doesn't learn the spells. So, I made the changes to the INI to see debug stuff...and found this:

error: Cannot call AddSpell() on a None object, aborting function callstack:[WildWolfSpellQuest (0A002851)].WolfSpellScript.OnStoryIncreaseLevel() - "WolfSpellScript.psc" Line 67[10/25/2012 - 12:06:48AM] warning: Assigning None to a non-object variable named "::temp1"stack:[WildWolfSpellQuest (0A002851)].WolfSpellScript.OnStoryIncreaseLevel() - "WolfSpellScript.psc" Line 67[10/25/2012 - 12:06:56AM]

What went wrong? Did I not set the NPC Property correctly? Line 67 is adding a spell when the player reaches level 2.
User avatar
herrade
 
Posts: 3469
Joined: Thu Apr 05, 2007 1:09 pm

Post » Mon Nov 19, 2012 9:55 pm

To start debugging, you need to show your code.
User avatar
Jacob Phillips
 
Posts: 3430
Joined: Tue Aug 14, 2007 9:46 am

Post » Tue Nov 20, 2012 2:32 am

Scriptname WolfSpellScript extends Quest Quest Property WildWolfSpellQuest  Auto SPELL Property Oakflesh  Auto SPELL Property Stoneflesh  Auto SPELL Property Ironflesh  Auto SPELL Property Ebonyflesh  Auto SPELL Property Paralyze  Auto SPELL Property MassParalysis  Auto SPELL Property Firebolt  Auto SPELL Property IceSpike  Auto SPELL Property LightningBolt  Auto SPELL Property ChainLightning  Auto SPELL Property flameCloak  Auto SPELL Property FrostCloak  Auto SPELL Property LightningCloak  Auto SPELL Property IceStorm  Auto SPELL Property Fireball  Auto SPELL Property IcySpear  Auto SPELL Property Incinerate  Auto SPELL Property Thunderbolt  Auto SPELL Property LightningStorm  Auto SPELL Property FireStorm  Auto SPELL Property Blizzard  Auto SPELL Property FastHealing  Auto SPELL Property TurnLesserUndead  Auto SPELL Property CloseWounds  Auto SPELL Property TurnUndead  Auto SPELL Property CircleOfProtection  Auto SPELL Property GrandHealing  Auto SPELL Property TurnGreaterUndead  Auto SPELL Property GuardianCircle  Auto Actor Property WolfArg  Auto Event OnStoryIncreaseLevel(int aiNewLevel)	    if (aiNewLevel == 2)  WolfArg.AddSpell(Oakflesh)elseif (aiNewLevel == 4)  WolfArg.AddSpell(Stoneflesh)  WolfArg.RemoveSpell(Oakflesh)  WolfArg.AddSpell(FastHealing)  WolfArg.AddSpell(TurnLesserUndead)elseif (aiNewLevel == 6)  WolfArg.AddSpell(Firebolt)  Wolfarg.AddSpell(IceSpike)  WolfArg.AddSpell(LightningBolt)elseif (aiNewLevel == 16)  WolfArg.AddSpell(IronFlesh)  WolfArg.RemoveSpell(Stoneflesh)  WolfArg.AddSpell(CloseWounds)  WolfArg.AddSpell(TurnUndead)elseif (aiNewLevel == 19)  WolfArg.AddSpell(ChainLightning)  WolfArg.AddSpell(Fireball)  WolfArg.AddSpell(flameCloak)  WolfArg.AddSpell(FrostCloak)  WolfArg.AddSpell(IceStorm)  WolfArg.AddSpell(LightningCloak)elseif (aiNewLevel == 29)  WolfArg.AddSpell(Ebonyflesh)  WolfArg.RemoveSpell(Ironflesh)  WolfArg.AddSpell(Paralyze)  WolfArg.AddSpell(CircleOfProtection)  WolfArg.AddSpell(GrandHealing)elseif (aiNewLevel == 31)  WolfArg.AddSpell(IcySpear)  WolfArg.AddSpell(Incinerate)  WolfArg.AddSpell(Thunderbolt)elseif (aiNewLevel == 41)  WolfArg.AddSpell(MassParalysis)  WolfArg.AddSpell(GuardianCircle)elseif (aiNewLevel == 43)  WolfArg.AddSpell(FireStorm)  WolfArg.AddSpell(Blizzard)  WolfArg.AddSpell(LightningStorm)endifENDEVENT

Sorry about that.
User avatar
Rachel Tyson
 
Posts: 3434
Joined: Sat Oct 07, 2006 4:42 pm

Post » Mon Nov 19, 2012 6:50 pm

And that is the exact script that is giving you the error, spaces, blank lines and all?

I do not see an issue with it, unless you are limited on the number of 'elseif' commands you can have.
User avatar
Mario Alcantar
 
Posts: 3416
Joined: Sat Aug 18, 2007 8:26 am

Post » Mon Nov 19, 2012 9:50 pm

And that is the exact script that is giving you the error, spaces, blank lines and all?

I do not see an issue with it, unless you are limited on the number of 'elseif' commands you can have.

I don't think there is, but even if there is it would be pretty pathetic for any language if just 8 elseif statements surpassed the limit...
User avatar
KRistina Karlsson
 
Posts: 3383
Joined: Tue Jun 20, 2006 9:22 pm

Post » Tue Nov 20, 2012 6:36 am

That's the script, copypasted and everything. I do note that it is giving me an error while playing the game - it compiles alright. I had placed the NPC in the RiverwoodRiverwoodTrader cell (So the player can encounter her early) and right-clicked on her, and renamed her Reference Editor ID WolfArg. As far as I am aware, this is what I must do to make the script run with her as a reference.
User avatar
Darlene DIllow
 
Posts: 3403
Joined: Fri Oct 26, 2007 5:34 am

Post » Tue Nov 20, 2012 4:28 am

So, did you link all the properties in the script to objects in the game?
User avatar
Ann Church
 
Posts: 3450
Joined: Sat Jul 29, 2006 7:41 pm

Post » Mon Nov 19, 2012 4:58 pm

Yes, I did. I linked every last property to its appropriate spell, linked the Actor to WolfArg from the Reference I made in RiverwoodRiverwoodTrader, and the quest WildWolfSpellQuest contains the script.
User avatar
Anthony Rand
 
Posts: 3439
Joined: Wed May 09, 2007 5:02 am

Post » Mon Nov 19, 2012 8:06 pm

And your playing with a clean save game? (a save game that never had your mod activated when it was saved)
User avatar
Jarrett Willis
 
Posts: 3409
Joined: Thu Jul 19, 2007 6:01 pm

Post » Mon Nov 19, 2012 9:02 pm

Yes, I started a new game just to test this mod.
User avatar
Gavin Roberts
 
Posts: 3335
Joined: Fri Jun 08, 2007 8:14 pm


Return to V - Skyrim