Jump to content

[LE] Problem with Reference Aliases


Recommended Posts

I feel so dumb posting about this but I've looked literally everywhere I can think of and just simply can't get this right for some reason. I basically want an item from a character's house to appear over his head using the MoveTo command and then he runs over and picks it up using an activate package. However, I cannot for the life of me figure out how to set up the reference aliases in the actual script. Again I feel dumb for asking because it seems like common knowledge, but how exactly do I go about this?

Link to comment
Share on other sites

Aliases are set up in Quests, in the Alias tab. They can be referred to in scripts through the property system, and can be assigned scripts themselves (there'll be a list on the right hand side once you create a specific alias). Filling them with the desired references is usually done through the Alias window as well.

Link to comment
Share on other sites

Aliases are set up in Quests, in the Alias tab. They can be referred to in scripts through the property system, and can be assigned scripts themselves (there'll be a list on the right hand side once you create a specific alias). Filling them with the desired references is usually done through the Alias window as well.

The problem is once I set up a function for an alias, the script then tells me "[whatever command I'm using] is not a function or does not exist". I think it's expecting an object reference, but surely it's possible to use a reference alias there?

Link to comment
Share on other sites

 

Aliases are set up in Quests, in the Alias tab. They can be referred to in scripts through the property system, and can be assigned scripts themselves (there'll be a list on the right hand side once you create a specific alias). Filling them with the desired references is usually done through the Alias window as well.

The problem is once I set up a function for an alias, the script then tells me "[whatever command I'm using] is not a function or does not exist". I think it's expecting an object reference, but surely it's possible to use a reference alias there?

 

 

ReferenceAliases and ObjectReferences are distinct things. Reference aliases will usually inherit events from the object filling them (so, e.g., an Actor filling an alias will have ReferenceAlias scripts receive events like OnEquip), but they do not have the same functions that ObjectReferences or Actors have. To access those you need to use GetReference() to obtain the ObjectReference filling the alias, and from there you can call functions on that variable as per normal. Likewise if you need to pass what's in the alias into some other function that expects an ObjectReference; you'll need to pull the reference with GetReference() and then pass that.

Link to comment
Share on other sites

 

 

Aliases are set up in Quests, in the Alias tab. They can be referred to in scripts through the property system, and can be assigned scripts themselves (there'll be a list on the right hand side once you create a specific alias). Filling them with the desired references is usually done through the Alias window as well.

The problem is once I set up a function for an alias, the script then tells me "[whatever command I'm using] is not a function or does not exist". I think it's expecting an object reference, but surely it's possible to use a reference alias there?

 

 

ReferenceAliases and ObjectReferences are distinct things. Reference aliases will usually inherit events from the object filling them (so, e.g., an Actor filling an alias will have ReferenceAlias scripts receive events like OnEquip), but they do not have the same functions that ObjectReferences or Actors have. To access those you need to use GetReference() to obtain the ObjectReference filling the alias, and from there you can call functions on that variable as per normal. Likewise if you need to pass what's in the alias into some other function that expects an ObjectReference; you'll need to pull the reference with GetReference() and then pass that.

 

 

 

In layman's terms..... a reference alias won't act like the thing you think it is until you do a "aliasName.GetReference().functionYouWantToUse()". The "GetReference()" gets the object that the reference points at. If you try to do functions on the alias itself, (for example "GetName()") you'll just get the properties of the ALIAS, not the thing that the alias points at.

 

An example.

 

If you have "Iron Armor" filling an alias called "ArmorAlias", this is what you'd get from the "GetName()" function.

 

ArmorAlias.GetName() would result in "ArmorAlias" (Assuming that that's the name you gave it in the quest.)

 

ArmorAlias.GetReference().GetName() would result in "Iron Armor"

Edited by corrado33
Link to comment
Share on other sites

  • 9 months later...
  • Recently Browsing   0 members

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