Page 1 of 1
detecting what a pc says
Posted: Thu Apr 20, 2006 10:14 am
by girlysprite
another scripting issue
Can I detect when a pc says 'I disbelieve'. Not in a conversation, but when the player types it.
Posted: Thu Apr 20, 2006 12:17 pm
by scratch
So you are asking if a PC says a specific phrase, activate a script or such?
Posted: Thu Apr 20, 2006 12:39 pm
by 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.
Posted: Thu Apr 20, 2006 1:05 pm
by 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
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.
Posted: Thu Apr 20, 2006 4:36 pm
by 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!
Posted: Thu Apr 20, 2006 4:41 pm
by 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.
Posted: Thu Apr 20, 2006 4:53 pm
by Papainhell
You could use an invisable object as well, no need to mess with a creature.
Posted: Thu Apr 20, 2006 4:58 pm
by PsiOmega
But placeables lack the OnPercieve and OnConversation events.
Using OnUserDefined somehow?
Posted: Thu Apr 20, 2006 8:26 pm
by girlysprite
It is possible, but this way was easier for me.
Posted: Thu Apr 20, 2006 9:20 pm
by 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?
Posted: Fri Apr 21, 2006 7:14 am
by Sindol
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.)