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);
}
}
}
}
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.
Solved, an little error 8)