SetActorValue and GetActorValue don't exist? (Creation Kit)

Post » Wed Jun 29, 2016 9:12 pm

Hiya!



I'm trying desperately to become a new modder in the Skyrim community, but I'm having a hard time wrapping my head around the reference architecture of the Creation Kit and how scripts and objects interact with one another. I've read through all of Bethesda's beginner tutorials and their Papyrus primer, and the syntax makes plenty of sense, but the way things interact is just beyond me. Before I started making any mods, I figured I'd mess around with some of the basic processes that I'd need to learn how to do for the mod I have in mind, but I'm coming across a compiler error which I can only possibly attribute to an issue in the way that I'm referencing what I'm working with.



Essentially, I have an actor in a testing Cell. He has his Activate Parent set to a pullbar over on the wall. I want to make it so that when the pullbar is pulled, it will set one of the actor's stats to a specific value and then give me a debug notification with the finished stat. Here's my code:


Scriptname StatSetup extends ObjectReference



ActorBase Property debugApprentice auto



Event OnActivate(ObjectReference akActionRef)

debugApprentice.SetActorValue("smithing", 15)

debug.notification("Smithing is " + (debugApprentice.GetActorValue("smithing") As String))

EndEvent


And my compiler error:


Starting 1 compile threads for 1 files...

Compiling "StatSetup"...

C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\StatSetup.psc(6,17): SetActorValue is not a function or does not exist

C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\StatSetup.psc(7,53): GetActorValue is not a function or does not exist

No output generated for StatSetup, compilation failed.



Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on StatSetup



I've been unable to find any other threads explaining why this is wrong, or any tutorials on the reference structure of Skyrim that makes any sense to me, so I figured I'd share this here and hope that somebody could explain to me just what I'm doing wrong.

User avatar
Code Affinity
 
Posts: 3325
Joined: Wed Jun 13, 2007 11:11 am

Post » Thu Jun 30, 2016 4:04 am

You need to do a little more of your own research.



Did you even look up the function on the Wiki?



http://www.creationkit.com/index.php?title=Actor_Script


http://www.creationkit.com/index.php?title=ActorBase_Script


http://www.creationkit.com/index.php?title=Category:Script_Objects



Try this.



Actor Property debugApprentice auto

Event OnActivate(ObjectReference akActionRef)

debugApprentice.SetActorValue("smithing", 15)

debug.notification("Smithing is " + (debugApprentice.GetActorValue("smithing") As String))

EndEvent
User avatar
Poetic Vice
 
Posts: 3440
Joined: Wed Oct 31, 2007 8:19 pm

Post » Wed Jun 29, 2016 2:14 pm

And to further explain, things that don't have an actual representation in the world like Perks and Quests do just have a single FormID and script type that you can use. But every thing that can actually appear in the world is defined by a base type and every instance of that base type has a reference to represent the actual game object. In some cases such as the player character there is one base form (the ActorBase with EditorID Player and FormID 00000007) and exactly one matching reference (the Actor with EditorID PlayerRef and FormID 00000014). In others such as the enchanting table there is one base form (the Furniture item with EditorID CraftingEnchantingWorkbench and FormID 000BAD0D) and many different references (of type ObjectReference) found at various places in the world.



SetActorValue and GetActorValue only work specific Actor references that exists in the game work. That potentially allows each individual Actor to have different values even if they are generated from the same ActorBase. (Think of all of those bandits that look alike but have different levels and skills.) For things that do have both a base type and an reference you almost always want to write your scripts to manipulate the reference because the script itself is attached to that reference.

User avatar
Maria Garcia
 
Posts: 3358
Joined: Sat Jul 01, 2006 6:59 am


Return to V - Skyrim