Author Topic: Stage Creation Question(s)  (Read 11584 times)

Stage Creation Question(s)
« on: April 28, 2009, 10:55:00 PM »
I'll be posting here when I have questions regarding stage creation scripts in Danmakufu. Feel free to post your own, so we don't clutter the board with questions regarding the same topic.

Here's a relatively easy question to start us off. I'm making a stage, and none of the damn enemies will spawn. I have no idea what I've done wrong, but I know it's gonna be something simple like "lol you left out ; here".

Here's the Stage Script:

Code: [Select]
#?????e????[Stage]
#Title[Lala Stage]
#Text[Lalalala.]
#Image[]
#BackGround[User(.\PIC\black.png, 1, 1)]
#Player[FREE]
#ScriptVersion[2]

script_stage_main
{
        let BlueEnemy = GetCurrentScriptDirectory~"PIC\BlueEnemy.txt";
        let imgEnemy = GetCurrentScriptDirectory~"PIC\Fairy.png";
       
task StageTask{

                function Wait(let frames){
loop(frames){yield;}
}
                function WaitForZeroEnemy{
while(GetEnemyNum() != 0){yield;}
}

                Wait(30);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"PIC\BlueEnemy.txt", 30, 120, 0, 0, 0);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"PIC\BlueEnemy.txt", 20, 120, 0, 0, 0);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"PIC\BlueEnemy.txt", 10, 120, 0, 0, 0);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"PIC\BlueEnemy.txt", 418, 120, 0, 0, 0);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"PIC\BlueEnemy.txt", 428, 120, 0, 0, 0);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"PIC\BlueEnemy.txt", 438, 120, 0, 0, 0);
                WaitForZeroEnemy;
                Wait(60);
                Clear;
}

@Initialize()
{
                LoadGraphic(imgEnemy);
                StageTask;
}

@MainLoop()
{
                yield;
}

@Finalize()
{
                DeleteGraphic(imgEnemy);
}

}

And the enemy I'm trying to spawn, "BlueEnemy.txt", located in the PIC directory:
Code: [Select]
script_enemy_main
{

let imgEnemy = GetCurrentScriptDirectory~"Fairy.png";
let destroy = 1;
let drawcounter = 0;
let frame = 0;
let v = 0;
let angle = 0;

@Initialize{
Concentration01(10);
SetLife(14);
}

@Mainloop{
    SetCollisionA(GetX, GetY, 16);
    SetCollisionB(GetX, GetY, 8);
frame++;

if(frame%12==0){
loop(5){
loop(7){
CreateShot01(GetX, GetY, v, GetAngleToPlayer + angle, BLUE21, 0);
v+=0.7;
}
v = 1;
angle += 360/5;
}
angle = 0;
}

}

@Drawloop{
drawcounter++;
SetTexture(imgEnemy);
SetRenderState(ALPHA);
SetAlpha(255);
//Blue Fairy drawing information.
if(drawcounter%9==1 || drawcounter%9==2 || drawcounter%9==3){
if(GetSpeedX()==0){SetGraphicRect(0, 0, 31, 31);}
else if(GetSpeedX()>0){SetGraphicRect(160, 32, 191, 63);}
else if(GetSpeedX()<0){SetGraphicRect(0, 32, 31, 63);}
}
if(drawcounter%9==4 || drawcounter%9==5 || drawcounter%9==6){
if(GetSpeedX()==0){SetGraphicRect(32, 0, 63, 31);}
else if(GetSpeedX()>0){SetGraphicRect(192, 32, 223, 63);}
else if(GetSpeedX()<0){SetGraphicRect(32, 32, 63, 63);}
}
if(drawcounter%9==7 || drawcounter%9==8 || drawcounter%9==0){
if(GetSpeedX()==0){SetGraphicRect(64, 0, 95, 31);}
else if(GetSpeedX()>0){SetGraphicRect(224, 32, 255, 63);}
else if(GetSpeedX()<0){SetGraphicRect(64, 32, 63, 95);}
}
DrawGraphic(GetX, GetY);
}

@Finalize{
if(destroy==1){
loop(2){
CreateItem(ITEM_SCORE, GetX + rand(-20, 20), GetY + rand(-20, 20));
}
}
}
}

Doesn't spawn the enemy, Reimu_A won't even lock in on anything. I know the enemy doesn't move, I just want it to spawn at this point.

Stuffman

  • *
  • We're having a ball!
Re: Stage Creation Question(s)
« Reply #1 on: April 29, 2009, 01:35:00 AM »
I'm stumped! I tried putting debug strings in there and adding a drawloop to show what part of the script it's in but nothing shows up!

Re: Stage Creation Question(s)
« Reply #2 on: April 29, 2009, 01:37:01 AM »
Well fuck.

Here's a .rar in case I copied something incorrectly.
« Last Edit: April 29, 2009, 01:41:55 AM by Naut »

Nuclear Cheese

  • Relax and enjoy the danmaku.
    • My homepage
Re: Stage Creation Question(s)
« Reply #3 on: April 29, 2009, 02:44:35 AM »
Well fuck.

Here's a .rar in case I copied something incorrectly.

The enemies are dissapearing immediately.  Hang on, I'm investigating.


EDIT: Figured it out.

Please try to remain calm and not hate yourself for this. ;)



In your enemy script (BlueEnemy.txt), you have @MainLoop and @DrawLoop improperly capitalized.

Danmakufu, like C, is case-sensitive.
Unfortunately, Danmakufu also will silently fail if you're missing one of the main functions, since it just assumes that you didn't want it.

So your script should work fine if you correct the capitalization.


As a programmer, I know how frustrating these little typos can be, since you'll look over them hundreds of times without noticing.  Then when you do notice, you want to smack yourself. :P
Happens to me all the time.
« Last Edit: April 29, 2009, 02:50:41 AM by Nuclear Cheese »
to quote Naut:
"I can see the background, there are too many safespots."
:V

Re: Stage Creation Question(s)
« Reply #4 on: April 29, 2009, 03:56:52 AM »
Figures. I knew it was something so small... I would've never noticed that, thanks a billion. Wish Danmakufu would've flagged it in an error message. However cryptic they may be, it's always more helpful than the nothing this yielded.

Re: Stage Creation Question(s)
« Reply #5 on: May 30, 2009, 01:23:20 AM »
Is there any way to preload stuff, or effectively call upon in the midst of stages? For example, I know you can load the enemy graphic sheet once at the beginning of the stage and never load it again, but can you load things like the shot replace script (and still use it's bullets in spellcard scripts)? Like, in most completed games there is a loading screen (CtC, Phantasm Romance, Fantom Fantasm, Etc). What does it load, and how do they do it.

Anything to speed up the transition from spellcard to spellcard, tired of that massive fps spike during @Initialize.

Stuffman

  • *
  • We're having a ball!
Re: Stage Creation Question(s)
« Reply #6 on: May 30, 2009, 03:46:43 PM »
Beats me, I've never used #includes.

Should be quick to try, I guess? Put the #include in your stage and see if your enemies can use the shotreplace bullets.

Though, if you want your spellcards to be playable in Single mode or your bosses in Plural, you're still going to have to put that #include in the individual spellcards.