Calling for trigger

Moderator: Event DM

Post Reply
GreyLynx
Elder Sage
Posts: 3254
Joined: Sun Mar 23, 2003 3:56 pm
Timezone: EDT (GMT-5)
Location: Ithaca, NY (GMT-5)
Contact:

Calling for trigger

Post by GreyLynx » Sun Mar 21, 2004 4:58 am

I was looking to have several triggers in an area that call up floaty text when entered. Is it possible to have a single script that can handle all of them? Basically, what I am asking is whether there is anything like
GetTriggerEntered or anything along those lines. I couldn't find one, but I thought more experienced folks might know better.
Thanks.
User avatar
Mistcaller
Team Member; Retired with Honors
Posts: 5477
Joined: Sun Feb 09, 2003 3:42 pm
Location: Athens, Greece (GMT +2)

Post by Mistcaller » Sun Mar 21, 2004 12:08 pm

GetEnteringObject() is used most often. What you could do is something like that:

Code: Select all

object oPC = GetEnteringObject();
if (GetIsPC(oPC))
      FloatingTextStringOnCreature(OBJECT_SELF, " blah blah");
If FloatingText doesnt work, you can use SendMessageToPC or SpeakString..
GreyLynx
Elder Sage
Posts: 3254
Joined: Sun Mar 23, 2003 3:56 pm
Timezone: EDT (GMT-5)
Location: Ithaca, NY (GMT-5)
Contact:

Post by GreyLynx » Sun Mar 21, 2004 5:37 pm

Ah, thanks, but actually I wanted to indentify the trigger, not the entering object. I have several triggers, and I wanted each trigger to generate a different message. Right now, I have each trigger assigned a different script for their OnEnter, but I was wondering if there was a way to allow all the triggers to refer to a single script, and have that script figure out which trigger has just called it and return the appropriate text.
User avatar
JollyOrc
Elder Sage
Posts: 3984
Joined: Fri Jan 17, 2003 11:41 am
Timezone: Europe, CE(S)T
Location: Germany
Contact:

Post by JollyOrc » Sun Mar 21, 2004 5:51 pm

how about this one ?

Works like a charm, and may be already life at the Server of your choice..

Code: Select all

//////////////////////////////////////////////////////
// Script name: onent_atmosphere
//////////////////////////////////////////////////////
// This script sends a message to PC's.  I
// generally use it to provide atmosphere.
// The script should be placed in the onenter of a
// generic trigger.  Place the message you wish the
// trigger to pass to the player in the Name field of
// the trigger.  This seems to cater for an indefinate
// number of characters.
// To record that the PC has received the message
// the script sets a local integer (assigned name of
// the trigger tag).  This means the PC only receives
// the message the first time they enter the trigger.
//////////////////////////////////////////////////////
// Created by Vicky Radcliffe for Avlis
// Date: 22 Nov 2003
//////////////////////////////////////////////////////
// Modified by
// Date:
//////////////////////////////////////////////////////
// Changes Made:
//
//////////////////////////////////////////////////////

void main()
{
object oPC = GetEnteringObject();
string sAtmosphereMessage = GetName(OBJECT_SELF);
string sAtmosphereTag = GetTag(OBJECT_SELF);

if (GetIsPC(oPC) && GetLocalInt(oPC,sAtmosphereTag)==0)
    {
    SendMessageToPC(oPC,sAtmosphereMessage);
    SetLocalInt(oPC, sAtmosphereTag, 1);
    }
}
GreyLynx
Elder Sage
Posts: 3254
Joined: Sun Mar 23, 2003 3:56 pm
Timezone: EDT (GMT-5)
Location: Ithaca, NY (GMT-5)
Contact:

Post by GreyLynx » Sun Mar 21, 2004 6:01 pm

Hey, thanks. I'll try that one out!
GreyLynx
Elder Sage
Posts: 3254
Joined: Sun Mar 23, 2003 3:56 pm
Timezone: EDT (GMT-5)
Location: Ithaca, NY (GMT-5)
Contact:

Post by GreyLynx » Sat Mar 27, 2004 5:11 pm

JollyOrc wrote:how about this one ?

Works like a charm, and may be already life at the Server of your choice..

Code: Select all

//////////////////////////////////////////////////////
// Script name: onent_atmosphere
//////////////////////////////////////////////////////
// This script sends a message to PC's.  I
// generally use it to provide atmosphere.
// The script should be placed in the onenter of a
// generic trigger.  Place the message you wish the
// trigger to pass to the player in the Name field of
// the trigger.  This seems to cater for an indefinate
// number of characters.
// To record that the PC has received the message
// the script sets a local integer (assigned name of
// the trigger tag).  This means the PC only receives
// the message the first time they enter the trigger.
//////////////////////////////////////////////////////
// Created by Vicky Radcliffe for Avlis
// Date: 22 Nov 2003
//////////////////////////////////////////////////////
// Modified by
// Date:
//////////////////////////////////////////////////////
// Changes Made:
//
//////////////////////////////////////////////////////

void main()
{
object oPC = GetEnteringObject();
string sAtmosphereMessage = GetName(OBJECT_SELF);
string sAtmosphereTag = GetTag(OBJECT_SELF);

if (GetIsPC(oPC) && GetLocalInt(oPC,sAtmosphereTag)==0)
    {
    SendMessageToPC(oPC,sAtmosphereMessage);
    SetLocalInt(oPC, sAtmosphereTag, 1);
    }
}
Does anyone know if the equivalent script using FloatingTextStringOnCreature instead of SendMessageToPC is already live on the Le'Or server?

Thanks.
Post Reply