Archer02 Posted May 12, 2018 Share Posted May 12, 2018 I'm a first time papyrus scripter and I'm having problems getting my head around this specific aspect of the Creation Kit. I've figured out the basis of using Text Replacement in books using a quest Alias for the player. <Alias=Player> The Next thing i want to do is <Alias=Player> <Alias=Message> Where Message is one of two strings depending on the value of a global variable, i know i probably need a script and an if statement but the issue is I'm not sure how to implement this in the creation kit. I've done debug messages with if statements based on the value of a global variable, I'm fine with setting up the logic and syntax but its this middle step that seems to be tripping me up. Any Advice of assistance would be appreciated. Link to comment Share on other sites More sharing options...
Deleted3897072User Posted May 12, 2018 Share Posted May 12, 2018 An alias can't be a message, only an ObjectReference or a Location. You might be able to do it if you have two dummy objects hidden somewhere whose names are each of the two messages, then an optional ReferenceAlias that you ForceRef to one or the other in a script. Link to comment Share on other sites More sharing options...
Archer02 Posted May 12, 2018 Author Share Posted May 12, 2018 Ahhh well that's a shame, Makes sense though now i think about it.Cheers that info saves me having to bang my head against a wall trying to figure out why it wasn't workingMuch appreciated Link to comment Share on other sites More sharing options...
Archer02 Posted May 12, 2018 Author Share Posted May 12, 2018 Another questionCan you use forceref() from an Activator? If so how? Scriptname Quest_Activator_Test extends ObjectReference Quest Property SuperQuest Auto function onActivate() Alias myAlias = SuperQuest.GetAlias(2) myAlias.ForceRefTo(Self as ObjectReference) endfunction GetAlias seems to be the closest i can get but that returns an Alias object which i cant use ForceRefTo() On as it requires an referenceAlias Link to comment Share on other sites More sharing options...
FrankFamily Posted May 12, 2018 Share Posted May 12, 2018 Can't you just make a referencealias property directly? Link to comment Share on other sites More sharing options...
Archer02 Posted May 12, 2018 Author Share Posted May 12, 2018 I'd imagine so. There is probably a easier to way to do what I'm trying but, I'm not certain it would help me later. In any case i seem to have solved the problem, i think its to do with casting. The following code on my Activator object seems to have done the trick. I had also forgotten to update the property Testing_Quest too. Scriptname ChangeMessageSource_Script extends ObjectReference Quest Property Testing_Quest Auto ReferenceAlias property MessageSource_Ref auto function onActivate(ObjectReference triggerRef) MessageSource_Ref = Testing_Quest.GetAlias(3) as ReferenceAlias MessageSource_Ref.ForceRefTo(Self as ObjectReference) debug.Notification("Changing Book Message to " + Self) EndFunction Link to comment Share on other sites More sharing options...
Evangela Posted May 12, 2018 Share Posted May 12, 2018 (edited) If the alias you want is on that quest, you only need to make a property for that reference alias, rather than use the GetAlias function, which forces casting(as it doesn't return a referencealias). And you should not need to cast self to objectreference.. when it's already an objectreference. ReferenceAlias property MessageSource_Ref auto { Contains the ReferenceAlias from the Testing_Quest. } Event OnActivate(ObjectReference akActionRef) MessageSource_Ref.ForceRefTo(self) debug.notification("Changing Book Message to " + Self) EndEvent Edited May 12, 2018 by Rasikko Link to comment Share on other sites More sharing options...
Archer02 Posted May 13, 2018 Author Share Posted May 13, 2018 Cheers Rasikko, I'll give that a go too it seems like a more efficient way. Is there a way to display the property of an alias object reference like Player.Health other than using a global? Link to comment Share on other sites More sharing options...
FrankFamily Posted May 13, 2018 Share Posted May 13, 2018 Check here for what can be used in text replacement: https://www.creationkit.com/index.php?title=Text_Replacement For anything else you'd need a global which you'd need to keep updated if the value is going to change. Link to comment Share on other sites More sharing options...
Recommended Posts