Page 1 of 1

detecting what a pc says

PostPosted: Thu Apr 20, 2006 10:14 am
Author: girlysprite
another scripting issue

Can I detect when a pc says 'I disbelieve'. Not in a conversation, but when the player types it.

PostPosted: Thu Apr 20, 2006 12:17 pm
Author: scratch
So you are asking if a PC says a specific phrase, activate a script or such?

PostPosted: Thu Apr 20, 2006 12:39 pm
Author: PsiOmega
You'll need a NPC in the area who'll pick up the line in the OnPercieve event. The NPC may or may not be invinsible depending on your needs.

Don't know how to script it though as I've never tried.

PostPosted: Thu Apr 20, 2006 1:05 pm
Author: girlysprite
I already finished it: let me share

I got an cutscene invisible pixie (which means undetectable by any means)

On the onSpawn script is the listening code

Code: Select all
    SetListenPattern(OBJECT_SELF,"I disbelieve",2001);

I listens for the sentence 'I disbelieve'

Now, for things to happen, I made another sciprt in onConversation, which also fires if the PC types something.

Code: Select all

void main()
         int nUser = GetUserDefinedEventNumber();
   int nMatch = GetListenPatternNumber();

    if(nMatch == 2001)

    object oTarget;
object oSpawn;
location lTarget;
oTarget = GetWaypointByTag("fog_02");

lTarget = GetLocation(oTarget);

oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "zep_fog001", lTarget);

oTarget = GetWaypointByTag("fog_01");

a fog item appears at a certain waypoint when I say this. Of course, now i realize I have to make set a variable, also have it checked...otherwise too many fogs can spawn if the player repeats the sentence.

PostPosted: Thu Apr 20, 2006 4:36 pm
Author: Tigg
sounds neat... when are you going to start making stuff for Avlis, hmm? :)

if the PC has true seeing or, in this case, see invis, does the cutscene stuff still show up when they hit tab, as "name/uninjured"? if it does another option might be to make a 'statue' NPC.

anyways, good luck!

PostPosted: Thu Apr 20, 2006 4:41 pm
Author: girlysprite
Cut scene invisible can not be detected in any way. Name also doesnt show up. Sounds that an npc emits, like twinkeling from a pixie, can be heard. Also, if the npc is hostile, it will attack, and the invi wont wear off.

Hm, maybe I should indeed apply as builder for avlis.

PostPosted: Thu Apr 20, 2006 4:53 pm
Author: Papainhell
You could use an invisable object as well, no need to mess with a creature.

PostPosted: Thu Apr 20, 2006 4:58 pm
Author: PsiOmega
But placeables lack the OnPercieve and OnConversation events.
Using OnUserDefined somehow?

PostPosted: Thu Apr 20, 2006 8:26 pm
Author: girlysprite
It is possible, but this way was easier for me.

PostPosted: Thu Apr 20, 2006 9:20 pm
Author: Krator
Papainhell wrote:You could use an invisable object as well, no need to mess with a creature.

If it was anyone else who said this I'd say "No, you can't."

But now I'm curious. Could you give an example code?

PostPosted: Fri Apr 21, 2006 7:14 am
Author: Sindol
The library is your friend:
(Apologies to those folks that don't have access. The Avlis library is only available for team members and subcontractors, apply if you are interested.)