error message when using code in b4 fade in (SOLVED)

Started by left, Sat 09/04/2005 20:49:24

Previous topic - Next topic

left

i am using some code in my game which switches the view of the room the charater is in, i am doing this using regions and global variables in the before fade in section

it works fine but when i quit the game  messages appear telling me to put the code (which is based on move character and set global int) into the after fade in section becuase i am calling a wait function.

I think i understand why this code should go in the after fade in section but:
the problem is that when i do this the game crashes, i have also tried the when player enters screen section but to no avail.

is it a big deal leaving my code in the before fade in section

code example:
if (GetGlobalInt(1) == 1) { //if the player has come from room 5
 
character[EGO].x=(191);
character[EGO].y=(127);

MoveToWalkableArea(EGO);
MoveCharacterBlocking(EGO, 197, 161, 1);

}
else {
character[EGO].x=(153);
character[EGO].y=(190);
}
 
 

FrogMarch

I guess you want your character to be walking as the screen fades in. Why not just put the 'MoveCharacterBlocking(EGO, 197, 161, 1);' bit in the after fade in section?

Also, is it absolutely necessary that the move character code has to be blocking? This is what is causing the problem, I think, in the before fade in section, as it is a wait function. If it can be avoided, try using MoveCharacter(EGO, 197, 161);' instead.

strazer_away

#2
Try this:

Code: ags

// script for room: Player enters screen (before fadein)

if (character[GetPlayerCharacter()].prevroom == 5) { //if the player has come from room 5
 
  character[EGO].x = 191;
  character[EGO].y = 127;

  MoveToWalkableArea(EGO);

}
else {
  character[EGO].x = 153;
  character[EGO].y = 190;
}


Code: ags

// script for room: Player enters screen (after fadein)

if (character[GetPlayerCharacter()].prevroom == 5) {
  MoveCharacterBlocking(EGO, 197, 161, 1);
}


Edit: previousroom -> prevroom

left

this works thank you


however the code as it is does not work: previousroom must be spelt prevroom for it to work. In fact i just cut that code down to (character[EGO].prevroom == 5);

thanks

strazer

#4
Yeah, sorry, I didn't have AGS or the manual handy. The property is called "PreviousRoom" in AGS v2.7.

And I used GetPlayerCharacter() because not in all games the player character is named EGO.

Anyway, glad I could help.

SMF spam blocked by CleanTalk