So, as I’m working on my new sci fi themed module I have a situation where a robot enters a trigger, says a line, there’s a sound, and then it attacks the party. I have two triggers for this to make sure this situation happens.
Now, here’s the odd thing. If the robot enters its trigger, everything works exactly Iike I intended. However, if the PC enters the other trigger, everything happens as it should EXCEPT the robot doesn’t say its line. Why is that? Here are the two scripts. First the one with the robot entering his trigger, and the second is where the line isn’t spoken, where the PC enters another trigger:
#include "ginc_actions"
//In this script everything works as it's intended
void main()
{
object oEnter = GetEnteringObject();
object oRobot = GetObjectByTag("l_robot");
object oPC = GetFirstPC();
object oDoor = GetObjectByTag("doorprroom");
if(!GetGlobalInt("freefromprison")) return;
if(IsInConversation(oPC)) return;
if(oEnter!=oRobot) return;
if(GetGlobalInt("DoneDroid")) return;
SetGlobalInt("DoneDroid",1);
SetLocked(oDoor,FALSE);
object oIP = CreateObject(OBJECT_TYPE_PLACEABLE, "plc_ipoint ", GetLocation(oPC));
// do not remove this space ^
string sWave = "robotvoice"; // <--- sound file name
DelayCommand(0.2f, AssignCommand(oIP, PlaySound(sWave, TRUE)));
SetPlotFlag(oIP, FALSE);
DestroyObject(oIP, 0.3f);
AssignCommand(oRobot,SpeakString("Alert! Prisoners escaping!"));
DelayCommand(0.5, AssignCommand(oPC,SpeakString("Appears the hacking didn't last very long.")));
StandardAttack(oRobot, oPC);
}
#include "ginc_actions"
//In this script the line with AssignCommand(oRobot,SpeakString("Alert! Prisoners escaping!")); doesn't happen
void main()
{
object oEnter = GetEnteringObject();
object oRobot = GetObjectByTag("l_robot");
object oPC = GetFirstPC();
object oDoor = GetObjectByTag("doorprroom");
if(!GetGlobalInt("freefromprison")) return;
if(IsInConversation(oPC)) return;
if(oEnter!=oPC) return;
if(GetGlobalInt("DoneDroid")) return;
SetGlobalInt("DoneDroid",1);
SetLocked(oDoor,FALSE);
object oIP = CreateObject(OBJECT_TYPE_PLACEABLE, "plc_ipoint ", GetLocation(oPC));
// do not remove this space ^
string sWave = "robotvoice"; // <--- sound file name
DelayCommand(0.2f, AssignCommand(oIP, PlaySound(sWave, TRUE)));
SetPlotFlag(oIP, FALSE);
DestroyObject(oIP, 0.3f);
AssignCommand(oRobot,SpeakString("Alert! Prisoners escaping!"));
DelayCommand(0.5, AssignCommand(oPC,SpeakString("Appears the hacking didn't last very long.")));
StandardAttack(oRobot, oPC);
}