Page 1 of 1

changing listening patterns

Posted: Sat Jan 10, 2004 9:01 pm
by JollyOrc
is it possible to set / change listening patterns during runtime, instead at onspawn ?

Posted: Fri Jan 16, 2004 3:30 pm
by KinX
How do you want to change the variables at run-time?

Posted: Fri Jan 16, 2004 3:32 pm
by Brannor
Don't see why not.
You would just need to keep the string being compared to out of the script.
Save it as a localstring on the char and load it on demand.

Posted: Fri Jan 16, 2004 3:38 pm
by JollyOrc
what I would want, for instance:

- Change codewords
- switch listening on or off entirely
- make an NPC listen to something else occasionally

one possible use:

1. activate listening (as with the scribe at the bulletin boards)
2. speak a codeword
3. deactivate listening, save the codeword
4. switch on listening on another NPC
5. this other NPC now waits to hear the codeword to deliver something / open door / etc...

Posted: Fri Jan 16, 2004 3:45 pm
by Mistcaller
Yea, I think with a persistent string variable (or local) you can do it...

i.e. (not sure if it works)

OnSpawn: Load Persistent string and store it on a Local string. Set 2 listening patterns: one that activates the password-check procedure, call it A, and one that fires the password-change procedure, call it B.

On Listening to A, the password-check is activated.
Read the Local String Variable and maybe set a new Listening pattern for it, if necessary (in the OnConversation event ).
Test matching with next spoken word (the actual password) and act accordingly.

If that next spoken word is the other pre-defined word (B), then you can speak one more word that is stored locally and in the persistent string as the new password.

Posted: Fri Jan 16, 2004 4:14 pm
by KinX
Is this how you want a conversation to look like?

PC: Activate

NPC: ok i'm listening

PC: codeword

NPC: you have been verified to be who you are

PC: change

NPC: Speak the new codeword

PC: newcode

NPC: "newcode" is now the password

PC: Get me some ale

NPC: sure thing

PC: deactivate

NPC: i'm now not listening.


I just want to make sure that's how you want things to work, because i want to do something like this too

Posted: Fri Jan 16, 2004 4:18 pm
by Mistcaller
KinX wrote:Is this how you want a conversation to look like?

PC: Activate

NPC: ok i'm listening

PC: codeword

NPC: you have been verified to be who you are

PC: change

NPC: Speak the new codeword

PC: newcode

NPC: "newcode" is now the password

PC: Get me some ale

NPC: sure thing

PC: deactivate

NPC: i'm now not listening.


I just want to make sure that's how you want things to work, because i want to do something like this too
Yup, that was exactly what I had in mind, though I cannot test it right now to be certain it works (especially the part that you set a listening pattern in the OnConversation event). And no need to de-activate him... he is de-activated already, until he listens to the 'activate' word.

Posted: Fri Jan 16, 2004 4:23 pm
by Halvar Yanocen
I'm sure that features like this will make player owned inns alot more popular among the guests.

Posted: Fri Jan 16, 2004 7:18 pm
by JollyOrc
heh... sounds good then.

Basically I just wanted to know that SetListeningPattern() works outside the onspawn event...

Seems to be that way, will test it soon :D

Posted: Fri Jan 16, 2004 7:55 pm
by Aloro
JollyOrc wrote:heh... sounds good then.

Basically I just wanted to know that SetListeningPattern() works outside the onspawn event...

Seems to be that way, will test it soon :D
Sure, you can set these at any point. I've done so a few times off triggers and other media.

- Aloro