Solved Trouble Between Exiting Game Mode and Fake End Level

Question that is answered or resolved.

maxman

Well-known member
I have trouble with exiting certain game modes which happens sometimes because I have a level branch for ending the game. I use the branch called "Ended" in levels.txt for ending the game with the ending level. Therefore, I want to end the 1-player mode with a Game Over text from a Continue screen or exit the game. I know that using the dummy level, seen in @Bloodbane's Map demo, is useful for not allowing to skip to end the game itself. I really like that. But I do not know how to exit the game after losing or quitting. When I use the "Ended" branch at the last part of the levels to end, I can exit the game after losing or quitting but starting the game mode with that branch reverts back to the title screen sometimes. When I put the dummy level at the last part of the levels in a game mode, you're not reverting back to the title screen at all, but the problem is when you lose with a Game Over text and it ends the level, it moves to the very end of the level which is the dummy level. I do not know how to end the game mode with that.

emptyspace.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
coords   160 230
at   0

spawn black
coords 1 240
at 0

Here's my levels.txt:
Code:
set    Arcade_Mode # 0
lives 1
#scoreformat 1
credits 10
#noshare 1
cansave 0
continuescore 1
disablehof 1
disablegameover 1
#single 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_Eagle
z    200 200 200
file    data/levels/eagle.txt # level 4

branch    Stage_Ryu
z    227 227 227
file    data/levels/ryu_stage.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

I'm using v3 with its compiled date of December 12, 2016. I tried using gotomain() something, I forget the name, but sadly, it doesn't allow me to exit. Should I use the latest version of v3 which is 6391? I saw that it has an option for exiting/quitting the game, but I'm not sure.
 
But I do not know how to exit the game
Are you trying to exit the game or closing the engine? There's some script functions that can help:

shutdown() = closes the engine instantly
gameover() = quit the current game mode, same effect as "quit" in the pause menu
finishlevel() = finish the current level by jumping to the next one
 
Just exiting the game. (Closing the engine is the easiest.) And I forgot that I used gameover() to quit the game mode, but it crashes before the continue screen shows.

Code:
    delay 4
    attack -128 -203 446 377 1 0 1 1 0 240 # 10
    noreflect 1
    frame data/chars/misc/continueanim/count00.png
    attack 0
    frame data/chars/misc/continueanim/count001.png # 52

    frame data/chars/misc/continueanim/count001.png
    frame data/chars/misc/continueanim/counbase.png # 53
    frame data/chars/misc/continueanim/counbase.png # 54
    #delay 210
    #frame data/chars/misc/continueanim/counbase.png
    delay 210
    @cmd noPJoin 0 1
    @cmd noPJoin 1 1
    #@cmd spawn06 "ContKill" 0 0 0
    @cmd playmusic "data/music/gameover.bor"
    frame data/chars/misc/continueanim/counbase.png # 55
    delay 112
    frame data/chars/misc/continueanim/counbase.png # 56
    #@cmd jumptobranch "ended" 1
    @cmd gameover
    frame data/chars/misc/continueanim/counbase.png # 57

If that's the case, I'm gonna have to switch to 6391 for this. I originally intended to have it release for PSP, but now that I have this encounter, I'm not certain about the possiblity of PSP. (I don't own PSP at all. LOL) Otherwise, if it doesn't work then I won't worry about it.

I didn't know there's finishlevel() line in it. Thank you.
 
I think we're missing more information here. When exactly do you exit the game? and how?
I got a feeling that you're trying to exit the game in a level with type 2 setting.
I'm not using type 2. Just type 1. I never tried using type 2 until I did some moments ago and it skips to the next level instead of going back to the main menu screen. Still, I'm sticking with type 1. Type 2 has problems: 1) Player 2 cannot join in the game. 2) I can't press start to continue maybe because I have "anybutton" enabled for resuming countdown, but I dunno.

If there's a solution for going back to the main menu, using type 2, that would be great.

I exit it by using jumptobranch "ended" for the last part in levels.txt. Before I removed the dummy level at the last part in levels.txt, I gave a select screen as a dummy level in there. What troubled me most was the ending part between the dummy level and the real ending level in levels.txt. Also, when I tried to (either) end (or quit) the game without using jumptobranch ("end"?), it moved to the next level, depending on which stage you are at based on the order that's set in levels.txt. For example, in levels.txt, when you are at Ryu's stage and lose the battle by letting the countdown go to 0 and the Game Over text show to end, it went to Ken's stage after. While I want the dummy level at the last part of the specific game mode, I want to have something to end the game mode after beating the game. But maybe it would be easy to use jumptobranch for ending it since that "return" level I have is for continuing the last battle the player's lost.

Code:
set    Arcade_Mode # 0
lives 1
#scoreformat 1
credits 10
#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_Eagle
z    200 200 200
file    data/levels/eagle.txt # level 2 # previously level 4

branch    Stage_Ryu
z    227 227 227
file    data/levels/ryu_stage.txt # level 3 # previously level 5

branch    Stage_Ken
z    227 227 227
file    data/levels/ken.txt # level 4 # previously level 6

branch Select_Screen
z    173 230 173
file    data/levels/charatest.txt #level 5, as for now
file    data/levels/return.txt # level 6, as for now also

#branch    Ended
#z    230 230 230
#file    data/levels/emptyspace.txt
#end

I remember other function called like gotomenu() or something, I used it a lot in my game after game over scene.
You mean gotomainmenu(), right?

gotomainmenu(flag)

  • to go to main menu
  • flag: gotomainmenu(flag); flag: 1 = no gameover, 2 = no halloffame, 4 = no intro.txt; you can use a combination like 1+2 = 3 or all 1+2+4 = 7
  • flag doesn't affect set nogameover/nohof

Thank you, @Felina! I just replaced jumptobranch "ended" 1 with gotomainmenu 3 in the last frame and boy, I have never felt that great after using it! I decided to go back to the dummy level like Bloodbane put as an example. I admit that I was quite afraid to use gotomainmenu because the last time I did, it crashed but maybe I forgot, didn't know the name of it, or my PC didn't let me run.

Code:
    @cmd gotomainmenu 3
    frame data/chars/misc/continueanim/counbase.png # 57
 
I tried to use gotomainmenu(3) for going straight back to the title screen, but it only goes straight to the select screen branch where I placed it as a dummy level. All I want is to end the game mode I'm in, but it's not working.

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

branch Screen_Vs_Eagle
z 200 200 200
file data/levels/1vseagle.txt
branch    Stage_Eagle
z    200 200 200
file    data/levels/eagle.txt

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

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

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

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

final.txt:
Code:
background data/chars/misc/black.gif
fglayer    data/bgs/blank.png    400000000 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0
panel data/bgs/blank.png
order a
notime 1
settime 0
direction both
nopause 1
cameratype 1
type 2
cameraoffset 0 0

wait
at 0

spawn delay
@script
void main(){
    //jumptobranch("Ended",1);
    gotomainmenu(3);
}
@end_script
health 100
coords 250 100
at 0

How can I avoid this issue for escaping the current set/mode without skipping to the next level?

EDIT: I forgot to change type from 2 to 1. Type 2 was the problem, so I solved it with type 1 or without it.

EDIT 2: finishlevel does really work well and I already made a text type entity using finishlevel in the end of the frame for skipping to the next level (as a VS scene).
 
Last edited:
I never tried using type 2 until I did some moments ago and it skips to the next level instead of going back to the main menu screen.
Type 2 levels has some weird behaviours - under the hood, it skips a lot of normal logics from normal stages, which leads to some weird behaviours, from I remember Kratus explaining to me.
You can see this in action on my Pocket Dimeinsional Clash 2: start a new game and once you reach the tutorial stage, pause and quit.
Instead of returning to the main menu... you will be thrown to the next level, but with NO PLAYER SELECTED.

@Kratus helped me to cover the hud using screen and now I use a normal level.
 
So true. Using it like normal levels does work.

EDIT: Adding a dummy/fake enemy like delay entity or some sort would be better.
 
Last edited:
Back
Top Bottom