three condition

Started by Flyman, Sun 04/03/2012 22:11:54

Previous topic - Next topic

Flyman

He I've created this situation, with e conditions:

1: can't go in the second room
2: go second room
3: display a help message in the room!!

I've set the tree global variable, but the code work not properly, work only for the 1 and the 2 condition...why?
my code:

function hHotspot5_AnyClick()
{
if (UsedAction (A_WALK_TO)) {
  if (MovePlayer (578, 40)) {
    FaceDirection (GetPlayerCharacter(), DIR_UP);
    Wait(5);
    if (d_1event){
    DisplaySpeech (GetPlayerCharacter (), "I'can't go room 2.");
    }
else if ((_2event)){   
  EnterRoom (36, 97, 126, DIR_LEFT);
    }
   
   else {
int xpos = 420; int ypos = 25;
while (xpos > 25) {
  SetViewport(xpos, ypos);
  Wait(1);
  xpos -= 90;
}
Wait(15);
cMichael.SayAt(40, 50, 100, "help!");
Wait(15);
ReleaseViewport();
Wait(20);
FaceDirection (GetPlayerCharacter(), DIR_DOWN);
    }
  }
}
}

Khris

Code: ags

function hHotspot5_AnyClick() {
  if (UsedAction (A_WALK_TO)) {
    if (MovePlayer (578, 40)) {
      FaceDirection (GetPlayerCharacter(), DIR_UP);
      Wait(5);
      if (d_1event) {
        DisplaySpeech (GetPlayerCharacter (), "I can't go to room 2.");
      }
      else if ((_2event)) {   
        EnterRoom (36, 97, 126, DIR_LEFT);
      }
      else {
        int xpos = 420; int ypos = 25;
        while (xpos > 25) {
          SetViewport(xpos, ypos);
          Wait(1);
          xpos -= 90;
        }
        Wait(15);
        cMichael.SayAt(40, 50, 100, "help!");
        Wait(15);
        ReleaseViewport();
        Wait(20);
        FaceDirection (GetPlayerCharacter(), DIR_DOWN);
      }
    }
  }
}


The third part is only executed if both d_1event and _2event are false/0.
We don't see where or when you are changing those, so there's not much we can do to help at this point.

Flyman

Solved, an little error  8)

SMF spam blocked by CleanTalk