O Ilusionista
Captain 100K
For this tutorial, we use script.txt, not script.c. And you should need to put it under the DATA folder.script.c
And no, it doesn't need main or anything like that.
For this tutorial, we use script.txt, not script.c. And you should need to put it under the DATA folder.script.c
Understood, thanks alot.For this tutorial, we use script.txt, not script.c. And you should need to put it under the DATA folder.
And no, it doesn't need main or anything like that.
I just started applying this script to my updated.c for the title screen animation, but somehow it keeps on adding an entity on the screen everytime the engine goes from the intro to the title screen.Understood, thanks alot.
For now, I am just going through your tutorial index list one by one to see which one I can use in my new game. I will start working on it in November or so.
You don't need a globalvar for that. This is handled by this loop:I added the globalvar for spawned entity and kill it with the killentity function, and it seemed to prevent from the addition.
if(openborvariant("in_titlescreen"))
{
void counter = getlocalvar("counter");
counter = setlocalvar("counter",0);
}
What I meant wasYou don't need a globalvar for that. This is handled by this loop:
C-like:if(openborvariant("in_titlescreen")) { void counter = getlocalvar("counter"); counter = setlocalvar("counter",0); }
void counter = getlocalvar("counter");
counter = setlocalvar("counter",0);
openborvariant("in_options")
Then you have to change the code - this code is spawning an entity on the select screen, not in the title screen.I want the spawned entity to disappear completely in the intro, then reappears whenever the engine is back to the title screen again.
I had this code in the title screen:Then you have to change the code - this code is spawning an entity on the select screen, not in the title screen.
Here is an update version I am using on my MMPR project - I have different entities for TITLE and SELECT screen:
{
void counter = getlocalvar("counter");
void vSpawn;
while(counter!=1)
{
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
counter = setlocalvar("counter",1); // turn on the variable, blocking a new spawn to be made
}
}
void counter = getlocalvar("counter");
counter = setlocalvar("counter",0);
void aniScreen(){
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")){
counter = setlocalvar("counter", 0);
}
if((openborvariant("in_titlescreen")) && (counter != 1)){
void subent;
loadmodel("bgmtitle");
clearspawnentry();
setspawnentry("name", "bgmtitle");
setspawnentry("coords", 1, 0, -1);
subent = spawn();
void mStyle = getglobalvar("musicStyle");
if(mStyle == 0){
changeentityproperty(subent, "animation", openborconstant("ANI_FOLLOW1"));
}else if(mStyle == 1){
changeentityproperty(subent, "animation", openborconstant("ANI_FOLLOW2"));
}else if(mStyle == 2){
changeentityproperty(subent, "animation", openborconstant("ANI_FOLLOW3"));
}
//counter = setlocalvar("counter", 1);
}
if(openborvariant("in_menuscreen")){
counter = setlocalvar("counter", 2);
}
if(openborvariant("in_selectscreen") && (counter != 3)){
//void counter = getlocalvar("counter");
void vSpawn;
while(counter!=3){
void subent;
loadmodel("scrSel");
clearspawnentry();
setspawnentry("name", "scrSel");
void mStyle = getglobalvar("musicStyle");
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",3); // turn on the variable, blocking a new spawn to be made
//counter2 = setlocalvar("counter2",1);
//cusent = spawn();
//changeentityproperty(cusent, "position", 440,130,-1); //for safe, set again the position
if(mStyle == 0){
changeentityproperty(subent, "animation", openborconstant("ANI_FOLLOW1"));
//counter = setlocalvar("counter",1);
}else if(mStyle == 1){
changeentityproperty(subent, "animation", openborconstant("ANI_FOLLOW3"));
//counter = setlocalvar("counter",1);
}else if(mStyle == 2){
changeentityproperty(subent, "animation", openborconstant("ANI_FOLLOW2"));
//counter = setlocalvar("counter",1);
}
}
}
}
name bgmtitle
type none
facing 1
palette none
nomove 1 1
#setlayer -100000
anim spawn
delay 5
offset 1 1
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
anim follow1 #green
delay 2
offset 0 0
@cmd changeentityproperty getlocalvar("self") "direction" 1
frame data/bgs/title/titleG.gif
frame data/bgs/title/titleG.gif
anim follow2 #red
delay 2
offset 0 0
@cmd changeentityproperty getlocalvar("self") "direction" 1
frame data/bgs/title/titleR.gif
frame data/bgs/title/titleR.gif
anim follow3 #blue
delay 2
offset 0 0
@cmd changeentityproperty getlocalvar("self") "direction" 1
frame data/bgs/title/titleB.gif
frame data/bgs/title/titleB.gif
name scrSel
type none
facing 1
palette none
nomove 1 1
setlayer -100000
animationscript data/scripts/animation/default.c
load selection
load bgmgrid
load selectr
load selectg
load selectb
load zeus2
anim spawn
offset 480 0
delay 2
@cmd projectile 1 "selection" 0 0 0
#custentity zeus2
#spawnframe 0 444 130 0 1
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
anim follow1 #Green
delay 2
offset 0 0
@cmd spawn001 "bgmgrid" "bgmgrid" 0 3 0 1
spawnframe 0 30 -40 0 0
custentity selectg
@cmd changeentityproperty getlocalvar("self") "direction" 1
frame data/bgs/select/selectg.png
frame data/bgs/select/selectg.png
anim follow2 #Blue
delay 2
offset 0 0
spawnframe 0 0 0 0 0
custentity selectb
#@cmd spawn01 "selectb" 0 0 0
@cmd spawn001 "bgmgrid" "bgmgrid" 2 3 0 1
@cmd changeentityproperty getlocalvar("self") "direction" 1
frame data/bgs/select/selectb.png
frame data/bgs/select/selectb.png
anim follow3 #Red
delay 2
#offset 480 0
offset 0 0
spawnframe 0 30 0 0 0
subentity selectr
@cmd spawn001 "bgmgrid" "bgmgrid" 1 3 0 1
@cmd changeentityproperty getlocalvar("self") "direction" 1
frame data/bgs/select/selectr_.png
frame data/bgs/select/selectr_.png
I would need to see your log, but from my experience, this happens because you simply refer to a localvar without ever describe it on the first place.Edit: I am quite lost on where to get the select screen part working. It crashes every time I select a game mode which has select screen scripted.
void aniScreen(){
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)
void main(){
if(openborvariant("in_titlescreen"))
{
void counter = getlocalvar("counter");
counter = setlocalvar("counter",0);
}
if(openborvariant("in_selectscreen"))
{
void counter = getlocalvar("counter");
void vSpawn;
while(counter!=1)
Since you are using a localvar inside a function, it will be available only in the local scope, not outside it.
Put the variables outside the function, like on my example on the first post.
void aniScreen(){
//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_titlescreen")){
void counter = getlocalvar("counter");
counter = setlocalvar("counter", 0);
}
if(openborvariant("in_titlescreen") || openborvariant("in_menuscreen")){
void counter = getlocalvar("counter");
void subent;
loadmodel("bgmtitle");
clearspawnentry();
setspawnentry("name", "bgmtitle");
setspawnentry("coords", 1, 0, -1);
subent = spawn();
changeentityproperty(subent, "position", 1,0,-1);
void mStyle = getglobalvar("musicStyle");
if(mStyle == 0){
changeentityproperty(subent, "animation", openborconstant("ANI_FOLLOW1"));
}else if(mStyle == 1){
changeentityproperty(subent, "animation", openborconstant("ANI_FOLLOW2"));
}else if(mStyle == 2){
changeentityproperty(subent, "animation", openborconstant("ANI_FOLLOW3"));
}
//counter = setlocalvar("counter", 1);
}
//if(openborvariant("in_menuscreen")){
// counter = setlocalvar("counter", 2);
//}
if(openborvariant("in_selectscreen")){
void counter = getlocalvar("counter");
void vSpawn;
while(counter!=1){
void counter = getlocalvar("counter");
void subent;
loadmodel("scrSel");
clearspawnentry();
setspawnentry("name", "scrSel");
void mStyle = getglobalvar("musicStyle");
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",3); // turn on the variable, blocking a new spawn to be made
//counter2 = setlocalvar("counter2",1);
//cusent = spawn();
//changeentityproperty(cusent, "position", 440,130,-1); //for safe, set again the position
if(mStyle == 0){
changeentityproperty(subent, "animation", openborconstant("ANI_FOLLOW1"));
//counter = setlocalvar("counter",1);
}else if(mStyle == 1){
changeentityproperty(subent, "animation", openborconstant("ANI_FOLLOW3"));
//counter = setlocalvar("counter",1);
}else if(mStyle == 2){
changeentityproperty(subent, "animation", openborconstant("ANI_FOLLOW2"));
//counter = setlocalvar("counter",1);
}
}
}
}
May @DCurrent corrects me but, as far as I know, those "palette none" entites won't add too much to the memory consumption, unless you really do something serious - as this will cost 768 bytes per image. But scritp is a whole different animal. Probably you are setting the same varible over and over.The log says, "Out of memory!"j in the attachment. (Maybe I still have trouble with getlocalvar("counter")?)
I have other entities loaded within an entity that has 'palette none' in the select screen area (depending on the chosen music style).

void main()
{
if(openborvariant("in_titlescreen")){
drawstring(110,10,3,"Version 1.10");
drawstring(110,250,2,"MysticalMist 2024-2026");
void counter = getlocalvar("counter");
void vSpawn;
void counter2 = getlocalvar("counter2");
counter2 = setlocalvar("counter2",0);
while(counter!=1)
{
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
counter = setlocalvar("counter",1); // turn on the variable, blocking a new spawn to be made
}
}
if(openborvariant("in_level")){
displayContinue();
//Announcer
processRushCount();
}
if(openborvariant("in_menuscreen"))
{
drawstring(110,10,3,"Version 1.10");
drawstring(110,250,2,"MysticalMist 2024-2026");
void counter = getlocalvar("counter");
void vSpawn;
void counter2 = getlocalvar("counter2");
counter2 = setlocalvar("counter2",0);
while(counter!=1)
{
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
counter = setlocalvar("counter",1); // turn on the variable, blocking a new spawn to be made
}
}
if(openborvariant("in_halloffamescreen"))
{
drawstring(110,10,3,"Version 1.10");
drawstring(110,250,2,"MysticalMist 2024-2026");
void counter2 = getlocalvar("counter2");
void vSpawn;
void counter = getlocalvar("counter");
counter = setlocalvar("counter",0);
while(counter2!=1)
{
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
}
}
}
That is because you need to reset the "counter" variable to 0 in your "in_selectscreen".When I enter a character select screen and then return to the title screen with esc, the background entity disappears. Whereas if I'm in a level and end the game, the bg entity reappears just fine. I feel like I'm overlooking something though.
counter = setlocalvar("counter",0);
if(openborvariant("in_selectscreen"))
{
counter = setlocalvar("counter",0);
}
That is because you need to reset the "counter" variable to 0 in your "in_selectscreen".
Ah whoops, I should've seen that sooner. I love coding sooo much...
Thank you!!
Check your models, offset and palettes, please.So, the only issue I have is that the frames don't appear.
mind to post your code?Gotcha. Still, since it never gave me an error message on the log, I have an idea on what to do. I apologize for any inconvenience, Ilu.