Issued with timed waypoints

Started by Glenjamin, Tue 15/01/2019 18:05:01

Previous topic - Next topic

Glenjamin

With my game's day/night cycle, characters move based on the time of day, and their current coordinates.

A timer starts at game_start, and when it expires, one in game minute is added. After 20 minutes, the hour increases and the minutes reset.

I've calculated that characters can move 58 pixels per minute rounded down with a standard movespeed of 3.

If a character needs to move vertically and horizontally, I'll split the 58, moving them 29 pixels along each axis.

This is what a standard movement looks like:
Code: ags

//NOON
   } if (WorldTime == 24){
         
        if (WorldMins == 1){
        
       if ((player.Room == cgranny.Room) && (cgranny.x == 1090)) {
              cgranny.AddWaypoint(1148, 124);
             }else if (player.Room != cgranny.Room){
                cgranny.x = 1148;
                cgranny.y = 124;
                } 
                
        }else if (WorldMins == 2){
        
       if ((player.Room == cgranny.Room) && (cgranny.x == 1148)){
              cgranny.AddWaypoint(1206, 124);
             }else if (player.Room != cgranny.Room){
                cgranny.x = 1206;
                cgranny.y = 124;
                } 
//this continues until WorldMins = 20
   }



Occasionally characters do not move to the specified coordinates.  For example instead of cgranny.AddWaypoint(1206), they move to 1207 or 1205.

Sometimes they'll walk somewhere completely different to a coordinate that appears nowhere in the entire project, no less the specific script.

I can't find any correlation between each instance of these errors.

Any help is greatly appreciated, thanks in advance.

SMF spam blocked by CleanTalk