» Thu Jun 21, 2012 5:08 pm
Did the line of code I suggested work? If so, let me try to explain again why that works and why what you tried didn't work, and why you got the error you did.
Your ''NPC'' variable is of the type ReferenceAlias. You called the function GetActorReference() on NPC. If you look at this page:
http://www.creationkit.com/GetActorReference_-_ReferenceAlias
you will get 2 important pieces of information. The first is at the very top of the page, and says: ''Member of: ReferenceAlias Script''. What this means is that the function can be called on objects of the type ReferenceAlias, which your NPC variable indeed is. If you also had another variable of the type integer for example (just a number), and tried to call GetActorReference() on that, it would have failed, because GetActorReference() is not a member of the integer script.
The second important piece of information is the Return value, which is of type Actor. This means that the piece of code ''NPC.GetActorReference()'' ends up being a pointer to something of the type Actor.
If you then look at the function which you were trying to use, the SetEssential() function, you will see on this page:
http://www.creationkit.com/SetEssential_-_ActorBase
by again looking at the top of the page, that this function is a member of the ActorBase Script. This means that you cannot call SetEssential() on ReferenceAliases, you cannot call it on integers, you cannot call it on apples, and indeed you cannot call it on an Actor. It can ONLY be called on something of type ActorBase. Because you only had a pointer to something of type Actor, the compiler did not understand what you were trying to do (because there is no SetEssential() function in the Actor script) and therefore threw the error at you which it did.
Because you can see on the function's wiki page that the function is a member of the ActorBase script, you also know already that if you want to call it on your actor, you need to figure out a way to convert your Actor into an ActorBase, and that is precisely what the function GetActorBase() is for:
http://www.creationkit.com/GetActorBase_-_Actor
As you can see on that page, the function is a member of the Actor script (and you have an Actor), and the return value is of type ActorBase (which is the type that you want to end up with), so that's how you can see that this function can be used, and that it gives you what you want.