Solved rush question.

Question that is answered or resolved.

DD Tokki

Well-known member
bor - 0022.png

rush.PNG

When moving from one stage to the next, max rush is initialized and changes to 0 when 100 is recorded, so the max record is not reflected on the complete screen. I would like to solve this problem.
 
View attachment 5186

View attachment 5188

When moving from one stage to the next, max rush is initialized and changes to 0 when 100 is recorded, so the max record is not reflected on the complete screen. I would like to solve this problem.
Here's my suggestion, put the code below in the endlevel.c/level.c script events respectively.

endlevel.c
C:
void main()
{
    saveMaxRush();
}

void saveMaxRush()
{//Save max rush counter when the level ends

    if(openborvariant("current_set") != 1){
        void player1 = getplayerproperty(0, "entity"); //IDENTIFY PLAYER 1
        void player2 = getplayerproperty(1, "entity"); //IDENTIFY PLAYER 2
        void player3 = getplayerproperty(2, "entity"); //IDENTIFY PLAYER 3
        void player4 = getplayerproperty(3, "entity"); //IDENTIFY PLAYER 4
        
        //IS PLAYER PLAYING THE GAME?? SAVE CURRENT PLAYER MAX RUSH COUNT
        if(player1 != NULL()){setglobalvar("maxRush1", getentityproperty(player1, "rush_tally"));}
        if(player2 != NULL()){setglobalvar("maxRush2", getentityproperty(player2, "rush_tally"));}
        if(player3 != NULL()){setglobalvar("maxRush3", getentityproperty(player3, "rush_tally"));}
        if(player4 != NULL()){setglobalvar("maxRush4", getentityproperty(player4, "rush_tally"));}
    }
}

level.c
C:
void main()
{
    loadMaxRush();
}

void loadMaxRush()
{//Load saved max rush counter and apply when the level starts
    void player1 = getplayerproperty(0, "entity"); //IDENTIFY PLAYER 1
    void player2 = getplayerproperty(1, "entity"); //IDENTIFY PLAYER 2
    void player3 = getplayerproperty(2, "entity"); //IDENTIFY PLAYER 3
    void player4 = getplayerproperty(3, "entity"); //IDENTIFY PLAYER 4
    
    if(player1 != NULL()){ //IS PLAYER 1 PLAYING THE GAME??
        changeentityproperty(player1, "rush_tally", getglobalvar("maxRush1")); //CHANGE PLAYER 1 MAX RUSH COUNT WITH LOADED VALUE
    }
    if(player2 != NULL()){ //IS PLAYER 2 PLAYING THE GAME??
        changeentityproperty(player2, "rush_tally", getglobalvar("maxRush2")); //CHANGE PLAYER 2 MAX RUSH COUNT WITH LOADED VALUE
    }
    if(player3 != NULL()){ //IS PLAYER 3 PLAYING THE GAME??
        changeentityproperty(player3, "rush_tally", getglobalvar("maxRush3")); //CHANGE PLAYER 3 MAX RUSH COUNT WITH LOADED VALUE
    }
    if(player4 != NULL()){ //IS PLAYER 4 PLAYING THE GAME??
        changeentityproperty(player4, "rush_tally", getglobalvar("maxRush4")); //CHANGE PLAYER 4 MAX RUSH COUNT WITH LOADED VALUE
    }
}
 
Here's my suggestion, put the code below in the endlevel.c/level.c script events respectively.

endlevel.c
C:
void main()
{
    saveMaxRush();
}

void saveMaxRush()
{//Save max rush counter when the level ends

    if(openborvariant("current_set") != 1){
        void player1 = getplayerproperty(0, "entity"); //IDENTIFY PLAYER 1
        void player2 = getplayerproperty(1, "entity"); //IDENTIFY PLAYER 2
        void player3 = getplayerproperty(2, "entity"); //IDENTIFY PLAYER 3
        void player4 = getplayerproperty(3, "entity"); //IDENTIFY PLAYER 4
       
        //IS PLAYER PLAYING THE GAME?? SAVE CURRENT PLAYER MAX RUSH COUNT
        if(player1 != NULL()){setglobalvar("maxRush1", getentityproperty(player1, "rush_tally"));}
        if(player2 != NULL()){setglobalvar("maxRush2", getentityproperty(player2, "rush_tally"));}
        if(player3 != NULL()){setglobalvar("maxRush3", getentityproperty(player3, "rush_tally"));}
        if(player4 != NULL()){setglobalvar("maxRush4", getentityproperty(player4, "rush_tally"));}
    }
}

level.c
C:
void main()
{
    loadMaxRush();
}

void loadMaxRush()
{//Load saved max rush counter and apply when the level starts
    void player1 = getplayerproperty(0, "entity"); //IDENTIFY PLAYER 1
    void player2 = getplayerproperty(1, "entity"); //IDENTIFY PLAYER 2
    void player3 = getplayerproperty(2, "entity"); //IDENTIFY PLAYER 3
    void player4 = getplayerproperty(3, "entity"); //IDENTIFY PLAYER 4
   
    if(player1 != NULL()){ //IS PLAYER 1 PLAYING THE GAME??
        changeentityproperty(player1, "rush_tally", getglobalvar("maxRush1")); //CHANGE PLAYER 1 MAX RUSH COUNT WITH LOADED VALUE
    }
    if(player2 != NULL()){ //IS PLAYER 2 PLAYING THE GAME??
        changeentityproperty(player2, "rush_tally", getglobalvar("maxRush2")); //CHANGE PLAYER 2 MAX RUSH COUNT WITH LOADED VALUE
    }
    if(player3 != NULL()){ //IS PLAYER 3 PLAYING THE GAME??
        changeentityproperty(player3, "rush_tally", getglobalvar("maxRush3")); //CHANGE PLAYER 3 MAX RUSH COUNT WITH LOADED VALUE
    }
    if(player4 != NULL()){ //IS PLAYER 4 PLAYING THE GAME??
        changeentityproperty(player4, "rush_tally", getglobalvar("maxRush4")); //CHANGE PLAYER 4 MAX RUSH COUNT WITH LOADED VALUE
    }
}
Can I just write this script in the character header?
 
There's no level event in the character header, only entity events. But the code I posted is simple, just copy/paste it in the level/endlevel files and everything will be fine.
script.PNGscript2.PNG

I put the script in the script folder and ran it, but the max value is still reset when I pass the stage.
 
This is the same script I'm using in the SORX, something may be wrong in your game. You can remove the openborvariant("current_set") requirement in case it's not necessary in your game.

Street of Rage x's script cannot be applied to my game without modification. I remember it worked after I modified it.
 
What script? It depends on what code you are using, the one I posted is really simple and can be applied in any game.
C:
set    Test #========================================
lives        5
credits        20
nosame         1 1
custfade        40
noshare         0
cansave        2
typemp        0

skipselect
select    data/select1.txt

z    180 268
file    data/level/stage02/L2/stage02c.txt
file    data/level/stage02/L2/stage02c.txt

set    Start #========================================
lives        5
credits        20
nosame         1 1
custfade        40
noshare         0
cansave        2
typemp        0

# [Start Menu]========================================
skipselect    Robert Robert
z    119 206
file     data/level/menu/start-menu.txt

# [Story Difficulty]========================================
branch    Story_Difficulty
z    119 206
file     data/level/menu/story-difficulty.txt

# [Survival Difficulty]========================================
branch    Survival_Difficulty
z    119 206
file     data/level/menu/survival-difficulty.txt

# [Boss Rush Difficulty]========================================
branch    Boss_Rush_Difficulty
z    119 206
file     data/level/menu/boss_rush-difficulty.txt

# [Story Easy]========================================
branch    Story_Easy
    
# [Stage00 Easy]
scene    data/scenes/event01.txt
select    data/select1.txt
z    162 274
file    data/level/stage00/L1/stage00a.txt
file    data/level/stage00/L1/stage00b.txt
scene    data/scenes/event02.txt
next   

# [Stage01 Easy]
select    data/select1.txt
z    190 243
file    data/level/stage01/L1/stage01a.txt
z    174 274
file    data/level/stage01/L1/stage01b.txt
z    182 274
file    data/level/stage01/L1/stage01c.txt
next   

# [Stage02 Easy]
select    data/select1.txt
z    210 274
file    data/level/stage02/L1/stage02a.txt
z    180 274
file    data/level/stage02/L1/stage02b.txt
z    180 268
file    data/level/stage02/L1/stage02c.txt
next
end

# [Story Normal]========================================
branch    Story_Normal
    
# [Stage00 Normal]
scene    data/scenes/event01.txt
select    data/select1.txt
z    162 274
file    data/level/stage00/L2/stage00a.txt
file    data/level/stage00/L2/stage00b.txt
scene    data/scenes/event02.txt
next   

# [Stage01 Normal]
select    data/select1.txt
z    190 243
file    data/level/stage01/L2/stage01a.txt
z    174 274
file    data/level/stage01/L2/stage01b.txt
z    182 274
file    data/level/stage01/L2/stage01c.txt
next   

# [Stage02 Normal]
select    data/select1.txt
z    210 274
file    data/level/stage02/L2/stage02a.txt
z    180 274
file    data/level/stage02/L2/stage02b.txt
z    180 268
file    data/level/stage02/L2/stage02c.txt
next
end

# [Story Hard]========================================
branch    Story_Hard
    
# [Stage00 Hard]
scene    data/scenes/event01.txt
select    data/select1.txt
z    162 274
file    data/level/stage00/L3/stage00a.txt
file    data/level/stage00/L3/stage00b.txt
scene    data/scenes/event02.txt
next   

# [Stage01 Hard]
select    data/select1.txt
z    190 243
file    data/level/stage01/L3/stage01a.txt
z    174 274
file    data/level/stage01/L3/stage01b.txt
z    182 274
file    data/level/stage01/L3/stage01c.txt
next   

# [Stage02 Hard]
select    data/select1.txt
z    210 274
file    data/level/stage02/L3/stage02a.txt
z    180 274
file    data/level/stage02/L3/stage02b.txt
z    180 268
file    data/level/stage02/L3/stage02c.txt
next
end

# [Story Extreme]========================================
branch    Story_Extreme
    
# [Stage00 Extreme]
scene    data/scenes/event01.txt
select    data/select1.txt
z    162 274
file    data/level/stage00/L4/stage00a.txt
file    data/level/stage00/L4/stage00b.txt
scene    data/scenes/event02.txt
next   

# [Stage01 Extreme]
select    data/select1.txt
z    190 243
file    data/level/stage01/L4/stage01a.txt
z    174 274
file    data/level/stage01/L4/stage01b.txt
z    182 274
file    data/level/stage01/L4/stage01c.txt
next   

# [Stage02 Extreme]
select    data/select1.txt
z    210 274
file    data/level/stage02/L4/stage02a.txt
z    180 274
file    data/level/stage02/L4/stage02b.txt
z    180 268
file    data/level/stage02/L4/stage02c.txt
next
end

# [Survival Easy]========================================
branch    Survival_Easy
end

# [Survival Normal]========================================
branch    Survival_Normal
end

# [Survival Hard]========================================
branch    Survival_Hard
end

# [Survival Extreme]========================================
branch    Survival_Extreme
end

# [Boss Rush Easy]========================================
branch    Boss_Rush_Easy

select    data/select1.txt
z    162 274
file    data/level/stage00/L1/boss_rush00.txt
z    182 274
file    data/level/stage01/L1/boss_rush01.txt
z    180 268
file    data/level/stage02/L1/boss_rush02.txt
end

# [Boss Rush Normal]========================================
branch    Boss_Rush_Normal

select    data/select1.txt
z    162 274
file    data/level/stage00/L2/boss_rush00.txt
z    182 274
file    data/level/stage01/L2/boss_rush01.txt
z    180 268
file    data/level/stage02/L2/boss_rush02.txt
end

# [Boss Rush Hard]========================================
branch    Boss_Rush_Hard

select    data/select1.txt
z    162 274
file    data/level/stage00/L3/boss_rush00.txt
z    182 274
file    data/level/stage01/L3/boss_rush01.txt
z    180 268
file    data/level/stage02/L3/boss_rush02.txt
end

# [Boss Rush Extreme]========================================
branch    Boss_Rush_Extreme

select    data/select1.txt
z    162 274
file    data/level/stage00/L4/boss_rush00.txt
z    182 274
file    data/level/stage01/L4/boss_rush01.txt
z    180 268
file    data/level/stage02/L4/boss_rush02.txt
end

# [Practice]========================================
branch    Practice
end

After continued testing, the script works well on stages that start with "Set".
It seems that the rush script does not work on the stage selected from the menu customized with "branch".
 
Do you remember one example I showed you about using reset 0 in levelscript from one particular level?

Like Kratus said, he made a very simple example of how he made the rush tally. But I think what you can do is to integrate his example and one for your particular level which you wish to set it to 0. If that doesn't work, maybe you can try using branch for both stage 1-A and stage 1-B. Try using levelscript for stage 1-B whether it's in branch or not.

I think what you're trying to do is to create a rush tally and collect its highest numbers in the end from the previous levels for one particular stage. The next level in the same stage is where you want to reset its rush score to 0. It's something like this, for instance. You reach 15 hits max, the end of the first level. Next level, you have it reset to 0, but this time, you make either smaller or bigger hits than what you did previously. Or it can be the same. It doesn't matter. What you want is to collect all the number of max hits you did from those certain levels just for the rush count results.
 
Do you remember one example I showed you about using reset 0 in levelscript from one particular level?

Like Kratus said, he made a very simple example of how he made the rush tally. But I think what you can do is to integrate his example and one for your particular level which you wish to set it to 0. If that doesn't work, maybe you can try using branch for both stage 1-A and stage 1-B. Try using levelscript for stage 1-B whether it's in branch or not.

I think what you're trying to do is to create a rush tally and collect its highest numbers in the end from the previous levels for one particular stage. The next level in the same stage is where you want to reset its rush score to 0. It's something like this, for instance. You reach 15 hits max, the end of the first level. Next level, you have it reset to 0, but this time, you make either smaller or bigger hits than what you did previously. Or it can be the same. It doesn't matter. What you want is to collect all the number of max hits you did from those certain levels just for the rush count results.
That's right. What I'm trying to do is calculate the max value as the score at the end of the stage.

The script posted by kratus is a script that maintains the rush max value even if the stage passes.

As long as this is in the script folder, the max value is maintained without any special writing, but when there is no script, it returns to 0.

If I just set this, it works normally, but in the level I made, it resets to 0, which is a difficult situation.

I would like to know more about the solution to this problem.
 
offtopic but @DD Tokki nice work on the complete screen! modifying that screen is one of the most painful things to do on OpenBOR - for whatever reason, everything uses a position releative to the lifebar instead of the screen borders.

But I have a small suggestion: You can get rid of the extra "1P/2P" text in every line.
This makes whe text easier to be read, take a look
1694522953496.png

A former design professor who taught me showed me a design rule that I still use today: where everything is highlighted, nothing is highlighted.
 
offtopic but @DD Tokki nice work on the complete screen! modifying that screen is one of the most painful things to do on OpenBOR - for whatever reason, everything uses a position releative to the lifebar instead of the screen borders.

But I have a small suggestion: You can get rid of the extra "1P/2P" text in every line.
This makes whe text easier to be read, take a look
View attachment 5204

A former design professor who taught me showed me a design rule that I still use today: where everything is highlighted, nothing is highlighted.
bor - 0020.png

I made changes based on opinions.
 
Last edited:
After continued testing, the script works well on stages that start with "Set".
It seems that the rush script does not work on the stage selected from the menu customized with "branch".
Maybe your problem is related to the current_set check in my script, as I said you can remove it if it's not necessary in your game. I see that the set with branches is the set 1, which is avoided in my script, I made this step to avoid the survival mode in the SORX.
But the problem is not connected with branches, it's just an coincidence due to the set number, in SORX I'm using branches a lot with no problems.

1694537331205.png

1694537006140.png

Previous
C:
void main()
{
    saveMaxRush();
}

void saveMaxRush()
{//Save max rush counter when the level ends

    if(openborvariant("current_set") != 1){
        void player1 = getplayerproperty(0, "entity"); //IDENTIFY PLAYER 1
        void player2 = getplayerproperty(1, "entity"); //IDENTIFY PLAYER 2
        void player3 = getplayerproperty(2, "entity"); //IDENTIFY PLAYER 3
        void player4 = getplayerproperty(3, "entity"); //IDENTIFY PLAYER 4
        
        //IS PLAYER PLAYING THE GAME?? SAVE CURRENT PLAYER MAX RUSH COUNT
        if(player1 != NULL()){setglobalvar("maxRush1", getentityproperty(player1, "rush_tally"));}
        if(player2 != NULL()){setglobalvar("maxRush2", getentityproperty(player2, "rush_tally"));}
        if(player3 != NULL()){setglobalvar("maxRush3", getentityproperty(player3, "rush_tally"));}
        if(player4 != NULL()){setglobalvar("maxRush4", getentityproperty(player4, "rush_tally"));}
    }
}

Fixed
C:
void main()
{
    saveMaxRush();
}

void saveMaxRush()
{//Save max rush counter when the level ends
    void player1 = getplayerproperty(0, "entity"); //IDENTIFY PLAYER 1
    void player2 = getplayerproperty(1, "entity"); //IDENTIFY PLAYER 2
    void player3 = getplayerproperty(2, "entity"); //IDENTIFY PLAYER 3
    void player4 = getplayerproperty(3, "entity"); //IDENTIFY PLAYER 4

    //IS PLAYER PLAYING THE GAME?? SAVE CURRENT PLAYER MAX RUSH COUNT
    if(player1 != NULL()){setglobalvar("maxRush1", getentityproperty(player1, "rush_tally"));}
    if(player2 != NULL()){setglobalvar("maxRush2", getentityproperty(player2, "rush_tally"));}
    if(player3 != NULL()){setglobalvar("maxRush3", getentityproperty(player3, "rush_tally"));}
    if(player4 != NULL()){setglobalvar("maxRush4", getentityproperty(player4, "rush_tally"));}
}
 
Back
Top Bottom