Author Topic: I need a bit of help with this Danmakufu script?  (Read 6530 times)

Sakuyasan

I need a bit of help with this Danmakufu script?
« on: November 30, 2009, 01:09:32 AM »
I am using Blargel's old tutorial to try and learn Danmakufu, but so far, not much progress...

I am trying to make a Spellcard, but I keep getting the "script_enemy_main" error when I run it in Danmakufu.

Before I show you the script, be reminded that I use the ZUN shot replacement, found at http://www.smwcentral.net/?p=thread&pid=388078&r=1#id388078.

Code: [Select]
#TouhouDanmakufu
#Title[Clocked Luna Dial]
#Image[.\SWR_sakuya.jpg]
#BGM[.\sakuya.mp3]
#PlayLevel[Normal]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let frame = 0;
    let BossCutIn = "SWR_sakuya.jpg";
    @Initialize {
        LoadUserShotData;
        SetLife(100000);
        SetDamageRate(100, 100);
        SetTimer(200);
        Set Invincibility(30);
        CutIn(KOUMA, "Clocked Luna Dial", BossCutIn, 0, 0, 200, 600);
        SetScore(50000000)
        SetEnemyMarker(true);
        SetDurableSpellCard;
        Concentration01(60);
        MagicCircle(true);
        SetEffectForZeroLife(180, 100, 1);
    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 24);
        if(frame==10){
            ShotData{ id=70 rect=(16,78,31,95) render=ALPHA angular_velocity = 0 delay_color= (255,64,64) }
        if(frame==60){
            ShotData{ id=74 rect=(80,78,95,95) render=ALPHA angular_velocity = 0 delay_color= (64,64,255) }
        if(frame==30){
            ShotData{ id=77 rect=(144,78,159,95) render=ALPHA angular_velocity = 0 delay_color= (32,255,32) }
           
    }

    @DrawLoop {
    }

    @Finalize {
    }

    @BackGround {
    }
}

Knuckx117

  • I go :V at silly pictures
Re: I need a bit of help with this Danmakufu script?
« Reply #1 on: November 30, 2009, 01:38:15 AM »
You want it to fire bullets, right? You're not supposed to define bullets in @MainLoop. They need to be defined in a seperate file. If you want it to fire bullets, use something like "CreateShot01"

dmf.shrinemaiden.org

Read some of the tutorials there. They'll steer you in the right direction. Save creating custom bullets for once you're more experienced.

Re: I need a bit of help with this Danmakufu script?
« Reply #2 on: November 30, 2009, 01:40:00 AM »
SetScore(50000000) is missing a ;


Edit: also ShotData{ id=70 rect=(16,78,31,95) render=ALPHA angular_velocity = 0 delay_color= (255,64,64) } is completely wrong unfortunately. Bullets can only be fired with functions. What you typed issomething that makes new shots and belongs in a completely seperate script. If you want to fire those bullets, you gotta import the shotscript and them use the CreateShot functions or similar functions to fire them.
« Last Edit: November 30, 2009, 01:41:55 AM by Suikama »

Re: I need a bit of help with this Danmakufu script?
« Reply #3 on: November 30, 2009, 01:41:31 AM »
Okay, first off, you are missing brackets.
Code: [Select]
if(frame==10){
ShotData{ id=70 rect=(16,78,31,95) render=ALPHA angular_velocity = 0 delay_color= (255,64,64) }
Notice that you started with two brackets, for the frame and the shotdata, but you only ended with one, then started the next if(frame).

Also, LoadUserShotData needs a path to actually load the shot data from.
And to actually make the conditional actions happen, you need to add "frame++;" in your MainLoop to start the count.

Edit:
And try going on the Danmakufu wiki (it's in one of the stickies.) There are a few tutorials, and example scripts there that you could really learn from.
« Last Edit: November 30, 2009, 01:45:05 AM by renaryuugu »

Re: I need a bit of help with this Danmakufu script?
« Reply #4 on: November 30, 2009, 01:42:56 AM »
You might want to take a look at other people's scripts to get a feel of how they should look like.

Knuckx117

  • I go :V at silly pictures
Re: I need a bit of help with this Danmakufu script?
« Reply #5 on: November 30, 2009, 01:46:59 AM »
Code: [Select]
[code#TouhouDanmakufu
#Title[Citrus Sign "100% Vitamin C"]
#Text[Always start off your mornings with a nice healthy glass of danmaku!]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let frame = 0;
    let addon = 0;

    @Initialize {

// Standard Initialize stuff
LoadGraphic(image);
shotinit;
        SetLife(750);
SetDamageRate(5, 1);
        SetEnemyMarker(true);
SetTimer(4500);
SetX(GetCenterX);
SetY(GetCenterY/2);
SetScore(50000);
SetTexture(image);
SetGraphicRect(0, 0, 64, 69);

    }

    @MainLoop {
SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 24);
      if(frame==240){


    // Charging Effect

    SetColor(255, 128, 0);
    Concentration01(120);
    SetColor(255, 255, 255);
        }
if(frame==360){
   
    addon += 4;

    // Ring of 30 Orange Shots
    ascent(a in 0..8){

// Set the first shots up

CreateShotA(1, GetX, GetY, 0);
SetShotKillTime(1, 61);


// Loop of second series of shots

ascent(b in 0..8){


    // Second shot setup

    CreateShotA(2, 0, 0, 0);
    SetShotKillTime(2, 61);


    // Loop for the third series of shots

    ascent(c in 0..8){

// Third Shot set-up

CreateShotA(3, 0, 0, 0);

// Giving instructions for the third shot

SetShotDataA(3, 0, 0.8, c*45, 0.5, 0, 3, ORANGE05);
SetShotDataA(3, 60, NULL, NULL+10, 0, 0.025, 3, ORANGE05);
SetShotDataA(3, 120, NULL, NULL, c, -0.025, -2, ORANGE05);
SetShotDataA(3, 240, NULL, c*45, 0, 0.0025, 2, ORANGE05);


// Telling the 3rd shot to fire at frame 120 of the 2nd shot's lifespan.

AddShot(60, 2, 3, 0);
    }



    // Giving instructions for the 2nd shot

    SetShotDataA(2, 0, 0.8, b*45, 2, 0.025, 2, ORANGE01);


    // Telling the 2nd shot to fire at frame 210 of the 1st shot's lifespan.

    AddShot(60, 1, 2, 0);
}


// 1st shots are being given instructions

SetShotDataA(1, 0, 1, a*45, 0, 0, 2, ORANGE02);


// Fire the shots off

FireShot(1);


// Reset the counter

        frame = 0;
    }
}
frame++;
    }

    @DrawLoop {
DrawGraphic(GetX, GetY);


  // Debug Information(Hold down "C" to display)

while(GetKeyState(VK_USER)==KEY_HOLD){


    // Frames per Second

    SetFontColor(255, 0, 0, 0, 0, 0);
    DrawText("FPS:", 35, 290, 12, 255);
    SetFontColor(255, 255, 255, 128, 128, 128);
    DrawText(GetFps, 45, 300, 12, 255);


    // Angle to the Player from the Boss

    SetFontColor(255, 0, 0, 0, 0, 0);
    DrawText("Ang2PlyrFrmBoss:", 35, 310, 12, 255);
    SetFontColor(255, 255, 255, 128, 128, 128);
    DrawText(GetAngleToPlayer, 45, 320, 12, 255);


    // Player's X Position

    SetFontColor(255, 0, 0, 0, 0, 0);
    DrawText("XPos:", 35, 330, 12, 255);
    SetFontColor(255, 255, 255, 128, 128, 128);
    DrawText(truncate(GetPlayerX), 45, 340, 12, 255);


    // Player's Y Position

    SetFontColor(255, 0, 0, 0, 0, 0);
    DrawText("YPos:", 35, 350, 12, 255);
    SetFontColor(255, 255, 255, 128, 128, 128);
    DrawText(truncate(GetPlayerY), 45, 360, 12, 255);


    // Number of Bullets currently active

    SetFontColor(255, 0, 0, 0, 0, 0);
    DrawText("Bullets:", 35, 370, 12, 255);
    SetFontColor(255, 255, 255, 128, 128, 128);
    DrawText(truncate(GetEnemyShotCount), 45, 380, 12, 255);


    // Time remaining in the current attack

    SetFontColor(255, 0, 0, 0, 0, 0);
    DrawText("Seconds Left:", 35, 390, 12, 255);
    SetFontColor(255, 255, 255, 128, 128, 128);
    DrawText(truncate(GetTimer), 45, 400, 12, 255);


    // Health of the Boss

    SetFontColor(255, 0, 0, 0, 0, 0);
    DrawText("Boss Health:", 35, 410, 12, 255);
    SetFontColor(255, 255, 255, 128, 128, 128);
    DrawText(truncate(GetLife), 45, 420, 12, 255);
    break;
}
    }

    @Finalize {
loop(15)
{
    CreateItem(ITEM_SCORE, rand(GetX,GetX*1.4), rand(GetY, GetY*1.4));
}
CreateItem(ITEM_BOMB, rand(GetX,GetX*1.4), rand(GetY, GetY*1.4));
DeleteGraphic(image);
    }

}

There's what mine looks like...

EDIT: Yes, I know some parts of it appear to be tabbed incorrectly, but that's just the way the forums seem to render them. >__>
« Last Edit: November 30, 2009, 01:50:34 AM by Knuckx117 »

Sakuyasan

Re: I need a bit of help with this Danmakufu script?
« Reply #6 on: November 30, 2009, 01:51:36 AM »
I ended up noticing all the errors after I posted the script, yeah, I suck at coding.

...anyhow...my next few problems with the script.

Code: [Select]
#TouhouDanmakufu
#Title[Clocked Luna Dial]
#Image[.\SWR_sakuya.jpg]
#BGM[.\sakuya.mp3]
#PlayLevel[Normal]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let frame = 0;
    let BossCutIn = "SWR_sakuya.jpg";
    @Initialize {

        SetLife(100000);
        SetDamageRate(100, 100);
        SetTimer(200);
        SetInvincibility(30);
        CutIn(KOUMA, "Clocked Luna Dial", BossCutIn, 0, 0, 200, 600);
        SetScore(50000000);
        SetEnemyMarker(true);
        SetDurableSpellCard;
        Concentration01(60);
        MagicCircle(true);
        SetEffectForZeroLife(180, 100, 1);

    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 24);
        let a   = 0;
        let num = 2;
       
        loop(num)
        {
            CreateShot01(GetX, GetY, 3, +rand(0, 360), RED01, 0);
            a += 360/num;
        }

        let a   = 0;
        let num = 2;
       
        loop(num)
        {
            CreateShot01(GetX, GetY, 6, +rand(0, 360), BLUE01, 0);
            a += 360/num;
        }
       

    {

        if(frame==40);
            CreateLaser01(10, 10, 4, 24, 6, 3, RED01, 10);

    }

    @DrawLoop {

    }

    @Finalize {

    }

    @BackGround {

    }
}

I now, again, get the "script_enemy_main" error, but everything in the script seems to be right.

Also, lasers won't appear. What am I doing wrong here?

Re: I need a bit of help with this Danmakufu script?
« Reply #7 on: November 30, 2009, 01:53:30 AM »
if(frame==40);

Sakuyasan

Re: I need a bit of help with this Danmakufu script?
« Reply #8 on: November 30, 2009, 02:05:12 AM »
Guess that fixes the laser problem, but still getting that stupid "script_enemy_main内で「{...}」が対応していません" error.

Code: [Select]
#TouhouDanmakufu
#Title[Clocked Luna Dial]
#Image[.\SWR_sakuya.jpg]
#BGM[.\sakuya.mp3]
#PlayLevel[Normal]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let frame = 0;
    let BossCutIn = "SWR_sakuya.jpg";
    @Initialize {

        SetLife(100000);
        SetDamageRate(100, 100);
        SetTimer(200);
        SetInvincibility(30);
        CutIn(KOUMA, "Clocked Luna Dial", BossCutIn, 0, 0, 200, 600);
        SetScore(50000000);
        SetEnemyMarker(true);
        SetDurableSpellCard;
        Concentration01(60);
        MagicCircle(true);
        SetEffectForZeroLife(180, 100, 1);

    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 24);
        let a   = 0;
        let num = 2;
       
        loop(num)
        {
            CreateShot01(GetX, GetY, 3, +rand(0, 360), RED01, 0);
            a += 360/num;
        }

        let a   = 0;
        let num = 2;
       
        loop(num)
        {
            CreateShot01(GetX, GetY, 6, +rand(0, 360), BLUE01, 0);
            a += 360/num;
        }
       

    {

            CreateLaser01(10, 10, 4, 24, 6, 3, RED01, 10);

    }

    @DrawLoop {

    }

    @Finalize {

    }

    @BackGround {

    }
}

Drake

  • *
Re: I need a bit of help with this Danmakufu script?
« Reply #9 on: November 30, 2009, 02:08:08 AM »
Here.

Code: [Select]
#TouhouDanmakufu
#Title[Clocked Luna Dial]
#Image[.\SWR_sakuya.jpg]
#BGM[.\sakuya.mp3]
#PlayLevel[Normal]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let frame = 0;
    let BossCutIn = "SWR_sakuya.jpg";
    @Initialize {

        SetLife(100000);
        SetDamageRate(100, 100);
        SetTimer(200);
        SetInvincibility(30);
        CutIn(KOUMA, "Clocked Luna Dial", BossCutIn, 0, 0, 200, 600);
        SetScore(50000000);
        SetEnemyMarker(true);
        SetDurableSpellCard;
        Concentration01(60);
        MagicCircle(true);
        SetEffectForZeroLife(180, 100, 1);
     
    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 24);
        let a   = 0;
        let num = 2;
       
        loop(num)
        {
            CreateShot01(GetX, GetY, 3, +rand(0, 360), RED01, 0);
            a += 360/num;
        }

        let a   = 0;
        let num = 2;
       
        loop(num)
        {
            CreateShot01(GetX, GetY, 6, +rand(0, 360), BLUE01, 0);
            a += 360/num;
        }
       

   ////{ this should not be here

            CreateLaser01(10, 10, 4, 24, 6, 3, RED01, 10);

    }

    @DrawLoop {

    }

    @Finalize {

    }

    @BackGround {

    }
}

This will work, but you're going to be firing lasers every frame which probably isn't the best idea.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Sakuyasan

Re: I need a bit of help with this Danmakufu script?
« Reply #10 on: November 30, 2009, 03:12:24 AM »
I can't figure out how to get the enemy sprite (and cut-in) onto the screen...would anyone be kind enough to explain it to a dumbbell like me?  :V

Drake

  • *
Re: I need a bit of help with this Danmakufu script?
« Reply #11 on: November 30, 2009, 03:17:15 AM »
If the cutin picture is in the same folder as your script is, then set it as GetCurrentScriptDirectory~"SWR_sakuya.jpg"; instead. I suggest you read the Drawing Tutorial or watch Hele's second tutorial.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Re: I need a bit of help with this Danmakufu script?
« Reply #12 on: November 30, 2009, 03:20:21 AM »
Take it to the Danmakufu Q&A thread for further questions, please. Don't clutter the board with miscellaneous queries.