Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void main()
- {// Update script for displaying different HP color from each player based on char name
- void P1 = getplayerproperty(0, "entity");
- void P2 = getplayerproperty(1, "entity");
- void Bar = getglobalvar("Bar");
- void Bar2 = getglobalvar("Bar2");
- void Bar3 = getglobalvar("Bar3");
- void Bar4 = getglobalvar("Bar4");
- void Bar5 = getglobalvar("Bar5");
- void Bar6 = getglobalvar("Bar6");
- char P1name = getentityproperty(P1, "defaultname");
- char P2name = getentityproperty(P2, "defaultname");
- trainingPause();
- //piladaKoul();
- //pauseToMusic();
- customPauseTest();
- //TITLE SCREEN, CLEAR AND START A LOT OF VARIABLES IF "NULL()"
- if(openborvariant("in_titlescreen")){
- loadAll();
- }
- //MENU SCREEN, SET THE "CLEARALL" FLAG TO 1
- if(openborvariant("in_menuscreen")){
- if(getglobalvar("clearAll") == NULL()){setglobalvar("clearAll", 1);}
- }
- //IN LEVEL
- if(openborvariant("in_level")){
- menuPartners();
- }
- //COMPLETE SCREEN, RESET SOME PARTNER VARIABLES
- if(openborvariant("in_showcomplete")){
- if(getglobalvar("partnerFull") != 1){setglobalvar("partnerFull", 1);}
- }
- /*
- if(openborvariant("in_level")==1){
- if(P1 && P1name == "Billy"){
- int HP1 = getentityproperty(P1, "health");
- drawbox(26,9,HP1-3,10,999,rgbcolor(56,160,248),0);
- drawsprite(Bar, 1, 8, 2500);
- }else if(P1 && P1name == "Jimmy"){
- int HP1 = getentityproperty(P1, "health");
- drawbox(26,9,HP1-3,10,999,rgbcolor(246,130,130),0);
- drawsprite(Bar2, 1, 8, 2500);
- }else if(P1 && P1name == "1jeff"){
- int HP1 = getentityproperty(P1, "health");
- drawbox(26,9,HP1-3,10,999,rgbcolor(41,220,113),0);
- drawsprite(Bar3, 1, 8, 2500);
- }else if(P1 && P1name == "CBilly"){
- int HP1 = getentityproperty(P1, "health");
- drawbox(26,9,HP1-3,10,999,rgbcolor(128,0,240),0);
- drawsprite(Bar4, 1, 8, 2500);
- }else if(P1 && P1name == "Sonny"){
- int HP1 = getentityproperty(P1, "health");
- drawbox(26,9,HP1-3,10,999,rgbcolor(239,181,41),0);
- drawsprite(Bar5, 1, 8, 2500);
- }else if(P1 && P1name == "chinsei"){
- int HP1 = getentityproperty(P1, "health");
- drawbox(26,9,HP1-3,10,999,rgbcolor(252,252,252),0);
- drawsprite(Bar6, 1, 8, 2500);
- }
- if(P2 && P2name == "Billy"){
- int HP2 = getentityproperty(P2, "health");
- drawbox(156,9,HP2-3,10,999,rgbcolor(56,160,248),0);
- drawsprite(Bar, 131, 8, 2500);
- }else if(P2 && P2name == "Jimmy"){
- int HP2 = getentityproperty(P2, "health");
- drawbox(156,9,HP2-3,10,999,rgbcolor(246,130,130),0);
- drawsprite(Bar2, 131, 8, 2500);
- }else if(P2 && P2name == "1jeff"){
- int HP2 = getentityproperty(P2, "health");
- drawbox(156,9,HP2-3,10,999,rgbcolor(41,220,113),0);
- drawsprite(Bar3, 131, 8, 2500);
- }else if(P2 && P2name == "CBilly"){
- int HP2 = getentityproperty(P2, "health");
- drawbox(156,9,HP2-3,10,999,rgbcolor(128,0,240),0);
- drawsprite(Bar4, 131, 8, 2500);
- }else if(P2 && P2name == "Sonny"){
- int HP2 = getentityproperty(P2, "health");
- drawbox(156,9,HP2-3,10,999,rgbcolor(239,181,41),0);
- drawsprite(Bar5, 131, 8, 2500);
- }else if(P2 && P2name == "chinsei"){
- int HP2 = getentityproperty(P2, "health");
- drawbox(156,9,HP2-3,10,999,rgbcolor(252,252,252),0);
- drawsprite(Bar6, 131, 8, 2500);
- }
- }
- */
- }
- void oncreate()
- {
- void Bar;
- void Bar2;
- void Bar3;
- void Bar4;
- void Bar5;
- void Bar6;
- if(!Bar){
- Bar = loadsprite("data/sprites/bar.gif");
- Bar2 = loadsprite("data/sprites/bar2.gif");
- Bar3 = loadsprite("data/sprites/bar3.gif");
- Bar4 = loadsprite("data/sprites/bar4.gif");
- Bar5 = loadsprite("data/sprites/bar5.gif");
- Bar6 = loadsprite("data/sprites/bar6.gif");
- setglobalvar("Bar", Bar);
- setglobalvar("Bar2", Bar2);
- setglobalvar("Bar3", Bar3);
- setglobalvar("Bar4", Bar4);
- setglobalvar("Bar5", Bar5);
- setglobalvar("Bar6", Bar6);
- }
- }
- void ondestroy(){
- void Bar = getglobalvar("Bar");
- void Bar2 = getglobalvar("Bar2");
- void Bar3 = getglobalvar("Bar3");
- void Bar4 = getglobalvar("Bar4");
- void Bar5 = getglobalvar("Bar5");
- void Bar6 = getglobalvar("Bar6");
- if(Bar){
- free(Bar);
- free(Bar2);
- free(Bar3);
- free(Bar4);
- free(Bar5);
- free(Bar6);
- setglobalvar("Bar", NULL());
- setglobalvar("Bar2", NULL());
- setglobalvar("Bar3", NULL());
- setglobalvar("Bar4", NULL());
- setglobalvar("Bar5", NULL());
- setglobalvar("Bar6", NULL());
- }
- }
- void piladaKoul()
- {
- //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 musicPause = getglobalvar("musicPause");
- int max = 4;
- 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");
- }
- /*if(menuPause == 2){
- playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
- //setglobalvar("menuPause", 0);
- playgif("data/scenes/howto.gif"); //playgif(path, x, y, noskip) e.g. playgif("data/scenes/cut.gif", 0, 12, 1);
- //selectMusic();
- //if(musicPause == 0){
- // fademusic(0.5, "data/music/dojo/001.ogg", 1, 470767.5);
- //}
- //if(musicPause == 1){
- // fademusic(0.5, "data/music/dojo/002.ogg", 1, 43526.7);
- //}
- //if(musicPause == 2){
- // fademusic(0.5, "data/music/dojo/003.ogg", 1, 35588.7);
- //}
- //if(musicPause == 3){
- // fademusic(0.5, "data/music/dojo/004.ogg", 1, 1);
- //}
- void str2;
- float hRes2 = openborvariant("hresolution");
- int align2;
- int yPos2 = 80;
- int fontPause2 = 3;
- int font02 = 0;
- int font12 = 0;
- int font22 = 0;
- int font32 = 0;
- int yAdd2 = 11;
- int layer2 = -1000000003;
- //DEFINE FONTS TO HIGHLIGHTED OPTIONS
- if(getglobalvar("musicPause") == 0){font02 = 1;}else //IS CONTINUE HIGHLIGHTED??
- if(getglobalvar("musicPause") == 1){font12 = 1;}else //IS OPTIONS HIGHLIGHTED??
- if(getglobalvar("musicPause") == 2){font22 = 1;}else //IS SELECT MUSIC HIGHLIGHTED??
- if(getglobalvar("musicPause") == 3){font32 = 1;} //IS END GAME HIGHLIGHTED??
- str2 = "Select Music";align2 = (hRes2-(strwidth(str2, fontPause2)))/2;
- drawstring(align2, yPos2, fontPause2, str2, layer2);
- yPos2 = yPos2+yAdd2*3;
- str2 = "001";align2 = (hRes2-(strwidth(str2, font02)))/2;
- drawstring(align2, yPos2, font02, str2, layer2);
- yPos2 = yPos2+yAdd2;
- str2 = "002";align2 = (hRes2-(strwidth(str2, font12)))/2;
- drawstring(align2, yPos2, font12, str2, layer2);
- yPos2 = yPos2+yAdd2;
- str2 = "003";align2 = (hRes2-(strwidth(str2, font22)))/2;
- drawstring(align2, yPos2, font22, str2, layer2);
- yPos2 = yPos2+yAdd2;
- str2 = "004";align2 = (hRes2-(strwidth(str2, font32)))/2;
- drawstring(align2, yPos2, font32, str2, layer2);
- }
- */
- //SELECT MUSIC
- if(menuPause == 3){
- playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
- //setglobalvar("menuPause", 2);
- void vSpawn = spawn();
- loadmodel("MusicSelect");
- clearspawnentry();
- setspawnentry("name", "MusicSelect");
- setspawnentry("coords", 1, 1, 0);
- changeentityproperty(vSpawn, "position", 1, 1, 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"));
- }
- //END GAME
- if(menuPause == 4){
- 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 font4 = 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 HOW TO PLAY HIGHLIGHTED??
- if(getglobalvar("menuPause") == 3){font3 = 1;}else //IS SELECT MUSIC HIGHLIGHTED??
- if(getglobalvar("menuPause") == 4){font4 = 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 = "Select Music";align = (hRes-(strwidth(str, font3)))/2;
- drawstring(align, yPos, font3, str, layer);
- yPos = yPos+yAdd;
- str = "End Game";align = (hRes-(strwidth(str, font4)))/2;
- drawstring(align, yPos, font4, 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 == 4){gameover();}
- }
- }
- }
- void trainingPause()
- {
- //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") && 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"));
- }
- //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(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 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 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();}
- }
- }
- }
- void customPauseTest(){
- //NECESSARY STEP TO RESET THE "MENU OPTION" VARIABLE AT THE TITLE SCREEN
- if(openborvariant("in_titlescreen")){
- if(getglobalvar("menuPause") != 0){setglobalvar("menuPause", 0);}
- }
- if(openborvariant("in_level") && openborvariant("current_set") == 2){
- int volume = openborvariant("effectvol");
- int speed = 100;
- int loop = 0;
- int menuPause = getglobalvar("menuPause");
- int max = 5;
- 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"));
- }
- //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");
- }
- // CALL PARTNER
- if(menuPause == 3){
- playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
- //setglobalvar("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"));
- }
- // MUSIC TEST
- if(menuPause == 4){
- playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
- //setglobalvar("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"));
- }
- //END GAME
- if(menuPause == 5){
- 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 font4 = 0;
- int font5 = 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 HOW TO PLAY HIGHLIGHTED??
- if(getglobalvar("menuPause") == 3){font3 = 1;}else //IS CALL PARTNER HIGHLIGHTED??
- if(getglobalvar("menuPause") == 4){font4 = 1;}else //IS MUSIC TEST HIGHLIGHTED??
- if(getglobalvar("menuPause") == 5){font5 = 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 = "Call Partner";align = (hRes-(strwidth(str, font3)))/2;
- drawstring(align, yPos, font3, str, layer);
- yPos = yPos+yAdd;
- str = "Music Test";align = (hRes-(strwidth(str, font4)))/2;
- drawstring(align, yPos, font4, str, layer);
- yPos = yPos+yAdd;
- str = "End Game";align = (hRes-(strwidth(str, font5)))/2;
- drawstring(align, yPos, font5, 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 == 5){gameover();}
- }
- }
- }
- void loadAll()
- {//Load all necessary variables
- //SCRIPT USED TO CLEAR ALL VARIABLES AND ASSETS
- if(getglobalvar("clearAll") != NULL()){clearAssets();clearlocalvar();clearglobalvar();}
- //PARTNER MENU FUNCTIONS
- if(getglobalvar("activeText") == NULL()){
- setglobalvar("highlight", 0);
- setglobalvar("selectPartner", "HaggarNPC");
- setglobalvar("partnerAlive", 0);
- setglobalvar("partnerMode", "balanced");
- setglobalvar("partnerAggression", "*****");
- setglobalvar("partnerGetFood", "yes");
- setglobalvar("partnerFollow", "automatic");
- setglobalvar("partnerRespawn", "instantly");
- setglobalvar("partnerLifeBar", "full_hud");
- setglobalvar("activeText", 0);
- setglobalvar("selectSong", "001");
- }
- //LOAD ALL NECESSARY ASSETS (SPRITES, SOUNDS, ETC)
- saveAssets();
- }
- void saveAssets()
- {//Load global assets for further use
- if(getglobalvar("saveAssets") == NULL()){ //TRIGGER TO ALLOW ALL VARIABLES TO BE DEFINED ONCE
- //CAUTION!! ALL GLOBAL VARIABLES BELOW WILL CHANGE ALL ASSETS USED IN MANY SCRIPTS
- //GLOBAL USAGE (PUT ALL NECESSARY SPRITES TO BE LOADED HERE)
- setglobalvar("parrow5", loadsprite("data/sprites/parrow5.png"));
- //TRIGGER TO STOP THE SCRIPT AFTER RUN ONCE, SAVE CPU POWER
- setglobalvar("saveAssets", 1);
- }
- }
- void clearAssets()
- {//Clear all used assets to save memory
- if(getglobalvar("clearAssets") == NULL()){ //TRIGGER TO CLEAR ALL VARIABLES
- //GLOBAL USAGE (PUT ALL PREVIOUS LOADED SPRITES HERE TO SAVE MEMORY)
- free(getglobalvar("parrow5"));
- //TRIGGER TO STOP THE SCRIPT AFTER RUN ONCE, SAVE CPU POWER
- setglobalvar("clearAssets", 1);
- }
- }
- void menuPartners()
- {//Draw a CPU Partner Menu in game
- //DRAW MENU
- if(getglobalvar("activeText") == "Partner"){
- void str;
- float hRes = openborvariant("hresolution");
- int align;
- int xDif = 10; //DIFFERENCE BETWEEN THE FIRST AND SECOND COLUMNS
- int xPos1 = (hRes/2)-xDif; //BASE X POSITION, FIRST COLUMN (HIGHLIGHTED OPTIONS NAME)
- int xPos2 = (hRes/2)+xDif; //BASE X POSITION, SECOND COLUMN (HIGHLIGHTED OPTIONS CHANGE)
- int yPos = 60; //BASE Y POSITION FOR ALL MENU CONTENT, USE THIS TO MOVE ALL OPTIONS TOGETHER
- int font0 = 0; //ALL FONTS BELOW CHANGES FROM 0 TO 1 IF THE OPTION IS HIGHLIGHTED
- int font0 = 0;
- int font1 = 0;
- int font2 = 0;
- int font3 = 0;
- int font4 = 0;
- int font5 = 0;
- int font6 = 0;
- int yAdd = 11;
- int layer = 1000000003;
- //DEFINE FONTS TO HIGHLIGHTED OPTIONS
- if(getglobalvar("highlight") == 0){ font0 = 1;}else //IS PARTNER MODE HIGHLIGHTED??
- if(getglobalvar("highlight") == 1){ font1 = 1;}else //IS PARTNER AGGRESSION HIGHLIGHTED??
- if(getglobalvar("highlight") == 2){ font2 = 1;}else //IS PARTNER GET FOOD HIGHLIGHTED??
- if(getglobalvar("highlight") == 3){ font3 = 1;}else //IS PARTNER FOLLOW HIGHLIGHTED??
- if(getglobalvar("highlight") == 4){ font4 = 1;}else //IS PARTNER RESPAWN HIGHLIGHTED??
- if(getglobalvar("highlight") == 5){ font5 = 1;}else //IS PARTNER LIFE BAR HIGHLIGHTED??
- if(getglobalvar("highlight") == 6){ font6 = 1;} //IS PARTNER SPAWN HIGHLIGHTED??
- str = "fighting_mode:";align = xPos1-strwidth(str, font0);
- drawstring(align, yPos, font0, str, layer);
- str = getglobalvar("partnerMode");
- drawstring(xPos2, yPos, font0, str, layer);
- yPos = yPos+yAdd;
- str = "aggression:";align = xPos1-strwidth(str, font0);
- drawstring(align, yPos, font1, str, layer);
- str = getglobalvar("partnerAggression");
- drawstring(xPos2, yPos, font1, str, layer);
- yPos = yPos+yAdd;
- str = "get_food:";align = xPos1-strwidth(str, font0);
- drawstring(align, yPos, font2, str, layer);
- str = getglobalvar("partnerGetFood");
- drawstring(xPos2, yPos, font2, str, layer);
- yPos = yPos+yAdd;
- str = "follow_caller:";align = xPos1-strwidth(str, font0);
- drawstring(align, yPos, font3, str, layer);
- str = getglobalvar("partnerFollow");
- drawstring(xPos2, yPos, font3, str, layer);
- yPos = yPos+yAdd;
- str = "respawn:";align = xPos1-strwidth(str, font0);
- drawstring(align, yPos, font4, str, layer);
- str = getglobalvar("partnerRespawn");
- drawstring(xPos2, yPos, font4, str, layer);
- yPos = yPos+yAdd;
- str = "life_bar:";align = xPos1-strwidth(str, font0);
- drawstring(align, yPos, font5, str, layer);
- str = getglobalvar("partnerLifeBar");
- drawstring(xPos2, yPos, font5, str, layer);
- yPos = yPos+yAdd;
- str = "spawn_partner:";align = xPos1-strwidth(str, font0);
- drawstring(align, yPos, font6, str, layer);
- str = getglobalvar("selectPartner");
- drawstring(xPos2, yPos, font6, str, layer);
- if(getglobalvar("highlight") == 6 && getglobalvar("partnerIndex") == NULL()){
- yPos = yPos+yAdd*2;
- str = "press_attack_to"; align = (hRes-strwidth(str, font0))/2;
- drawstring(align, yPos, font6, str);
- yPos = yPos+yAdd;
- str = "call_cpu_partner"; align = (hRes-strwidth(str, font0))/2;
- drawstring(align, yPos, font6, str);
- yPos = yPos+yAdd;
- str = "(player_1_only)"; align = (hRes-strwidth(str, font0))/2;
- drawstring(align, yPos, font6, str);
- }
- }
- }
- void musicMenu()
- {
- // Draw list of songs
- // DRAW MUSIC MENU
- if(getglobalvar("activeText") == "Song"){ // Does the music playlist exist?
- void str;
- float hRes = openborvariant("hresolution");
- int align;
- int xDif = 10; //DIFFERENCE BETWEEN THE FIRST AND SECOND COLUMNS
- int xPos1 = (hRes/2)-xDif; //BASE X POSITION, FIRST COLUMN (HIGHLIGHTED OPTIONS NAME)
- int xPos2 = (hRes/2)+xDif; //BASE X POSITION, SECOND COLUMN (HIGHLIGHTED OPTIONS CHANGE)
- int yPos = 60; //BASE Y POSITION FOR ALL MENU CONTENT, USE THIS TO MOVE ALL OPTIONS TOGETHER
- int font0 = 0; //ALL FONTS BELOW CHANGES FROM 0 TO 1 IF THE OPTION IS HIGHLIGHTED
- int font0 = 0;
- int font1 = 0;
- int yAdd = 11;
- int layer = 1000000003;
- //DEFINE FONTS TO HIGHLIGHTED OPTIONS
- if(getglobalvar("highlight") == 0){ font0 = 1;}else // CHOOSE SONG
- if(getglobalvar("highlight") == 1){ font1 = 1;}else // EXIT
- //if(getglobalvar("highlight") == 2){ font2 = 1;}
- str = "Choose_song:";align = xPos1-strwidth(str, font0);
- drawstring(align, yPos, font0, str, layer);
- str = getglobalvar("selectSong");
- drawstring(xPos2, yPos, font0, str, layer);
- /*if(getglobalvar("highlight") == 0 && getglobalvar("songIndex") == NULL()){
- yPos = yPos+yAdd*2;
- str = "press_attack_to"; align = (hRes-strwidth(str, font0))/2;
- drawstring(align, yPos, font0, str);
- yPos = yPos+yAdd;
- str = "play_music"; align = (hRes-strwidth(str, font0))/2;
- drawstring(align, yPos, font0, str);
- yPos = yPos+yAdd;
- str = "(player_1_only)"; align = (hRes-strwidth(str, font0))/2;
- drawstring(align, yPos, font0, str);
- }*/
- yPos = yPos+yAdd;
- str = "Close";align = xPos1-strwidth(str, font1);
- drawstring(align, yPos, font1, str, layer);
- //str = getglobalvar("closeMusicMenu");
- //drawstring(xPos2, yPos, font1, str, layer);
- //yPos = yPos+yAdd;
- //str = "002";align = xPos1-strwidth(str, font0);
- //drawstring(align, yPos, font2, str, layer);
- //str = getglobalvar("partnerGetFood");
- //drawstring(xPos2, yPos, font2, str, layer);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment