Need Help! Getting reference from another quest's alias

Post » Tue Jun 19, 2012 4:02 pm

I need to run a script that will force a reference from another quest's alias (type Specific alias) into an empty alias on another quest

Quest One:
Alias Tab: npcAlias will have a specific reference to the NPC placed in the world.

Quest Two
Alias tab: myEmptyAlias - Empty Alias waiting to be filled with the same ref in quest One.

It might be something along the lines of this. Or it will hopefully give an idea of what I'm trying to do. It will be run from quest Two; a fragment to do with topics. (Extends TopicInfo Hidden)

;Properties
Actor Property NPCref Auto
ReferenceAlias Alias_myAlias Auto

NPCref = npcAlias.getActorRef [This needs to be looking in quest one, but not sure how]

myEmptyAlias.ForceRefTo(NPCref) - fill fill the alias with the ref in quest one.

so in code it looks like this

Spoiler
Scriptname QuestTWOFragment Extends TopicInfo HiddenFunction Fragment_1(ObjectReference akSpeakerRef)   Actor akSpeaker = akSpeakerRef as Actor   Game.GetPlayer().RemoveItem(Gold001, gMyCost.value as int)   Alias_myNPC.GetActorRef().SetFactionRank(AFaction, 1)   Alias_myNPC.GetActorRef().SetFactionOwner(BFaction)   RenameNPC.ForceRefTo(Alias_myNPC.GetActorRef());;  New code thats not working yet;   NPCref = npcAlias.GetActorRef()   myEmptyAlias.ForceRefTo(NPCref);EndFunction;Actor Property NPCref AutoReferenceAlias Property myEmptyAlias AutoReferenceAlias Property RenameNPC  AutoMiscObject Property Gold001  AutoFaction Property AFaction  AutoFaction Property BFaction  AutoGlobalVariable Property gMyCost  AutoReferenceAlias Property Alias_myNPC  Auto
User avatar
Tyler F
 
Posts: 3420
Joined: Mon Aug 27, 2007 8:07 pm

Post » Wed Jun 20, 2012 1:28 am

Hate to do it but... bump
User avatar
Mark Churchman
 
Posts: 3363
Joined: Sun Aug 05, 2007 5:58 am

Post » Tue Jun 19, 2012 5:57 pm

You'll want to use http://www.creationkit.com/GetAlias_-_Quest to get the information that you want to be represented by "npcAlias", which is currently undefined in that script.

Hate to do it but... bump
Little did you know, I was looking at this thread intending to answer before you posted that.

Cipscis
User avatar
FABIAN RUIZ
 
Posts: 3495
Joined: Mon Oct 15, 2007 11:13 am

Post » Wed Jun 20, 2012 1:49 am

You'll want to use http://www.creationkit.com/GetAlias_-_Quest to get the information that you want to be represented by "npcAlias", which is currently undefined in that script.

Little did you know, I was looking at this thread intending to answer before you posted that.

Cipscis
This new alias system is giving me a headache at times. I'll see if I can implement it. I really need to go through some more papyrus tutorials. :thanks:
I tried setting the AI package to be owned by a quest earlier to access aliases there, and using External Alias Reference but it never seems to work between quest forms.
User avatar
Bedford White
 
Posts: 3307
Joined: Tue Jun 12, 2007 2:09 am

Post » Tue Jun 19, 2012 10:19 pm

You'll want to use http://www.creationkit.com/GetAlias_-_Quest to get the information that you want to be represented by "npcAlias", which is currently undefined in that script.

Little did you know, I was looking at this thread intending to answer before you posted that.

Cipscis

Is this the right thing to do... dropping NPCref from before...

Alias npcAlias = QuestOne.GetAlias(25)
; where 25 is the ID of the alias I want to capture, then...

myEmptyAlias.ForceRefTo(npcAlias)


So in code...

Spoiler
Scriptname QuestTWOFragment Extends TopicInfo HiddenFunction Fragment_1(ObjectReference akSpeakerRef)   Actor akSpeaker = akSpeakerRef as Actor   Game.GetPlayer().RemoveItem(Gold001, gMyCost.value as int)   Alias_myNPC.GetActorRef().SetFactionRank(AFaction, 1   Alias_myNPC.GetActorRef().SetFactionOwner(BFaction)   RenameNPC.ForceRefTo(Alias_myNPC.GetActorRef());;  New code that might work, but then again, it might not;   Alias npcAlias = QuestOne.GetAlias(25)   myEmptyAlias.ForceRefTo(npcAlias);EndFunction;;ReferenceAlias Property myEmptyAlias Auto	; In Property manager points to Alias to be filled in QuestTwo;ReferenceAlias Property RenameNPC  AutoMiscObject Property Gold001  AutoFaction Property AFaction  AutoFaction Property BFaction  AutoGlobalVariable Property gMyCost  AutoReferenceAlias Property Alias_myNPC  Auto
User avatar
Quick Draw III
 
Posts: 3372
Joined: Sat Oct 20, 2007 6:27 am

Post » Wed Jun 20, 2012 6:01 am

Almost. However, you're currently trying to force myEmptyAlias to point to a http://www.creationkit.com/ReferenceAlias_Script, whereas it should be pointing to an http://www.creationkit.com/ObjectReference_Script. You can call http://www.creationkit.com/GetReference_-_ReferenceAlias in order to effectively convert a ReferenceAlias to the ObjectReference at which it is pointing:
myEmptyAlias.ForceRefTo(npcAlias.GetReference())

Cipscis
User avatar
sarah taylor
 
Posts: 3490
Joined: Thu Nov 16, 2006 3:36 pm

Post » Tue Jun 19, 2012 5:06 pm

Almost. However, you're currently trying to force myEmptyAlias to point to a http://www.creationkit.com/ReferenceAlias_Script, whereas it should be pointing to an http://www.creationkit.com/ObjectReference_Script. You can call http://www.creationkit.com/GetReference_-_ReferenceAlias in order to effectively convert a ReferenceAlias to the ObjectReference at which it is pointing:
myEmptyAlias.ForceRefTo(npcAlias.GetReference())

Cipscis

ok tried what you said although myEmptyAlias should be aimed at the alias in the QuestTwo where the script is running. I can't se why it should be ObjectReference if its an alias.

I tried it and got a few errors:

variable QuestOne is undefined
none is not a known user-defined type
GetReference is not a function or does not exist
ForceRefTo is not a function or does not exist

Spoiler
Scriptname QuestTWOFragment Extends TopicInfo HiddenFunction Fragment_1(ObjectReference akSpeakerRef)   Actor akSpeaker = akSpeakerRef as Actor   Game.GetPlayer().RemoveItem(Gold001, gMyCost.value as int)   Alias_myNPC.GetActorRef().SetFactionRank(AFaction, 1   Alias_myNPC.GetActorRef().SetFactionOwner(BFaction)   RenameNPC.ForceRefTo(Alias_myNPC.GetActorRef());;  New code that might work, but then again, it might not;   Alias npcAlias = QuestOne.GetAlias(25)   myEmptyAlias.ForceRefTo(npcAlias.GetReference());EndFunction;;ObjectReference Property myEmptyAlias Auto ; In Property manager points to Alias to be filled in QuestTwo;ReferenceAlias Property RenameNPC  AutoMiscObject Property Gold001  AutoFaction Property AFaction  AutoFaction Property BFaction  AutoGlobalVariable Property gMyCost  AutoReferenceAlias Property Alias_myNPC  Auto
User avatar
Katie Louise Ingram
 
Posts: 3437
Joined: Sat Nov 18, 2006 2:10 am

Post » Wed Jun 20, 2012 5:33 am

By using the http://www.creationkit.com/ForceRefTo_-_ObjectReference function, you're setting the http://www.creationkit.com/ObjectReference_Script to which you want your http://www.creationkit.com/ReferenceAlias_Script to point. That's what ReferenceAliases do - they point to an ObjectReference.

When you post compiler errors, please include the entire script and the entire compiler error, as that includes line and character number information making the errors much easier to find.

The problem here is that you haven't defined any variable or property called "QuestOne", so the compiler doesn't know what you're trying to refer to. Remember, scripts are completely separate from data files, and you have to use Properties and native functions for them to interact with data files. You cannot use http://www.cipscis.com/skyrim/tutorials/editorids.aspx.

The "function doesn't exist" errors are because you're using the wrong types for your "myEmptyAlias" and "npcAlias" Properties. They should both be of type ReferenceAlias.

Cipscis
User avatar
Sabrina Steige
 
Posts: 3396
Joined: Mon Aug 20, 2007 9:51 pm

Post » Tue Jun 19, 2012 6:07 pm

By using the http://www.creationkit.com/ForceRefTo_-_ObjectReference function, you're setting the http://www.creationkit.com/ObjectReference_Script to which you want your http://www.creationkit.com/ReferenceAlias_Script to point. That's what ReferenceAliases do - they point to an ObjectReference.

When you post compiler errors, please include the entire script and the entire compiler error, as that includes line and character number information making the errors much easier to find.

The problem here is that you haven't defined any variable or property called "QuestOne", so the compiler doesn't know what you're trying to refer to. Remember, scripts are completely separate from data files, and you have to use Properties and native functions for them to interact with data files. You cannot use http://www.cipscis.com/skyrim/tutorials/editorids.aspx.

The "function doesn't exist" errors are because you're using the wrong types for your "myEmptyAlias" and "npcAlias" Properties. They should both be of type ReferenceAlias.

Cipscis
Only one error now, so must be getting closer...

I'll post the entire code without using any generic names. I'm getting confused between the two. Also it will make the line numbering make sense. So forget the earlier names like npcAlias or MyEmptyAlias - I was trying to to make it clear like the wiki definitions , but I'm getting mixed up between the two :smile:

So QuestOne is really the vanilla stables quest.
QuestTwo is really the StablesFollowerHorse quest (non-vanilla)
npcAlias is really playerHorseAlias
myEmptyAlias (the unfilled alias) is really tgtPlayerHorse

So I define stables (QuestOne) and had just one error
\steam\....\temp\JAD_TIF__0100182F.psc(14,15): type mismatch while assigning to a referencealias (cast missing or types unrelated)

Spoiler
 [/size];BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment;NEXT FRAGMENT INDEX 2Scriptname JAD_TIF__0100182F Extends TopicInfo Hidden;BEGIN FRAGMENT Fragment_1Function Fragment_1(ObjectReference akSpeakerRef)Actor akSpeaker = akSpeakerRef as Actor;BEGIN CODE;   Game.GetPlayer().RemoveItem(Gold001, horsecost.value as int)   Alias_Horse.GetActorRef().SetFactionRank(FollowerHorseFaction, 1)   Alias_Horse.GetActorRef().SetFactionOwner(CurrentFollowerFaction)   FollowersHorse.ForceRefTo(Alias_Horse.GetActorRef())   referencealias playerHorseAlias = stables.GetAlias(25)   tgtPlayerHorse.ForceRefTo( playerHorseAlias.GetReference());END CODEEndFunction;END FRAGMENT;END FRAGMENT CODE - Do not edit anything between this and the begin commentquest property stables AutoReferenceAlias Property tgtPlayerHorse AutoReferenceAlias Property FollowersHorse  AutoMiscObject Property Gold001  AutoFaction Property FollowerHorseFaction  AutoFaction Property CurrentFollowerFaction  AutoGlobalVariable Property HorseCost  AutoReferenceAlias Property Alias_Horse  Auto[size=4]
User avatar
Max Van Morrison
 
Posts: 3503
Joined: Sat Jul 07, 2007 4:48 pm

Post » Tue Jun 19, 2012 4:45 pm

Okay, the problem here is that you're trying to assign a value of type http://www.creationkit.com/Alias_Script to a variable of its child, http://www.creationkit.com/ReferenceAlias_Script in this line:
referencealias playerHorseAlias = stables.GetAlias(25)
Assuming the alias returned by http://www.creationkit.com/GetAlias_-_Quest can always be cast successfully to ReferenceAlias, as should be the case here, then this should work:
ReferenceAlias playerHorseAlias = stables.GetAlias(25) as ReferenceAlias
If any cast is ever unsuccessful, the returned value is None.

Cipscis
User avatar
GEo LIme
 
Posts: 3304
Joined: Wed Oct 03, 2007 7:18 pm

Post » Wed Jun 20, 2012 5:46 am

Okay, the problem here is that you're trying to assign a value of type http://www.creationkit.com/Alias_Script to a variable of its child, http://www.creationkit.com/ReferenceAlias_Script in this line:
referencealias playerHorseAlias = stables.GetAlias(25)
Assuming the alias returned by http://www.creationkit.com/GetAlias_-_Quest can always be cast successfully to ReferenceAlias, as should be the case here, then this should work:
ReferenceAlias playerHorseAlias = stables.GetAlias(25) as ReferenceAlias
If any cast is ever unsuccessful, the returned value is None.

Cipscis

Complilers happy now and so am I :foodndrink: Thanks. You are to well up to speed with this new language.

Now to get AI follow packages working on the horse to follow the playerHorse alias. Earlier, even if I set the ownership of packages to either quest, the game couldn't see the alias or what the alias was pointing to. Even CK complained when reloading. Something to do with not being able to do it that way unless you start a new game, unless script is used to force it. Allow Reserved on the alias tab is greyed out since the quest is start enabled. Hopefully, now, each time the Player horse dies, the alias can be reassigned to the new ref ID number. Before all this, when I just assigned the package to the ref and not an alias, it worked great until the player horse died.
User avatar
Tiffany Holmes
 
Posts: 3351
Joined: Sun Sep 10, 2006 2:28 am


Return to V - Skyrim