OK, in my game there's a job where you're a janitor. Each night you use the key to get in, then theres dirt and crap on the floor you have to sweep up. Then you use the broom and stuff to clean it. How to I make it so the dirt and crap only appears @ night?
Once again you have to use variables...
First you declare this variable on top of your script:
int isnight;
Now you initialise it in your game_start ( ) function like this:
isnight = 0;
Now whenever you change from being night to day you change the variable using:
isnight = 1;
or:
isnight = 0;
And then you go to "On Player enters screen" of the room with the dirt and crap and write:
ObjectOff ( DIRT );
ObjectOff ( CRAP );
if ( isnight == 1 )
{
Ã, Ã, ObjectOn ( DIRT );
Ã, Ã, ObjectOn ( CRAP );
}
That only shows the dirt and crap when it is night...
Ask if you have further questions or look it up in the manual!
Global variables don't have to be initialized, they are automatically initialized to 0.
If you need another starting value, you can initialize it when defining it:
// global script
int isnight = 1;
To be able to access a variable defined in the global script in room scripts, you have to export it first, then import it in either the global script header (for all rooms) or just the room script of the room where you need it:
// global script
int isnight;
export isnight;
Then
// main script header
import int isnight;
or
// room script
import int isnight;