detecting what a pc says

Moderator: Event DM

Post Reply
User avatar
girlysprite
Elder Sage
Posts: 3659
Joined: Mon Apr 12, 2004 2:38 pm
Location: In my little pony ranch
Contact:

detecting what a pc says

Post by girlysprite » Thu Apr 20, 2006 10:14 am

another scripting issue

Can I detect when a pc says 'I disbelieve'. Not in a conversation, but when the player types it.
Gaming doesn't make people voilent, lag does

<Dimotane> I think deep down, when we're honest with ourselves... we're all a pregnant male elf.
User avatar
scratch
Lord of Blithering Idiots
Posts: 127
Joined: Sun Nov 14, 2004 2:39 pm
Contact:

Post by scratch » Thu Apr 20, 2006 12:17 pm

So you are asking if a PC says a specific phrase, activate a script or such?
User avatar
PsiOmega
Team Member; Retired with Honors
Posts: 4886
Joined: Tue Jun 08, 2004 4:55 pm
Timezone: GMT+1/+2 (DST)
Location: Sweden

Post by PsiOmega » Thu Apr 20, 2006 12:39 pm

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.
User avatar
girlysprite
Elder Sage
Posts: 3659
Joined: Mon Apr 12, 2004 2:38 pm
Location: In my little pony ranch
Contact:

Post by girlysprite » Thu Apr 20, 2006 1:05 pm

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

   SetListening(OBJECT_SELF,TRUE);
    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.
Gaming doesn't make people voilent, lag does

<Dimotane> I think deep down, when we're honest with ourselves... we're all a pregnant male elf.
User avatar
Tigg
Elder Sage
Posts: 3486
Joined: Wed Feb 09, 2005 11:18 pm
Location: Into the sunset/Hyboria

Post by Tigg » Thu Apr 20, 2006 4:36 pm

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!
Ua mau ke ea o ka ina i ka pono.
User avatar
girlysprite
Elder Sage
Posts: 3659
Joined: Mon Apr 12, 2004 2:38 pm
Location: In my little pony ranch
Contact:

Post by girlysprite » Thu Apr 20, 2006 4:41 pm

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.
Gaming doesn't make people voilent, lag does

<Dimotane> I think deep down, when we're honest with ourselves... we're all a pregnant male elf.
User avatar
Papainhell
Sage
Posts: 2138
Joined: Wed Oct 01, 2003 1:09 am
Timezone: Time?
Location: Kodiak, Alaska (for now)
Contact:

Post by Papainhell » Thu Apr 20, 2006 4:53 pm

You could use an invisable object as well, no need to mess with a creature.
Image
Playing as:
Master Odel Helmsplitter
Odel Helmsplitter- Hammer Fist Stylist, monk of The Order of The Dragon.
User avatar
PsiOmega
Team Member; Retired with Honors
Posts: 4886
Joined: Tue Jun 08, 2004 4:55 pm
Timezone: GMT+1/+2 (DST)
Location: Sweden

Post by PsiOmega » Thu Apr 20, 2006 4:58 pm

But placeables lack the OnPercieve and OnConversation events.
Using OnUserDefined somehow?
User avatar
girlysprite
Elder Sage
Posts: 3659
Joined: Mon Apr 12, 2004 2:38 pm
Location: In my little pony ranch
Contact:

Post by girlysprite » Thu Apr 20, 2006 8:26 pm

It is possible, but this way was easier for me.
Gaming doesn't make people voilent, lag does

<Dimotane> I think deep down, when we're honest with ourselves... we're all a pregnant male elf.
User avatar
Krator
Elder Sage
Posts: 4935
Joined: Thu Jun 10, 2004 6:44 pm
Timezone: GMT
Location: Amsterdam

Post by Krator » Thu Apr 20, 2006 9:20 pm

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?
User avatar
Sindol
Team Member; Retired with Honors
Posts: 6479
Joined: Mon Jan 06, 2003 4:23 pm
Location: Nijmegen - Netherlands (GMT+1)
Contact:

Post by Sindol » Fri Apr 21, 2006 7:14 am

The library is your friend: http://www.avlis.org/viewtopic.php?t=18686.
(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.)
So much fun,
yet so little time to enjoy it.
- Sindol
Post Reply