What condition should this script have?

Post » Fri Sep 05, 2014 1:15 pm

Okay, so I've just written this script, but it comes up with this error message when I try to compile it:

Starting 1 compile threads for 1 files...
Compiling "defaultaddshoutonequipscript"...
D:\Downloaded Programs\Steam\Steam\steamapps\common\skyrim\Data\Scripts\Source\defaultaddshoutonequipscript.psc(22,13): HasShout is not a function or does not exist
D:\Downloaded Programs\Steam\Steam\steamapps\common\skyrim\Data\Scripts\Source\defaultaddshoutonequipscript.psc(28,13): HasShout is not a function or does not exist
D:\Downloaded Programs\Steam\Steam\steamapps\common\skyrim\Data\Scripts\Source\defaultaddshoutonequipscript.psc(34,13): HasShout is not a function or does not exist
No output generated for defaultaddshoutonequipscript, compilation failed.
Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on defaultaddshoutonequipscript
even though 'HasShout' seems to exist on the creation kit website?? http://www.creationkit.com/Category:Condition_Functions What should I put instead so it works? Thanks :)
Here's the script:
Scriptname defaultaddshoutonequipscript extends ObjectReference  {Generic script that adds a shout to the actor when an item is equipped} Shout Property ShoutToAdd01  Auto  Shout Property ShoutToAdd02  Auto  Shout Property ShoutToAdd03  Auto  Event OnEquipped(Actor akActor)if (ShoutToAdd01 != None)akActor.AddShout(ShoutToAdd01)EndIfif (ShoutToAdd02 != None)akActor.AddShout(ShoutToAdd02)EndIfif (ShoutToAdd03 != None)akActor.AddShout(ShoutToAdd03)EndIfEndEvent Event OnUnequipped(Actor akActor) if (ShoutToAdd01 != None)if akActor.HasShout(ShoutToAdd01)akActor.RemoveShout(ShoutToAdd01)endIfendif if (ShoutToAdd02 != None)if akActor.HasShout(ShoutToAdd02)akActor.RemoveShout(ShoutToAdd02)endIfendif if (ShoutToAdd03 != None)if akActor.HasShout(ShoutToAdd03)akActor.RemoveShout(ShoutToAdd03)endIfendif EndEvent
User avatar
Lily
 
Posts: 3357
Joined: Mon Aug 28, 2006 10:32 am

Post » Fri Sep 05, 2014 5:03 pm

HasShout is a Condition 'function' used in Conditions, e.g. TopicInfos, .... and not a Papyrus function.

http://www.creationkit.com/HasSpell-_Actor should do the trick.

User avatar
Nichola Haynes
 
Posts: 3457
Joined: Tue Aug 01, 2006 4:54 pm

Post » Fri Sep 05, 2014 4:23 am

Thanks so much! Yep it did the trick :)

User avatar
Allison Sizemore
 
Posts: 3492
Joined: Wed Jul 19, 2006 6:09 am

Post » Fri Sep 05, 2014 11:12 am

:wink: You'r welcome

User avatar
Jennifer Rose
 
Posts: 3432
Joined: Wed Jan 17, 2007 2:54 pm

Post » Fri Sep 05, 2014 5:58 am

When looking for functions you can use, you can look them up by the script type. So, for instance, you want to call a function on akActor, which is of the type Actor:

Event OnEquipped(Actor akActor)

You can then go to the Creation Kit Wiki, and search for "Actor Script" to find every function you can call on an actor: http://www.creationkit.com/Actor_Script page. Since you're looking for how to detect shouts, you could Ctrl-F on that page and search for "Shout" -- you will notice the HasSpell function docblacky pointed out says: "Checks to see if this actor has the given Spell or Shout."

Similarly, if you wanted to call a function on, say, a Weapon type object, you can search for "Weapon Script" in the Creation Kit Wiki, and you'll find all the functions you can use on weapons: http://www.creationkit.com/Weapon_Script. The same goes for any other type, just search for " Script" and you can find a list of available functions.

Whenever you try to compile your script but you get an error like the one you posted above that says " is not a function or does not exist" that means you're trying to use a function that doesn't exist for the type of object you're calling it on.

Hopefully that helps for future reference!

User avatar
Beulah Bell
 
Posts: 3372
Joined: Thu Nov 23, 2006 7:08 pm

Post » Fri Sep 05, 2014 9:43 am

Thanks, yeah that's definitely helpful! :)

User avatar
Dark Mogul
 
Posts: 3438
Joined: Tue Feb 20, 2007 11:51 am


Return to V - Skyrim