Jump to content

Call actor name in message


Minuos

Recommended Posts

Hi all,

 

I have workshop NPCs (FF) that bring up a message box when activated, displaying a few actor values (MessageName.Show()). I know you can't pass a text string to a float but I'd like to make the name of the activated NPC appear at the top of the message box for QoL reasons. Is this possible?

 

I'm aware of F4SE's GetName() and GetDisplayName() functions but not sure if it's possible to pass the resulting string to a message in the CK. Anyone know?

 

I'm not really sure how to work with aliases, so I'd very much appreciate a little added guidance if that's the only way to do this.

Link to comment
Share on other sites

Using base game ingredients create a quest reference alias, lets say SettlerName, and check the Stores Text box.

 

Then update the message with Owner Quest dropdown name.

 

In the title or body insert <Alias=SettlerName>

 

Then you need to script finding your actor ObjectReference to add, display message and then remove from the quest reference alias.

Link to comment
Share on other sites

Thanks for your help. I wasn't aware of the dropdown. It now returns [...] which means the alias isn't being filled? Are there any settings other than Stores Text I should be using?

 

What's the cleanest way to fill an alias from a script? Running AliasName.ForceRefTo(Self) on the actor's script (OnActivate()) doesn't seem to be working. The message still displays [...].

Link to comment
Share on other sites

Do you know for 100% sure the quest is running and the alias is filling ... what does console SQV tell you about your quest ?

 

Also hit the papyrus debug log to check for errors.

 

ps no idea of your knowledge level so of course you need to mark any quest aliases that are not filled at quest start with OPTIONAL.

Link to comment
Share on other sites

The quest is enabled and running. The alias -> NONE even after activating the NPC with the ForceRefTo() line.

 

I have script experience and I've used autorun quests to handle stuff before, but my knowledge level is pretty much 0 when it comes to aliases.

 

I created the alias by hitting New Reference Alias and checking Stores Text and Optional. I didn't touch anything else. Are there other steps?

 

 

(By the way, if you just want to display actor values, you can also use Debug.MessagesBox).

 

That's useful, thanks. There are a couple of 'submenu' messages that loop back to this main message though, so I need to use the CK this time.

Edited by Minuos
Link to comment
Share on other sites

There's really not much to that event, but sure:

Event OnActivate(ObjectReference akActionRef)

HiMyNameIs.ForceRefTo(Self)
IdleMenu()

EndEvent

The reference alias is defined as:

ReferenceAlias Property HiMyNameIs Auto Const

IdleMenu() calls a custom function which handles the message box stuff. This works, so I know OnActivate() is firing.

Link to comment
Share on other sites

I would suspect there is a context issue using the OnActivate event for an actor attached script.

 

Your going to have to trace it out :

Event OnActivate(ObjectReference akActionRef)
	Debug.Trace("MyScript.OnActivate " + Self) 
	HiMyNameIs.ForceRefTo(Self)
	Debug.Trace("MyScript.HiMyNameIs " + HiMyNameIs.GetReference()) 
	IdleMenu()
	HiMyNameIs.Clear() ;never hold a ref persistent in an alias, always clean as you go !
EndEvent

Post the relevant lines from Papyrus0 log

Link to comment
Share on other sites

I figured it out. The reference alias property couldn't be filled on the script attached to the actor. I removed the property from the script manually and added it through the CK and for some reason that allowed it to be filled when adding the script to the actor... I'm not sure exactly how, but the message now displays the actor's name using the settings you advised, so I'm happy.

 

Thanks for all your help. It's very much appreciated.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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