Stage Timer is too long

Aerisetta

Active member
Hi, I recently turned on timer in my game

settime 30
notime 0

However, the timer is ticking once every 2 real world seconds instead of once every 1 real world second as I expected. Is there a way to alter this?
 
Last edited:
I don't know a way to change the native one, but you can draw a custom game timer with the real value.

C:
void main()
{
    float hRes        = openborvariant("hresolution");
    float vRes        = openborvariant("vresolution");
    float time        = openborvariant("game_time");
    float seconds    = 200;
    float time        = openborvariant("game_time")/seconds;
    int font        = 1;
    int xPos        = (hRes-strwidth(""+time, font))/2; //MAINTAIN ALWAYS CENTRALIZED ON THE SCREEN
    int yPos        = 180; //BASE Y POSITION
    int layer        = 10001; //BASE Z LAYER
    
    //DRAW CLOCK
    drawstring(xPos, yPos, font, time, layer);
}

 
Set the settime value to 0 so there won't be that time running. Otherwise, you can take a look at Street Fighter 89 The Final Fight for the timer reference.

If not, then you can try something similar to Bloodbane's delay trick. But what I did was that I copied a script based on the delay entity and created its health point with drawstring to display it like it's a timer in ondrawcript. I'm only showing you some partially useful ones, but for changing to specific animation, use your imagination, or let someone here in this community to help how you want the "timer" to act.

C:
name        RefPlays
type        none
health        60
animationscript    data/scripts/wasitS.c
ondrawscript data/scripts/playerwin.c
load WinLose2
load Announce
#diesound data/sounds/SND_COM2_8.wav

anim    spawn
@script
  if(frame==1 && openborvariant("count_players")==1){ // Player vs enemy
    void P1 = getplayerproperty(0, "entity");
    void P2 = getplayerproperty(1, "entity");

    if(P1){
      setglobalvar("F1", P1);
    } else if(P2){
      setglobalvar("F2", P2);
    }
  }

  if(frame>=1 && openborvariant("count_players")==2){ // Player vs player
    void P1 = getplayerproperty(0, "entity");
    void P2 = getplayerproperty(1, "entity");

    if(P1 && P2){
      void self = getlocalvar("self");
      setglobalvar("F1", P1);
      setglobalvar("F2", P2);

      changeentityproperty(P2, "direction", 0);
      //setidle(self, openborconstant("ANI_IDLE"));
    }
  }

  if(frame == 3){
    void self = getlocalvar("self");
    setidle(self, openborconstant("ANI_IDLE"));
  }
@end_script
    delay    2
    offset    1 1
    frame    data/chars/misc/empty.gif # 0 - 2
    frame    data/chars/misc/empty.gif # 1 - 4
    delay    459
    frame    data/chars/misc/empty.gif # 2 - 463
    frame    data/chars/misc/empty.gif # 3 - change to idle quickly if script is set

anim    idle
@script
void self = getlocalvar("self");
int Health = getentityproperty(self, "health");
int P1 = getplayerproperty(0, "entity");
int P2 = getplayerproperty(1, "entity");
int T1 = findtarget(P1);
int T2 = findtarget(P2);

int HP1 = getentityproperty(P1, "health");
int HP2 = getentityproperty(P2, "health");
int THP1 = getentityproperty(T1, "health");
int THP2 = getentityproperty(T2, "health");


int index = getlocalvar("player");
void player = getplayerproperty(index, "entity");
void pBase = getentityproperty(player, "base");
int Py = getentityproperty(player, "y");
void target = findtarget(player);
void tBase = getentityproperty(target, "base");
void Ty = getentityproperty(target, "y");

  if(frame==1){
    void self = getlocalvar("self");
    int Habis = Desid();

    if(Habis>=1){
      performattack(self, openborconstant("ANI_FOLLOW1"));
    }
  }

  if(frame == 4){
    changeentityproperty(self, "health", Health-1);
    int Habis2 = Desid();

    if(Health <= 0){
    performattack(self, openborconstant("ANI_DIE"));
    }
  }

  if(frame >= 5){
    if(Health <= 0 && pBase == Py && tBase == Ty){
    performattack(self, openborconstant("ANI_DIE"));
    }
  }
@end_script
    loop    1 #1
    delay    2
    offset    1 1
    frame    data/chars/misc/empty.gif #0
    frame    data/chars/misc/empty.gif #1
    frame    data/chars/misc/empty.gif #2
    frame    data/chars/misc/empty.gif #3
    delay    5 #105
    #delay    1
    frame    data/chars/misc/empty.gif #4 - 5
    frame    data/chars/misc/empty.gif # 5 - 10
    frame    data/chars/misc/empty.gif
    frame    data/chars/misc/empty.gif
    frame    data/chars/misc/empty.gif
    frame    data/chars/misc/empty.gif
    frame    data/chars/misc/empty.gif
    frame    data/chars/misc/empty.gif
    frame    data/chars/misc/empty.gif
    frame    data/chars/misc/empty.gif
    frame    data/chars/misc/empty.gif
    frame    data/chars/misc/empty.gif
    frame    data/chars/misc/empty.gif
    frame    data/chars/misc/empty.gif
    frame    data/chars/misc/empty.gif
    frame    data/chars/misc/empty.gif
    frame    data/chars/misc/empty.gif
    frame    data/chars/misc/empty.gif
    frame    data/chars/misc/empty.gif
    frame    data/chars/misc/empty.gif
    frame    data/chars/misc/empty.gif

In level:
Code:
spawn RefPlays 1
health 10
coords 160 200
at 0

playerwin.c: (for displaying level timer)
C:
void main(){
    //RoundCount();
    levelTimer();
}

void levelTimer(){
// Timer display
    void self = getlocalvar("self");
    int hp = getentityproperty(self, "health");
    void ani = getentityproperty(self, "animationid");
    void branch = openborvariant("current_branch");
    //void sprite = loadsprite("data/sprites/versus.png");
 
    if(ani == openborconstant("ANI_FOLLOW3") && hp > 0 ){
        changeentityproperty(self, "health", 0);
        //drawstring(153,7,6,"00");
    }
 
    //Referee health as timer
    if(hp>=130){
        drawstring(153,7,6,hp);
    }else if(hp>=122 && hp < 130){
        drawstring(153,7,6,hp);
    }else if(hp==121){
        drawstring(155,7,6,hp);
    }else if(hp==120){
        drawstring(153,7,6,hp);
    }else if(hp >= 112 && hp < 120){
        drawstring(155,7,6,hp);
    }else if(hp == 111){
        drawstring(157,7,6,hp);
    }else if(hp == 110){
        drawstring(155,7,6,hp);
    }else if(hp>=100 && hp < 110){
        drawstring(153,7,6,hp);
    }else if(hp<100 && hp>= 20){
        drawstring(155,7,6,hp);
    }else if(hp<20 && hp>=10){
        drawstring(157,7,6,hp);
    }else if(hp<10){
        drawstring(155,7,6,"0"+hp);
    }

}

Starting from 6:20:

For mine, when it comes to time out, it's set to anim death.

Also, you can make it as an NPC for joining you. Battle music here in Devil May Cry style, but for this question, maybe you don't need music since you want that entity to act as a timer when it goes along with you.
 
Last edited:
Back
Top Bottom