Jump to content

Get Ref/Variable of NPC speaking?


Demeggy

Recommended Posts

Afternoon,

 

Trying to determine a feasible way of determining the Ref of the NPC you're in dialogue with (using NVSE 4.1), then pull a variable from that NPC.

 

Have tried various ways, which don't always prove to be consistent. I'm running the code at the end of each topic.

 

The method I'm adopting is as below;

ref npc
short loc
set npc GetCrossHairRef
set loc to npc.GetVariable rndLoc

printc "Responded"
MessageEx "My location is %g" loc

I did utilise a similar piece of code in another topic last night which worked, momentarily at the least, but for some reason now - doesn't (can't work out why, as I haven't amended it)

ref npc
set npc getCrossHairRef

if npc == testQuest.targetNoc
 MessageEx "True"
else
 MessageEx "False"
endif

The code just fails to actually run. It does appear to printc as stated in the above block, but doesn't provide any other actions.

 

Thoughts?

 

Link to comment
Share on other sites

 

The variable name must be in double-quote. Try:

set loc to npc.GetVariable "rndLoc"

 

Cheers. Having amended it, I've tried running it again, still to no joy.

 

I'm now suspecting that the GetCrosshairRef method isn't ideal, as it doesn't seem to be correctly identifying the NPC Ref.

 

ref npc
short loc
set npc to GetCrossHairRef
set loc to npc.GetVariable "rndLoc"


printc "My location is %g" loc
Link to comment
Share on other sites

Resolved :)

 

I moved the topic script to a quest script, conditionalising it by placing it into a dialogue block. The topic script triggers the quest block, the quest block runs, then turns off at the end.

Works like a charm. :)

 

Thanks for pointing out the syntax error.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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