Jump to content

Text Replacement, Books and Quest Allias


Recommended Posts

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

Another question

Can 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

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

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 by Rasikko
Link to comment
Share on other sites

  • Recently Browsing   0 members

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