generated from Jaysyn/ModuleTemplate
55 lines
1.5 KiB
Plaintext
55 lines
1.5 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Trigger Enter Event
|
|
//:: FileName l404_trig_speech
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
Speech trigger script causes the object pointed to in the tag to speak the text
|
|
in the name field of the trigger. To have the entering PC speak, use "speak_PC"
|
|
as the tag.
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By:Red Golem
|
|
//:://////////////////////////////////////////////
|
|
|
|
void reenableTriggerSpeak(object target);
|
|
|
|
void reenableTriggerSpeak(object target)
|
|
{
|
|
if (GetIsObjectValid(target))
|
|
{
|
|
SetLocalInt(target, "TRIGGER_SPEAK_DISABLED", 0);
|
|
}
|
|
}
|
|
void main()
|
|
{
|
|
object oMod = GetModule();
|
|
object oArea = GetArea(OBJECT_SELF);
|
|
|
|
object oEntering = GetEnteringObject();
|
|
string myTag = GetTag(OBJECT_SELF);
|
|
string myName = GetName(OBJECT_SELF);
|
|
|
|
if (GetIsPC(oEntering) && !GetIsDM(oEntering))
|
|
{
|
|
string targetTag = GetStringRight(myTag, (GetStringLength(myTag)-6));
|
|
object target;
|
|
|
|
if (targetTag == "PC")
|
|
{
|
|
target = oEntering;
|
|
}
|
|
else
|
|
{
|
|
target = GetNearestObjectByTag(targetTag);
|
|
}
|
|
|
|
if (GetIsObjectValid(target) && !GetIsInCombat(target) && !IsInConversation(target) && !GetLocalInt(target, "TRIGGER_SPEAK_DISABLED"))
|
|
{
|
|
AssignCommand(target, SpeakString(myName));
|
|
SetLocalInt(target, "TRIGGER_SPEAK_DISABLED", 1);
|
|
AssignCommand(target, DelayCommand(6.0f, reenableTriggerSpeak(target)));
|
|
}
|
|
}
|
|
}
|
|
|