maxman
Well-known member
The custom pause menu script which was created by @Kratus himself, works wonders! It really works for my Street Fighter project and any other mod. However, it doesn't display itself in my Rhythm of Destruction mod. Despite using the same code from both the template and my SF project, it doesn't show in ROD.
This is my update.c for ROD.
I don't understand why it's not working at all.
Another issue I have is that I'm trying to include a certain model as a music option or something else. And I have to press anybutton and then escape button, to look at the music menu. Sometimes, I press "anybutton", "start", and then "escape", just to look at it too. I removed playgif and (excluded) setglobalvar("menuPause", 0) from the 3rd option, so I could input the music menu as an option in the pause menu.
Here is the invisible music entity as a list of music selection.
update.c:
I don't like when I have to press any button on a different option, and then the escape button after. I want to press any button on that particular option like I do to any option in the pause menu. How can I achieve pressing any button effortlessly without requiring button combinations? The music menu is a text type entity.
This is my update.c for ROD.
C:
#import "data/scripts/dc_bug_patch/continue_timer.c"
//#import "data/scripts/menu/pauseMenu.c"
void oncreate()
{
}
void ondestroy()
{
}
void main()
{
/*
* Execute the bug patch function.
* The numeric value is allowed
* continue time in game seconds.
* Native engine default is 10.
*/
int continue_time = 20;
dc_continue_bug_patch(continue_time);
LastNumber();
//titleMusic();
if(pausingGo()) result;
}
void titleMusic()
{
if(openborvariant("in_menuscreen") || openborvariant("in_titlescreen"))
{
if(getlocalvar("MusicMenu") == NULL())
{
playmusic("Data/Music/versus.bor", 1);
setlocalvar("MusicMenu", 1);
}
}
else {if(getlocalvar("MusicMenu") != NULL()) setlocalvar("MusicMenu", NULL());}
}
void LastNumber()
{
//if(pausingGo()) return;
if(openborvariant("in_level"))
{
int P1 = getplayerproperty(0, "entity");
int P2 = getplayerproperty(1, "entity");
int P1Life = getplayerproperty(0, "lives");
int P2Life = getplayerproperty(1, "lives");
if(P1)
{
drawstring(131, 2, 3, P1Life-1);
}
if(P2)
{
drawstring(311, 2, 3, P2Life-1);
}
}
}
void pausingGo()
{
//NECESSARY STEP TO RESET THE "MENU OPTION" VARIABLE AT THE TITLE SCREEN
if(openborvariant("in_titlescreen")){
if(getglobalvar("menuPause") != 0){setglobalvar("menuPause", 0);}
}
//CHECK IF THE PLAYER IS IN A LEVEL
if(openborvariant("in_level")){
int volume = openborvariant("effectvol");
int speed = 100;
int loop = 0;
int menuPause = getglobalvar("menuPause");
int max = 3;
int min = 0;
int add = 1;
//CHECK IF THE GAME IS PAUSED BUT NOT IN OPTIONS
if(openborvariant("game_paused") && !openborvariant("in_options")){
//DETECT UP/DOWN BUTTON PRESS AND CHANGE THE HIGHLIGHTED OPTION
if( playerkeys(0, 1, "movedown")||
playerkeys(1, 1, "movedown")||
playerkeys(2, 1, "movedown")||
playerkeys(3, 1, "movedown")){
if(menuPause >= min && menuPause < max){setglobalvar("menuPause", menuPause+add);}
if(menuPause == max){setglobalvar("menuPause", min);}
}
if( playerkeys(0, 1, "moveup")||
playerkeys(1, 1, "moveup")||
playerkeys(2, 1, "moveup")||
playerkeys(3, 1, "moveup")){
if(menuPause > min && menuPause <= max){setglobalvar("menuPause", menuPause-add);}
if(menuPause == min){setglobalvar("menuPause", max);}
}
//DEFINE A FUNCTION TO BE EXECUTED WHEN EACH OPTION IS CONFIRMED BY PRESSING ACTION KEYS
//NOTE THAT SOME OPTIONS ALREADY PLAY SAMPLES NATIVELY, ONLY A FEW NEED TO BE MANUALLY PLAYED
if( playerkeys(0, 1, "anybutton")||
playerkeys(1, 1, "anybutton")||
playerkeys(2, 1, "anybutton")||
playerkeys(3, 1, "anybutton")){
//LOCK NATIVE KEYS
changeplayerproperty(0, "newkeys", 0);
changeplayerproperty(1, "newkeys", 0);
changeplayerproperty(2, "newkeys", 0);
changeplayerproperty(3, "newkeys", 0);
//CONTINUE
if(menuPause == 0){
changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
//changeplayerproperty(0, "newkeys", openborconstant("FLAG_START"));
//changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
//changeplayerproperty(1, "newkeys", openborconstant("FLAG_START"));
//changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
//changeplayerproperty(2, "newkeys", openborconstant("FLAG_START"));
//changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
//changeplayerproperty(3, "newkeys", openborconstant("FLAG_START"));
}
//OPTIONS
if(menuPause == 1){
playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
options();
}
//HOW TO PLAY
if(menuPause == 2){
playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
setglobalvar("menuPause", 0);
playgif("data/scenes/howto.gif");
}
//END GAME
if(menuPause == 3){
changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
//changeplayerproperty(0, "newkeys", openborconstant("FLAG_START"));
//changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
//changeplayerproperty(1, "newkeys", openborconstant("FLAG_START"));
//changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
//changeplayerproperty(2, "newkeys", openborconstant("FLAG_START"));
//changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
//changeplayerproperty(3, "newkeys", openborconstant("FLAG_START"));
}
}
//TEXTS, IMAGES AND EFFECTS
void str;
float hRes = openborvariant("hresolution");
int align;
int yPos = 80;
int fontPause = 3;
int font0 = 0;
int font1 = 0;
int font2 = 0;
int font3 = 0;
int yAdd = 11;
int layer = 50000000; //-1000000003;
//DEFINE FONTS TO HIGHLIGHTED OPTIONS
if(getglobalvar("menuPause") == 0){font0 = 1;}else //IS CONTINUE HIGHLIGHTED??
if(getglobalvar("menuPause") == 1){font1 = 1;}else //IS OPTIONS HIGHLIGHTED??
if(getglobalvar("menuPause") == 2){font2 = 1;}else //IS HOW TO PLAY HIGHLIGHTED??
if(getglobalvar("menuPause") == 3){font3 = 1;} //IS END GAME HIGHLIGHTED??
str = "Pause";align = (hRes-(strwidth(str, fontPause)))/2;
drawstring(align, yPos, fontPause, str, layer);
yPos = yPos+yAdd*3;
str = "Continue";align = (hRes-(strwidth(str, font0)))/2;
drawstring(align, yPos, font0, str, layer);
yPos = yPos+yAdd;
str = "Options";align = (hRes-(strwidth(str, font1)))/2;
drawstring(align, yPos, font1, str, layer);
yPos = yPos+yAdd;
str = "How To Play";align = (hRes-(strwidth(str, font2)))/2;
drawstring(align, yPos, font2, str, layer);
yPos = yPos+yAdd;
str = "End Game";align = (hRes-(strwidth(str, font3)))/2;
drawstring(align, yPos, font3, str, layer);
}
//LOCK ACTION KEYS, NECESSARY STEP TO QUIT FROM THE OPTIONS IGNORING THE NATIVE "END GAME" OPTION
if(openborvariant("game_paused") && openborvariant("in_options")){
changeplayerproperty(0, "newkeys", 0);
changeplayerproperty(1, "newkeys", 0);
changeplayerproperty(2, "newkeys", 0);
changeplayerproperty(3, "newkeys", 0);
}
//NECESSARY STEPS THAT NEEDS TO RUN AFTER SOME OPTIONS LIKE "END GAME" ARE CONFIRMED
//THERE'S A FEW ENGINE FUNCTIONS THAT ONLY RUNS OUTSIDE OF THE PAUSE MENU
if(!openborvariant("game_paused") && !openborvariant("in_options")){
//END GAME
if(menuPause == 3){gameover();}
}
}
}
I don't understand why it's not working at all.
Another issue I have is that I'm trying to include a certain model as a music option or something else. And I have to press anybutton and then escape button, to look at the music menu. Sometimes, I press "anybutton", "start", and then "escape", just to look at it too. I removed playgif and (excluded) setglobalvar("menuPause", 0) from the 3rd option, so I could input the music menu as an option in the pause menu.
Here is the invisible music entity as a list of music selection.
C:
name MusicSelect
type text
shadow 0
anim idle
@script
void self = getlocalvar("self");
int index = getentityproperty(self, "playerindex");
void up = playerkeys(index, 0, "moveup");
void down = playerkeys(index, 0, "movedown");
void pick = playerkeys(index, 0, "anybutton");
int Cframe = getentityproperty(self, "animpos");
if(frame >= 1)
{
if(Cframe == 3 && down){updateframe(self, 4);}// NO SOUND TO BEGIN
if(Cframe == 6 && up){updateframe(self, 7);} // SOUND TO GO UP
if(Cframe == 9 && down){updateframe(self, 4);} // SOUND TO GO DOWN
if(Cframe == 3 && pick){fademusic(0.5, "data/music/dojo/001.ogg", 1, 470767.5); updateframe(self, 24); }
if(Cframe == 6 && pick){fademusic(0.5, "data/music/dojo/002.ogg", 1, 43526.7); updateframe(self, 24); }
if(Cframe == 9 && pick){fademusic(0.5, "data/music/dojo/001.ogg", 1, 470767.5); updateframe(self, 24); }
}
@end_script
delay 11
offset 1 1
frame data/chars/0misc/empty.gif # 0
@cmd settextobj 0 60 50 1 999999999 "001"
@cmd settextobj 1 60 60 0 999999999 "002"
frame data/chars/0misc/empty.gif # 1
frame data/chars/0misc/empty.gif # 2
@cmd updateframe getlocalvar("self") 2
frame data/chars/0misc/empty.gif # 3
sound data/sounds/beep.wav
@cmd settextobj 0 60 50 0 999999999 "001"
@cmd settextobj 1 60 60 1 999999999 "002"
frame data/chars/0misc/empty.gif # 4
frame data/chars/0misc/empty.gif # 5
@cmd updateframe getlocalvar("self") 5
frame data/chars/0misc/empty.gif # 6
sound data/sounds/beep.wav
frame data/chars/0misc/empty.gif # 7
@cmd settextobj 0 60 50 1 999999999 "001"
@cmd settextobj 1 60 60 0 999999999 "002"
frame data/chars/0misc/empty.gif # 8
@cmd updateframe getlocalvar("self") 8
frame data/chars/0misc/empty.gif # 9
sound data/sounds/beep.wav
frame data/chars/0misc/empty.gif # 10
@cmd settextobj 0 60 50 0 999999999 "001"
@cmd settextobj 1 60 60 1 999999999 "002"
frame data/chars/0misc/empty.gif # 11
@cmd updateframe getlocalvar("self") 11
frame data/chars/0misc/empty.gif # 12
frame data/chars/0misc/empty.gif # 13
frame data/chars/0misc/empty.gif # 14
frame data/chars/0misc/empty.gif # 15
frame data/chars/0misc/empty.gif # 16
frame data/chars/0misc/empty.gif # 17
frame data/chars/0misc/empty.gif # 18
frame data/chars/0misc/empty.gif # 19
frame data/chars/0misc/empty.gif # 20
frame data/chars/0misc/empty.gif # 21
frame data/chars/0misc/empty.gif # 22
frame data/chars/0misc/empty.gif # 23
frame data/chars/0misc/empty.gif # 24
frame data/chars/0misc/empty.gif # 25
frame data/chars/0misc/empty.gif # 26
frame data/chars/0misc/empty.gif # 27
delay 2
@cmd cleartextobj 0
@cmd cleartextobj 1
@cmd killentity getlocalvar("self")
frame data/chars/0misc/empty.gif # 28
frame data/chars/0misc/empty.gif # 29
update.c:
C:
void main()
{
//SONG SELECTION IN THE PAUSE MENU ONLY IN THE THIRD GAME MODE
if(openborvariant("in_titlescreen")){
if(getglobalvar("menuPause") != 0){setglobalvar("menuPause", 0);}
}
//CHECK IF THE PLAYER IS IN THE THIRD GAME MODE
if(openborvariant("in_level") && openborvariant("current_set") == 2){
int volume = openborvariant("effectvol");
int speed = 100;
int loop = 0;
int menuPause = getglobalvar("menuPause");
int max = 3;
int min = 0;
int add = 1;
//CHECK IF THE GAME IS PAUSED BUT NOT IN OPTIONS
if(openborvariant("game_paused") && !openborvariant("in_options")){
//DETECT UP/DOWN BUTTON PRESS AND CHANGE THE HIGHLIGHTED OPTION
if( playerkeys(0, 1, "movedown")||
playerkeys(1, 1, "movedown")||
playerkeys(2, 1, "movedown")||
playerkeys(3, 1, "movedown")){
if(menuPause >= min && menuPause < max){setglobalvar("menuPause", menuPause+add);}
if(menuPause == max){setglobalvar("menuPause", min);}
}
if( playerkeys(0, 1, "moveup")||
playerkeys(1, 1, "moveup")||
playerkeys(2, 1, "moveup")||
playerkeys(3, 1, "moveup")){
if(menuPause > min && menuPause <= max){setglobalvar("menuPause", menuPause-add);}
if(menuPause == min){setglobalvar("menuPause", max);}
}
//DEFINE A FUNCTION TO BE EXECUTED WHEN EACH OPTION IS CONFIRMED BY PRESSING ACTION KEYS
//NOTE THAT SOME OPTIONS ALREADY PLAY SAMPLES NATIVELY, ONLY A FEW NEED TO BE MANUALLY PLAYED
if( playerkeys(0, 1, "anybutton")||
playerkeys(1, 1, "anybutton")||
playerkeys(2, 1, "anybutton")||
playerkeys(3, 1, "anybutton")){
//LOCK NATIVE KEYS
changeplayerproperty(0, "newkeys", 0);
changeplayerproperty(1, "newkeys", 0);
changeplayerproperty(2, "newkeys", 0);
changeplayerproperty(3, "newkeys", 0);
//CONTINUE
if(menuPause == 0){
changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
//changeplayerproperty(0, "newkeys", openborconstant("FLAG_START"));
//changeplayerproperty(1, "newkeys", openborconstant("FLAG_START"));
//changeplayerproperty(2, "newkeys", openborconstant("FLAG_START"));
//changeplayerproperty(3, "newkeys", openborconstant("FLAG_START"));
}
//OPTIONS
if(menuPause == 1){
playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
options();
}
//HOW TO PLAY
/*
if(menuPause == 2){
playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
setglobalvar("menuPause", 0);
playgif("data/scenes/howto.gif");
}
*/
//SELECT MUSIC
if(menuPause == 2){
playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
//setglobalvar("menuPause", 0);
void vSpawn = spawn();
loadmodel("MusicSelect");
setspawnentry("name", "MusicSelect");
}
//END GAME
if(menuPause == 3){
changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
}
}
//TEXTS, IMAGES AND EFFECTS
void str;
float hRes = openborvariant("hresolution");
int align;
int yPos = 80;
int fontPause = 3;
int font0 = 0;
int font1 = 0;
int font2 = 0;
int font3 = 0;
int yAdd = 11;
int layer = -1000000003;
//DEFINE FONTS TO HIGHLIGHTED OPTIONS
if(getglobalvar("menuPause") == 0){font0 = 1;}else //IS CONTINUE HIGHLIGHTED??
if(getglobalvar("menuPause") == 1){font1 = 1;}else //IS OPTIONS HIGHLIGHTED??
if(getglobalvar("menuPause") == 2){font2 = 1;}else //IS SELECT MUSIC HIGHLIGHTED??
if(getglobalvar("menuPause") == 3){font3 = 1;} //IS END GAME HIGHLIGHTED??
str = "Pause";align = (hRes-(strwidth(str, fontPause)))/2;
drawstring(align, yPos, fontPause, str, layer);
yPos = yPos+yAdd*3;
str = "Continue";align = (hRes-(strwidth(str, font0)))/2;
drawstring(align, yPos, font0, str, layer);
yPos = yPos+yAdd;
str = "Options";align = (hRes-(strwidth(str, font1)))/2;
drawstring(align, yPos, font1, str, layer);
yPos = yPos+yAdd;
str = "Select Music";align = (hRes-(strwidth(str, font2)))/2;
drawstring(align, yPos, font2, str, layer);
yPos = yPos+yAdd;
str = "End Game";align = (hRes-(strwidth(str, font3)))/2;
drawstring(align, yPos, font3, str, layer);
}
//LOCK ACTION KEYS, NECESSARY STEP TO QUIT FROM THE OPTIONS IGNORING THE NATIVE "END GAME" OPTION
if(openborvariant("game_paused") && openborvariant("in_options")){
changeplayerproperty(0, "newkeys", 0);
changeplayerproperty(1, "newkeys", 0);
changeplayerproperty(2, "newkeys", 0);
changeplayerproperty(3, "newkeys", 0);
}
//NECESSARY STEPS THAT NEED TO RUN AFTER SOME OPTIONS LIKE "END GAME" ARE CONFIRMED
//THERE'S A FEW ENGINE FUNCTIONS THAT ONLY RUN OUTSIDE OF THE PAUSE MENU
if(!openborvariant("game_paused") && !openborvariant("in_options")){
//END GAME
if(menuPause == 3){gameover();}
}
}
}
I don't like when I have to press any button on a different option, and then the escape button after. I want to press any button on that particular option like I do to any option in the pause menu. How can I achieve pressing any button effortlessly without requiring button combinations? The music menu is a text type entity.
Last edited: