Help with area transition script

The situation is this - there is an area in the module known as “The Hills” where a secret bandit camp is hidden. But I don’t want the PC to be able to go into the Hills until he learns that is where the bandit camp is. Otherwise he could just prematurely stumble upon the camp. So for the area transition trigger for the Hills I put this script in OnClick:

void main()
{
    object oPC = GetClickingObject();
  object oTarget = GetTransitionTarget(OBJECT_SELF);
  object oWay = GetObjectByTag("WPHills");
  location lLoc = GetLocation(oTarget);
   if(!(GetLocalInt(oPC, "bandit") == 2))

    AssignCommand(oPC,ActionJumpToObject(oWay));
     else
    AssignCommand( oPC, SpeakString( "This path leads back up into the Hills.  It is best to not start wandering around up there unless you know where you are going." ) );

}

If it worked the way I wanted to the PC should get the text about not wandering around when they click on the trigger without knowing about the bandit camp. Once they have the conversation about the bandit camp (and the LocalInt of “bandit” now equals 2) then they can jump to the hills.

But as it is now the PC always jumps to the Hills no matter what the condition. Any help to get it to work right would be appreciated.

As it stands, the transition occurs if the local int is NOT 2.

If you remove the ! it should work.

1 Like

Also, unless you want the PC to forget where the camp is after you might use

GetLocalInt(oPC, "bandit") >= 2
1 Like

As it looks, nobody or nothing ELSE can use this Area Transition (after Prolerics correction)

In most cases it’s not neccessary to take care of anybody else, but sometimes it is.
And you should decide, if you want to use the waypoint or the transition target.

So, how’s about that?:

void main()
{
  object oPC = GetClickingObject();
  object oTarget = GetTransitionTarget(OBJECT_SELF);

  if (GetIsPC (oPC) && GetLocalInt (oPC, "bandit") != 2)
    {
      AssignCommand( oPC, SpeakString("This path leads back up into the Hills. I don't like hills!!!"));
      return;
    }

  AssignCommand(oPC,ActionJumpToObject(oTarget));
}
1 Like

That did it. I had a feeling it was just some small, simple detail I was overlooking. Thanks so much! :grinning:

Thanks for the advice meaglyn and Mmat. It really isn’t necessary in this particular situation. But who knows - it might be needed in a future module. Or another module builder might be looking for the something similar.

Thanks