I had a weird problem when testing some things just now. I oftentimes use scripts on the OnClientEnter of an area. I’ve never had any issues with this before, but now I had some odd and worrying things happen, which made me doubt my own understanding of how the OnClientEnter of an area actually works…
This script ran the first time I entered the area but NOT the second time for some reason.
My understanding, which I now think is not right, is that the OnClientEnter only runs if the PC enters the area, but the OnEnter of an area runs everytime something enters? Is that correct. Anyhow, here’s my script:
void CheckArea()
{
object oPC = GetFirstPC();
object oArea = GetObjectByTag("Island");
object oCasper = GetObjectByTag("casper");
if(GetArea(oCasper) == oArea)
{
SetLocalInt(OBJECT_SELF,"Done",1);
SetCutsceneMode(oPC);
AssignCommand(oCasper, ActionStartConversation(oPC, "c_casper", FALSE, FALSE, TRUE, FALSE));
}
}
void main()
{
object oPC = GetEnteringObject();
if(!GetIsPC(oPC)) return;
SendMessageToPC(oPC,"The script is found and runs.");
if(GetLocalInt(OBJECT_SELF,"Done")) return;
DelayCommand(0.3,CheckArea());
}
EDIT: To Clarify: When testing this the object oCasper wasn’t in the area, so that bit of code was never run. Also, when switching to using this on the OnEnter of the area, it worked both times I when I entered, and then reentered the area (by going to another area and then coming back). By the way, this script is in my campaign folder, if that has anything to do with it.