funny you should ask that actually...just checked both ways.. after unlocking the second screen does not play any animation on it at all... but when selecting the other mode where those players are unlocked after beating the game... well select screen 1 animation shows but not 2.... keeps getting weirder lolAre you trying to make the 2nd select screen animation appear in one game mode after unlocking characters from finishing some past levels or in another game mode?
void main(){
//MAIN START
void SelAnim = getglobalvar("selanim"); // Read select screen animated state to check
if(openborvariant("in_menuscreen")){ // Check if the game is in menu screen
setglobalvar("counter", NULL());
setglobalvar("selanim", NULL());
}
if(openborvariant("in_selectscreen") && SelAnim!=1){ // Check to avoid double spawn
void counter = getglobalvar("counter"); // Read variable 1 to check
if(counter!=1 && counter!=2){ // first select screen
void subent;
loadmodel("pnameanim"); // load the entity to be loaded
clearspawnentry(); // clean the spawn entry
setspawnentry("name", "pnameanim"); // define the entity to be spawn
setspawnentry("coords", 1,0,-1); // set the position of the entity
subent=spawn(); // spawn the entity
changeentityproperty(subent, "position", 1,0,-1); //for safe, set again the position
setglobalvar("counter",1); // counting select screen order
setglobalvar("selanim",1); // set the variable to 1, blocking a new spawn to be made
} else if(counter==1){ // second select screen
void subent;
loadmodel("pnameanim2"); // load the entity to be loaded
clearspawnentry(); // clean the spawn entry
setspawnentry("name", "pnameanim2"); // define the entity to be spawn
setspawnentry("coords", 1,0,-1); // set the position of the entity
subent=spawn(); // spawn the entity
changeentityproperty(subent, "position", 1,0,-1); //for safe, set again the position
setglobalvar("counter",2); // counting select screen order
setglobalvar("selanim",1); // set the variable to 1, blocking a new spawn to be made
}
}
} // MAIN END
ill try some of that thanks... i didnt make this script.. this was fixed and working by master bloodbane 2 years a go before i lost the game.... ill try stuff like that thanks againWhy is the value for selanim the same?
Maybe you could use either NULL() or 2 for that globalvar of "selanim". I think you need to practice the globalvar value like how Kratus taught me in the pause menu thread. Try to practice with binary first (0 and 1) before you try any value.
void initializeFlags() {
// Initialize flags and screen state
setglobalvar("flag_screen1_loaded", 0);
setglobalvar("flag_screen2_loaded", 0);
setglobalvar("screen_state", 1); // Default screen state for testing
}
void main() {
// Ensure flags are initialized
if (getglobalvar("flag_screen1_loaded") == NULL()) {
initializeFlags();
}
// Check if the game is in the menu screen
if (openborvariant("in_menuscreen")) {
// Reset flags and debug test when in menu screen
setglobalvar("flag_screen1_loaded", 0);
setglobalvar("flag_screen2_loaded", 0);
setglobalvar("screen_state", 1); // Optionally reset screen state
}
// Check if we are in the select screen
else if (openborvariant("in_selectscreen")) {
int screenState = getglobalvar("screen_state");
if (screenState == 1) {
if (getglobalvar("flag_screen1_loaded") == 0) {
// Clear previous entries to avoid clutter
clearspawnentry();
// Load and spawn pnameanim
loadmodel("pnameanim");
setspawnentry("name", "pnameanim");
setspawnentry("coords", 1, 0, -1);
int subent = spawn();
if (subent) {
changeentityproperty(subent, "position", 1, 0, -1);
setglobalvar("flag_screen1_loaded", 1); // Mark screen 1 as loaded
}
}
} else if (screenState == 2) {
if (getglobalvar("flag_screen2_loaded") == 0) {
// Clear previous entries to avoid clutter
clearspawnentry();
// Load and spawn pnameanim2
loadmodel("pnameanim2");
setspawnentry("name", "pnameanim2");
setspawnentry("coords", 1, 0, -1);
int subent = spawn();
if (subent) {
changeentityproperty(subent, "position", 1, 0, -1);
setglobalvar("flag_screen2_loaded", 1); // Mark screen 2 as loaded
}
}
}
}
// Not in select screen
else {
setglobalvar("flag_screen1_loaded", 0);
setglobalvar("flag_screen2_loaded", 0);
}
}
Loaded 32-bit background 'data/bgs/title'
Loaded 32-bit background 'data/bgs/titleb'
Video track: resolution=1920*1080, display resolution=1920*1080, 25.00 frames/second
Audio track: 44100.000000 Hz, 2 channels, 16 bits/sample
Loading 'pnameanim'
************ Shutting Down ************
I don't know if I understood how the "screen_state" function works, but currently in your code it only allows flag 1 to work.no matter how i rework the script..change shit around still pnameanim2 will never load..just wont it only loads 1 ugh...
C:void initializeFlags() { // Initialize flags and screen state setglobalvar("flag_screen1_loaded", 0); setglobalvar("flag_screen2_loaded", 0); setglobalvar("screen_state", 1); // Default screen state for testing } void main() { // Ensure flags are initialized if (getglobalvar("flag_screen1_loaded") == NULL()) { initializeFlags(); } // Check if the game is in the menu screen if (openborvariant("in_menuscreen")) { // Reset flags and debug test when in menu screen setglobalvar("flag_screen1_loaded", 0); setglobalvar("flag_screen2_loaded", 0); setglobalvar("screen_state", 1); // Optionally reset screen state } // Check if we are in the select screen else if (openborvariant("in_selectscreen")) { int screenState = getglobalvar("screen_state"); if (screenState == 1) { if (getglobalvar("flag_screen1_loaded") == 0) { // Clear previous entries to avoid clutter clearspawnentry(); // Load and spawn pnameanim loadmodel("pnameanim"); setspawnentry("name", "pnameanim"); setspawnentry("coords", 1, 0, -1); int subent = spawn(); if (subent) { changeentityproperty(subent, "position", 1, 0, -1); setglobalvar("flag_screen1_loaded", 1); // Mark screen 1 as loaded } } } else if (screenState == 2) { if (getglobalvar("flag_screen2_loaded") == 0) { // Clear previous entries to avoid clutter clearspawnentry(); // Load and spawn pnameanim2 loadmodel("pnameanim2"); setspawnentry("name", "pnameanim2"); setspawnentry("coords", 1, 0, -1); int subent = spawn(); if (subent) { changeentityproperty(subent, "position", 1, 0, -1); setglobalvar("flag_screen2_loaded", 1); // Mark screen 2 as loaded } } } } // Not in select screen else { setglobalvar("flag_screen1_loaded", 0); setglobalvar("flag_screen2_loaded", 0); } }
log
Code:Loaded 32-bit background 'data/bgs/title' Loaded 32-bit background 'data/bgs/titleb' Video track: resolution=1920*1080, display resolution=1920*1080, 25.00 frames/second Audio track: 44100.000000 Hz, 2 channels, 16 bits/sample Loading 'pnameanim' ************ Shutting Down ************
it just refuses to load... this is like the 6th or 7th iteration of the same damn script smfh..almost trhowing in the towel and just have a sad plain select screen ugh.
also is not the animation itself.. as i also have flipped the names and it works on the first part of the code for the first select screen... i have also splitted them into 2 scripts while keeping them in the same updated.c script with same results...id rather be split if possible that way i can add another select screen a 3rd one if i can ever get shit going and not keep getting stuck like this smfh
will check when i get home...files are right and they do work elsewhere if i try them, no crashes log looks like that cus i alt f4 a lot...also worked at one point displaying them both at the same time on both screens...the state thing ill have to recheck...was a long ass night...flag thing is confusing, actually alot of it still is lolI don't know if I understood how the "screen_state" function works, but currently in your code it only allows flag 1 to work.
In case you are having crashes while loading/spawning pnameanim/pnameanim2 entities, I suggest replacing them with any other entity to check if there's a problem with them (sprite issues or bad file paths can cause crashes too).
void main(){
//MAIN START
void SelAnim = getglobalvar("selanim"); // Read select screen animated state to check
if(openborvariant("in_menuscreen")){ // Check if the game is in menu screen
setglobalvar("counter", 0);
setglobalvar("selanim", 0);
}
if(openborvariant("in_selectscreen") && SelAnim!=1){ // Check to avoid double spawn
void counter = getglobalvar("counter"); // Read variable 1 to check
if(counter==1){ // second & subsequent select screens
void subent;
loadmodel("pnameanim2"); // load the entity to be loaded
clearspawnentry(); // clean the spawn entry
setspawnentry("name", "pnameanim2"); // define the entity to be spawned
setspawnentry("coords", 1,0,-1); // set the position of the entity
subent=spawn(); // spawn the entity
changeentityproperty(subent, "position", 1,0,-1); //for safe, set again the position
setglobalvar("selanim",1); // set the variable to 1, blocking a new spawn to be made
} else { // first select screen
void subent;
loadmodel("pnameanim"); // load the entity to be loaded
clearspawnentry(); // clean the spawn entry
setspawnentry("name", "pnameanim"); // define the entity to be spawned
setspawnentry("coords", 1,0,-1); // set the position of the entity
subent=spawn(); // spawn the entity
changeentityproperty(subent, "position", 1,0,-1); //for safe, set again the position
setglobalvar("counter", counter + 1); // incrementing select screen order
setglobalvar("selanim",1); // set the variable to 1, blocking a new spawn to be made
}
}
} // MAIN END
sadly no still pnameanim2 not loading....I've tried the update.c script myself and it didn't work. Therefore, I've updated it into this:
update.c
C:void main(){ //MAIN START void SelAnim = getglobalvar("selanim"); // Read select screen animated state to check if(openborvariant("in_menuscreen")){ // Check if the game is in menu screen setglobalvar("counter", 0); setglobalvar("selanim", 0); } if(openborvariant("in_selectscreen") && SelAnim!=1){ // Check to avoid double spawn void counter = getglobalvar("counter"); // Read variable 1 to check if(counter==1){ // second & subsequent select screens void subent; loadmodel("pnameanim2"); // load the entity to be loaded clearspawnentry(); // clean the spawn entry setspawnentry("name", "pnameanim2"); // define the entity to be spawned setspawnentry("coords", 1,0,-1); // set the position of the entity subent=spawn(); // spawn the entity changeentityproperty(subent, "position", 1,0,-1); //for safe, set again the position setglobalvar("selanim",1); // set the variable to 1, blocking a new spawn to be made } else { // first select screen void subent; loadmodel("pnameanim"); // load the entity to be loaded clearspawnentry(); // clean the spawn entry setspawnentry("name", "pnameanim"); // define the entity to be spawned setspawnentry("coords", 1,0,-1); // set the position of the entity subent=spawn(); // spawn the entity changeentityproperty(subent, "position", 1,0,-1); //for safe, set again the position setglobalvar("counter", counter + 1); // incrementing select screen order setglobalvar("selanim",1); // set the variable to 1, blocking a new spawn to be made } } } // MAIN END
Try this and tell me if this works on your end.
Loaded 32-bit background 'data/bgs/title'
Loaded 32-bit background 'data/bgs/titleb'
Video track: resolution=1920*1080, display resolution=1920*1080, 25.00 frames/second
Audio track: 44100.000000 Hz, 2 channels, 16 bits/sample
Loading 'pnameanim' from data/chars/misc/pnameanim.txt
...done!
Level Loading: 'DATA/LEVELS/level51.TXT'
Total Ram: 32092991488 Bytes ( 30606 MB )
Free Ram: 20304711680 Bytes ( 19364 MB )
Used Ram: 131371008 Bytes ( 125 MB )
Loading 'moonbeach' from data/bgs/level5/l51/moonbeach.txt
...done!
Loading 'ocean' from data/bgs/level5/l51/ocean.txt
...done!
Loading 'trash' from data/chars/misc/Trash.txt
SET VENGEANCE
credits 50
lives 3
nosame 1
typemp 1
custfade 250
cansave 2
disablehof 1
maxplayers 3
skipselect
scene data/scenes/title.txt
select data/bgs/select1.txt
void main(){
void SelAnim = getglobalvar("selanim"); // Read select screen animated state to check
if(openborvariant("in_menuscreen")){ // Check if the game is in menu screen
setglobalvar("counter", 0);
setglobalvar("selanim", 0);
}
if(openborvariant("in_selectscreen") && SelAnim!=1){ // Check to avoid double spawn
void counter = getglobalvar("counter"); // Read variable 1 to check
if(counter==0){ // second & subsequent select screens
void subent;
loadmodel("pnameanim"); // load the entity to be loaded
clearspawnentry(); // clean the spawn entry
setspawnentry("name", "pnameanim"); // define the entity to be spawned
setspawnentry("coords", 1,0,-1); // set the position of the entity
subent=spawn(); // spawn the entity
changeentityproperty(subent, "position", 1,0,-1); //for safe, set again the position
setglobalvar("selanim",1); // set the variable to 1, blocking a new spawn to be made
} else { // first select screen
void subent;
loadmodel("pnameanim2"); // load the entity to be loaded
clearspawnentry(); // clean the spawn entry
setspawnentry("name", "pnameanim2"); // define the entity to be spawned
setspawnentry("coords", 1,0,-1); // set the position of the entity
subent=spawn(); // spawn the entity
changeentityproperty(subent, "position", 1,0,-1); //for safe, set again the position
setglobalvar("counter", counter + 1); // incrementing select screen order
setglobalvar("selanim",1); // set the variable to 1, blocking a new spawn to be made
}
}
}
oh ok wow lol.. yet more complex than i thought and yeah exactly what you just said would be whats needed.. apologies i didnt even thought it would be like that.I think I should tell you that this second select screen animation only works if you play it from the beginning. If you saved game after playing couple stages, then exit the game then replaying the game then load that saved game, select screen animation will start from the first one. To solve this, I need to change the script to play second animation when a variable is set in a level instead.
As for different select screen animation for different modes, that's doable but will need change of the script to check for mode instead.
void main(){
//MAIN START
if(openborvariant("in_menuscreen") || openborvariant("in_titlescreen")){
setglobalvar("selanim", 0);
} else if(openborvariant("in_selectscreen")){
void SelAnim = getglobalvar("selanim"); // Read select screen animated state to check
if(SelAnim!=1){ // Check to avoid double spawn
int Set = openborvariant("current_set"); //Get set number
int Stage = openborvariant("current_level"); //Get stage number
void Screen, subent;
if(Set>=1){ // second & other modes
Screen = "pnameanim3";
} else if(Stage>=1){ // second & subsequent select screens in first mode
Screen = "pnameanim2";
} else { // first select screen in first mode
Screen = "pnameanim";
}
clearspawnentry(); // clean the spawn entry
setspawnentry("name", Screen); // define the entity to be spawned
setspawnentry("coords", 0,0,-1); // set the position of the entity
subent=spawn(); // spawn the entity
changeentityproperty(subent, "direction", 1); // Fix facing direction
setglobalvar("selanim",1); // set the variable to 1, blocking a new spawn to be made
}
}
} // MAIN END
GDLK... i will do sir and yes youre correct..1 mode to start in which after level 4 the second select screen will show up after beating the characters that wil join you...then after beating the game the other mode where the characters are unlucked from the start hence that modes first select screen will be pnameanim2 since its the one with the characters unlucked... and since those are unlocked already in the second mode... there will be a replacement for them hence the 3rd select screen xD... will play around with it and thank you so much brother.Alright, I've modified the script to fix the issue I've mentioned above and add mode check.
update.c
C:void main(){ //MAIN START if(openborvariant("in_menuscreen") || openborvariant("in_titlescreen")){ setglobalvar("selanim", 0); } else if(openborvariant("in_selectscreen")){ void SelAnim = getglobalvar("selanim"); // Read select screen animated state to check if(SelAnim!=1){ // Check to avoid double spawn int Set = openborvariant("current_set"); //Get set number int Stage = openborvariant("current_level"); //Get stage number void Screen, subent; if(Set>=1){ // second & other modes Screen = "pnameanim3"; } else if(Stage>=1){ // second & subsequent select screens in first mode Screen = "pnameanim2"; } else { // first select screen in first mode Screen = "pnameanim"; } clearspawnentry(); // clean the spawn entry setspawnentry("name", Screen); // define the entity to be spawned setspawnentry("coords", 0,0,-1); // set the position of the entity subent=spawn(); // spawn the entity changeentityproperty(subent, "direction", 1); // Fix facing direction setglobalvar("selanim",1); // set the variable to 1, blocking a new spawn to be made } } } // MAIN END
I've removed loading lines assuming that pnameanim, pnameanim2 and pnameanim3 are already LOADed in models.txt.
Pnameanim will be played on select screen in first game mode. Then the next select screens after first level will have Pnameanim2 played.
Pnameanim will be played on second and other game modes.
I don't know how you arranged your game modes or level sets so I only assume you only have one main mode which is not locked and other modes which require unlocking.
This might require modifications but for now give this a try![]()
void main(){
//MAIN START
if(openborvariant("in_menuscreen") || openborvariant("in_titlescreen")){
setglobalvar("selanim", 0);
} else if(openborvariant("in_selectscreen")){
void SelAnim = getglobalvar("selanim"); // Read select screen animated state to check
if(SelAnim!=1){ // Check to avoid double spawn
int Set = openborvariant("current_set"); //Get set number
int Stage = openborvariant("current_level"); //Get stage number
void Screen, subent;
// Set Stage to 0 if it is 2
if (Stage == 2) {
Stage = 0; }
void Screen, subent;
if(Set>=1){ // second & other modes
Screen = "pnameanim3";
} else if(Stage>=1){ // second & subsequent select screens in first mode
Screen = "pnameanim2";
} else { // first select screen in first mode
Screen = "pnameanim";
}
clearspawnentry(); // clean the spawn entry
setspawnentry("name", Screen); // define the entity to be spawned
setspawnentry("coords", 0,0,-1); // set the position of the entity
subent=spawn(); // spawn the entity
changeentityproperty(subent, "direction", 1); // Fix facing direction
setglobalvar("selanim",1); // set the variable to 1, blocking a new spawn to be made
}
}
} // MAIN END
void main()
{
setglobalvar("selanim", NULL());
}
void main() {
// MAIN START
if(openborvariant("in_menuscreen") || openborvariant("in_titlescreen")) {
setglobalvar("selanim", 0);
} else if(openborvariant("in_selectscreen")) {
void SelAnim = getglobalvar("selanim"); // Read select screen animated state to check
if(SelAnim != 1) { // Check to avoid double spawn
int Set = openborvariant("current_set"); // Get set number
int Stage = openborvariant("current_level"); // Get stage number
void Screen, subent;
// Set Stage to 0 if it is 2
if (Stage == 2) {
Stage = 0;
}
if(Set >= 2) { // Third mode
if(Stage >= 1) { // Second select screen in third mode
Screen = "pnameanim6";
} else { // First select screen in third mode
Screen = "pnameanim5";
}
} else if(Set == 1) { // Second mode
if(Stage >= 1) { // Second select screen in second mode
Screen = "pnameanim4";
} else { // First select screen in second mode
Screen = "pnameanim3";
}
} else { // First mode
if(Stage >= 1) { // Second & subsequent select screens in first mode
Screen = "pnameanim2";
} else { // First select screen in first mode
Screen = "pnameanim";
}
}
clearspawnentry(); // Clean the spawn entry
setspawnentry("name", Screen); // Define the entity to be spawned
setspawnentry("coords", 0, 0, -1); // Set the position of the entity
subent = spawn(); // Spawn the entity
changeentityproperty(subent, "direction", 1); // Fix facing direction
setglobalvar("selanim", 1); // Set the variable to 1, blocking a new spawn to be made
}
}
} // MAIN END