The basic problem: I'm trying to make a game that imitates real time, with certain events only happening at specific times, but dialogue always makes it crash.
I've got the game keeping track of time using a counter that's in the global script, under repeatedly_execute, like so:
Code: ags
It works pretty well so far, but now I'm trying to have an NPC enter a room at a specific time (which works), and then say something (which doesn't). The problem is that dialogue is a blocking event, and it's making the whole game crash if I put the command to have the NPC speak under repeatedly_execute_always, but if I put it under repeatedly_execute, it just seems to skip over the command entirely.
I've read through the description of the Display command and a few other questions on the forums, so I know there's no non-blocking version of Display, but is there some kind of work-around I can use? IIRC, I'm pretty sure at least one adventure game I've played had text pop up to indicate sounds effects without interrupting the gameplay... Any suggestions?
I've got the game keeping track of time using a counter that's in the global script, under repeatedly_execute, like so:
Seconds++;
if(Seconds == 100){
OneMinutes++;
Seconds = 0;
}
if(OneMinutes == 10){
TenMinutes++;
OneMinutes = 0;
}
if(TenMinutes == 6){
Hours++;
TenMinutes = 0;
}
// If you're curious, the OneMinutes/TenMinutes thing (rather than just Minutes) was so that
// the time displays correctly if the player checks a clock
if(Hours == 12){
if(AnteMeridian == false){
Seconds = 0;
TenMinutes = 0;
OneMinutes = 0;
Hours = 7;
AnteMeridian = true;
PartOfDay = "AM";
NewDay = true;
DayCount++;
}
else{
PartOfDay = "PM";
}
}
if(Hours == 13){
if(AnteMeridian == true){
Seconds = 0;
TenMinutes = 0;
OneMinutes = 0;
Hours = 1;
AnteMeridian = false;
}
}
It works pretty well so far, but now I'm trying to have an NPC enter a room at a specific time (which works), and then say something (which doesn't). The problem is that dialogue is a blocking event, and it's making the whole game crash if I put the command to have the NPC speak under repeatedly_execute_always, but if I put it under repeatedly_execute, it just seems to skip over the command entirely.
I've read through the description of the Display command and a few other questions on the forums, so I know there's no non-blocking version of Display, but is there some kind of work-around I can use? IIRC, I'm pretty sure at least one adventure game I've played had text pop up to indicate sounds effects without interrupting the gameplay... Any suggestions?