Custom GameOver and Complete Screen

dantedevil

Well-known member
I decide use this new features:
Code:
noshowcomplete {int}
~set 1 you won't display the complete screen after NEXT! useful for custom HUD.
0: display (default)
1: not display
Code:
disablegameover {int}

    ~set 1 you won't display the gameover screen! useful for custom HUD.
        0: display (default)
        1: not display

But I don't unrdestand how really works this "custom HUD".
How can create the this custom Complete and Gameover screens?
The complete custom stage works like the normal, with the bonus score included?

 
Damon Caskey said:
Not really sure what you're trying to do here. Maybe a more in depth explanation?

DC

Sorry, let me explain better:

If use noshowcomplete,  I don't see the complete screen after NEXT anymore.
So if I want see this screen in some specific levels, how need to do this?

The same with disablegameover.
So if I want see this screen in some specific moments, how need to do this?
 
After a long time, I decided to address this issue again and to my surprise when searching the forum, I found that there was this thread created by me, but that a solution was never posted.

My idea is to be able to create a specific GAMEOVER, depending on the game mode.
The same happens in the case of the COMPLETE SCREEN. My idea would be to be able to create a specific one depending on the game mode, since my mod currently has several game modes and it would look much better if I could customize these types of screens, to adjust them to the game mode.

I am clear that this should be done via script, but I have not been able to find information about it, or any mod as an example.
 
The only way I know is to completely disable the default game over and script your own.

Most of the native cut-scene behavior was hard-coded to be simple and easy for beginners. The downside is that.. well, it's hard-coded. If you want different behavior you have to make your own game over system. I can tell you how but it would be a wall of text and I haven't built any examples you could use beyond a custom select screen, and even that's not finished yet.

I'd look to @Kratus and @Bloodbane. They both have a lot of out-of-game custom behavior put together.
 
@dantedevil

for cutscenes i use actual levels & text entities to allow dynamic elements.

same thing can apply to level complete screens.

a fake game over screen can be achieved by a cutscene or level after a script directs you to a branch, followed by a brief game over screen can just be a black screen that flashes for less than a second.

NS controls branchin using levels with black overlays & animation script on a text entity after completing certain levels
so its - LevelX.txt - branchselect level - cutscene branch - cutscenepoodied.txt - branchselect level - fake game over branch - fake game over.txt - branchselect level - last branch - true game over.txt

how you may want to control such things is the devil in the details, say for example that you have
a Winnie the Poo character, after his last life, you have a choice, his ondeath script or death animation triggers a jump to the fake game-over screen branch for winnie the poo, this branch is programmed in a way that it takes you to the final branch that holds the 30 millsecond black gameover screen.

OR his death triggers a txt entity that is overlayed on top the screen & this entity has a script that after its over takes you out of the game & into the start menu of the game
 
Last edited:
Thanks for your answer my friend.
But in my mod things get a little more complicated, because currently there are a large number of game modes and within each one, they are separated into several more.
For this reason, using the ondeath script would imply working in a lot of variants, so that depending on the game mode, a specific gamover screen is applied.
Also having 3 or 2 players, using it in the ondeath script could be a problem, if I'm not mistaken.
But I understand your point and without a doubt it is a starting point to begin to guide a solution for this issue.

Thanks buddy! ;)
 
@dantedevil

For the "gameover" scene, you can simple detect the current set you currently are and do all necessary operations.
I don't know if there's a way to add scripts directly in the gameover.txt scene file, only how to play gif, webm or music. So, the only way I know to detect this scene correctly is by using updated.c event, once it runs all the time.

Considering that you will use the updated.c, I will show a script example:

C:
//GAME OVER SCENE
    if(openborvariant("current_scene") == "data/scenes/gameover.txt"){
        void text;
        int font    = 7;
        int layer    = 1001;
        int x        = 240;
        int y        = 136;

        while(!getglobalvar("gameOver")){ //CHECK IF THE "GAMEOVER" FLAG IS NULL
            musicGameover(); //PLAY MUSIC!!
            setglobalvar("gameOver", 1); //SET THE "GAMEOVER" FLAG TO 1 TO PLAY MUSIC ONCE
        }
        
        //DETECT WHICH SET YOU ARE AND CHANGE THE TEXT ACCORDING TO
        if(openborvariant("current_set") == 0){text = "arcade";}
        if(openborvariant("current_set") == 1){text = "survival";}
        if(openborvariant("current_set") == 2){text = "rebellion";}

        drawstring(x, y, font, text, layer);
    }

The same goes to the complete screen by detecting the "in_showcomplete" openborvariant. However, this one is a bit more complicated if you are using the levels.txt configurations, once most of its options are not accessible with scripts (clearbonus, lifebonus, rushbonus, etc).

But it's possible to add new texts and images, maintaining only the score positions.
 
I'm a little confused though, @Kratus. How would the game over script text activate to begin with? The script seems to activate once that game over scene plays; but wouldn't it only play if you put it in a level set like any other scene?
 
I'm a little confused though, @Kratus. How would the game over script text activate to begin with? The script seems to activate once that game over scene plays; but wouldn't it only play if you put it in a level set like any other scene?
@NickyP

First you will need to create the updated.c file at the "data/scripts/" folder, and then check if you have the file script.txt file in your data folder with the command "alwaysupdate 1".
When these two steps are done, you will have the updated.c event running all the time, no matter if you are playing a level or not.

The script I posted is only a short example, the complete version is this:
C:
void main()
{ //Draw content in the game over scene
   
    if(openborvariant("current_scene") == "data/scenes/gameover.txt"){
        void text;
        int font    = 7;
        int layer    = 1001;
        int x        = 240;
        int y        = 136;

        while(!getglobalvar("gameOver")){ //CHECK IF THE "GAMEOVER" FLAG IS NULL
            musicGameover(); //PLAY MUSIC!!
            setglobalvar("gameOver", 1); //SET THE "GAMEOVER" FLAG TO 1 TO PLAY MUSIC ONCE
        }
       
        //DETECT WHICH SET YOU ARE AND CHANGE THE TEXT ACCORDING TO
        if(openborvariant("current_set") == 0){text = "arcade";}
        if(openborvariant("current_set") == 1){text = "survival";}
        if(openborvariant("current_set") == 2){text = "rebellion";}

        drawstring(x, y, font, text, layer);
    }
}

The gameover event will run automatically if you quit the current game (unless if you are using "disablegameover"), or if you declare as a scene in the level.txt.
Once the updated.c event detects the gameover event, the entire script will run, showing the desired content according to the game mode (current_set).

The script will continue running until the gameover event ends, and the music will play once due to the gameover flag check in the code.
 
hy not using "in_gameoverscreen" instead?
@O Ilusionista

Yeah, in previous versions I used "in_gameoverscreen", but I accidentally discovered that this variant doesn't work if the "game over" event if it's declared as a scene before the "end" command.

But you gave me a good idea. On the original SOR2/3 the "game over" only appears if you lose all lives and credits, because in fact it's a "defeat" and not a "victory". In the end-game, the original jump directly to the hi-scores, avoiding the game over scene.

By reading the manual again, I think that this is not a bug because it is working as intended, same as the original SOR2/3.

data/scenes/gameover.txt
~This is a cutscene file. If it exists, it will be played when all players lose all their lives and credits, or if a player chooses to quit during a game.
~If this file isn't found, OpenBoR displays the default game over screen: the letters "GAME OVER" displayed in font 4.

Maybe it's better if I remove the game over scene at the end-game. Thanks buddy :)

Code:
branch            sor3_st8e
z                155 270
file            data/levels/sor3/st8e.txt    #NEO.X ROOM
next

#ENDINGS
branch            ending_sor3a
scene            data/scenes/ending_sor3a.txt
scene            data/scenes/gameover.txt
end

EDIT:
Btw, is musicGameover() an engine function?
No, this is a scripted function based on the native engine "playmusic" function. I replaced the native functions by this one because I need to change additional properties, like folder's name.
 
Last edited:
Hello dear friends!
I'm sorry it took so long to answer about this, but how do you know, certain personal events have kept me a bit lost.

First of all I want to thank again @Kratus who has been very kind to share the script and explain it.

I could already test the script and make it work without problem, but I think there was a misunderstanding or maybe I did not explain myself in the best way.

Using this script, I can get a specific text to appear in the "Game Over" depending on the "set", but that is not the result I was looking for.

What I want is to literally have a "Custom Game Over" for each set.
I mean that the scene that is included in the gameover.txt is not reproduced, and instead another scene is reproduced depending on the set.
 
Hello dear friends!
I'm sorry it took so long to answer about this, but how do you know, certain personal events have kept me a bit lost.

First of all I want to thank again @Kratus who has been very kind to share the script and explain it.

I could already test the script and make it work without problem, but I think there was a misunderstanding or maybe I did not explain myself in the best way.

Using this script, I can get a specific text to appear in the "Game Over" depending on the "set", but that is not the result I was looking for.

What I want is to literally have a "Custom Game Over" for each set.
I mean that the scene that is included in the gameover.txt is not reproduced, and instead another scene is reproduced depending on the set.
@dantedevil

If I understand correctly, you want a way to change the gameover.txt content according to the current set. Unfortunately it's not possible, the gameover.txt file does not accept scripts inside and it will always run the same defined cutscene. In addition, the engine accepts only one gameover.txt file.

However, you have a tons of other ways to create a custom gameover using a blank gif cutscene inside the gameover.txt:

1) You can add all custom content by using other functions, like drawstring, drawsprite, drawbox, spawn entities, play music/sounds, etc.

2) You can use the playwebm script function to run a different webm video for every set

3) You can use the playgif script function to run a different gif cutscene for every set

For example, the Extra Menu in SORX in fact does not exist, it's a simple blank gif cutscene inside the howto.txt cutscene. Everything you see is drawn manually with scripts while the howto.txt cutscene runs.
 
Back
Top Bottom