Solved Continuing in Certain Stage After Loss and Rushing Countdown during Continue Screen

Question that is answered or resolved.

maxman

Well-known member
Here are two issues I need help with: One is the certain returning level switch after continue and select screens, and the other one is with rushing the countdown by tapping any button.

I'm trying to go back to the level where I left off after losing. I have a continue screen and if I press start, I will go back to the select screen. I'm trying to go back instead of reverting back to the very beginning. For instance, if you are in stage B (level 3) and lose there, you can continue and go back to the select screen which is level 1. After selecting a character, you wanna go back to Stage B instead of stage A. However, you go to Stage A which means you are going back to the very beginning after the select screen. I need to revert back to Stage B after the select screen.

Code:
set Arcade
branch Select
z 160 230
file data/levels/select.txt # level 1
branch StageA
z 200 200
file data/levels/stageA.txt # level 2
branch StageB
z 200 200
file data/levels/stageB.txt # level 3
branch StageC
z 200 200
file data/levels/stageC.txt # level 4
branch StageD
z 200 200
file data/levels/stageD.txt # level 5
branch    Ended
z    230 230 230
file    data/levels/emptyspace.txt # level 6
end
branch Return
z 160 230
file    data/levels/select.txt # level 7

I have the continue script working well but the continue entity is not type text. It's a none type entity but I already got a pause script for it. Also, I have an invisible player entity which is fake as a player, and it really helps me to move back to the select screen when I press start as a none type since it's not text type. But the problem is I can't press any button to change frame or rush to countdown. How can I have the keys access to rush the countdown? Do I need keyscript or animationscript (though I have it, I don't know which to use)?

For type text, I can press attack or jump (or any?) button to skip, but I cannot press start to skip or cancel as I understand you can pause it. Also, if I press start, I can't go back to the select screen because it's "paused".

Code:
name    EnemyWin
health  2
type text
#type none
shadow 0
nolife  1
palette none
speed 10 #speed {value} # Used for panel type entity
nomove 1 1
nodrop 1
nopain  1
load CountD
load black
#setlayer   345000000
#setlayer    400000000
setlayer    100
animationscript data/scripts/script.c
#onspawnscript data/scripts/winSpawn.c
#ondrawscript data/scripts/winText.c

anim idle # Ryu
    offset 40 1
    delay 650
    custentity CountD
    spawnframe 1 200 60 0 1
    @cmd    changeopenborvariant "nojoin" 1
    @cmd    changeopenborvariant "nopause" 1
    @cmd    playmusic "data/music/fightend.ogg"
    #@cmd spawn06 "Black" 0 0 660
    frame data/sprites/portraits/ryu.png
    delay 90
    @cmd    changeopenborvariant "nojoin" 0
    @cmd    changeopenborvariant "nopause" 0
    @cmd killentity getlocalvar("self")
    @cmd    playmusic "data/music/continue.bor" 1 528400.25
    frame data/sprites/portraits/ryu.png

anim freespecial # Ken
    offset 40 1
    delay 650
    custentity CountD
    spawnframe 1 200 60 0 1
    @cmd    changeopenborvariant "nojoin" 1
    @cmd    changeopenborvariant "nopause" 1
    @cmd    playmusic "data/music/fightend.ogg"
    frame data/sprites/portraits/ken.png
    @cmd    changeopenborvariant "nojoin" 0
    @cmd    changeopenborvariant "nopause" 0
    @cmd killentity getlocalvar("self")
    @cmd    playmusic "data/music/continue.bor" 1 528400.25
    frame data/sprites/portraits/ken.png

anim freespecial2 # Chun-Li
    offset 40 1
    delay 650
    custentity CountD
    spawnframe 1 200 60 0 1
    @cmd    changeopenborvariant "nojoin" 1
    @cmd    changeopenborvariant "nopause" 1
    @cmd    playmusic "data/music/fightend.ogg"
    frame data/sprites/portraits/chun-li.png
    @cmd    changeopenborvariant "nojoin" 0
    @cmd    changeopenborvariant "nopause" 0
    @cmd killentity getlocalvar("self")
    @cmd    playmusic "data/music/continue.bor" 1 528400.25
    frame data/sprites/portraits/chun-li.png

anim freespecial3 # Zangief
    offset 40 1
    delay 650
    custentity CountD
    spawnframe 1 200 60 0 1
    @cmd    changeopenborvariant "nojoin" 1
    @cmd    changeopenborvariant "nopause" 1
    @cmd    playmusic "data/music/fightend.ogg"
    frame data/sprites/portraits/zangief.png
    @cmd    changeopenborvariant "nojoin" 0
    @cmd    changeopenborvariant "nopause" 0
    @cmd killentity getlocalvar("self")
    @cmd    playmusic "data/music/continue.bor" 1 528400.25
    frame data/sprites/portraits/zangief.png

Continue screen entity:
Code:
name CountD
type none
#type text
#health 10
speed 10
#falldie 1
subject_to_minz 0
subject_to_maxz 0
setlayer 410000000
facing 1
load black-fade-in
load black-fade-out
load black
#animationscript data/scripts/paus0001.c
animationscript data/scripts/script.c

anim idle
    offset 1 1
    delay 9
    custentity black-fade-out
    @cmd changeopenborvariant "nopause" 1
    @cmd paus0001 1 1000000000 #paus0001 {toggle} {time}
    @cmd changelevelproperty "bgspeed" 0 # changelevelproperty {bgspeed} {value} # Stop background from speeding
    spawnframe 56 0 240 0 0 # spawnframe {frame} {x} {z} {y} {relative}
    @cmd spawn06 "Black" 0 0 660
    frame data/chars/misc/continueanim/counbase.png # 0
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/counbase.png # 1
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/count091.png # 2
    delay 2 #160
    sound data/sounds/nine.wav
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/count09.png # 3
    delay 78
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/count09.png # 4
    delay 40
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/count09.png # 5
    delay 40
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/count09.png # 6
    delay 9
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/count091.png # 7
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/counbase.png # 8
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/counbase.png # 9
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/count081.png # 10
    delay 160
    sound data/sounds/eight.wav
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/count08.png # 11
    delay 9
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/count081.png # 12
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/counbase.png # 13
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/counbase.png # 14
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/count071.png # 15
    delay 160
    @cmd paus0001 1 1000000000
    sound data/sounds/seven.wav
    frame data/chars/misc/continueanim/count07.png # 16
    delay 9
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/count071.png # 17
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/counbase.png # 18
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/counbase.png # 19
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/count061.png # 20
    delay 260
    sound data/sounds/six.wav
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/count06.png # 21
    delay 9
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/count061.png # 22
    frame data/chars/misc/continueanim/counbase.png # 23
    frame data/chars/misc/continueanim/counbase.png # 24
    frame data/chars/misc/continueanim/count051.png # 25
    delay 260
    @cmd paus0001 1 1000000000
    sound data/sounds/five.wav
    frame data/chars/misc/continueanim/count05.png # 26
    delay 9
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/count051.png # 27
    frame data/chars/misc/continueanim/counbase.png # 28
    frame data/chars/misc/continueanim/counbase.png # 29
    frame data/chars/misc/continueanim/count041.png # 30
    delay 260
    @cmd paus0001 1 1000000000
    sound data/sounds/four.wav
    frame data/chars/misc/continueanim/count04.png # 31
    delay 9
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/count041.png # 32
    frame data/chars/misc/continueanim/counbase.png # 33
    frame data/chars/misc/continueanim/counbase.png # 34
    frame data/chars/misc/continueanim/count031.png # 35
    delay 260
    @cmd paus0001 1 1000000000
    sound data/sounds/three.wav
    frame data/chars/misc/continueanim/count03.png # 36
    delay 9
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/count031.png # 37
    frame data/chars/misc/continueanim/counbase.png # 38
    frame data/chars/misc/continueanim/counbase.png # 39
    frame data/chars/misc/continueanim/count021.png # 40
    delay 260
    @cmd paus0001 1 1000000000
    sound data/sounds/two.wav
    frame data/chars/misc/continueanim/count02.png # 41
    delay 9
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/count021.png # 42
    frame data/chars/misc/continueanim/counbase.png # 43
    frame data/chars/misc/continueanim/counbase.png # 44
    frame data/chars/misc/continueanim/count011.png # 45
    delay 260
    @cmd paus0001 1 1000000000
    sound data/sounds/one.wav
    frame data/chars/misc/continueanim/count01.png # 46
    delay 9
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/count011.png # 47
    frame data/chars/misc/continueanim/counbase.png # 48
    frame data/chars/misc/continueanim/counbase.png # 49
    frame data/chars/misc/continueanim/count001.png # 50
    delay 260
    @cmd paus0001 1 1000000000
    sound data/sounds/timeover.wav
    frame data/chars/misc/continueanim/count00.png # 51
    delay 9
    @cmd paus0001 1 1000000000
    frame data/chars/misc/continueanim/count001.png # 52
    frame data/chars/misc/continueanim/counbase.png # 53
    #delay 180
    frame data/chars/misc/continueanim/counbase.png # 54
    delay 210
    @cmd playmusic "data/music/gameover.bor"
    #@cmd settextobj 0 138 60 3 145000000 "Game_Over" # settextobj {index} {x} {y} {font} {text}
    @cmd settextobj 1 138 60 3 145000000 "Game_Over"
    frame data/chars/misc/continueanim/counbase.png # 55
    delay 112
    frame data/chars/misc/continueanim/counbase.png # 56
    @cmd jumptobranch "end" 1
    frame data/chars/misc/continueanim/counbase.png # 57

anim follow1
    flipframe 0
    loop    0
    offset    0 0
    delay 10
@script
    changeopenborvariant("nopause", 0);
@end_script
    frame data/chars/misc/continueanim/counbase.png
    delay 1
    @cmd killentity getlocalvar("self")
    frame data/chars/misc/continueanim/counbase.png

I use type none because it works for the fake player entity.

Code:
name player1
type player
health 1 #100
speed 10
turndelay 9999999999999999999999
#facing 1
#antigravity 100
subject_to_gravity 0
subject_to_obstacle 0
subject_to_wall    1
subject_to_platform 0
subject_to_hole 1
no_adjust_base  0
shadow        0
#candamage    enemy obstacle
atchain        1
load        Challenger
load        black-fade-out

animationscript data/scripts/script.c
ondrawscript data/scripts/dumdraw.c
onspawnscript data/scripts/arcSpawn.c
#onspawnscript data/chars/misc/opselect/p1join.c

script @script
void main(){
    changeentityproperty(getlocalvar("self"), "name", "_");
}
@end_script

anim waiting
    delay 4
    offset 1 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim select
    delay 4
    offset 1 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim spawn
    delay 9
    offset 1 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim respawn
    delay 9
    offset 1 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim idle
 
    loop 1
    delay 6
    offset 1 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim walk

    loop 1
    delay 6
    offset 1 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim backwalk

    loop 1
    delay 6
    offset 1 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim pain
    delay 4
    offset 1 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim attack
    delay 4
    offset 1 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim fall
    delay 4
    offset 1 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim rise
    delay 4
    offset 1 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim follow1 # Return to Character Select Screen after Continue

    delay 120
    offset 1 1
    subentity black-fade-out
    spawnframe 0 0 240 0 0
    frame data/chars/misc/empty.gif
    delay 6
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    @cmd jumptobranch "Arcade_Select" 1
    frame data/chars/misc/empty.gif

anim follow2 # Here comes a new challenger
    delay 9
    offset 1 1
    custentity Challenger
    spawnframe 0 0 0 0 0
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim follow3 # First player returns to select screen or second player joins after first player loses completely

    delay 1
    offset 1 1
    @cmd clearglobalvar
    frame data/chars/misc/empty.gif
    delay 6
    @cmd jumptobranch "Arcade_Select" 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

Challenger.txt:

Code:
name Challenger
type text
subtype noskip

anim idle

offset 1 1
delay 100
@cmd playmusic "data/music/charenja.ogg"
frame data/chars/misc/empty.gif
delay 5
@cmd clearglobalvar
frame data/chars/misc/empty.gif
@cmd jumptobranch "Arcade_Select" 1
#@cmd clearglobalvar
frame data/chars/misc/empty.gif
delay 5
@cmd killentity getlocalvar("self")
frame data/chars/misc/empty.gif

ArcSpawn.c (it's actually in arcSpawn_actual.c):
Code:
#define RESPAWN openborconstant("ANI_RESPAWN") //#define {any_name_for_the_value} {value}
#define SPAWN openborconstant("ANI_SPAWN")

void actual_main(){ // This function is #imported from its main file in the main scripts folder
    arcade_spawn();
}


void arcade_spawn(){
    void self = getlocalvar("self"); // Get entity
    void aniID = getentityproperty(self, "animationid"); // Get entity's animation ID
    int set = openborvariant("current_set"); // Calling on the current set or mode of the game
    int level = openborvariant("current_level"); // Calling on the current level
    //void in_level = openborvariant("in_level");
    void branch = openborvariant("current_branch"); // Calling on current branch
    changeentityproperty(self, "name", "_"); // Change entity's name
    int PLAY = openborvariant("count_players");

// This goes back to the select screen from the continue screen
    if(set == 0 && branch == "Continue"){ // During Continue screen in the first set?
        if(aniID == RESPAWN || aniID == SPAWN){ // Take a look at #define above and see why the value is like this
            performattack(self, openborconstant("ANI_FOLLOW1")); // Confirming to return to the select screen
        }
    }

// This calls upon a new challenger
    if((level == 2 || level == 3 || level == 4 || level == 5) && PLAY == 2 && set == 0){ // Second player joins the fray in certain levels under one mode!
        if(aniID == RESPAWN || aniID == SPAWN){
            performattack(self, openborconstant("ANI_FOLLOW2")); // Confirms a new challenger and returns to select screen
        }
    }
 
    // Continue to battle
    if((level == 2 || level == 3 || level == 4) && PLAY == 1 && set == 0){ // First (either 1P or 2P) player returns to battle!
        if(aniID == RESPAWN){
            performattack(self, openborconstant("ANI_FOLLOW3")); //Jump to select screen
        }if(aniID == SPAWN){
            performattack(self, openborconstant("ANI_FOLLOW3"));
        }
    }

}

EDIT:
I forgot to show that I put an entity spawn in the level here. It still cannot work and it seems empty.

Code:
spawn    Empty
@script
void main()
{
    setglobalvar("Return", "StageB");
}
@end_script
coords    320 400
at    0
 
Last edited:
Here are two issues I need help with: One is the certain returning level switch after continue and select screens, and the other one is with rushing the countdown by tapping any button.

I'm trying to go back to the level where I left off after losing. I have a continue screen and if I press start, I will go back to the select screen. I'm trying to go back instead of reverting back to the very beginning. For instance, if you are in stage B (level 3) and lose there, you can continue and go back to the select screen which is level 1. After selecting a character, you wanna go back to Stage B instead of stage A. However, you go to Stage A which means you are going back to the very beginning after the select screen. I need to revert back to Stage B after the select screen.
MMM, did you try to make a specific level to select? Instead of placing it in level A.

and at that level you could make a script that returns to a specific level (it joins by assigning a global variable).

I use this with the NPC selection menu. so that after selecting the player he would return to the village and not start again on the map
I have the continue script working well but the continue entity is not type text. It's a none type entity but I already got a pause script for it. Also, I have an invisible player entity which is fake as a player, and it really helps me to move back to the select screen when I press start as a none type since it's not text type. But the problem is I can't press any button to change frame or rush to countdown. How can I have the keys access to rush the countdown? Do I need keyscript or animationscript (though I have it, I don't know which to use)?
I say keyscript would be better, using the global keycapture system. Master @Bloodbane uses it in Dungeons and Dragons :D
 
I tried putting the code here before, but I don't know how to skip to Stage B.

Code:
spawn    Empty
@script
void main()
{
    setglobalvar("Return", "StageB");
}
@end_script
coords    320 400
at    0

I think I would need a script that reads the variable and jumps there on player's death, but I don't know how to do it.

Player's death anim:
Code:
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 win3 = getglobalvar("win3");
    int win4 = getglobalvar("win4");
    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){
    if(win2 == NULL()){
        setglobalvar("win2", 1);
    }
    if(win2 == 1){
        setglobalvar("win2", 2);
    }
   }*/


    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{
        changeentityproperty(vSpawn, "position", 160 + XPos, 120);
    }
    setglobalvar("Wait", 1);
    clearglobalvar();
      } else {
    jumptobranch(Current,1);
    //setglobalvar("Return", NULL());
      }
    }


    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

    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 {
    //setglobalvar("Return", Current);
    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"));
    //jumptobranch("VS_Select", 1);
    setglobalvar("Wait", 1);
    clearglobalvar();
      } else {
    jumptobranch(Current,1);
      }
    }

    @end_script   
    offset    49 40
    delay    15
#    spawnframe 4 0 0 0 1
#    custentity conttest
    sound data/sounds/fall.wav
    frame    data/chars/ryu/0504000010.gif # 0 15
    delay 250
    frame    data/chars/ryu/0504000010.gif # 1 265
    delay 10
    frame    data/chars/ryu/0504000010.gif # 2 275
    frame    data/chars/ryu/0504000010.gif # 3 285
    frame    data/chars/ryu/0504000010.gif # 4 295
    frame    data/chars/ryu/0504000010.gif # 5 305
    frame    data/chars/ryu/0504000010.gif # 6 315
    delay 50
    frame    data/chars/ryu/0504000010.gif # 7 365
    frame    data/chars/ryu/0504000010.gif # 8 415
    frame    data/chars/ryu/0504000010.gif # 9 465
#    frame    data/chars/misc/empty.gif
#    delay 1
#    @cmd spawn01 "conttest" 320 0 160
#    frame    data/chars/misc/empty.gif

I say keyscript would be better, using the global keycapture system. Master @Bloodbane uses it in Dungeons and Dragons :D
I even saw the key movement in the Map demo which he made too.
 
You have to do a false level, or in the same function when you continue or select.

The entity that does such an action must have jumptobranch(varname,1);

If you don't understand my point you could lend me the main elements of your mod and I personally apply the function.

After doing tests I send you the elements so you can add them
 
But the problem is I can't press any button to change frame or rush to countdown. How can I have the keys access to rush the countdown? Do I need keyscript or animationscript (though I have it, I don't know which to use)?

As BladeMaster posted above, keyscript is the solution (y). Just like what I did with upgrade menu for Robz Rush:

The upgrade menu you see is type text, pausing everything else when it appears. However, I have keyall.c which captures key press and key release event from players and store it in respective global variable. By acquiring the value of these variables, I can change animation of upgrade menu entity 😎.

For instance, if you are in stage B (level 3) and lose there, you can continue and go back to the select screen which is level 1. After selecting a character, you wanna go back to Stage B instead of stage A.

Hmmm... storing last entered stage is correct step. The next step is you might need a quick level which reads that last entered stage then jumps there. I believe I have posted tutorial on how to create quick level 🤔 before but I can't recall where 😅.
 
Yeah I think a dummy stage after select screen that will make some checks and send you to the correct branch. I did something like this in my double dragon vs mode mod but it was super hacky. I only had the dummy stage, which setup/reset all the win counters etc. every other stage was branch and I would also load a VS screen before it which did some other steps. (Dummy stage runs so fast you don't see it, just looks like a black screen anyway)

Basically you only have one normal stage in stages.txt - the dummy stage, and everything else is set as a branch. You will just always control it yourself what the next branch will be, over riding any default openbor behaviour.

//VS MODE TEST
Code:
file    data/levels/DUMMY.TXT //dummy stage setting up the vars etc. (also used as the first VS screen)
branch zero
z 192 242
file    data/levels/STAGE1.TXT  //an actual stage vs random opponent
file    data/levels/INTER.TXT  // VS - VICTORY & LOSS SCREEN - used between matches
branch one
z 230 238
file    data/levels/STAGE2.TXT   //another stage
file    data/levels/INTER.TXT    // VS - VICTORY
branch two
z 190 242
file    data/levels/STAGE3.TXT
file    data/levels/INTER.TXT
branch end
z 192 242
file    data/levels/END.TXT //

The stages are being reused for each round by using branch command, so it's only loaded once. My mod was dodgy thou, it was just proof of concept, not done well. I think I was just setting the branch changes from victory poses in players and enemies... nothing special.

something like...
Code:
void iStage = openborvariant("current_branch");

Code:
jumptobranch(iStage, 1);

If i recall correctly, Branches count from ZERO (0)

I didn't have a dummy player, just forced a certain freespecial animation on that stage so they can't do anything, and the player is hidden behind a black layer and then I'm drawing the portraits and the VS text etc. over the top.
 
OK. I created a new entity named Return used for returning to the last level.

Return.txt (none type entity):
Code:
name Return
type none
speed 10
antigravity      100

anim idle
@script
void self = getlocalvar("self");
void Name = getentityproperty(self, "name");
void Return = getglobalvar("Return");

       if(frame == 1){
        jumptobranch(Return, 1);
       }

@end_script
    offset 1 1
    delay 10
    #loop 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

I also made a fake level as a returning level after the select screen.

Return.txt (level txt):
Code:
bglayer        data/bgs/garden.png
panel        data/bgs/garden.png
order        a
direction    both
settime         0
nopause        1
nofadeout    1

nojoin    1
at    0

spawn   empty
@script
void main(){
    void self = getlocalvar("self");
    void Name = getentityproperty(self, "name");
    void Return = getglobalvar("Return");

    if(Return == NULL()){
        //setglobalvar("Return", "Stage_"++Name);
        setglobalvar("Return", "Return");
        //jumptobranch(Name, 1);
    }
}
@end_script
coords   160 200
at   0

spawn black
coords 1 240
at 0

spawn return
coords 200 200
at 0

In Ryu's stage which is the first battle level here..

Code:
fglayer data/sprites/hud_base.png -1 1 0 3 3 1 1 1 1 1 0 0 0 0 0 0
fglayer data/sprites/hud.png -1 1 0 3 3 1 1 1 1 1 0 0 0 0 0 0

bglayer        data/bgs/ryu/0-0.png 0.4365 0 0 -26 1 1 1 1 1 0 0 0 0 0 0
bglayer        data/bgs/ryu/0-1.png 0 0 0 -10 0 0 -1 1 1 0 0 0 0 0 0.83
bglayer        data/bgs/ryu/0-2.png 0 0 0 -30 0 0 -1 1 1 0 0 0 0 0 0.653
bglayer        data/bgs/ryu/0-3.png 0.17 0 0 73 1 1 1 1 1 0 0 0 0 0 0

panel        data/bgs/ryu/0-4-ryu.png

bgspeed 7
order a
direction both
settime 0
notime 1


spawn    camera 1
@script
void main(){
    void self = getlocalvar("self");
    int width = openborvariant("levelwidth")/2;
    changeentityproperty(self, "position", width, -5, 0);
}
@end_script
coords 0 200
at 0

spawn RyuPanel 1
@script
void main(){
    void self = getlocalvar("self");
    performattack(self, openborconstant("ANI_FOLLOW1"));
    changeentityproperty(self, "position", 1, 244, 0);
}
@end_script
coords 0 244 #1 244
at 0

spawn empty 1
@script
void main(){
    setglobalvar("Return", "Stage_Ryu");
}
@end_script
coords 0 210
at 0


spawn    1vs1 1
@script
  #import "data/scripts/aimove.c"
  void main()
  {
    void self = getlocalvar("self");
    int P1 = getplayerproperty(0, "entity"); // Get player 1
    int P2 = getplayerproperty(1, "entity");
    int map = getentityproperty(self, "map");
    int x = getentityproperty(self, "x");
    int y = getentityproperty(self, "y");


    if(P1){
       setglobalvar("Fighter1", P1);
       changeentityproperty(P1, "position", half-70, openborvariant("player_min_z"), 0);
       changeentityproperty(P1, "direction", 1);
    changeentityproperty(P1, "health", 1);
       setglobalvar("Fighter2", self);
       changeentityproperty(self, "position", half+70, openborvariant("player_min_z"), 0);
       changeentityproperty(self, "direction", 0);
       changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
    }
    if(P2){
       setglobalvar("Fighter2", P2);
       changeentityproperty(P2, "position", half+70, 227, 0);
       changeentityproperty(P2, "direction", 0);
    changeentityproperty(P2, "health", 1);
       setglobalvar("Fighter1", self);
       changeentityproperty(self, "position", half-70, 227, 0);
       changeentityproperty(self, "direction", 1);
       changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
    }

  }
@end_script
#health 100
coords    0 227 0
at    0


spawn    Rounds 1
@script
void main(){
    void self = getlocalvar("self");
    int vres = openborvariant("vresolution");
    int zmin = openborvariant("player_min_z");
    int ypos = openborvariant("ypos");
    int y = ypos+vres/2;
    int width = openborvariant("levelwidth")/2; //Levelwidth is full width of the level
    changeentityproperty(self, "position", width-5, 220, y);
}
@end_script
coords  0 10 #Altitude value should be 6 or higher for spawning text entity
at    0


spawn RefPlays 1
coords 160 200
at 0

First set In levels.txt:
Code:
set    Testing_Fight_Level # 0
lives 1
credits 30
noshare 1
cansave 0
continuescore 1 #Determines how taking continue effect score. 1 = score reset to 0 when continue; 2 = 1 point added to your score when continue. like capcom scoring system for putting continue numbers in scores
disablehof 1
disablegameover 1

skipselect player1 player2
branch Arcade_Select
z    173 230 173
file    data/levels/charatest.txt # level 1

branch    Stage_Ryu
z    227 227 227
file    data/levels/ryu_stage.txt # level 2
#branch    Stage_Eagle
#z    200 200 200
#file    data/levels/eagle.txt # level 3
branch    Stage_Ken
z    227 227 227
file    data/levels/ken.txt # level 4
branch    Ended
z    230 230 230
file    data/levels/emptyspace.txt # level 5
end
branch Returning
z    173 230 173
file    data/levels/charatest.txt
file    data/levels/return.txt
file    data/levels/return.txt

I changed the branch name of "Arcade_Select" from both Challenger and player1/player2 entities to "Returning" branch so it could move to the last stage. However, every time I'm in the Returning branch after the select screen, it goes back to the title screen now (or skips to Level B sometimes) after reaching the return level. Also, if you lose in level B and go back to the Returning branch, you'd be going back to the title screen. At least I got my first start in setting globalvar in a level. Not only am I going with Stage B but also Stage A, after testing with Return branch. I think I'm half way there. Am I missing something?

As for the keys, I set it in keyall.c, along with the continue key for the countdown entity.

keyall.c:
Code:
#import "data/scripts/dcancel.c"
#import "data/chars/misc/continueanim/contkey.c"

void main(){
   
    daimaoKeyCancel();
    continueKey();
}

contkey.c:
Code:
void main(){
    continueKey();
}

void continueKey(){
    int player = getlocalvar("player");
    //int self = getplayerproperty(player, "entity");
    int attack = playerkeys(player, 1, "attack");
    int attack2 = playerkeys(player, 1, "attack2");
    int attack3 = playerkeys(player, 1, "attack3");
    int attack4 = playerkeys(player, 1, "attack4");
    int jump = playerkeys(player, 1, "jump");
    int special = playerkeys(player, 1, "special");

    int attackR = playerkeys(player, 2, "attack");
    int attack2R = playerkeys(player, 2, "attack2");
    int attack3R = playerkeys(player, 2, "attack3");
    int attack4R = playerkeys(player, 2, "attack4");
    int jumpR = playerkeys(player, 2, "jump");
    int specialR = playerkeys(player, 2, "special");

    // Action event capture

    if(attack){
        setglobalvar(player+"A", 1);
    }
    if(attackR){
        setglobalvar(player+"A", NULL());
    }

    if(attack2){
        setglobalvar(player+"A2", 1);
    }
    if(attack2R){
        setglobalvar(player+"A2", NULL());
    }

    if(attack3){
        setglobalvar(player+"A3", 1);
    }
    if(attack3R){
        setglobalvar(player+"A3", NULL());
    }

    if(attack4){
        setglobalvar(player+"A4", 1);
    }
    if(attack4R){
        setglobalvar(player+"A4", NULL());
    }

    if(jump){
        setglobalvar(player+"J", 1);
    }
    if(jumpR){
        setglobalvar(player+"J", NULL());
    }

    if(special){
        setglobalvar(player+"S", 1);
    }
    if(specialR){
        setglobalvar(player+"S", NULL());
    }
}

However, if I put the global key script in the countdown entity, the engine crashes. I'm trying to change frame during a long delay frame with an attack key, but maybe it doesn't register. I'm lost with keys, but I don't need a start button since the fake player can always jump to the select screen if you press start, unless it's a text type entity.
Code:
@script
void self = getlocalvar("self");
int frame = getentityproperty(self, "animpos");

void 0A = getglobalvar("0A");
void 1A = getglobalvar("1A");


    //setglobalvar("0A", NULL());
    //setglobalvar("1A", NULL());


if(frame == 3 || frame == 4 || frame == 5 || frame == 6){
        setglobalvar("0A", 1);
        updateframe(self, 7);

}
@end_script

I'm missing something again.

Hey @aL BeasTie! It's great to see you here! I forgot about level branches for number of rounds until I figured out how to do it. It's a nice idea to have a level which is for VS screen and choosing which opponent to face, and I'll try to integrate it after winning battles.
 
Last edited:
I can't get it to work. I have a select screen as a level instead of a default one. Here's the following that belong to the select screen as an example.

Select screen for single player mode:
Code:
bglayer        data/bgs/title/select.png
fglayer        data/bgs/title/select.png 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
panel        data/chars/misc/empty.gif
#music        data/music/opselect.bor
direction    both
scrollspeed    0
settime        0
notime        1
#nopause        1
nofadeout    1
order        a
spawn1        210 115
spawn2        220 115
wall        50 239 -500 -500 0 0 200 5000 # Left side
wall        280 239 0 0 70 70 200 5000 # Right side
wall        0 239 -500 -500 500 500 15 5000 # Below
type        1 0 0

spawn    empty 1
@script
void main()
{
    setglobalvar("PilP1", NULL());
    setglobalvar("PilP2", NULL());
}
@end_script
coords    160 240
at    0

spawn    empty 1
coords    160 240 50
at    0

spawn    Pilada 1
coords    160 150
at    0

spawn    PlayerPorts 1
#flip    1
coords    70 260
at    0

spawn    PlayerPorts 1
mp    2
flip    1
coords    250 260
at    0

# 1st row
spawn    Slots 1
alias    Ryu
coords    51 176
at    0

spawn    Slots 1
alias    Joe
aggression 5
coords    85 176 
at    0

spawn    Slots 1
alias    Guy
aggression 8
coords    119 176 
at    0

spawn    Slots 1
alias    Vega
aggression 9
coords    153 176 
at    0

spawn    Slots 1
alias    Eagle
aggression 7
coords    187 176 
at    0

spawn    Slots 1
alias    Birdie
aggression 12
coords    221 176 
at    0

spawn    Slots 1
alias    Balrog
aggression 10
coords    255 176 
at    0

#2nd row
spawn    Slots 1
alias    Ken
aggression 2
coords    51 210
at    0

spawn    Slots 1
alias    Chun-Li
aggression 3
coords    85 210 
at    0

spawn    Slots 1
alias    Guile
aggression 14
coords    119 210 
at    0

spawn    Slots 1
alias    Necro
aggression 13
coords    153 210 
at    0

spawn    Slots 1
alias    Zangief
aggression 4
coords    187 210 
at    0

spawn    Slots 1
alias    Dhalsim
aggression 6
coords    221 210 
at    0

spawn    Slots 1
alias    Bison
aggression 11
coords    255 210 
at    0

Player 1 cursor:
C:
name        P1Cursor
type        player
health        100
atchain        1
nomove        1 1
modelflag    7
antigrab    34 # vertical movement
grabforce    34 # horizontal movement
facing        1
setlayer    550
candamage    obstacle
palette        none
com    f    freespecial
com    b    freespecial2
com    u    freespecial3
com    d    freespecial4

com a2 freespecial5
com a3 freespecial6
com j freespecial7
com s freespecial8
com a4 freespecial9

subject_to_wall 1


anim    idle
    loop    1
    delay    5
    offset    17 17
    #platform 17 34 -17 -17 17 17 34 20
    frame    data/chars/misc/opselect/p1.gif
    delay    10
    hitfx    data/sounds/empty.wav
    attack    4 4 17 17 0 0 1 1 0 200
    frame    data/chars/misc/opselect/p1.gif
    attack    0
    frame    data/chars/misc/opselect/p1.gif


anim    freespecial
@script
  if(frame==1){
    void self = getlocalvar("self");
    int x = getentityproperty(self, "x");
    int z = getentityproperty(self, "z");
    int Step = getentityproperty(self, "grabforce");
    
    int H = checkwall(x+Step,z);
    int P = checkplatformbelow(x+Step, z, 22);

    if(H <= 0 && !P){
      int SFX = loadsample("data/sounds/beep.wav");

      playsample(SFX, 0, 120, 120, 100, 0);
      setglobalvar("PilP1", NULL());
      changeentityproperty(self, "position", x + Step);
    }

    if(x == 255){ // At the last box of the row
        int SFX = loadsample("data/sounds/beep.wav");

        playsample(SFX, 0, 120, 120, 100, 0);
        setglobalvar("PilP1", NULL());
        changeentityproperty(self, "position", 51, z, NULL()); // Move from the last box to the first box of the row
    }
  }
@end_script
    delay    2
    offset    17 17
    #platform 17 34 -17 -17 17 17 34 20
    frame    data/chars/misc/opselect/p1.gif
    frame    data/chars/misc/opselect/p1.gif

anim    freespecial2
@script
  if(frame==1){
    void self = getlocalvar("self");
    int x = getentityproperty(self, "x");
    int z = getentityproperty(self, "z");
    int Step = getentityproperty(self, "grabforce");
    
    int H = checkwall(x-Step,z);
    int P = checkplatformbelow(x-Step, z, 22);

    if(H <= 0 && !P){
      int SFX = loadsample("data/sounds/beep.wav");

      playsample(SFX, 0, 120, 120, 100, 0);
      setglobalvar("PilP1", NULL());
      changeentityproperty(self, "position", x - Step);
    }

    if(x == 51){
        int SFX = loadsample("data/sounds/beep.wav");

        playsample(SFX, 0, 120, 120, 100, 0);
        setglobalvar("PilP1", NULL());
        changeentityproperty(self, "position", 255, z, NULL());
    }
  }
@end_script
    delay    2
    offset    17 17
    #platform 17 34 -17 -17 17 17 34 20
    frame    data/chars/misc/opselect/p1.gif
    frame    data/chars/misc/opselect/p1.gif

anim    freespecial3
@script
  if(frame==1){
    void self = getlocalvar("self");
    int x = getentityproperty(self, "x");
    int z = getentityproperty(self, "z");
    int Leap = getentityproperty(self, "antigrab");
    int ZMin = openborvariant("PLAYER_MIN_Z");

    int H = checkwall(x,z - Leap);
    int P = checkplatformbelow(x, z - Leap, 22);

    if(z - Leap > ZMin && H <= 0 && !P){
      int SFX = loadsample("data/sounds/beep.wav");

      playsample(SFX, 0, 120, 120, 100, 0);
      setglobalvar("PilP1", NULL());
      changeentityproperty(self, "position", x, z - Leap);
    }

    if(z == 176){ //From the top
        int SFX = loadsample("data/sounds/beep.wav");

        playsample(SFX, 0, 120, 120, 100, 0);
        setglobalvar("PilP1", NULL());
        changeentityproperty(self, "position", x, 210); //Switch to the bottom
    }
  }
@end_script
    delay    2
    offset    17 17
    #platform 17 34 -17 -17 17 17 34 20
    frame    data/chars/misc/opselect/p1.gif
    frame    data/chars/misc/opselect/p1.gif

anim    freespecial4
@script
  if(frame==1){
    void self = getlocalvar("self");
    int x = getentityproperty(self, "x");
    int z = getentityproperty(self, "z");
    int Leap = getentityproperty(self, "antigrab");
    int ZMax = openborvariant("PLAYER_MAX_Z");

    int H = checkwall(x,z + Leap);
    int P = checkplatformbelow(x, z + Leap, 22);

    if(z + Leap < ZMax && H <= 0 && !P){
      int SFX = loadsample("data/sounds/beep.wav");

      playsample(SFX, 0, 120, 120, 100, 0);
      setglobalvar("PilP1", NULL());
      changeentityproperty(self, "position", x, z + Leap);
    }

    if(z == 210){
        int SFX = loadsample("data/sounds/beep.wav");

        playsample(SFX, 0, 120, 120, 100, 0);
        setglobalvar("PilP1", NULL());
        changeentityproperty(self, "position", x, 176);
    }
  }
@end_script
    delay    2
    offset    17 17
    #platform 17 34 -17 -17 17 17 34 20
    frame    data/chars/misc/opselect/p1.gif
    frame    data/chars/misc/opselect/p1.gif

anim attack1 # Confirm
@script
int set = openborvariant("current_set");
  if(frame==1){
    void self = getlocalvar("self");
    void P1 = getplayerproperty(0, "entity"); // Calling player is important ONLY if you want anything to do with player especially maps/palettes
    int PIndex = getentityproperty(self,"playerindex") + 1;
    void P1Map = getentityproperty(P1, "map"); // Color map/palette
    void aniID1 = getentityproperty(P1, "animationid");
    int PLAY = openborvariant("count_players");

    setglobalvar("Chara" + PIndex, 2);
    setglobalvar("Mapra" + PIndex, 0); // 0 = first palette, 1 = alternate palette
    //setglobalvar("Battle1", 1);
  }

@end_script
    delay    8
    offset    17 17
    platform 17 34 -17 -17 17 17 34 20
    sound    data/sounds/beep2.wav
    frame    data/chars/misc/opselect/p1.gif
    delay 20
    frame    data/chars/misc/opselect/p1.gif
    delay 8
    frame    data/chars/misc/opselect/p1.gif
    delay 1
    #@cmd setglobalvar "Return" "Return"
    frame    data/chars/misc/opselect/p1.gif
    frame    data/chars/misc/opselect/p1.gif

anim freespecial5
@script
  if(frame==1){
    void self = getlocalvar("self");
    void P1 = getplayerproperty(0, "entity");
    int PIndex = getentityproperty(self,"playerindex") + 1;
    void P1Map = getentityproperty(P1, "map");

    setglobalvar("Chara" + PIndex, 2);
    setglobalvar("Mapra" + PIndex, 1);
  }
@end_script
    delay    8
    offset    17 17
    platform 17 34 -17 -17 17 17 34 20
    sound    data/sounds/beep2.wav
    frame    data/chars/misc/opselect/p1.gif
    delay 20
    frame    data/chars/misc/opselect/p1.gif
    delay 8
    frame    data/chars/misc/opselect/p1.gif

anim freespecial6
@script
  if(frame==1){
    void self = getlocalvar("self");
    void P1 = getplayerproperty(0, "entity");
    int PIndex = getentityproperty(self,"playerindex") + 1;
    void P1Map = getentityproperty(P1, "map");

    setglobalvar("Chara" + PIndex, 2);
    setglobalvar("Mapra" + PIndex, 2);
  }
@end_script
    delay    8
    offset    17 17
    platform 17 34 -17 -17 17 17 34 20
    sound    data/sounds/beep2.wav
    frame    data/chars/misc/opselect/p1.gif
    delay 20
    frame    data/chars/misc/opselect/p1.gif
    delay 8
    frame    data/chars/misc/opselect/p1.gif

anim freespecial7
@script
  if(frame==1){
    void self = getlocalvar("self");
    void P1 = getplayerproperty(0, "entity");
    int PIndex = getentityproperty(self,"playerindex") + 1;
    void P1Map = getentityproperty(P1, "map");

    setglobalvar("Chara" + PIndex, 2);
    setglobalvar("Mapra" + PIndex, 3);
  }
@end_script
    delay    8
    offset    17 17
    platform 17 34 -17 -17 17 17 34 20
    sound    data/sounds/beep2.wav
    frame    data/chars/misc/opselect/p1.gif
    delay 20
    frame    data/chars/misc/opselect/p1.gif
    delay 8
    frame    data/chars/misc/opselect/p1.gif

anim freespecial8
@script
  if(frame==1){
    void self = getlocalvar("self");
    void P1 = getplayerproperty(0, "entity");
    int PIndex = getentityproperty(self,"playerindex") + 1;
    void P1Map = getentityproperty(P1, "map");

    setglobalvar("Chara" + PIndex, 2);
    setglobalvar("Mapra" + PIndex, 4);
  }
@end_script
    delay    8
    offset    17 17
    platform 17 34 -17 -17 17 17 34 20
    sound    data/sounds/beep2.wav
    frame    data/chars/misc/opselect/p1.gif
    delay 20
    frame    data/chars/misc/opselect/p1.gif
    delay 8
    frame    data/chars/misc/opselect/p1.gif

anim freespecial9
@script
  if(frame==1){
    void self = getlocalvar("self");
    void P1 = getplayerproperty(0, "entity");
    int PIndex = getentityproperty(self,"playerindex") + 1;
    void P1Map = getentityproperty(P1, "map");

    setglobalvar("Chara" + PIndex, 2);
    setglobalvar("Mapra" + PIndex, 5);
  }
@end_script
    delay    8
    offset    17 17
    platform 17 34 -17 -17 17 17 34 20
    sound    data/sounds/beep2.wav
    frame    data/chars/misc/opselect/p1.gif
    delay 20
    frame    data/chars/misc/opselect/p1.gif
    delay 8
    frame    data/chars/misc/opselect/p1.gif

anim    spawn
    delay    1
    offset    17 17
    frame    data/chars/misc/opselect/p1.gif
    frame    data/chars/misc/opselect/p1.gif

Arcade mode limit in choosing character:
C:
name        Pilada
type        panel
speed        10

# Arcade Mode style (1P or 2P as single player; or going head-to-head)

anim    idle
@script
  if(frame > 1){
    int Play = openborvariant("count_players");
    void P1 = getplayerproperty(0, "entity");
    void P2 = getplayerproperty(1, "entity");
    char Ch1 = getglobalvar("Chara1");
    char Ch2 = getglobalvar("Chara2");
    char Path = getglobalvar("Path");

    if(Path){
      void self = getlocalvar("self");
      int P1 = getplayerproperty(0, "entity");
      int P2 = getplayerproperty(1, "entity");

      if(P1){
        changeentityproperty(P1,"noaicontrol",1);
      }
      if(P2){
        changeentityproperty(P2,"noaicontrol",1);
      }

      performattack(self, openborconstant("ANI_FOLLOW1"));
    }

    if(P1){
      char P1Name = getentityproperty(P1,"name");

      if(P1Name!="P1Cursor"){
        changeplayerproperty(0,"name","P1Cursor");
        changeentityproperty(P1, "model", "P1Cursor", 1);
        changeentityproperty(P1, "name", "P1Cursor");
        changeentityproperty(P1,"position", 51, 176);
      }
    }

    if(P2){
      char P2Name = getentityproperty(P2,"name");

      if(P2Name!="P2Cursor"){
        changeplayerproperty(1,"name","P2Cursor");
        changeentityproperty(P2, "model", "P2Cursor", 1);
        changeentityproperty(P2, "name", "P2Cursor");
        changeentityproperty(P2,"position", 51, 210);
      }
    }

    if(Ch1){
      changeentityproperty(P1,"noaicontrol",1);
    }
    if(Ch2){
      changeentityproperty(P2,"noaicontrol",1);
    }

    if(Play == 1){
     if(Ch1 || Ch2){
      void self = getlocalvar("self");

      performattack(self, openborconstant("ANI_FOLLOW1"));
     }
    } else if(Play == 2){
     if(Ch1 || Ch2){
      void self = getlocalvar("self");

      performattack(self, openborconstant("ANI_FOLLOW1"));
     }
    }
  }
@end_script
    loop    1
    delay    1
    offset    300 100
    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

anim    follow1
@script
  if(frame == 1){
    int P1 = getplayerproperty(0, "entity");
    int P2 = getplayerproperty(1, "entity");

    if(P1){
      char Ch1 = getglobalvar("PilP1");
      int Map1 = getglobalvar("Mapra1");

      changeplayerproperty(0,"name", Ch1);
      changeplayerproperty(0,"colourmap", Map1);
      changeentityproperty(P1, "model", Ch1, 1);
      changeentityproperty(P1, "name", Ch1);
      changeentityproperty(P1, "map", Map1);

      changeentityproperty(P1,"position", -300);
    }

    if(P2){
      char Ch2 = getglobalvar("PilP2");
      int Map2 = getglobalvar("Mapra2");

      changeplayerproperty(1,"name", Ch2);
      changeplayerproperty(1,"colourmap", Map2);
      changeentityproperty(P2, "model", Ch2, 1);
      changeentityproperty(P2, "name", Ch2);
      changeentityproperty(P2, "map", Map2);

      changeentityproperty(P2,"position", -300);
    }

    setglobalvar("Chara1", NULL());
    setglobalvar("Chara2", NULL());
    setglobalvar("Mapra1", NULL());
    setglobalvar("Mapra2", NULL());

    setglobalvar("Path", NULL());
    jumptobranch("Stage", 1);
  }
@end_script
    delay    100
    offset    10 17
    frame    data/chars/misc/empty.gif
    delay    10
    frame    data/chars/misc/empty.gif
    frame    data/chars/misc/empty.gif

Character slots:
Code:
name        slots
health        100
type        obstacle
facing          1
nolife      1
setlayer    500
aggression    1
palette        none
takedamagescript data/scripts/chus.c
animationscript data/chars/misc/slots/slots.c
offscreenkill    3000

anim    idle # Ryu
    loop    1
    delay    10
    offset    17 17
    bbox    0 0 34 34 200
    platform 1 1 1 1 1 1 1 1
    frame    data/chars/misc/slots/ryu.png
    frame    data/chars/misc/slots/ryu.png

anim    fall
    delay    10
    offset    17 17
    frame    data/chars/misc/slots/ryu.png

anim    spawn
    delay    2
    offset    17 17
    frame    data/chars/misc/slots/ryu.png
    @cmd    slots
    frame    data/chars/misc/slots/ryu.png

anim    follow2 # Ken
    loop    1
    delay    10
    offset    17 17
    bbox    0 0 34 34 200
    platform 1 1 1 1 1 1 1 1
    frame    data/chars/misc/slots/ken.png
    frame    data/chars/misc/slots/ken.png

anim    follow3 # Chun-Li
    loop    1
    delay    10
    offset    17 17
    bbox    0 0 34 34 200
    platform 1 1 1 1 1 1 1 1
    frame    data/chars/misc/slots/chun-li.png
    frame    data/chars/misc/slots/chun-li.png

anim    follow4 # Zangief
    loop    1
    delay    10
    offset    17 17
    bbox    0 0 34 34 200
    platform 1 1 1 1 1 1 1 1
    frame    data/chars/misc/slots/zangief.png
    frame    data/chars/misc/slots/zangief.png

anim    follow5 # Joe
    loop    1
    delay    10
    offset    17 17
    bbox    0 0 34 34 200
    platform 1 1 1 1 1 1 1 1
    frame    data/chars/misc/slots/joe.png
    frame    data/chars/misc/slots/joe.png

anim    follow6 # Dhalsim
    loop    1
    delay    10
    offset    17 17
    bbox    0 0 34 34 200
    platform 1 1 1 1 1 1 1 1
    frame    data/chars/misc/slots/dhalsim.png
    frame    data/chars/misc/slots/dhalsim.png

anim    follow7 # Eagle
    loop    1
    delay    10
    offset    17 17
    bbox    0 0 34 34 200
    platform 1 1 1 1 1 1 1 1
    frame    data/chars/misc/slots/eagle.png
    frame    data/chars/misc/slots/eagle.png

anim    follow8 # Guy
    loop    1
    delay    10
    offset    17 17
    bbox    0 0 34 34 200
    platform 1 1 1 1 1 1 1 1
    frame    data/chars/misc/slots/guy.png
    frame    data/chars/misc/slots/guy.png

anim    follow9 # Vega
    loop    1
    delay    10
    offset    17 17
    bbox    0 0 34 34 200
    platform 1 1 1 1 1 1 1 1
    frame    data/chars/misc/slots/vega.png
    frame    data/chars/misc/slots/vega.png

anim    follow10 # Balrog
    loop    1
    delay    10
    offset    17 17
    bbox    0 0 34 34 200
    platform 1 1 1 1 1 1 1 1
    frame    data/chars/misc/slots/balrog.png
    frame    data/chars/misc/slots/balrog.png

anim    follow11 # Bison
    loop    1
    delay    10
    offset    17 17
    bbox    0 0 34 34 200
    platform 1 1 1 1 1 1 1 1
    frame    data/chars/misc/slots/bison.png
    frame    data/chars/misc/slots/bison.png

anim    follow12 # Birdie
    loop    1
    delay    10
    offset    17 17
    bbox    0 0 34 34 200
    platform 1 1 1 1 1 1 1 1
    frame    data/chars/misc/slots/birdie.png
    frame    data/chars/misc/slots/birdie.png

anim    follow13 # Necro
    loop    1
    delay    10
    offset    17 17
    bbox    0 0 34 34 200
    platform 1 1 1 1 1 1 1 1
    frame    data/chars/misc/slots/necro.png
    frame    data/chars/misc/slots/necro.png

anim    follow14 # Guile
    loop    1
    delay    10
    offset    17 17
    bbox    0 0 34 34 200
    platform 1 1 1 1 1 1 1 1
    frame    data/chars/misc/slots/guile.png
    frame    data/chars/misc/slots/guile.png

C:
void slots()
{
      void self = getlocalvar("self");
      int Aggro = getentityproperty(self,"aggression");

      if(Aggro == 2){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW2"));
      } else if(Aggro == 3){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW3"));
      } else if(Aggro == 4){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW4"));
      } else if(Aggro == 5){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW5"));
      } else if(Aggro == 6){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW6"));
      } else if(Aggro == 7){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW7"));
      } else if(Aggro == 8){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW8"));
      } else if(Aggro == 9){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW9"));
      } else if(Aggro == 10){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW10"));
      } else if(Aggro == 11){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW11"));
      } else if(Aggro == 12){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW12"));
      } else if(Aggro == 13){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW13"));
      } else if(Aggro == 14){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW14"));
      }
}
 
Sorry for the double post, but I'm just continuing to include the related ones to the player select.

chus.c:
C:
void main()
{// Select player effect on damage
    void self = getlocalvar("self"); //Get calling entity.
    char Nama = getentityproperty(self,"name");
    void Opp = getlocalvar("attacker"); //Get attacker
    int PIndex = getentityproperty(Opp,"playerindex") + 1;

    setglobalvar("PilP" + PIndex, Nama);
}
 
I can't get it to work. I have a select screen as a level instead of a default one.

You know, I think that quoted texts would only be understandable for modders who have copied level select system.

But back to topic, what is actually not working here? did you fail to return to last stage? did it crashed? or something else?
 
I failed to return to last stage. I forgot to include the return level here.

return.txt (level):
Code:
bglayer        data/bgs/garden.png
panel        data/bgs/garden.png
order        a
direction    both
settime         0
nopause        1
nofadeout    1

nojoin    1
at    0

spawn   Return
@script
void main(){
    void self = getlocalvar("self");
    void Name = getentityproperty(self, "name");
    void Return = getglobalvar("Return");
    void Branch = openborvariant("current_branch");

    if(Return == NULL()){
        setglobalvar("Return", Return);
    }
}
@end_script
coords   160 200
at   0

spawn black
coords 1 240
at 0

#spawn return
#alias Stage_Ryu
#coords 0 180
#at 0

#spawn return
#alias Stage_Ken
#coords 0 200
#at 0

And this is the return entity in case you are wondering.

Return.txt (entity):

Code:
name Return
type none
antigravity      100

anim idle
@script
void self = getlocalvar("self");
char Name = getentityproperty(self, "name");
void Return = getglobalvar("Return");
int Plays = openborvariant("count_players");
int set = openborvariant("current_set");

       if(frame == 1 && Plays == 1 && set == 0){
        jumptobranch(Return, 1);
    //changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
       }

@end_script
    offset 1 1
    loop 1
    delay 5
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim follow1
@script
    void self = getlocalvar("self");
    void Name = getentityproperty(self, "name");
    void Return = getglobalvar("Return");

    if(frame == 0){
        setglobalvar("Return", Name);
        jumptobranch("Returning", 1);
    }
@end_script
    offset 1 1
    delay 5
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
 
After going back to the select screen with set to type none for CountD, I selected the character and it started to crash.

Log:

I just found out. When I have the first branch (Arcade_Select) set here for level 1, it crashes. But if I don't have it set and Stage_Ryu is the first branch, it skips to the title screen after continuing and selecting a character. As a result, it fails to return to the last level.

Code:
set    Testing_Fight_Level # 0
lives 1
credits 30
noshare 1
cansave 0
continuescore 1 #Determines how taking continue effect score. 1 = score reset to 0 when continue; 2 = 1 point added to your score when continue. like capcom scoring system for putting continue numbers in scores
disablehof 1
disablegameover 1
skipselect player1 player2
branch Arcade_Select
z    173 230 173
file    data/levels/charatest.txt # level 1
branch    Stage_Ryu
z    227 227 227
file    data/levels/ryu_stage.txt # level 2
#branch    Stage_Eagle
#z    200 200 200
#file    data/levels/eagle.txt # level 3
branch    Stage_Ken
z    227 227 227
file    data/levels/ken.txt # level 4
branch    Ended
z    230 230 230
file    data/levels/emptyspace.txt # level 5
end
branch Returning
skipselect player1 player2
z    173 230 173
file    data/levels/charatest.txt # level 1
#file    data/levels/charatest.txt
file    data/levels/return.txt
file    data/levels/return.txt

Player starter:
Code:
name player1
type player
health 1 #100
speed 10
turndelay 9999999999999999999999
#facing 1
#antigravity 100
subject_to_gravity 0
subject_to_obstacle 0
subject_to_wall    1
subject_to_platform 0
subject_to_hole 1
no_adjust_base  0
shadow        0
#candamage    enemy obstacle
atchain        1
load        Challenger
load        black-fade-out

animationscript data/scripts/script.c
ondrawscript data/scripts/dumdraw.c
onspawnscript data/scripts/arcSpawn.c
#onspawnscript data/chars/misc/opselect/p1join.c

script @script
void main(){
    changeentityproperty(getlocalvar("self"), "name", "_");
}
@end_script

anim waiting
    delay 4
    offset 1 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim select
    delay 4
    offset 1 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim spawn
    delay 9
    offset 1 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim respawn
    delay 9
    offset 1 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim idle
    
    loop 1
    delay 6
    offset 1 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim walk

    loop 1
    delay 6
    offset 1 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim backwalk

    loop 1
    delay 6
    offset 1 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim pain
    delay 4
    offset 1 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim attack
    delay 4
    offset 1 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim fall
    delay 4
    offset 1 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim rise
    delay 4
    offset 1 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim follow1 # Return to Character Select Screen after Continue

    delay 120
    offset 1 1
    subentity black-fade-out
    spawnframe 0 0 240 0 0
    frame data/chars/misc/empty.gif
    delay 6
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    @cmd jumptobranch "Returning" 1
    frame data/chars/misc/empty.gif

anim follow2 # Here comes a new challenger
    delay 9
    offset 1 1
    custentity Challenger
    spawnframe 0 0 0 0 0
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim follow3 # First player returns to select screen or second player joins after first player loses completely

    delay 1
    offset 1 1
    @cmd clearglobalvar
    frame data/chars/misc/empty.gif
    delay 6
    @cmd jumptobranch "Returning" 1
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
 
Last edited:
This time, I figured out the argument for the Return entity when it is in the first game mode, but still, I can't jump to a certain branch. I changed the varname (variant name) in the argument (under second frame).

Code:
anim idle
@script
void self = getlocalvar("self");
char Name = getentityproperty(self, "name");
void Return = getglobalvar("Return");
int Plays = openborvariant("count_players");
int set = openborvariant("current_set");

       if(frame == 1 && Plays == 1 && set == 0){
        //jumptobranch("Stage", 1);
        jumptobranch("Return", 1);
       }

@end_script
    offset 1 1
    loop 1
    delay 5
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

"Return" is not a branch name in levels.txt and it looks like it's not specify which branch to go with. I'm under "Returning" branch after losing the battle and I want to return the last level I left off. How to do it?
 
I believe it should be:
C:
@script
void self = getlocalvar("self");
char Name = getentityproperty(self, "name");
void Return = getglobalvar("Return");
int Plays = openborvariant("count_players");
int set = openborvariant("current_set");

       if(frame == 1 && Plays == 1 && set == 0){
        jumptobranch(Return, 1);
       }
@end_script
 
I did that and realized that could be it. Got one element down, a few more to go for it to register.

I'm tired of showing full codes here. I don't wanna be redundant of it, so I show it with PasteBin links for now.

Pilada.txt (part of select element similar to Pilmon.txt). Take a look at Return variable/function. Am I doing it wrong? Here:

Return.txt (level part). The Return level spawns Return entity to load with globalvar. Look at the script tag of it. The spawned Black entity is a none type entity in case you're wondering.

CHARATEST.txt (similar to Pilih.txt). Playerports is similar to Modis and Slots is similar to Foto. Is there anything I did wrong here for setting globalvars in attempting to return to last levels? Take a look at "Return" globals or something.

I have the Returning branch part in first set under levels.txt.

Code:
set    Testing_Fight_Level # 0
lives 1
credits 30
noshare 1
cansave 0
continuescore 1 #Determines how taking continue effect score. 1 = score reset to 0 when continue; 2 = 1 point added to your score when continue. like capcom scoring system for putting continue numbers in scores
disablehof 1
disablegameover 1
#single 1
#z    230 230 230
#file    data/levels/emptyspace.txt
skipselect player1 player2
#branch Arcade_Select
z    173 230 173
file    data/levels/charatest.txt # level 1
#z    230 230 230
#file    data/levels/darknc.txt

#branch 0 #Ryu
#z    485 485 485
#file    data/levels/ryu.txt

#branch    Enemy_VS_Test
#z    200 200 200
#file    data/levels/Enemy_InvTest.txt # level 2
branch    Stage_Ryu
z    227 227 227
file    data/levels/ryu_stage.txt # level 2
#branch    Stage_Eagle
#z    200 200 200
#file    data/levels/eagle.txt # level 3
branch    Stage_Ken
z    227 227 227
file    data/levels/ken.txt # level 4
branch    Ended
z    230 230 230
file    data/levels/emptyspace.txt # level 5
end
branch Returning
skipselect player1 player2
z    173 230 173
file    data/levels/charatest.txt # level 1
#file    data/levels/charatest.txt
file    data/levels/return.txt # <-- Return level for jumping to last levels
file    data/levels/return.txt

Player 1 cursor for character select screen (P1Cursor.txt, similar to Kursor1.txt; check anim attack in there):

Is this because I didn't declare the return globalvar in the player cursor?
 
I've checked Pilada.txt and I found this:
Code:
    setglobalvar("Return", NULL());
    jumptobranch("Stage", 1);

You cleared "Return" variable but you haven't used anything stored there yet, because you jump to branch called "Stage".
It should be like this:
Code:
    jumptobranch(Return, 1);

This would work properly if you've stored correct return branchname in match level, such as : Stage_Eagle in eagle.txt or Stage_Ken in ken.txt . You've done that right? :)
 
Thanks, Bloodbane! It worked! :D But I solved the returning point by observing carefully at how @Blade Master did his SelectNPC.txt level and other elements used for jumping to a certain branch instead of just Map branch, and playing with the fake player's onspawnscript, using how he did it, but I made them to different branches. I figured out how I could get anything stored to the return variable in its spawn script. :) I think you can do it with the global player joining script (join#.c; # as in player index; e.g. 1 for player 1). Before I show you the elements, here's my udpated levels.txt. (I'm not using Returning branch anymore because it's pointless now.)

Code:
set    Testing_Fight_Level # 0
lives 1
credits 30
noshare 1
cansave 0
continuescore 1
disablehof 1
disablegameover 1
skipselect player1 player2
z    173 230 173
file    data/levels/charatest.txt # level 1
branch Arcade_Select
z    173 230 173
file    data/levels/charatest.txt # level 2
file    data/levels/return.txt # level 3
branch    Stage_Ryu
z    227 227 227
file    data/levels/ryu_stage.txt # level 4
branch    Stage_Eagle
z    200 200 200
file    data/levels/eagle.txt # level 5
branch    Stage_Ken
z    227 227 227
file    data/levels/ken.txt # level 6
branch    Ended
z    230 230 230
file    data/levels/emptyspace.txt # level 7
end

Here is my spawn script for the fake player's respawn anims.

I just updated the player 1 spawner which is used to spawn or respawn.

In case you get confused with assigning which levels to use, here's a better one with branches.

C:
    if(PLAY == 1 && set == 0){
        if(branch == "Stage_Ryu"){
            if( (aniID == RESPAWN || aniID == SPAWN) && Return == NULL() ){
                setglobalvar("Return","Stage_Ryu"); //Return to Ryu's stage?
                performattack(self, openborconstant("ANI_FOLLOW3"));
                jumptobranch("Arcade_Select", 1); //Jump to select screen
            }
        }

        if(branch == "Stage_Eagle"){
            if( (aniID == RESPAWN || aniID == SPAWN) && Return == NULL() ){
                setglobalvar("Return","Stage_Eagle"); // Return to Eagle's stage?
                performattack(self, openborconstant("ANI_FOLLOW3"));
                jumptobranch("Arcade_Select", 1); //Jump to select screen
            }
        }

        if(branch == "Stage_Ken"){
            if( (aniID == RESPAWN || aniID == SPAWN) && Return == NULL() ){
                setglobalvar("Return","Stage_Ken"); // Return to Ken's stage?
                performattack(self, openborconstant("ANI_FOLLOW3"));
                jumptobranch("Arcade_Select", 1); //Jump to select screen
            }
        }
    }

I updated the return level here.

Return.txt (level):
Code:
bglayer        data/bgs/garden.png
panel        data/bgs/garden.png
order        a
direction    both
settime         0
nopause        1
nofadeout    1

nojoin    1
at    0

spawn   Return
@script
void main(){
    void self = getlocalvar("self");
    void Return = getglobalvar("Return");

    if(Return == NULL()){
        setglobalvar("Return", "Arcade_Select");
    }
}
@end_script
coords   160 200
at   0

spawn black
coords 1 240
at 0

I'm not gonna show everything from the character select level. But just some relevant one(s) for jumping to stages here.

Code:
bglayer        data/bgs/title/select.png
fglayer        data/bgs/title/select.png 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
panel        data/chars/misc/empty.gif
#music        data/music/opselect.bor
direction    both
scrollspeed    0
settime        0
notime        1
#nopause        1
nofadeout    1
order        a
spawn1        210 115
spawn2        220 115
wall        50 239 -500 -500 0 0 200 5000 # Left side
wall        280 239 0 0 70 70 200 5000 # Right side
wall        0 239 -500 -500 500 500 15 5000 # Below
type        1 0 0

#levelscript data/levels/select_screen_arcade.c

spawn    empty 1
@script
void main()
{
    setglobalvar("PilP1", NULL());
    setglobalvar("PilP2", NULL());
}
@end_script
coords    160 240
at    0

spawn    empty 1
@script
void main()
{
    void self = getlocalvar("self");
    void Return = getglobalvar("Return");
    
    if(Return == NULL()){
    setglobalvar("Return","Stage_Ryu");
    }
}
@end_script
coords    160 240 50
at    0

spawn    Pilada 1
@script
void main(){
    void self = getlocalvar("self");
    int Return = getglobalvar("Return");

    if(Return == NULL()){
        setglobalvar("Return","Stage_Eagle");
    }
}
@end_script
coords    160 150
at    0

spawn    PlayerPorts 1
#flip    1
coords    70 260
at    0

spawn    PlayerPorts 1
mp    2
flip    1
coords    250 260
at    0

I was checking on Robz Rush mod on the "pause" menu and there are two parts that play their role as a pause for upgrade menu. Pauser (none type) and PausM (text type). I understand they have keys active with index, but the index and keys are what confuse me, such as St for start, and 0St for player 1's start. I tried it before, pretty confusing to know how they are handled as keys. Hmm... it seems that St is getglobalvar("0St"), isn't it? My none type ent is not a pause, but I wanna try to do the keys on the none type ent. How can I handle the index keys for 2 players separately? I plan on changing frame upon pressing any button under one animation. Otherwise, I'd separate them into animations.

P.S.: I still have limited knowledge of globalvars, localvars, and entityvars and how they are set. But getlocalvar("self") is very easy to identity as an entity itself. :)
 
I was working on the key for the countdown but I have trouble with the one in the script tag here. Take a look at 0A and 1A as I'm trying to register as attack keys to change frame.


Log:

Personal keyscript for the countdown entity.

Code:
void main(){
    continueKey();
}

void continueKey(){
    int player = getlocalvar("player");
    void self = getlocalvar("self");
    int frame = getentityproperty(self, "animpos");
    //int self = getplayerproperty(player, "entity");
    int attack = playerkeys(player, 1, "attack");
    int attack2 = playerkeys(player, 1, "attack2");
    int attack3 = playerkeys(player, 1, "attack3");
    int attack4 = playerkeys(player, 1, "attack4");
    int jump = playerkeys(player, 1, "jump");
    int special = playerkeys(player, 1, "special");

    int attackR = playerkeys(player, 2, "attack");
    int attack2R = playerkeys(player, 2, "attack2");
    int attack3R = playerkeys(player, 2, "attack3");
    int attack4R = playerkeys(player, 2, "attack4");
    int jumpR = playerkeys(player, 2, "jump");
    int specialR = playerkeys(player, 2, "special");

    int anybutton = playerkeys(player, 1, "anybutton");
    int anybuttonR = playerkeys(player, 2, "anybutton");

    // Action event capture

    if(anybutton){
        setglobalvar("AB", 1);
    }

    if(attack){
        setglobalvar(player+"A", 1);
    }
    if(attackR){
        setglobalvar(player+"A", NULL());
    }

    if(attack2){
        setglobalvar(player+"A2", 1);
    }
    if(attack2R){
        setglobalvar(player+"A2", NULL());
    }

    if(attack3){
        setglobalvar(player+"A3", 1);
    }
    if(attack3R){
        setglobalvar(player+"A3", NULL());
    }

    if(attack4){
        setglobalvar(player+"A4", 1);
    }
    if(attack4R){
        setglobalvar(player+"A4", NULL());
    }

    if(jump){
        setglobalvar(player+"J", 1);
    }
    if(jumpR){
        setglobalvar(player+"J", NULL());
    }

    if(special){
        setglobalvar(player+"S", 1);
    }
    if(specialR){
        setglobalvar(player+"S", NULL());
    }
   
}

I'm trying to store player index with index keys for pressing. How do I register player index and keys for changing frame in that animation?

EDIT: This is the player's opponent's victory in case you wanna know as an example.

Code:
name    EnemyWin
health  2
type text
#type none
shadow 0
nolife  1
palette none
speed 10 #speed {value} # Used for panel type entity
nomove 1 1
nodrop 1
nopain  1
load CountD
load continue
load black
#setlayer   345000000 
#setlayer    400000000 
setlayer    100
#animationscript data/scripts/script.c
animationscript data/scripts/textpos.c
#onspawnscript data/scripts/winSpawn.c
#ondrawscript data/scripts/winText.c

anim idle # Ryu
    offset 40 1
    delay 650
    custentity CountD
    #subentity continue
    spawnframe 1 200 60 0 1
    @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!"
    #@cmd spawn06 "Black" 0 0 660
    frame data/sprites/portraits/ryu.png
    delay 90
    @cmd    changeopenborvariant "nojoin" 0
    @cmd    changeopenborvariant "nopause" 0
    @cmd    drawdialog1 0 "_"
    @cmd    drawdialog2 1 "_"
    @cmd killentity getlocalvar("self")
    @cmd    playmusic "data/music/continue.bor" 1 528400.25
    frame data/sprites/portraits/ryu.png
 
Last edited:
I'm so glad my mod helped you. A suggestion, if you are using a global variable to know if some keys are being pressed you have to put it in a repeating animation, so that it is updated periodically (I discovered it the bad way HAHA).

a small example:

Code:
anim    follow1
@script
        if(frame == 0)
    {
 setglobalvar("MenuMove",0);
  setglobalvar("MenuSelect",0);
    }
    if(frame >= 1){

    void self = getlocalvar("self");
    int move = getglobalvar("MenuMove");//update the keys
    int ok = getglobalvar("MenuSelect");//update the keys

        if(move == 2)
    {
 changeentityproperty(self,"animation",openborconstant("ANI_FOLLOW2"));
    }
 else if(move == -2)
    {
 changeentityproperty(self,"animation",openborconstant("ANI_FOLLOW3"));
    }
    if(ok == 2)
    {
 changeentityproperty(self,"animation",openborconstant("ANI_FOLLOW4"));
    }
}
    @end_script  
    loop    1 2
    delay    5
    offset    240 0
    sound    data/sounds/beep.wav
    frame    data/chars/system/inn01.png
    frame    data/chars/system/inn01.png
 
Back
Top Bottom