Aller au contenu

Photo

Calling script from conversation


3 réponses à ce sujet

#1
kosmonymous

kosmonymous
  • Members
  • 16 messages
When calling script from conversation is there a way for the script to know who is the NPC which player is talking to and is there a actual way to pass parameters to that script.

I was thinking of changing core so it saves in a global variable who is player talking to and then make separate scripts for every parameter option needed.

Motivation for this is a new type of quest and reputation-system, where NPC:s have a different types of knowledge about player (and possibly each other) and talking options depend on that.

 

#2
BryanDerksen

BryanDerksen
  • BioWare Employees
  • 273 messages
Not directly. When we created the main campaign we relied pretty much entirely on plot flags to send information from conversation to script and back again. I suppose you could also use local variables to store a value for a script to read.



We added a function, GetConversationEntryParameter, to allow a conversation to pass an integer parameter directly to a plot script. However, I have just now discovered that the version of the game engine that shipped predates our addition of that function. So the game currently doesn't support it and we'll have to wait for a game patch to restore it.



For your reputation system, I'd suggest looking into using "defined" plot flags as conditions for conversation responses. You could have a plot flag that's only true when one's reputation is 20 or higher, for example.

#3
Phaenan

Phaenan
  • Members
  • 315 messages

We added a function, GetConversationEntryParameter, to allow a conversation to pass an integer parameter directly to a plot script. However, I have just now discovered that the version of the game engine that shipped predates our addition of that function. So the game currently doesn't support it and we'll have to wait for a game patch to restore it.


So it will be restored at some point ! That's a damn good news !
Having to create one script pseudo-duplicate per possible parameter was tedious. :blush:

#4
Proleric

Proleric
  • Members
  • 2 361 messages
Plot flags are really cool. If you still need to identify the conversation owner, in a plot event script you can use GetEventObject(eParms, 0). This is documented in the example script plot_core and works fine.