r1de Posted March 21, 2012 Share Posted March 21, 2012 I made a couple of custom horses for my Girlfriend and I, and then I made a quest that will set an objective on that horse so we can find it if it runs off. The quest uses an alias pointed at the ref of the horse as an objective. I was thinking this could work to track the GetPlayersLastRiddenHorse reference and work to find *ANY* players horse when they run off, if only I could set the Alias with "Game.GetPlayersLastRiddenHorse()"...I thought, this will be simple, and could be useful to other players... I was wrong. So I made a new quest to try this experiment...I have an Alias on that Quest, "My_Horse"In the Script attached to the quest, when I try to set the alias with: My_Horse = Game.GetPlayersLastRiddenHorse() The alias does not seem to get set, I have tried different things and either the alias never gets set or I get an error in the papyrus logs about a type mismatch.GetPlayersLastRiddenHorse returns a reference to an actor, why does this alias not set? Isn't this pretty much *exactly* what Papyrus is for? I have tried to set the alias type as ObjectReference, ReferenceAlias, Alias, Actor, etc... Actor and ObjectReference will allow the script to compile cleanly but no objective is set in the quest, because of a incompatible type.I have tried to "cast" the variable to other types, all result in error.(I am using say, My_Horse = Game.GetPlayersLastRiddenHorse() as Actor (or as ObjectReference or anything else)) and it still does not seem to work. I admit, I am probably using "cast" wrong.) There is a lesser power that starts this experimental quest and I put a "Debug.MessageBox(Game.GetPlayersLastRiddenHorse)" and confirmed that it is indeed a ref alias to the last ridden horse.What am I missing? I'm sure it's something simple. Link to comment Share on other sites More sharing options...
tunaisafish Posted March 21, 2012 Share Posted March 21, 2012 If this is a fragment script, then the quest alias's should be defined for you.They get "Alias_" prepended to the name though. Link to comment Share on other sites More sharing options...
r1de Posted March 21, 2012 Author Share Posted March 21, 2012 If this is a fragment script, then the quest alias's should be defined for you.They get "Alias_" prepended to the name though.No, the script in question was not a fragment, it is a separate script attached to the quest, the "My_Horse" property of the script is set to the Alias on the quest. I'll try setting it within the fragment. maybe that will work, I don't think I tried that avenue yet. I think I've tried about everything else, I really didn't think it would be so hard... Thanks Tuna! :smile: Link to comment Share on other sites More sharing options...
DangerManzo Posted March 21, 2012 Share Posted March 21, 2012 (edited) I'm still somewhat of a script noob but this may help.Since My_Horse is an alias and Game.GetPlayersLastRiddenHorse() is an actor you are telling it to set an actor to an alias. This seems correct to our human brains but papyrus says an actor is not an alias, so that is why you get the type mismatch.Try this:My_Horse.ForceRefTo(Game.GetPlayersLastRiddenHorse() as ObjectReference) http://www.creationkit.com/ForceRefTo_-_ReferenceAlias edit: I noticed that ForceRefTo needs an object reference and Game.GetPlayersLastRiddenHorse() returns an actor. So maybe Game.GetPlayersLastRiddenHorse() as ObjectReference will do it. See, still a noob at this. :whistling: Edited March 21, 2012 by DangerManzo Link to comment Share on other sites More sharing options...
r1de Posted March 21, 2012 Author Share Posted March 21, 2012 I'm still somewhat of a script noob but this may help.Since My_Horse is an alias and Game.GetPlayersLastRiddenHorse() is an actor you are telling it to set an actor to an alias. This seems correct to our human brains but papyrus says an actor is not an alias, so that is why you get the type mismatch.Try this:My_Horse.ForceRefTo(Game.GetPlayersLastRiddenHorse() as ObjectReference) http://www.creationkit.com/ForceRefTo_-_ReferenceAlias edit: I noticed that ForceRefTo needs an object reference and Game.GetPlayersLastRiddenHorse() returns an actor. So maybe Game.GetPlayersLastRiddenHorse() as ObjectReference will do it. See, still a noob at this. :whistling: Thanks. :smile: That's why I asked, to get others ideas and insights... I'm still pretty new at this too, especially the scripting part. I do have a little bit of programming know-how in me, but not much. I think I tried that using "as ObjectReference" and it still did not work. I'll check it some more at some point today, my syntax was probably off or some other PEBKAC error. :smile: Link to comment Share on other sites More sharing options...
r1de Posted March 21, 2012 Author Share Posted March 21, 2012 well with both of your suggestions together, I might have gotten it to work.At least, it seems to be working so far... Kinda nice being able to find the stupid horses. :smile: Link to comment Share on other sites More sharing options...
Recommended Posts