Announcing Call in Referee System w/ Engine's Performance

maxman

Well-known member
This is complicating to explain, but this is about improving the referee system for the engine's performance rate and its consistency.

I just got started with the attempt on making a better referee system based on @Bloodbane's Versus template demo (actually, not "demo" as in "incomplete game", but as a demonstration). What I had made before this is/was based on the referee system from D&D Rise of Warduke, but it's mixed with some parts from the Versus template too. I'm having trouble with memory consumption every time it loads to the next scene or reloads its current branch. I have some globalvars which load/draw sprites for a number of victories from each round. I already declared those with characters' death and "lose" animations in script tags. Here's the kind of referee system I'm using but it's for calling existing players in stage.


I made a new main referee entity that spawns each referee entity that represents a present playable entity based on how many players exist in game. One exists when one player is present but kills itself off when two players are present. The other one exists when two players are present but kills itself off when one player is present.

Main referee to be present:
C:
name refereeMain #Arcade mode's referee
type none
animationscript data/scripts/script.c
load referee
load referee2

anim spawn
@script
if(frame == 0){
    int P1 = getplayerproperty(0, "ent");
    int P2 = getplayerproperty(1, "ent");
    int maxHP1 = getentityproperty(P1, "maxhealth");
    int maxHP2 = getentityproperty(P2, "maxhealth");
    changeentityproperty(P1, "health", maxHP1);
    changeentityproperty(P2, "health", maxHP2);
}
@end_script
    offset 1 1
    delay 2
    @cmd spawn01 "referee" 0 0 0
    @cmd spawn01 "referee2" 0 0 0
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    move 100000
    frame data/chars/misc/empty.gif

Here's one referee for a single player being existent, but it needs some work for calling out certain winner.


Is it necessary for me to skip levels after one wins a round or do I need to jump to current branch which I'm using for a number of rounds/victories via levels.txt? For skipping levels, I'm referring to the setup in levels.txt based on the VS template like this.

Code:
set    Player_VS_Enemy
credits    1
lives    1
cansave 0
#disablegameover 1
disablehof 1
# ===== | ===== #
branch    First
z    105 180 105
file    data/levels/PvsE/PvsEi1.txt
z    175 265 175
file    data/levels/PvsE/PvsEh1.txt
z    167 247 167
file    data/levels/PvsE/PvsEf1.txt
z    190 270 190
file    data/levels/PvsE/PvsEg1.txt
z    170 265 170
file    data/levels/PvsE/PvsEc1.txt
z    220 300 220
file    data/levels/PvsE/PvsEe1.txt
z    160 250 160
file    data/levels/PvsE/PvsEb1.txt
z    180 260 180
file    data/levels/PvsE/PvsEd1.txt
z    125 265 125
file    data/levels/PvsE/PvsEa1.txt
# ===== || ===== #
branch    Second
z    167 247 167
file    data/levels/PvsE/PvsEf2.txt
z    190 270 190
file    data/levels/PvsE/PvsEg2.txt
z    170 265 170
file    data/levels/PvsE/PvsEc2.txt
z    220 300 220
file    data/levels/PvsE/PvsEe2.txt
z    180 260 180
file    data/levels/PvsE/PvsEd2.txt
z    125 265 125
file    data/levels/PvsE/PvsEa2.txt
z    105 180 105
file    data/levels/PvsE/PvsEi2.txt
z    175 265 175
file    data/levels/PvsE/PvsEh2.txt
z    160 250 160
file    data/levels/PvsE/PvsEb2.txt

What I mean by jumping to current branch is the setup I have here in levels.txt, which I have to load the same level in the same branch again like (Stage_Ryu branch).

Code:
set    Arcade_Mode # 0
lives 1
credits 10
custfade 300
cansave 0
continuescore 1
disablehof 1
skipselect player1 player2
z    173 230 173
file    data/levels/charatest.txt # level 1
branch Screen_Vs_Eagle
z 200 200 200
file data/levels/1vseagle.txt
branch    Stage_Eagle
z    200 200 200
file    data/levels/eagle.txt

branch Screen_Vs_Ryu
z 200 200 200
file data/levels/1vsryu.txt
branch    Stage_Ryu
z    227 227 227
file    data/levels/ryu_stage.txt

branch Screen_Vs_Ken
z 200 200 200
file data/levels/1vsken.txt
branch    Stage_Ken
z    227 227 227
file    data/levels/ken.txt

branch    Final
z    230 230 230
file    data/levels/final.txt

branch Arcade_Select
z    173 230 173
file    data/levels/charatest.txt
file    data/levels/return.txt

How can I use DifitFind and check if one fighter is defeated after finishing one level?

Is the terminate function from wasit.c for killing off one target of the player? I asked because I would like the referee to kill off the losing player after the winning player proceeds (while two players exist) before moving to the next stage.

C:
void killplayer(int P)
{// Kills defined player and removes their lives and credits
// P : Player index starting from 0
    void Player = getplayerproperty(P, "entity");

    if(Player != NULL()){
      changeplayerproperty(P, "lives", 0);
      changeplayerproperty(P, "credits", 0);
      killentity(Player);
    }
}

void terminate(){
// Terminating defeated fighter

    int index = getlocalvar("player");
    void player = getplayerproperty(index, "entity");
    void enemy = findtarget(player);

    
}

Pay attention to the performance information at the bottom right corner, but because I started to record with Bandicam and it started to increase over 200kb used RAM in its performance rate. I normally have about less than 200kb used RAM before it increases its limit.



What I don't understand in the videos about the engine's performance rate is that the used RAM gets higher than the free RAM.

Is it because of the globalvars I use that cause the RAMs to increase in its performance?
 
I forgot about these for characters' animations of death and time-over. Player and enemy types have different winning results.

C:
anim death
@script
    void self = getlocalvar("self");
    void Return = getglobalvar("Return");
    void Current = openborvariant("current_branch");
    int win1 = getglobalvar("win1");
    int win2 = getglobalvar("win2");
    int PLAY = openborvariant("count_players");
    int P1 = getplayerproperty(0, "entity");
    int P2 = getplayerproperty(1, "entity");

    int set = openborvariant("current_set");
    int draw = getglobalvar("draw");


    if(frame==8  && PLAY == 1  && set == 0){
        if(win1 == 2 || win2 == 2){

            void vSpawn; //Spawn object.
            int XPos = openborvariant("xpos"); //Get screen edge's position
            int YPos = openborvariant("ypos"); // Get camera position
            int Screen = openborvariant("hResolution"); // Get screen width

            void target = getentityproperty(self, "opponent");
            void name = getentityproperty(target, "name");

            clearspawnentry(); //Clear current spawn entry.

            loadmodel("enemywin");
            setspawnentry("name", "enemywin"); //Acquire spawn entity by name.

            vSpawn = spawn(); //Spawn in entity.

            if(name == "Ken"){
                changeentityproperty(vSpawn, "position", 160 + XPos, 120);
                changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL"));
            }else if(name == "Eagle"){
                changeentityproperty(vSpawn, "position", 160 + XPos, 120);
                changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL4"));
            }else{
                changeentityproperty(vSpawn, "position", 160 + XPos, 120);
            }
    setglobalvar("Wait", 1);
    clearglobalvar();
        } else if(win1 == 2 && win2 == 2){
            void vSpawn; //Spawn object.
            int XPos = openborvariant("xpos");
            int YPos = openborvariant("ypos");
            int Screen = openborvariant("hResolution");
            
            loadmodel("CountD");
            setspawnentry("name", "CountD");
            clearspawnentry();
            vSpawn = spawn();
            
            changeentityproperty(vSpawn, "position", 160 + XPos, 120);
            
        } else {
            jumptobranch(Current,1);
        }
    }


    if(frame==8 && PLAY == 2  && set == 0){
      if(win1 == 2 || win2 == 2){
    void vSpawn; //Spawn object.
        int XPos = openborvariant("xpos"); //Get screen edge's position
        int YPos = openborvariant("ypos"); // Get camera position
        int Screen = openborvariant("hResolution"); // Get screen width
        
        void target = findtarget(self); // Calling target.
    void name = getentityproperty(target, "name"); // Calling target's name.

    clearspawnentry(); //Clear current spawn entry.
    loadmodel("victory");
    setspawnentry("name", "victory");

    vSpawn = spawn(); //Spawn in entity.
    
    if(name == "Ken"){
        changeentityproperty(vSpawn, "position", 160 + XPos, 120);
        changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL"));
    }else if(name == "Chun-Li"){
        changeentityproperty(vSpawn, "position", 160 + XPos, 120);
        changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL2"));
    }else if(name == "Zangief"){
        changeentityproperty(vSpawn, "position", 160 + XPos, 120);
        changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL3"));
    }else if(name == "Dhalsim"){
        changeentityproperty(vSpawn, "position", 160 + XPos, 120);
        changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL4"));
    }else if(name == "Guy"){
        changeentityproperty(vSpawn, "position", 160 + XPos, 120);
        changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL5"));
    }else if(name == "Joe"){
        changeentityproperty(vSpawn, "position", 160 + XPos, 120);
        changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL6"));
    }else if(name == "Eagle"){
        changeentityproperty(vSpawn, "position", 160 + XPos, 120);
        changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL7"));
    }else if(name == "Balrog"){
        changeentityproperty(vSpawn, "position", 160 + XPos, 120);
        changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL8"));
    }else if(name == "Bison" || name == "M._Bison"){
        changeentityproperty(vSpawn, "position", 160 + XPos, 120);
        changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL9"));
    }else if(name == "Guile"){
        changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL10"));
    }else if(name == "Vega"){
        changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL11"));
    }else{ // Defaultly switch to Ryu?
        changeentityproperty(vSpawn, "position", 160 + XPos, 120);
    }
    changeentityproperty(vSpawn, "position", 160 + XPos, 120);
    
      setglobalvar("Wait", 1);
      } else {
    jumptobranch(Current,1);
      }
    }


 // ANIM FOLLOW5 FOR SPAWNED MODEL NOT YET DONE
    if(frame==8 && PLAY == 2  && set > 0){
      if(win1 == 2 || win2 == 2){
    void vSpawn; //Spawn object.
        int XPos = openborvariant("xpos"); //Get screen edge's position
        int YPos = openborvariant("ypos"); // Get camera position
        int Screen = openborvariant("hResolution"); // Get screen width

    void target = getentityproperty(self, "opponent");
    void name = getentityproperty(target, "name");

    clearspawnentry(); //Clear current spawn entry.
    loadmodel("darkblue");
    setspawnentry("name", "darkblue"); //Acquire spawn entity by name.

    vSpawn = spawn(); //Spawn in entity.

    changeentityproperty(vSpawn, "position", 160 + XPos, 246 + YPos);
    changeentityproperty(vSpawn, "animation", openborconstant("ANI_FOLLOW5"));
    setglobalvar("Wait", 1);
    clearglobalvar();
      } else {
    jumptobranch(Current,1);
      }
    }

    @end_script
    offset 97 177
    delay 15
    sound data/sounds/fall.wav
    frame data/CHARS/ARyu/fallc02.png
    delay 250
    frame data/CHARS/ARyu/fallc02.png
    delay 10
    frame data/CHARS/ARyu/fallc02.png
    frame data/CHARS/ARyu/fallc02.png
    frame data/CHARS/ARyu/fallc02.png
    frame data/CHARS/ARyu/fallc02.png
    frame data/CHARS/ARyu/fallc02.png
    delay 70
    frame data/CHARS/ARyu/fallc02.png
    delay 2
    frame data/CHARS/ARyu/fallc02.png
    @cmd spawn06map2 "ARyuCont" 91 0 182
    @cmd suicide
    frame data/CHARS/ARyu/fallc02.png

Time-over anim for players:
C:
anim follow15 #YOU LOSE!
@script
    void self = getlocalvar("self");
    void Return = getglobalvar("Return");
    void Current = openborvariant("current_branch");
    int win1 = getglobalvar("win1");
    int win2 = getglobalvar("win2");
    int PLAY = openborvariant("count_players");
    int P1 = getplayerproperty(0, "entity");
    int P2 = getplayerproperty(1, "entity");
    int set = openborvariant("current_set");

    if(frame== 6 && PLAY == 1 && set == 0){
        if((win1 == 2 || win2 == 2) && PLAY == 1){
            void vSpawn; //Spawn object.
            int XPos = openborvariant("xpos"); //Get screen edge's position
            int YPos = openborvariant("ypos"); // Get camera position
            int Screen = openborvariant("hResolution"); // Get screen width

            void target = getentityproperty(self, "opponent");
            void name = getentityproperty(target, "name");

            clearspawnentry(); //Clear current spawn entry.

            loadmodel("enemywin");
            setspawnentry("name", "enemywin"); //Acquire spawn entity by name.

            vSpawn = spawn(); //Spawn in entity.

            if(name == "Ken"){
                changeentityproperty(vSpawn, "position", 160 + XPos, 120);
                changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL"));
            }if(name == "Eagle"){
                changeentityproperty(vSpawn, "position", 160 + XPos, 120);
                changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL4"));
            }else{
                changeentityproperty(vSpawn, "position", 160 + XPos, 120);
            }
            setglobalvar("Wait", 1);
            clearglobalvar();
        } else {
            jumptobranch(Current,1);
        }
    }


        if(frame==6 && PLAY == 2  && set == 0){
      if(win1 == 2 || win2 == 2){
    void vSpawn; //Spawn object.
        int XPos = openborvariant("xpos"); //Get screen edge's position
        int YPos = openborvariant("ypos"); // Get camera position
        int Screen = openborvariant("hResolution"); // Get screen width

    clearspawnentry(); //Clear current spawn entry.
    loadmodel("darkblue");
    setspawnentry("name", "darkblue"); //Acquire spawn entity by name.

    vSpawn = spawn(); //Spawn in entity.

    changeentityproperty(vSpawn, "position", 160 + XPos, 246 + YPos);
    changeentityproperty(vSpawn, "animation", openborconstant("ANI_FOLLOW4"));
      setglobalvar("Wait", 1);
      } else {
    jumptobranch(Current,1);
      }
    }


 // ANIM FOLLOW5 FOR SPAWNED MODEL NOT YET DONE
    if(frame==6 && PLAY == 2  && set > 0){
      if( win1 == 2 || win2 == 2 || (win1 == 2 && win2 == 2) ){
    void vSpawn; //Spawn object.
        int XPos = openborvariant("xpos"); //Get screen edge's position
        int YPos = openborvariant("ypos"); // Get camera position
        int Screen = openborvariant("hResolution"); // Get screen width

    void target = getentityproperty(self, "opponent");
    void name = getentityproperty(target, "name");

    clearspawnentry(); //Clear current spawn entry.
    loadmodel("darkblue");
    setspawnentry("name", "darkblue"); //Acquire spawn entity by name.

    vSpawn = spawn(); //Spawn in entity.

    changeentityproperty(vSpawn, "position", 160 + XPos, 246 + YPos);
    changeentityproperty(vSpawn, "animation", openborconstant("ANI_FOLLOW5"));
    setglobalvar("Wait", 1);
    clearglobalvar();
      } else {
    jumptobranch(Current,1);
      }
    }

    @end_script
    offset 97 177
    delay 9
    frame data/CHARS/ARyu/loss01.png
    frame data/CHARS/ARyu/loss02.png
    frame data/CHARS/ARyu/loss03.png
    frame data/CHARS/ARyu/loss04.png
    frame data/CHARS/ARyu/loss05.png
    delay 339
    frame data/CHARS/ARyu/loss06.png
    @cmd spawn06map2 "ARyuCont" 91 0 182
    @cmd suicide
    frame data/CHARS/ARyu/loss06.png

Winning enemy in one player mode:
C:
name    EnemyWin
health  2
type text
shadow 0
nolife  1
palette none
speed 10
nomove 1 1
nodrop 1
nopain  1
load CountD
load continue
load black
setlayer    410000000
animationscript data/scripts/textpos.c

anim idle # Ryu
    offset 64 64
    delay 650
    custentity CountD
    spawnframe 1 200 60 0 1
    @cmd spawn06 "Black" 0 0 660
    @cmd    changeopenborvariant "nojoin" 1
    @cmd    changeopenborvariant "nopause" 1
    @cmd    playmusic "data/music/fightend.ogg"
    @cmd    drawdialog1 0 "You_must_defeat_my_Shoryuken_to"
    @cmd    drawdialog2 1 "stand_a_chance!"
    frame data/sprites/ports/ryu2.png
    delay 90
    @cmd    changeopenborvariant "nojoin" 0
    @cmd    changeopenborvariant "nopause" 0
    @cmd    drawdialog1 0 "_"
    @cmd    drawdialog2 1 "_"
    @cmd    suicide
    @cmd    playmusic "data/music/continue.bor" 1 528400.25
    frame data/sprites/ports/ryu2.png

anim freespecial # Ken
    offset 64 64
    delay 650
    custentity CountD
    spawnframe 1 200 60 0 1
    @cmd spawn06 "Black" 0 0 660
    @cmd    changeopenborvariant "nojoin" 1
    @cmd    changeopenborvariant "nopause" 1
    @cmd    playmusic "data/music/fightend.ogg"
    @cmd    drawdialog1 0 "Get_up!!__It's_too_early_for"
    @cmd    drawdialog2 1 "you_to_be_defeated!"
    frame data/sprites/ports/ken2.png
    @cmd    changeopenborvariant "nojoin" 0
    @cmd    changeopenborvariant "nopause" 0
    @cmd    drawdialog1 0 "_"
    @cmd    drawdialog2 1 "_"
    @cmd    suicide
    @cmd    playmusic "data/music/continue.bor" 1 528400.25
    frame data/sprites/ports/ken2.png

anim freespecial2 # Chun-Li
    offset 64 64
    delay 650
    custentity CountD
    spawnframe 1 200 60 0 1
    @cmd spawn06 "Black" 0 0 660
    @cmd    changeopenborvariant "nojoin" 1
    @cmd    changeopenborvariant "nopause" 1
    @cmd    playmusic "data/music/fightend.ogg"
    @cmd    drawdialog1 0 "Didn't_take_me_seriously_because"
    @cmd    drawdialog2 1 "I'm_a_woman?_Look_what_happened!"
    frame data/sprites/ports/chun-li2.png
    @cmd    changeopenborvariant "nojoin" 0
    @cmd    changeopenborvariant "nopause" 0
    @cmd    drawdialog1 0 "_"
    @cmd    drawdialog2 1 "_"
    @cmd    suicide
    @cmd    playmusic "data/music/continue.bor" 1 528400.25
    frame data/sprites/ports/chun-li2.png

anim freespecial3 # Zangief
    offset 40 1
    delay 650
    custentity CountD
    spawnframe 1 200 60 0 1
    @cmd spawn06 "Black" 0 0 660
    @cmd    changeopenborvariant "nojoin" 1
    @cmd    changeopenborvariant "nopause" 1
    @cmd    playmusic "data/music/fightend.ogg"
    @cmd    drawdialog1 0 "You're_training_your_body_the_wrong_way!"
    @cmd    drawdialog2 1 "_"
    frame data/sprites/ports/zangief.png
    @cmd    changeopenborvariant "nojoin" 0
    @cmd    changeopenborvariant "nopause" 0
    @cmd    drawdialog1 0 "_"
    @cmd    drawdialog2 1 "_"
    @cmd    suicide
    @cmd    playmusic "data/music/continue.bor" 1 528400.25
    frame data/sprites/ports/zangief.png

anim freespecial4 # Eagle
    offset 64 64
    delay 650
    custentity CountD
    spawnframe 1 200 60 0 1
    @cmd spawn06 "Black" 0 0 660
    @cmd    changeopenborvariant "nojoin" 1
    @cmd    changeopenborvariant "nopause" 1
    @cmd    playmusic "data/music/fightend.ogg"
    @cmd    drawdialog1 0 "Respect_comes_first._Victory"
    @cmd    drawdialog2 1 "and_defeat_are_afterthoughts."
    frame data/sprites/ports/eagle.png
    delay 90
    @cmd    changeopenborvariant "nojoin" 0
    @cmd    changeopenborvariant "nopause" 0
    @cmd    drawdialog1 0 "_"
    @cmd    drawdialog2 1 "_"
    @cmd    suicide
    @cmd    playmusic "data/music/continue.bor" 1 528400.25
    frame data/sprites/ports/eagle.png

Here's the enemy type's death result for losing which allows the player to move on.
C:
anim death
@script
    void self = getlocalvar("self");
    int win1 = getglobalvar("win1");
    int win2 = getglobalvar("win2");
    void Current = openborvariant("current_branch");

    if(frame==9){
    if(win1 == 2 || win2 == 2){
    void vSpawn; //Spawn object.
        int XPos = openborvariant("xpos"); //Get screen edge's position
        int YPos = openborvariant("ypos"); // Get camera position
        int Screen = openborvariant("hResolution"); // Get screen width

    void target = findtarget(self); // Calling target.
    void name = getentityproperty(target, "name"); // Calling target's name.

    clearspawnentry(); //Clear current spawn entry.

    loadmodel("victory");
    setspawnentry("name", "victory"); //Acquire spawn entity by name.

    vSpawn = spawn(); //Spawn in entity.

    if(name == "Ken"){
        changeentityproperty(vSpawn, "position", 160 + XPos, 120);
        changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL"));
    }else if(name == "Chun-Li"){
        changeentityproperty(vSpawn, "position", 160 + XPos, 120);
        changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL2"));
    }else if(name == "Zangief"){
        changeentityproperty(vSpawn, "position", 160 + XPos, 120);
        changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL3"));
    }else if(name == "Dhalsim"){
        changeentityproperty(vSpawn, "position", 160 + XPos, 120);
        changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL4"));
    }else if(name == "Guy"){
        changeentityproperty(vSpawn, "position", 160 + XPos, 120);
        changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL5"));
    }else if(name == "Joe"){
        changeentityproperty(vSpawn, "position", 160 + XPos, 120);
        changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL6"));
    }else if(name == "Eagle"){
        changeentityproperty(vSpawn, "position", 160 + XPos, 120);
        changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL7"));
    }else if(name == "Balrog"){
        changeentityproperty(vSpawn, "position", 160 + XPos, 120);
        changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL8"));
    }else if(name == "Bison" || name == "M._Bison"){
        changeentityproperty(vSpawn, "position", 160 + XPos, 120);
        changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL9"));
    }else if(name == "Guile"){
        changeentityproperty(vSpawn, "position", 160 + XPos, 120);
        changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL10"));
    }else if(name == "Vega"){
        changeentityproperty(vSpawn, "position", 160 + XPos, 120);
        changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL11"));
    }else if(name == "Birdie"){
        changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL12"));
    }else if(name == "Necro"){
        changeentityproperty(vSpawn, "position", 160 + XPos, 120);
        changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL13"));
    }else{ // Defaultly switch to Ryu?
        changeentityproperty(vSpawn, "position", 160 + XPos, 120);
    }
    changeentityproperty(vSpawn, "position", 160 + XPos, 120);
      clearglobalvar();
      } else {
      jumptobranch(Current,1);
      }
    }
    @end_script   
    offset 97 177
    delay 15
    sound data/sounds/fall.wav
    frame data/CHARS/ARyu/fallc02.png
    delay 250
    frame data/CHARS/ARyu/fallc02.png
    delay 10
    frame data/CHARS/ARyu/fallc02.png
    frame data/CHARS/ARyu/fallc02.png
    frame data/CHARS/ARyu/fallc02.png
    frame data/CHARS/ARyu/fallc02.png
    frame data/CHARS/ARyu/fallc02.png
    delay 70
    frame data/CHARS/ARyu/fallc02.png
    delay 2
    frame data/CHARS/ARyu/fallc02.png
    @cmd suicide
    frame data/CHARS/ARyu/fallc02.png

C:
name victory
health 2
type text
palette none
shadow 0
nolife 1
speed 10
setlayer 410000000
load black
facing 1
animationscript data/scripts/textpos.c

anim idle # RYU (solo mode)
    offset 64 64
    delay 650
    @cmd spawn06 "Black" 0 0 660
    @cmd    changeopenborvariant "nojoin" 1
    @cmd    changeopenborvariant "nopause" 1
    @cmd    playmusic "data/music/fightend.ogg" 0
    @cmd    drawdialog1 0 "You_must_defeat_my_Shoryuken_to"
    @cmd    drawdialog2 1 "stand_a_chance!"
    frame data/sprites/ports/ryu2.png
    delay 90
    @cmd    changeopenborvariant "nojoin" 0
    @cmd    changeopenborvariant "nopause" 0
    @cmd    jumptobranch "end" 1
    frame data/sprites/ports/ryu2.png

anim freespecial # KEN (solo mode)

    offset 64 64
    delay 650
    @cmd    changeopenborvariant "nojoin" 1
    @cmd    changeopenborvariant "nopause" 1
    @cmd    playmusic "data/music/fightend.ogg" 0
    @cmd spawn06 "Black" 0 0 660
    @cmd    drawdialog1 0 "Get_up!!__It's_too_early_for"
    @cmd    drawdialog2 1 "you_to_be_defeated!"
    frame data/sprites/ports/ken2.png
    delay 90
    @cmd    changeopenborvariant "nojoin" 0
    @cmd    changeopenborvariant "nopause" 0
    @cmd    jumptobranch "end" 1
    frame data/sprites/ports/ken2.png
 
playerwin.c (ondrawscript for the referee):
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);
    }

}

void RoundCount(){
    void win = getglobalvar("win");
    int P1 = getplayerproperty(0, "entity"); // Player 1
    int P2 = getplayerproperty(1, "entity"); // Player 2
    void Opp1 = findtarget(P1); // Player 1's opponent
    void Opp2 = findtarget(P2); // Player 2's opponent
    void win1 = getglobalvar("win1"); // Win point for Player type in single player mode; player 1 in dual mode
    void win2 = getglobalvar("win2"); // Win point for Enemy type in single player mode; player 2 in dual mode
    int PLAY = openborvariant("count_players");
    void draw = getglobalvar("draw"); // Draw point if both fighters do not win
    void empty = getglobalvar("empty");
    
    if(!win){
        win = loadsprite("data/chars/misc/win.png");
        setglobalvar("win", win);
    }
    
    if(PLAY == 2){ // 2 players in dual mode
        if(win1 == 1){
            if(P1){ // Player 1
                drawsprite(win, 1, 25, 500);
            }
        }if(win1 == 2){
            if(P1){ // Player 1
                drawsprite(win, 13, 25, 500);
                drawsprite(win, 1, 25, 500);
            }
        }if(win2 == 1){
            if(P2){ // Player 2
                drawsprite(win, 309, 25, 500);
            }
        }if(win2 == 2){
            if(P2){ // Player 2
                drawsprite(win, 309, 25, 500);
                drawsprite(win, 297, 25, 500);
            }
        }if(win1 == 2 && win2 == 1){
            if(P1){ // Player 1
                drawsprite(win, 13, 25, 500);
                drawsprite(win, 1, 25, 500);
                drawsprite(win, 309, 25, 500);
            }
        }if(win2 == 2 && win1 == 1){
            if(P2){ // Player 2
                drawsprite(win, 309, 25, 500);
                drawsprite(win, 297, 25, 500);
                drawsprite(win, 1, 25, 500);
            }
        }

    }
    
    if(PLAY == 1){ // Single player only?
        
        if(win1 == 1){
            drawsprite(win, 142, 25, 500);
        }
        if(win1 == 2){
            drawsprite(win, 142, 25, 500);
            drawsprite(win, 127, 25, 500);
        }

        if(win2 == 1){
            drawsprite(win, 174, 25, 500);
        }
        if(win2 == 2){
            drawsprite(win, 174, 25, 500);
            drawsprite(win, 189, 25, 500);
        }   


    }
}
 
Back
Top Bottom