Jump to content

Help needed with Quest Alias + Papyrus


Recommended Posts

Hey guys, is it possible to define a quest alias with a papyrus script, clear it on a specified occasion & then assign a new reference after?

 

For (a simplified) example, lets say I created a quest that turned an alias "the one" into a god after the player completed the main story quest.

 

The player could cast a spell on any NPC which would mark that specific NPC as "the one". (aka the spells aktarget becomes the specific reference alias)

 

However if the NPC died, it would clear the alias. ("the one" alias had a script run on death that would self.clear() ondeath )

 

The player would then need to cast the spell on a new NPC to make them "the one"

 

 

I've taken a peek at the follower quests, which suggest that dynamically assigning aliases is possible but I cant figure it out :(

 

Link to comment
Share on other sites

Yes and here's an example of one of the ways that's achieved.

 

Let's take your concept and apply a little bit of it. Let's say the following code is the effect for your spell.

Scriptname FillAnAliasEffect extends ActiveMagicEffect

ReferenceAlias property myAlias auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
Actor PlayerRef = Game.GetPlayer() ; I'm being lazy and don't feel like making another property.

if akCaster == PlayerRef
    if myAlias.GetReference() == none ; Make sure the alias is empty first.
        myAlias.ForceRefTo(akTarget)
    else
        ; reference already filled.
        return
    endif
endif
    
EndEvent

Now let's say the spell worked, and the NPC was added to the alias. Now let's say you want this alias to be cleared if the NPC is killed, like you say:

Scriptname AliasFromSpellRefScript extends ReferenceAlias

Event OnDying(Actor akKiller)
; This event is faster than OnDeath.

Clear()
    
EndEvent
Edited by Terra Nova
Link to comment
Share on other sites

  • Recently Browsing   0 members

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