Suggestion: Animated Titlescreen and InGame Character Selection Handling

Well I tested it actually works. Player 2/3/4 don't choose other colour maps until you press up/down.
 
utunnels said:
Well I tested it actually works. Player 2/3/4 don't choose other colour maps until you press up/down.
Mmm... I write my steps:
1) I select the first char in a set with "nosame 1" -> OK
2) In level I join with 2nd player and it has the right map -> OK
3) I join with 3th player: It has the 2nd map -> WRONG
4) I join with 4th player: It has the 3th map -> WRONG

ps. I use remap in chara.txt

I hope you help me =)
 
Not yet. The hof is not something I'm interested in currently.
In theory it can be simulated with filestrea.
 
I tried but you can not read the data INTEGER.
I can read the names as a string but if I try to read the record int: 0x23000000
I can not convert it to decimal integer (35)
Need to add a method readInt() for example.

Ps. getfilestreamargument(0, 0, "int") gets integers only if it is in ascii table coded. Ex. 0x37 -> 7 -> OK
 
Well I mean you can save your own txt format and forget the old one.

Or if you don't care you can create a new set that don't have any levels with skipselect. You'll be in the hall of fame once you play that set because there's no levels. (The side effect, fadeout, return to title screen instead of menu after that, etc)
 
Latest version of selectPlayer():

Code:
#define NOSAME_FLAG 1
#define NOSAME_FLAG_INIT 1 // NOSAME at select screen when you press start for first time
#define MAX_PLAYERS openborvariant("maxplayers")
#define SELECT_MUSIC "data/music/menu_.bor"
#define TITLE_MUSIC "data/music/remix.bor"

void selectPlayer() {
	int i, s, t=0, d=0, p;
	void ent;
	void list = glv("playerlist");
	void flag = glv("playerflag");
	int se = loadsample("data/sounds/beep2.wav");
	int se2 = loadsample("data/sounds/beep.wav");
	char text  = "SELECT YOUR CHARACTER";
	int vres = openborvariant("vresolution");
	int hres = openborvariant("hresolution");
	void title_bg = glv("title_bg");

    if ( glv("select_music") == NULL() ) {
        playmusic(SELECT_MUSIC, 1);
        slv("select_music",1);
    }
    if (!title_bg) slv("title_bg", spawnsubentity("title_bg", 0,0,0));

	//int se = loadsample("data/sounds/lkicksh.wav");

    //if (ent) drawstring(10,160,0,"MAP:  "+gep(ent, "map"));
    //if (ent) drawstring(10,160,0,"MAP:  "+gep(ent, "hmapl"));
    //if (ent) drawstring(10,170,0,"MAP:  "+gep(ent, "hmapu"));
    //for(p = 0; p < size(list); ++p) drawstring(10, 40+10*p, 0, ":   "+ get(list, p) + " : " + get(flag, p) );

    drawstring(hres/2-strwidth(text, 0)/2, 10, 6, text);
    for(i = 0; i<MAX_PLAYERS; i++) {
            if ( i<2 ) drawstring(13+79*i, 188, 0, "player "+(i+1));
            else drawstring(1+13+79*i, 188, 0, "player "+(i+1));
    }

	for(i = 0; i<MAX_PLAYERS; i++) {
		if(glv("player."+i+".join")) {
            if ( !glv("player."+i+".joint") ) {
                if ( ov("count_players") > 0 ) playsample(se); // in questo momento è count_players-1 perchè ancora non è stato spawnato il player
                slv("player."+i+".joint", 1); // ==1 significa che è appena entrato. Non entrato== NULL(), Entrato da tempo == 2
            }
			if(!glv("player."+i+".decided")) {
				s = glv("player."+i+".selector");
				if(!s) { s = 0; }
				if(gpp(i, "name") == "") {
                    // CONTROLLO PERSONAGGIO GIA' PRESO
                    if ( NOSAME_FLAG && glv("player."+i+".joint") == 2 && size(list) > 1 ) {
                        if( get(flag, s) ) {
                            if (glv("player."+i+".move") == -1) {
                                do {
                                    if( --s < 0 ) s = size(list)-1;
                                } while ( get(flag,s) == 1 );
                            } else {
                                do {
                                    if ( ++s >= size(list) ) s = 0;
                                } while ( get(flag,s) == 1 );
                            }
                        }
                    }
                    // FINE CONTROLLO PERSONAGGIO GIA' PRESO

                    // CONTROLLO PERSONAGGIO GIA' PRESO SU NEW ENTRY (START/ENTRY ON SELECT SCREEN)
                    if ( (NOSAME_FLAG || NOSAME_FLAG_INIT) && size(list) > 1 && glv("player."+i+".joint") == 1 ) { // Eseguiamo questo processo solo se c'è più di un personaggio selezionabile e solo quando un giocatore è appena entrato
                        s = 0;
                        for(p = 0; p < size(list); p++) {
                            if ( get(flag,p) == 0 ) {
                                break;
                            } else ++s;
                        }
                    }
                    slv("player."+i+".joint", 2);
                    // ################################

					cpp(i, "name", get(list, s));
					if ( NOSAME_FLAG || NOSAME_FLAG_INIT ) set(flag, s, 1); // NOSAME: Chiudi a commento se vuoi settare NOSAME = 0

					ent = gpp(i, "entity");
					if(ent) killentity(ent);
					setspawnentry("name", gpp(i, "name"));
					ent = spawn();

                    // CHECK NOT EXIST CHARACTER
					if ( !gep(ent,"exists") ) {
                        if ( glv("player."+i+".move") == 1 ) {
                            set(flag, s, 0);
                            cpp(i, "name", "");
                            if(++s>=size(list)) s = 0;
                        } else {
                            set(flag, s, 0);
                            cpp(i, "name", "");
                            if(--s<0) s = size(list)-1;
                        }
                        slv("player."+i+".selector", s);
                        continue;
					}
					// ################################

					cpp(i, "colourmap", gep(ent,"map")); // map reset

                    // set 1p, 2p etc...
					if ( glv("player."+i+".arrow") ) killentity(glv("player."+i+".arrow"));
                    slv( "player."+i+".arrow", spawnsubentity_relative("parrow"+(i+1),0,0,0,ent) );

					if (i < 2) cep(ent, "position", 0+80*i, 20, 0);
					else cep(ent, "position", 1+80*i, 20, 0);

					cep(ent, "direction", 1);
					cep(ent, "aiflag", "blink", 0);
					cep(ent, "noaicontrol", 1);
					cep(ent, "gfxshadow", 1);
                    setidle(ent, 58, 1); //58 = waiting -- 24 = select
					cpp(i, "entity", ent);
				}

				ent = gpp(i, "entity");
				if(keyp(i, "moveleft")) {
                    playsample(se2);
                    set(flag, s, 0);
                    cpp(i, "name", "");
					if(--s<0) s = size(list)-1;
					slv("player."+i+".move", -1);
				} else if(keyp(i, "moveright")) {
				    playsample(se2);
				    set(flag, s, 0);
				    cpp(i, "name", "");
					if(++s>=size(list)) s = 0;
					slv("player."+i+".move", 1);
				} else if(keyp(i, "movedown")) {
				    int map = gep(ent, "map")-1;
				    int hmapl = gep(ent, "hmapl");
				    int hmapu = gep(ent, "hmapu");

				    //playsample(se2);
				    if ( map < 0 ) map = gep(ent, "mapcount")-1;
                    while( map >= hmapl && map <= hmapu && hmapl != 0 && hmapu != 0 ) {
                        --map;
                        if ( map < 0 ) map = gep(ent, "mapcount")-1;
                    }
                    cep(ent, "map", map);
                    cpp(i, "colourmap", map);
				} else if(keyp(i, "moveup")) {
                    int map = gep(ent, "map")+1;
				    int hmapl = gep(ent, "hmapl");
				    int hmapu = gep(ent, "hmapu");

				    //playsample(se2);
				    if ( map >= gep(ent, "mapcount") ) map = 0;
                    while( map >= hmapl && map <= hmapu && hmapl != 0 && hmapu != 0 ) {
                        ++map;
                        if ( map >= gep(ent, "mapcount") ) map = 0;
                    }
                    cep(ent, "map", map);
                    cpp(i, "colourmap", map);
				} else if (keyp(i, "start") || keyp(i, "attack")) {
					if( gep(ent, "aiflag", "idling") ) {
						setidle(ent, 24, 1);
                        if ( glv("player."+i+".arrow") ) { // Elimina l'arrow
                            killentity( glv("player."+i+".arrow") );
                            slv("player."+i+".arrow", NULL());
                        }
						slv("player."+i+".decided", 1);
						/*if(glv("mselector") == 3) {
							setspawnentry("name", "title_bg");
							setspawnentry("coords", 160, 260, 0);
							spawn();
						}*/
					}
				}

				slv("player."+i+".selector", s);
			} else {
				ent = gpp(i, "entity");
				if(!gep(ent, "aiflag", "animating")) {
					d++;
                    if (i<2) drawstring(18+80*i,45,0,"ready!");
                    else drawstring(1+18+80*i,45,0,"ready!");
				}
			}
			t++;
		} else {
			slv("player."+i+".join", keyp(i, "start"));
		}
	}

	if( t > 0 && t == d ) {
		for( i = 0; i < MAX_PLAYERS; i++) {
			cpp(i, "entity", NULL());
			if(gpp(i, "name") != "") {
				cpp(i, "lives", LIVES);
				cpp(i, "credits", CREDITS);
			}
		}
		clp("background", 0, "enabled", 0);
		clp("bglayer", 0, "enabled", 0);
		clp("bglayer", 1, "enabled", 0);
		clp("bglayer", 2, "enabled", 0);
		//sgv("in_menu", NULL());
        if (glv("title_bg")) killentity(title_bg);
        slv("title_bg", NULL());
		playgame(glv("mselector")+1, 2);
        //if(glv("playerlist")!=NULL()) {free(glv("playerlist")); slv("playerlist",NULL());}
        //if(glv("playerflag")!=NULL()) {free(glv("playerflag")); slv("playerflag",NULL());}
	} else if(key("esc")) {
	    slv("select_music",NULL());
        if (glv("title_bg")) killentity(title_bg);
        slv("title_bg", NULL());
		for(i=0; i<MAX_PLAYERS; i++) {
			cpp(i, "lives", 0);
			cpp(i, "credits", 0);
			cpp(i, "colourmap", 0);
			cpp(i, "name", "");
			ent = gpp(i, "entity");
			if(ent) killentity(ent);
			cpp(i, "entity", NULL());
			slv("player."+i+".join", NULL());
			slv("player."+i+".joint", NULL());
			slv("player."+i+".decided", NULL());
			slv("player."+i+".move", NULL());
			if ( glv("player."+i+".arrow") ) {
                killentity( glv("player."+i+".arrow") );
                slv("player."+i+".arrow", NULL());
			}
			slv("player."+i+".selector", NULL()); // Se non vuoi ricordare l'ultimo pg scelto
		}
		for(i=0; i<size(flag); i++) {
			set(flag, i, 0);
		}
        playmusic(TITLE_MUSIC, 1);
		//ent = glv("pigman");
		if(ent) killentity(ent);
		//slv("pigman", NULL());
		clp("background", 0, "enabled", 0);
		clp("bglayer", 0, "enabled", 0);
		clp("bglayer", 1, "enabled", 0);
		clp("bglayer", 2, "enabled", 1);
		slv("mselector", 0);
		slv("start", "mode");
	}

}
 
BeasTie said:
Is there an easy way to disable the select screen feature in the script? so you just go straight to the level set you've chosen.

I'm in the process of trying to do that now. Except, I just want to skip the "select screen" and "mode choosing" altogether. I just want to go straight to Level 1. Unfortunately, I'm having no luck at all. lol.  :-\
 
Back
Top Bottom