name bgfx1
health 1
type panel
speed 10
shadow 0
setlayer -2000
facing 1
palette none
anim idle
loop 1 1
offset 0 0
delay 10
@cmd changeentityproperty getlocalvar("self") "direction" 1
frame data/bgs/bgfx1/1.gif
@cmd changeentityproperty getlocalvar("self") "setlayer" -2000
frame data/bgs/bgfx1/2.gif
frame data/bgs/bgfx1/3.gif
frame data/bgs/bgfx1/4.gif
frame data/bgs/bgfx1/5.gif
frame data/bgs/bgfx1/6.gif
frame data/bgs/bgfx1/7.gif
frame data/bgs/bgfx1/8.gif
frame data/bgs/bgfx1/9.gif
frame data/bgs/bgfx1/10.gif
frame data/bgs/bgfx1/11.gif
void main(){//MAIN START
if(getglobalvar("zoomentity"))
{
zoom();
}
void counter= getlocalvar("counter"); // Set a variable to trigger the spawn on and off (title)
void counter2= getlocalvar("counter2"); // Set a variable to trigger the spawn on and off (select)
void counter3= getlocalvar("counter3"); // Set a variable to trigger the spawn on and off (select)
if(openborvariant("in_menuscreen")) // Check if the game is in menu screen
{counter = setlocalvar("counter",0); }
if((openborvariant("in_titlescreen")) &&(counter!=1)) // Check the variable to avoid double spawn
{void subent;
loadmodel("bgfx2"); // name of the entity to be loaded
clearspawnentry(); // clean the spawn entry
setspawnentry("name", "bgfx2"); // 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
counter = setlocalvar("counter",1); // turn on the variable, blocking a new spawn to be made
}
if(openborvariant("in_menuscreen")) // Check if the game is in menu screen
{counter2 = setlocalvar("counter2",0); }
if((openborvariant("in_selectscreen")) &&(counter2!=1)) // Check the variable to avoid double spawn
{void subent;
loadmodel("bgfx"); // name of the entity to be loaded
clearspawnentry(); // clean the spawn entry
setspawnentry("name", "bgfx"); // 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
counter2 = setlocalvar("counter2",1); // turn on the variable, blocking a new spawn to be made
}
if(openborvariant("in_menuscreen")) // Check if the game is in menu screen
{counter3 = setlocalvar("counter3",0); }
if((openborvariant("in_options")) &&(counter3!=1)) // Check the variable to avoid double spawn
{void subent;
loadmodel("options"); // name of the entity to be loaded
clearspawnentry(); // clean the spawn entry
setspawnentry("name", "options"); // 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
counter3 = setlocalvar("counter3",1); // turn on the variable, blocking a new spawn to be made
}
}// MAIN END
kimono said:alemasper: Hi, I use these scripts both in title and select scenes. They are located in data/scripts/updated.c (bgfx2 for title screen and bgfx for select):
Code:void main(){//MAIN START if(getglobalvar("zoomentity")) { zoom(); } void counter= getlocalvar("counter"); // Set a variable to trigger the spawn on and off (title) void counter2= getlocalvar("counter2"); // Set a variable to trigger the spawn on and off (select) void counter3= getlocalvar("counter3"); // Set a variable to trigger the spawn on and off (select) if(openborvariant("in_menuscreen")) // Check if the game is in menu screen {counter = setlocalvar("counter",0); } if((openborvariant("in_titlescreen")) &&(counter!=1)) // Check the variable to avoid double spawn {void subent; loadmodel("bgfx2"); // name of the entity to be loaded clearspawnentry(); // clean the spawn entry setspawnentry("name", "bgfx2"); // 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 counter = setlocalvar("counter",1); // turn on the variable, blocking a new spawn to be made } if(openborvariant("in_menuscreen")) // Check if the game is in menu screen {counter2 = setlocalvar("counter2",0); } if((openborvariant("in_selectscreen")) &&(counter2!=1)) // Check the variable to avoid double spawn {void subent; loadmodel("bgfx"); // name of the entity to be loaded clearspawnentry(); // clean the spawn entry setspawnentry("name", "bgfx"); // 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 counter2 = setlocalvar("counter2",1); // turn on the variable, blocking a new spawn to be made } if(openborvariant("in_menuscreen")) // Check if the game is in menu screen {counter3 = setlocalvar("counter3",0); } if((openborvariant("in_options")) &&(counter3!=1)) // Check the variable to avoid double spawn {void subent; loadmodel("options"); // name of the entity to be loaded clearspawnentry(); // clean the spawn entry setspawnentry("name", "options"); // 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 counter3 = setlocalvar("counter3",1); // turn on the variable, blocking a new spawn to be made } }// MAIN END
bgfx and bgfx2 are in data/chars/misc/bgfx folder and declared in models.txt. You can see how it works at the demo here:
https://drive.google.com/open?id=1kLs2Q9DgDdmTiuuIopRQme_5gdNuQAcI
I will upload an update of this project in the forum in the following days. Any clue of what kind of project do you prepare?
#include "data/scripts/AniTitle.c"
#include "data/scripts/story/story_define.h"
#include "data/scripts/story.c"
#include "data/scripts/gettick.c"
#include "data/scripts/playsound.c"
void zoom()
{
void vscreen = openborvariant("vscreen");
int maxz=openborvariant("PLAYER_MAX_Z")+1000;
int zoom_value=getglobalvar("zoomvalue");
int zoom_x=getglobalvar("zoomx");
int zoom_y=getglobalvar("zoomy");
void ent=getglobalvar("zoomentity");
int px=getentityproperty(ent,"x") + zoom_x - openborvariant("xpos");
int py=getentityproperty(ent,"z") + zoom_y - openborvariant("ypos") - getentityproperty(ent,"a");
void zoom_scr = getglobalvar("zoomscreen");
if(!zoom_scr){
zoom_scr = allocscreen(openborvariant("hResolution"),openborvariant("vResolution"));
setglobalvar("zoomscreen",zoom_scr);
}
clearscreen(zoom_scr);
//draw what we need
drawspriteq(zoom_scr,0,openborconstant("MIN_INT"),maxz,0,0);
//setup drawMethod
//setdrawmethod(NULL(), 0); // ADDED - Nullify the trail effect
changedrawmethod(NULL(),"reset",1);
changedrawmethod(NULL(),"enabled",1);
changedrawmethod(NULL(),"scalex",zoom_value);
changedrawmethod(NULL(),"scaley",zoom_value);
changedrawmethod(NULL(),"centerx",px);
changedrawmethod(NULL(),"centery",py);
//Draw the resized customized screen to main screen.
drawscreen(zoom_scr,px,py, maxz+1);
changedrawmethod(NULL(),"enabled", 0);
drawspriteq(vscreen, 0, maxz+1,maxz+1, 0, 0);
drawspriteq(vscreen, 0, maxz+2,openborconstant("MAX_INT"), 0, 0);
changedrawmethod(NULL(),"reset",1);
clearspriteq();
}
void main(){//MAIN START
void counter= getlocalvar("counter"); // Set a variable to trigger the spawn on and off (title)
void counter2= getlocalvar("counter2"); // Set a variable to trigger the spawn on and off (select)
void counter3= getlocalvar("counter3"); // Set a variable to trigger the spawn on and off (select)
if(openborvariant("in_menuscreen")) // Check if the game is in menu screen
{counter = setlocalvar("counter",0); }
if((openborvariant("in_titlescreen")) &&(counter!=1)) // Check the variable to avoid double spawn
{void subent;
loadmodel("bgfx2"); // name of the entity to be loaded
clearspawnentry(); // clean the spawn entry
setspawnentry("name", "bgfx2"); // 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
counter = setlocalvar("counter",1); // turn on the variable, blocking a new spawn to be made
}
if(openborvariant("in_titlescreen")) // Check if the game is in menu screen
{counter2 = setlocalvar("counter2",0); }
if((openborvariant("in_menuscreen")) &&(counter2!=1)) // Check the variable to avoid double spawn
{void subent;
loadmodel("bgfx"); // name of the entity to be loaded
clearspawnentry(); // clean the spawn entry
setspawnentry("name", "bgfx"); // 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
counter2 = setlocalvar("counter2",1); // turn on the variable, blocking a new spawn to be made
}
if(openborvariant("in_menuscreen")) // Check if the game is in menu screen
{counter3 = setlocalvar("counter3",0); }
if((openborvariant("in_options")) &&(counter3!=1)) // Check the variable to avoid double spawn
{void subent;
loadmodel("bgfx3"); // name of the entity to be loaded
clearspawnentry(); // clean the spawn entry
setspawnentry("name", "bgfx3"); // 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
counter3 = setlocalvar("counter3",1); // turn on the variable, blocking a new spawn to be made
}
if(getglobalvar("zoomentity"))
{
zoom();
}
mainLoop();
processRushCount();
}
// MAIN END
void main(){
void counter= getlocalvar("counter"); // Set a variable to trigger the spawn on and off
if(openborvariant("in_titlescreen")) // Check if the game is in menu screen
{ counter = setlocalvar("counter",0); }
if((openborvariant("in_menuscreen")) &&(counter!=1)) // Check the variable to avoid double spawn
{ void subent;
loadmodel("bgfx"); // name of the entity to be loaded
clearspawnentry(); // clean the spawn entry
setspawnentry("name", "bgfx"); // define the entity to be spawn
setspawnentry("coords", 240,380,0); // set the position of the entity
subent=spawn(); // spawn the entity
changeentityproperty(subent, "position", 240,380,0); //for safe, set again the position
counter = setlocalvar("counter",1); // turn on the variable, blocking a new spawn to be made
}
if(getglobalvar("zoomentity"))
{
zoom();
}
processRushCount();
mainLoop();
}
Thank you very much for your kind sharing your script with us.Edit: You need to set ALWAYSUPDATE 1 in scripts.txt.
How do I load the bgfx at anytime in the certain stage?
- "in_level", detects if you are playing a level
Take a look at the manual OpenBORManual - DCEmulationAm I supposed to create a file called "scripts" and type in ALWAYSUPDATE 1 and nothing else inside?
Once you load something, it will stay in the memory until you let it go, so there is no need to load it on stages.How do I load the bgfx at anytime in the certain stage?
I understand, but I currently don't have the file called "scripts.c or script.cTake a look at the manual OpenBORManual - DCEmulation
ah no, as the manual says, its "script.txt" and you save it under the data folderI understand, but I currently don't have the file called "scripts.c or script.c
Is there anything (main, etc..) needs to be on script.c beside ALWAYSUPDATE 1 ?ah no, as the manual says, its "script.txt" and you save it under the data folder