Author Topic: Danmakufu Q&A/Problem Thread  (Read 200850 times)

Cabblecorento

  • I'm a cat!
  • MEOW.
Re: Danmakufu Q&A/Problem Thread
« Reply #90 on: May 30, 2009, 10:51:06 PM »
Code: [Select]
#TouhouDanmakufu
#Title[Black Barrage]
#BackGround[User(.\bg.png, 1, 1)]
#BGM[.\bgm.mp3]
#PlayLevel[Easy]
#Player[REIMU, MARISA]
#ScriptVersion[2]

script_enemy_main {
let cx=GetCenterX();
let cy=GetCenterY();
let pos1 = cx + cx - 1;
    let BossImage = "script\img\olol.gif";
    let frame = 0;
let frame2 = 0;
let frame3 = 0;
let frame4 = 0;
    @Initialize {
        SetLife(3000);
        SetEnemyMarker(true);
SetMovePosition02(cx+0,60,60);
LoadGraphic(BossImage)
    }


    @MainLoop {
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 100);
if (frame2<20){
Bullet(GetX, GetY, 3, frame+180);
Bullet(GetX, GetY, 3, frame);
}
if (frame3<20){
Bullet(GetX, GetY, 3, frame4+180);
Bullet(GetX, GetY, 3, frame4);
}
if(frame2==30){
Bullet(GetX, GetY, 6, 105);
Bullet(GetX, GetY, 6, 45);
Bullet(GetX, GetY, 6, 75);
Bullet(GetX, GetY, 6, 135);
Bullet(GetX, GetY, 6, 105);
frame2 = 0;
}
if(frame3==30){
frame3 = 0;
}
        frame++;
frame2++;
frame3++;
frame4--;
    }

    @DrawLoop {
SetTexture(BossImage);
DrawGraphic(GetX, GetY);
    }

    @Finalize {
    }

    @BackGround {
    }
}
task Bullet(x, y, v, angle) {
      let obj=Obj_Create(OBJ_SHOT);

      Obj_SetPosition(obj, x, y);
      Obj_SetAngle(obj, angle);
      Obj_SetSpeed(obj, v);
      ObjShot_SetGraphic(obj, RED01);
      ObjShot_SetDelay  (obj, 0);
      ObjShot_SetBombResist (obj, true);

      while(Obj_BeDeleted(obj)==false) {

              if(Obj_GetX(obj)<GetClipMinX) {
                     Obj_SetAngle(obj, 180 - Obj_GetAngle(obj) );
                     Obj_SetX(obj,  Obj_GetX(obj) + 0.1);
              }

              if(Obj_GetX(obj)>GetClipMaxX) {
                     Obj_SetAngle(obj, 180 - Obj_GetAngle(obj) );
                     Obj_SetX(obj,  Obj_GetX(obj) - 0.1);
              }

              yield;
       }
Whenever I try to use that, an error pops up.


Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread
« Reply #91 on: May 30, 2009, 11:11:20 PM »
You have put your task otuside the script_enemy_main brackets. Therefore it doesn't exist inside it and danmakufu can't find it, so it raises an error.

You have to put your task after everything else in the script_enemy_main brackets (or before everything else, or between the different @loops, but at the end they they are probably the least confusing) but still inside the main script.


So, the solution is to just move the "}" bracket from after the @Background to after the task.




Hmmm, I'll have to reword the tutorial post. This is the second time someone has assumed "after @Finalize" means "after the closing bracket of script_enemy_main". Is it that misleading?  :-X
« Last Edit: May 30, 2009, 11:14:52 PM by Iryan »
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

Cabblecorento

  • I'm a cat!
  • MEOW.
Re: Danmakufu Q&A/Problem Thread
« Reply #92 on: May 31, 2009, 12:17:32 AM »
It didn't work, Iryan.

CK Crash

  • boozer
Re: Danmakufu Q&A/Problem Thread
« Reply #93 on: May 31, 2009, 12:21:36 AM »
You don't have the correct number of ending brackets in the Bullet task. Try adding another } to the end of that part of the code.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread
« Reply #94 on: May 31, 2009, 12:31:25 AM »
Oh. Indeed, I didn't notice that second mistake, sorry.  :-\

You forgot the closing bracket for your complete task. Because of that, danmakufu raised an error once you had put the task inside script_enemy_main. So, as Onthenet said, adding another closing bracket after your task will negate that error.
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

Cabblecorento

  • I'm a cat!
  • MEOW.
Re: Danmakufu Q&A/Problem Thread
« Reply #95 on: May 31, 2009, 12:47:50 AM »
But now the bullets won't bounce. 3:

Re: Danmakufu Q&A/Problem Thread
« Reply #96 on: May 31, 2009, 12:55:01 AM »
Put "yield;" inside your @Mainloop, at the end of it.

Drake

  • *
Re: Danmakufu Q&A/Problem Thread
« Reply #97 on: May 31, 2009, 02:51:01 AM »
How could I make this more awesome?

Code: [Select]
#TouhouDanmakufu
#Title[circles]
#BackGround[User(.\PIC\black.png, 1, 1)]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {

let inv = 2.27;
   
    @Initialize {

   SetLife(2000);
   SetTimer(40);
   SetMovePosition02(GetCenterX, GetCenterY, 20);
   circle;   
     
    }

    @MainLoop {
       SetCollisionB(GetX, GetY, 24);
       yield;
   }

    @DrawLoop {
    }

    @Finalize {
    }

    task circle{
        loop(30){yield;}
        Concentration01(80);
        loop(90){yield;}
        let a = rand(30, 60);
        let acc = 1;
        loop(4){
            CreateShotA(0, (cos(a)*170)+GetX, (sin(a)*170)+GetY, 20);
            SetShotDataA(0, 0, 5, a+(60*inv), inv, 0, 0, WHITE05);
            SetShotKillTime(0,36);
            ascent(i in 1..6){
                CreateShotA(1, 0, 0, 10);
                SetShotDataA(1, 0, 1.5, 0, 0, -0.01, 0.75, WHITE11);
                ascent(j in 1..24){
                    CreateShotA(2, 0, 0, 0);
                    SetShotDataA(2, 0, 1.5, j*15, 0, -0.01, 0.75, WHITE11);
                    AddShot(0, 1, 2, 0);
                }
                AddShot((i*6)-6, 0, 1, 0);
            }
            FireShot(0);
            a+=90;
        }
        inv *= -1;
        loop(170){yield;}
        circle;
    }
   
}

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

Re: Danmakufu Q&A/Problem Thread
« Reply #98 on: May 31, 2009, 03:17:28 AM »
Make more circles appear more frequently (and make less bullets in the circle to compensate for more being spawned, something like AddShot(i*4)-4, 0, 1, 0); and ascent(j in 1..18) with j*20 as the angular SetShotData parameter -- maybe even less bullets than that). Have the shots keep spawning past the origin, so double it's time (SetShotKillTime(0, 72);) and double the loop (ascent(i in 1..12)). Don't wait 170 frames before making another wave (maybe like... 40), and toss the boss closer to the top of the screen to compensate for more frequent waves (and thus more bullets). Make them a different colour too, white is boring. Rainbow or something. China that shit up.
« Last Edit: May 31, 2009, 03:19:07 AM by Naut »

Drake

  • *
Re: Danmakufu Q&A/Problem Thread
« Reply #99 on: May 31, 2009, 04:46:11 AM »
It looks kind of messy if you're only looking at the bottom, but eh.

Code: [Select]
#TouhouDanmakufu
#Title[circles]
#BackGround[User(.\PIC\black.png, 1, 1)]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {

let inv = 2.27;
let color = [RED11, ORANGE11, YELLOW11, GREEN11, AQUA11, BLUE11, PURPLE11];
   
    @Initialize {

   SetLife(2000);
   SetTimer(40);
   SetMovePosition02(GetCenterX, GetCenterY-70, 20);
   circle;   
     
    }

    @MainLoop {
       SetCollisionB(GetX, GetY, 24);
       yield;
   }

    @DrawLoop {
    }

    @Finalize {
    }

    task circle{
        loop(30){yield;}
        Concentration01(80);
        loop(90){yield;}
        let a = rand(30, 60);
        let acc = 1;
        loop(4){
            CreateShotA(0, (cos(a)*170)+GetX, (sin(a)*170)+GetY, 20);
            SetShotDataA(0, 0, 5, a+(60*inv), inv, 0, 0, WHITE05);
            SetShotKillTime(0,72);
            ascent(i in 1..18){
            let c = RED11;
            if(i<=7){c = color[i-1];}
            if(i>7 && i<=14){c = color[i-8];}
            if(i>14 && i<18){c = color[i-15];}
                CreateShotA(1, 0, 0, 10);
                SetShotDataA(1, 0, 1.75, 0, 0, -0.01, 0.7, c);
                ascent(j in 1..10){
                    CreateShotA(2, 0, 0, 0);
                    SetShotDataA(2, 0, 1.75, j*36, 0, -0.01, 0.7, c);
                    AddShot(0, 1, 2, 0);
                }
                AddShot((i*4)-4, 0, 1, 0);
            }
            FireShot(0);
            a+=90;
        }
        inv *= -1;
        loop(160){yield;}
        circle;
    }
   
}

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

Re: Danmakufu Q&A/Problem Thread
« Reply #100 on: May 31, 2009, 04:42:41 PM »
Is it possible to draw things outside the playable screen ie have it appear under your bombs/lives and stuff?

Stuffman

  • *
  • We're having a ball!
Re: Danmakufu Q&A/Problem Thread
« Reply #101 on: May 31, 2009, 05:15:02 PM »
No.

SetEffectLayer will let you change the layer certain effects take place on but currently only works with Concentration01/02.

ObjEffect_SetLayer lets you change the layer an effect object is on, but it only goes up to 7, which is still below the frame.

Delpolo

Re: Danmakufu Q&A/Problem Thread
« Reply #102 on: May 31, 2009, 09:27:37 PM »
I had another problem (and I'd like to thank all of you for answering before) which was more mathematical than anything, but I figured it out before posting.

I found out how to do slanted ovals, and I thought I might as well post it here. (I got the idea from Lissajous's curve.)

Here's the code:
Code: [Select]
    let frame=0;
    let cx=GetCenterX();
    let cy=GetCenterY();
    let angle;
    if(frame==60) {
        ascent (angle in 0..360) {
            CreateShot01(cx+100*sin(angle), cy+100*sin(angle-45), 1, angle-40, YELLOW05, 10);
            CreateShot01(cx+100*sin(angle), cy-100*sin(angle-45), 1, -angle+40, YELLOW05, 10);
        }
    }
    frame++;

Just insert it into a boss' code and you'll see two crossing ovals with a safe zone in the center of the playing field. Changing the -45 makes the safe zone smaller or bigger (with 0 making it start as a line and 90 making it a circle).

Anyways, does anyone know how to do a rose curve?

Re: Danmakufu Q&A/Problem Thread
« Reply #103 on: May 31, 2009, 10:43:48 PM »
Depends on if you know your trig laws well enough to get k outside of the angle area.

If memory serves, this should be correct for k = 2:

r(θ) = cos(2θ) = cosθ*cosθ - sinθ*sinθ

Which just comes from...

cos(A + B) = cosA*cosB - sinA*sinB

Where A and B are the same number (2A).

Hell if I know any other value of k... Except 1 of course. But that's just a circle.



If you feel adventurous you could try the sin version as well, but it's not the Rose curve formula:

r(θ) = sin(2θ) = sinθ*cosθ + cosθ*sinθ

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread
« Reply #104 on: May 31, 2009, 10:50:22 PM »
Mmmmmh.....
If k=number of petals and n=total number of bullets...


loop(n){
   a+=360/n;
   CreateShot01(x+r*cos(k*a)^k, y+r*sin(k*a)^k, 1, a, RED01, 0);
}

Could that work..?
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

Re: Danmakufu Q&A/Problem Thread
« Reply #105 on: May 31, 2009, 10:52:56 PM »
A colleague of mine claims that is incorrect. You should test it though, Danmakufu is crazy afterall.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread
« Reply #106 on: June 01, 2009, 09:26:28 AM »
SUCCESS!

Modify b and d to modify the rose. n is the number of bullets.
I haven't worked out the correct angles for each bullets, though...


?dit: I somehow had made a stupid edit to the script while posting that made it not work as it should've... Now it will work as intended! (at least as you don't put in too strange k values. If you do, you have to either increase the value of n or the value of z to fix it.)


Code: [Select]
#TouhouDanmakufu
#Title[Stuff 73]
#Text[Stuff]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let BossImage = "script\img\ExRumia.png";
    let BossCutIn = "script\img\ExRumia.png";
    let frame=1400;

    let color=[RED32, BLUE32, GREEN32, RED32, BLUE32, GREEN32];

    let flyangle=rand(0, 360);

    let b=5;
    let d=1;
    let k=b/d;
    let n=3600;
    let z=3;
    let a=100;

    let x=1;
    let y=1;
    let r=1;

    @Initialize {
        LoadGraphic(BossImage);
        SetLife(3000);
        SetDamageRate(100, 0);
        SetTimer(60);
        SetInvincibility(120);
        SetMovePosition02(GetCenterX, 128, 60);
        Concentration01(60);

    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 24);
        SetCollisionB(GetX, GetY, 24);

if(frame==1500){


        ascent(i in 0..(n+2)){
           r = a*cos(k*z*i);
           x = r*cos(z*i);
           y =  (r^2 - x^2)^0.5 ;
           CreateShot01(GetCenterX + x, GetCenterY+ y, 0.1, 3*k*i, RED05, 0);
           CreateShot01(GetCenterX + x, GetCenterY- y, 0.1, -3*k*i, RED05, 0);
        }

        frame=0;
}

        frame++;

        yield;
 
    }

    @DrawLoop {
SetRenderState(ALPHA);
if(GetSpeedX()==0){SetGraphicRect(64,1,127,64);}
else if(GetSpeedX()>0){SetGraphicRect(192,1,255,64);}
else if(GetSpeedX()<0){SetGraphicRect(128,1,191,64);}
        SetTexture(BossCutIn);
       
    }

    @Finalize {
    }
}
« Last Edit: June 04, 2009, 12:34:07 AM by Iryan »
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

Re: Danmakufu Q&A/Problem Thread
« Reply #107 on: June 05, 2009, 12:09:27 AM »
Excellent stuff, didn't think multiplying values inside the angle area (I mean cos(here)) would work.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread
« Reply #108 on: June 05, 2009, 12:29:15 AM »
Note that, in this code, a high b value will cause the pattern to look broken unless you lower the z value.

I think this will provide good rose curves only if both (n*z)/360>b && (n*z)/360>d are true statements.

As it is, the axis of symmetry points to the right. If you want the rose to have a vertical axis of symmetry, replacing x and y in the CreateShot should do the job. At least I think so. Hm, I may test it some time later...
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

Re: Danmakufu Q&A/Problem Thread
« Reply #109 on: June 07, 2009, 12:27:54 AM »
I think someone said a while back that the amount of blackspace on the bulletsheet image determines the hitbox size, and the more black there is the larger the hitbox. To confirm it, I tried making bullets with no background and the result is thier hitboxes are extremely small related to the sprite.

So basically less black = smaller hitbox.


Then again I might be completely wrong. Please correct me if that is so.
« Last Edit: June 07, 2009, 12:32:14 AM by Suikama »

Re: Danmakufu Q&A/Problem Thread
« Reply #110 on: June 07, 2009, 01:41:49 AM »
You are 100% correct. The bigger the image dimentions, the bigger the hitbox, and vice versa.

Re: Danmakufu Q&A/Problem Thread
« Reply #111 on: June 07, 2009, 02:02:41 AM »
You are 100% correct. The bigger the image dimentions, the bigger the hitbox, and vice versa.
Also the hitbox always appears to be a circle. I tried using a rectangular object and it was all screwy. No wonder the knife hitboxes are messed.

Re: Danmakufu Q&A/Problem Thread
« Reply #112 on: June 07, 2009, 02:07:52 AM »
Yes sir. You can make a square hitbox if you'd like, but it requires object bullets~

Drake

  • *
Re: Danmakufu Q&A/Problem Thread
« Reply #113 on: June 07, 2009, 05:43:57 AM »
No wonder the knife hitboxes are messed.
please stop saying this

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

Hat

  • Just an unassuming chapeau.
  • I will never be ready.
Re: Danmakufu Q&A/Problem Thread
« Reply #114 on: June 07, 2009, 03:49:39 PM »
That is really bizarre, but hopefully it won't end up being a huge problem...

Okay, I might as well post it now, so I can deal with whatever is making my script blow itself to pieces.

Code: [Select]
#TouhouDanmakufu[Player]
#ScriptVersion[2]
#Menu[Yuka Kazami]
#Text[]

#Image[.\yukaimage.png]
#ReplayName[Yuka]

script_player_main {
    let ImgPlayer = GetCurrentScriptDirectory()~"pl09.png";
    let ImgCutIn = GetCurrentScriptDirectory()~"yuka_cutin.png";
    let YukaShotData = GetCurrentScriptDirectory()~"Yuka_Shot.txt";
    let bslow = false; //Parameter that defines whether Yuka is in focus or not. Presumably it's a boolean where true is focus and false is not.
    let CharAlpha = 255; //Alpha of the character, starts out big.
    let bShot = false; //The shot button is being depressed.
    let bLeft = false;
    let bRight = false;
    let bSlow = false;
let drawframe = 0;
let drawnext = 1;
let rect = 1;

//I'll get to more variables later

    @Initialize {
      LoadGraphic(ImgPlayer);
      LoadGraphic(ImgCutIn);
      SetRibirthFrame(12);
      SetGrazeCircle(45);
      SetSpeed(2.9, 1.7);
      SetItemCollectLine(150); //May have to change this, I only decreased it because Yuka's so damn slow.
      SetPlayerLifeImage(NEED_SOMETHING_HERE);
  SetTexture(ImgPlayer);

      TMain;
    }
   
    @MainLoop {
        if(OnBomb){SetItemCollectLine(464);} //Auto-collects all items on screen on bombing.
        else{SetItemCollectLine(128);}
        SetIntersectionCircle(GetPlayerX, GetPlayerY, 1.5); //May have to change this, might be too small.
        yield;
    }
/*
    @SpellCard {
      if(!IsLastSpell){
        if(bSlow){
          UseSpellCard("TwinSpark");
          CutIn(YOUMU, "Yokai Sign "\""Twin Spark"\", ImgCutIn, 0, 0, WIDTH, HEIGHT); //Need the width and the height, here.
        }
        else{
          UseSpellCard("RTrap");
          CutIn(YOUMU, "Yokai Sign "\""Raspberry Trap"\", ImgCutIn, 0, 0, WIDTH, HEIGHT); //Need the width and the height here too.
        }
      }
      else{
        UseSpellCard("Gensokyo"); //Actual name: Gensokyo, Past and Present
        CutIn(YOUMU, "Flower Sign "\""Gensokyo, Past and Present"\", ImgCutIn, 0, 0, WIDTH, HEIGHT);
}
}
*/
@DrawLoop{
if(drawframe%6 == 0){
if(GetKeyState(VK_LEFT)==KEY_PUSH || GetKeyState(VK_RIGHT)==KEY_PUSH){rect = 1;}
if(GetKeyState(VK_LEFT)==KEY_FREE && GetKeyState(VK_RIGHT)==KEY_FREE && drawnext==1){
  YukaNull(rect);
  rect++;
  if(rect==8){rect=1;}
}
if(bLeft && !bRight){
YukaLeft(rect);
rect++;
if(drawnext<=4){drawnext++;}
if(rect>=5){
  YukaLeft(rect);
  if(rect==8){rect=5;
  drawnext=5;}
}}
if(bRight){
YukaRight(rect);
rect++;
if(drawnext<=4){drawnext++;}
if(rect>=5){
  YukaRight(rect);
  if(rect==8){rect=5;
  drawnext=5;}
}
if((GetKeyState(VK_LEFT)==KEY_PULL || GetKeyState(VK_LEFT)==KEY_FREE) && drawnext>1){
YukaLeft(rect);
rect--;
drawnext--;
}
if((GetKeyState(VK_RIGHT)==KEY_PULL || GetKeyState(VK_RIGHT)==KEY_FREE) && drawnext>1){
if(rect!=5){rect=5;}
YukaRight(rect);
rect--;
drawnext--;
}
}//drawframe endbracket
DrawGraphic(GetPlayerX, GetPlayerY);
drawframe++;
}
}

    @Finalize {
      DeleteGraphic(ImgPlayer);
      DeleteGraphic(ImgCutIn);
    }

//TASK TIME OHOHOH

    task TMain {
      TKeyInput; //Task that checks for important movement parameters.
      TShot; //Task for shootin's.
      yield;
    }

    task TKeyInput{
      let state;

      loop {
        state  = GetKeyState(VK_SHOT);
        bShot  = (state == KEY_PUSH || state == KEY_HOLD);

        state  = GetKeyState(VK_LEFT);
        bLeft  = (state == KEY_PUSH || state == KEY_HOLD);

        state  = GetKeyState(VK_RIGHT);
        bRight = (state == KEY_PUSH || state == KEY_HOLD);

        state  = GetKeyState(VK_SLOWMOVE);
        bSlow  = (state == KEY_PUSH || state == KEY_HOLD);

        yield;
        }
      }
task TShot{
if(!bSlow){}

function YukaNull(let nframe){
alternative(nframe)
case(1){SetGraphicRect(0, 0, 32, 48);}
case(2){SetGraphicRect(32, 0, 64, 48);}
case(3){SetGraphicRect(64, 0, 96, 48);}
case(4){SetGraphicRect(96, 0, 128, 48);}
case(5){SetGraphicRect(128, 0, 160, 48);}
case(6){SetGraphicRect(160, 0, 192, 48);}
case(7){SetGraphicRect(192, 0, 224, 48);}
case(8){SetGraphicRect(224, 0, 256, 48);}
}
function YukaLeft(let lframe){
alternative(lframe)
case(1){SetGraphicRect(0, 48, 32, 96);}
case(2){SetGraphicRect(32, 48, 64, 96);}
case(3){SetGraphicRect(64, 48, 96, 96);}
case(4){SetGraphicRect(96, 48, 128, 96);}
case(5){SetGraphicRect(128, 48, 160, 96);}
case(6){SetGraphicRect(160, 48, 192, 96);}
case(7){SetGraphicRect(192, 48, 224, 96);}
case(8){SetGraphicRect(224, 48, 256, 96);}
}
function YukaRight(let rframe){
alternative(rframe)
case(1){SetGraphicRect(0, 96, 32, 144);}
case(2){SetGraphicRect(32, 96, 64, 144);}
case(3){SetGraphicRect(64, 96, 96, 144);}
case(4){SetGraphicRect(96, 96, 128, 144);}
case(5){SetGraphicRect(128, 96, 160, 144);}
case(6){SetGraphicRect(160, 96, 192, 144);}
case(7){SetGraphicRect(192, 96, 224, 144);}
case(8){SetGraphicRect(224, 96, 256, 144);}
//FUCK MY LIFE AAAAHHHHHHH.
}
}
I did in fact call her spellcards later in the script, but they're so fragmentary that it's redundant to insert them. Oh, and that huge drawloop mess is supposed to be animations for Yuka turning one way or another, proceeding through the frames. Obviously I used a spritemap for this.
Basically, the problem is: every time I try to load a stage with this character, some weird blippy nonsense happens, and it reverts back to the stage select screen. ... halp?

Nimono

  • wat
Re: Danmakufu Q&A/Problem Thread
« Reply #115 on: June 07, 2009, 06:05:42 PM »
I'm having some trouble with a script... Basically, it just randomly crashes. I just can't figure it out. It's so random, it'd be difficult to tell whether or not the crashing ever stopped, because it could just look fixed, but still crash later on...

-WARNING-

You might consider the reference in the script to be a spoiler, so if you don't like spoilers, HELP AT YOUR OWN RISK. (I don't feel like hiding the reference to avoid possible spoilers.)

Code: [Select]
#TouhouDanmakufu
#Title[Unzrirock Assault]
#Text[...]
#Image[]
#BackGround[Default]
#PlayLevel[UNZRIROCK]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{
let BossImage = GetCurrentScriptDirectory ~ "Ichirirock.png";
let BossCutIn = GetCurrentScriptDirectory ~ "IchirirockCutIn.png";
let frame = -40;
let frame2 = -60;
let frame3 = -120;
let frame4 = -121;
let Angle = 0;
let ShotSFX = "script\sfx\shot.wav";
let LaserSFX = "script\sfx\laser.wav";
let Face = [];
let Position = false;
let Stop = false;
let a = 0;
let b = 0;
let c = 0;
let speed = 8;
let Colors = [YELLOW11, WHITE11];

task Unzrirock()
{
let i = 0;
while (i < length(Face))
{
if(Obj_BeDeleted(Face[i]))
{
Face = erase(Face, i);
i--;
}
else if(! Obj_BeDeleted(Face[i]))
{
if(Obj_GetSpeed(Face[i]) == 0)
{
Position = true;
Obj_SetAngle(Face[i], atan2(GetPlayerY - Obj_GetY(Face[i]), GetPlayerX - Obj_GetX(Face[i])));
}
else if(Obj_GetSpeed(Face[i]) > 0 && Obj_GetSpeed(Face[i]) > -0.1)
{
Obj_SetSpeed(Face[i], Obj_GetSpeed(Face[i]) - 0.5);
}
}
i++;
}
}

@Initialize
{
LoadGraphic(BossImage);
SetLife(512);
SetDamageRate(10,10);
SetTimer(152);
SetInvincibility(30);
CutIn(YOUMU, "Test", BossCutIn, 0, 0, 256, 320);
SetScore(70000);
SetEnemyMarker(true);
MagicCircle(true);
SetMovePosition02(GetCenterX,90,30);
LoadUserShotData(GetCurrentScriptDirectory ~ "Unzrirock.txt");
}

@MainLoop
{
Unzrirock();
SetCollisionA(GetX(),GetY(),32);
SetCollisionB(GetX(),GetY(),24);
if(frame == 0)
{
CreateShot01(GetClipMinX, GetClipMinY, speed, atan2(GetPlayerY - GetClipMinY, GetPlayerX - GetClipMinX), 2, 0);
CreateShot01(GetClipMaxX, GetClipMinY, speed, atan2(GetPlayerY - GetClipMinY, GetPlayerX - GetClipMaxX), 4, 0);
CreateShot01(GetClipMinX, GetClipMaxY, speed, atan2(GetPlayerY - GetClipMaxY, GetPlayerX - GetClipMinX), 2, 0);
CreateShot01(GetClipMaxX, GetClipMaxY, speed, atan2(GetPlayerY - GetClipMaxY, GetPlayerX - GetClipMaxX), 4, 0);
PlaySE(ShotSFX);
a++;
speed -= 1;
frame = -15;
}
if(frame2 == 0)
{
let obj = Obj_Create(OBJ_SHOT);
ObjShot_SetGraphic(obj, 1);
Obj_SetPosition(obj, GetClipMinX-5, GetClipMinY-5);
Obj_SetAngle(obj, 45);
Obj_SetSpeed(obj, 6);
ObjShot_SetBombResist(obj, true);
Face = Face ~ [obj];

let obj2 = Obj_Create(OBJ_SHOT);
ObjShot_SetGraphic(obj2, 3);
Obj_SetPosition(obj2, GetClipMaxX+20, GetClipMinY-5);
Obj_SetAngle(obj2, 135);
Obj_SetSpeed(obj2, 6);
ObjShot_SetBombResist(obj2, true);
Face = Face ~ [obj2];

let obj3 = Obj_Create(OBJ_SHOT);
ObjShot_SetGraphic(obj3, 1);
Obj_SetPosition(obj3, GetClipMinX-20, GetClipMaxY+5);
Obj_SetAngle(obj3, 315);
Obj_SetSpeed(obj3, 6);
ObjShot_SetBombResist(obj3, true);
Face = Face ~ [obj3];

let obj4 = Obj_Create(OBJ_SHOT);
ObjShot_SetGraphic(obj4, 3);
Obj_SetPosition(obj4, GetClipMaxX+20, GetClipMaxY+5);
Obj_SetAngle(obj4, 225);
Obj_SetSpeed(obj4, 6);
ObjShot_SetBombResist(obj4, true);
Face = Face ~ [obj4];
PlaySE(LaserSFX);
}
if(frame3 == 0)
{
Stop = true;
TimeStop(120, 1, 1, 1);
frame3 = -180;
}
if(frame3 == -70)
{
Concentration01(60);
}
if(Position && !Stop)
{
frame3++;
frame = -40;
frame4++;
}
if(Stop)
{
frame++;
b++;
}
if(b == 120)
{
speed = 8;
b = 0;
Stop = false;
PlaySE(LaserSFX);
}
if(frame4 == 0)
{
CreateShot01(GetX, GetY, 3, Angle, Colors[c], 5);
CreateShot01(GetX, GetY, 3, Angle, Colors[c], 5);
if(c == 1)
{
c = 0;
}
else if(c == 0)
{
c = 1;
}
Angle += 28;
frame4 = -2;
}
frame2++;
}

@DrawLoop
{
SetTexture(BossImage);
SetGraphicRect(12,1,56,93);
DrawGraphic(GetX, GetY);
}

@Finalize
{
DeleteGraphic(BossImage);
}
}

Code: [Select]
#PlayerShotData

ShotImage = ".\Unzrirock.PNG"

ShotData
{
id = 1
rect = (0,0,88,92)
angular_velocity = 0
}

ShotData
{
id = 2
rect = (178,0,242,64)
angular_velocity = 0
}

ShotData
{
id = 3
rect = (88,0,176,92)
angular_velocity = 0
}

ShotData
{
id = 4
rect = (178,64,242,128)
angular_velocity = 0
}


http://i244.photobucket.com/albums/gg13/MatthewPZC/Ichirirock.png


http://i244.photobucket.com/albums/gg13/MatthewPZC/IchirirockCutIn.png


http://i244.photobucket.com/albums/gg13/MatthewPZC/Unzrirock.png


(And as for the sounds, I REALLY hate reuploading them. They're just sounds from the official Touhou games, after all.)
« Last Edit: June 07, 2009, 06:16:17 PM by pikaguy900 »

Heath Robinson

Re: Danmakufu Q&A/Problem Thread
« Reply #116 on: June 07, 2009, 07:48:55 PM »
Does anyone happen to know the scoping rules that Danmakufu uses?

Re: Danmakufu Q&A/Problem Thread
« Reply #117 on: June 07, 2009, 08:11:19 PM »
@Heath Robinson

Does anyone happen to know the scoping rules that Danmakufu uses?

Specify what you mean? Scoping...?



@Karfloozly

Your script isn't detected in my player list. Can you .rar all your files and upload it?



@pikaguy900

Getting to yours, expect edits.

Edit 1: Can't get it to crash, going to look through your script for anything odd.

Edit 2: Didn't see anything out of the ordinary... Are you using a .ogg or corrupted music file when you play the script or something? I'm not sure what would make it crash.
« Last Edit: June 07, 2009, 08:25:53 PM by Naut »

Nimono

  • wat
Re: Danmakufu Q&A/Problem Thread
« Reply #118 on: June 07, 2009, 09:09:33 PM »
@pikaguy900

Getting to yours, expect edits.

Edit 1: Can't get it to crash, going to look through your script for anything odd.

Edit 2: Didn't see anything out of the ordinary... Are you using a .ogg or corrupted music file when you play the script or something? I'm not sure what would make it crash.

Nope, there's no song files in this script. What you see in what I posted is what is in my script...

However, I'm curious as to something... Could you copy the LoadUserShotData out of @Initialize and put it in @MainLoop, while leaving the original where it was? I previously had a copy of that function in the MainLoop because I thought you couldn't access the original bullets while you had a LoadUserShotData in a script. Thus, I also had a LoadUserShotData("") later on, where I spawn the YELLOW11 bullets. It crashed then, often, even when I commented out the LoadUserShotData("")... So perhaps LoadUserShotData can't be called more than once without ill effects?

Re: Danmakufu Q&A/Problem Thread
« Reply #119 on: June 07, 2009, 09:26:27 PM »
Perhaps. Interesting thing about comments is that they don't work sometimes. For example, in one of my stage scripts I had  commented something regarding a task I created, so I named the task inside my comment and Danmakufu read it as if it was uncommented. Not sure how it worked or what I screwed up... But it was a mind boggling result that took me a while to fix.

Best thing is to just call it once and leave it at that. You have shot_all.png, so you can just take any of the original bullets off of that and copy them onto your sprite sheet, if you need to spawn something outside of your custom shots.