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

Drake

  • *
Re: Danmakufu Q&A/Problem Thread
« Reply #60 on: May 26, 2009, 02:51:28 AM »
Yeah, that won't quite work for anything else, lol. Oh well, I'll keep trying.

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

Re: Danmakufu Q&A/Problem Thread
« Reply #61 on: May 26, 2009, 09:56:47 PM »
Frazer: That's actually simple to do. Make a variable that starts at the value of the frame you want the first bullet to move at. Every time you create a bullet, subtract that value by the same time it takes to create the next one. So:

Code: [Select]
let TimeToMove = 240;
if(frame==0)
{
CreateShotA(shot, GetX, GetY, 10);
SetShotDataA(shot, 0, 0, 0, 0, 0, 0, RED01);
SetShotDataA(shot, TimeToMove, Angle, 0, 0, 0.2, 4, RED01);
FireShot(shot);
shot++;
TimeToMove -= 10;
frame = -10;
}

Something similar to that. You most likely won't do it exactly like that, but I guess it shows what I mean. So, let's look at it...

Every time frame hits 0, the bullet is created, shot is increased so each new shot has its own number, frame is set to -10, meaning it'll take 10 more frames to get it up to 0 again. Because of this, we decrease TimeToMove by 10. However, I'm sure you know to reset the value of TimeToMove eventually, since it'd be bad if the bullet moves at say, -10 frames. XD


Okay, but when I am looping the bullet say eight times, how do I make the delay separate for each individual bullet while keeping the delay above 0? When I have {TimeToMove -=  10}, this will stop making the bullets move altogether after the tenth one. With this function I mean using AddShot as well, i.e. Scarlet Gensokyo's case.

Things I can't do for this problem to make it work properly:

1. Leave it alone.
2. Set the delay at a higher point (because I don't want to wait that long for every bullet to act).
3. Make TimeToMove -= a shorter number (because it will still force the bullets to stop moving at a certain point anyway).
4. Create an individual I.D. for each shot (because then things will become horribly cluttered).


Also, still having to do with Remilia's spell cards, is it possible to use just one shot I.D. and make, say:

Code: [Select]
ascent(i in 1..20){
    CreateShotA(2, 0, 0, 30);
    SetShotDataA(2, 100, 0, angle, 0, 0.01, 2, PURPLE01);

    CreateShotA(4, 0, 0, 30);
    SetShotDataA(4, 100, 0, angle2, 0, 0.01, 2, PURPLE01);

    AddShot(i*8+0, 1, 2, 0);
    AddShot(i*8+0, 3, 4, 0);


    angle += 5;
    angle2 += 5;
}


See the [angle += 5;] part? Say I want to use that with only one shot I.D. but I want every one of the bullets in each line to move at a set angle (take a look at Scarlet Gensokyo's second and fourth bullet waves to see what I am trying to specify) instead of carrying [angle +=] to each line of bullets. Is this possible?

Drake

  • *
Re: Danmakufu Q&A/Problem Thread
« Reply #62 on: May 26, 2009, 10:13:59 PM »
Make the delay (shot*2)+1 or something. 1-3-5-7-9-11-13-15 should be fine, right?

EDIT: Also I fixed my squares

EDIT:

Code: [Select]
let ba=45;

task lolawesome{     
    let a = ba;
    let xv = NULL;
    let yv = NULL;
    loop(1){yield;}
    loop(40){
        if (a>=ba && a<(ba+90)){
            xv = ((a - 90) / -9)/3;
            yv = 5/3;
        }else if(a>=(ba+90) && a<(ba+180)){
            xv = -5/3;
            yv = ((a - 180) / -9)/3;
        }else if(a>=(ba+180) && a<(ba+270)){
            xv = ((a - 270) / 9)/3;
            yv = -5/3;
        }else if(a>=(ba+270) && a<(ba+360)){
            xv = 5/3;
            yv = ((a - 360) / 9)/3;
        }
        CreateShot11(GetEnemyX, GetEnemyY, xv, yv, RED01, 9);
        a += (360/40);
    }
    ba+=9;
    lolawesome;
}

hahaha cool

EDIT: Is there any way to get an effect like SetShotDirectionType, but indicating which angle falls at 0?
« Last Edit: May 26, 2009, 10:52:03 PM by Drake »

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

Re: Danmakufu Q&A/Problem Thread
« Reply #63 on: May 27, 2009, 12:54:10 AM »
Not that I know of offhand, that was my problem as well. I have no real idea how to aim the square in any direction. NuclearCheese does, however, as I can remember something along the lines of "changing the coordinate grid" posted on the old forums. Hopefully he'll bless us with his presence sometime soon~

...~

Hat

  • Just an unassuming chapeau.
  • I will never be ready.
Re: Danmakufu Q&A/Problem Thread
« Reply #64 on: May 27, 2009, 09:47:14 PM »
What is the syntax for an XOR statement? I can only find AND and OR statements on thwiki.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread
« Reply #65 on: May 27, 2009, 09:58:39 PM »
Well, you can always use ( (A and not B) or (B and not A) )...

Code: [Select]
if((A&&!B)||(!A&&B)) { stuff }
...where A and B are the two conditions, of course.
« Last Edit: May 27, 2009, 10:15: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."

Drake

  • *
Re: Danmakufu Q&A/Problem Thread
« Reply #66 on: May 27, 2009, 10:03:10 PM »
I don't think there is any. Just use this.


Code: [Select]
function XOR(x, y, a, b){
    if (x=a){
        if (y=b){
            return false;
        }else{
            return true;
        }
    }else if (y=b){
        return true;
    }else{
        return false;
    }
}

As an example,

Code: [Select]
varx = 1;
vary = 2;
answer1 = 5;
answer2 = 2;

if (XOR(varx, vary, answer1, answer2) == true){
    //do stuff
}

Stuff would be done here.

Code: [Select]
varx = 1;
vary = 2;
answer1 = 1;
answer2 = 2;

if (XOR(varx, vary, answer1, answer2) == true){
    //do stuff
}

Stuff would not be done here.

Code: [Select]
varx = 5;
vary = 4;
answer1 = 1;
answer2 = 2;

if (XOR(varx, vary, answer1, answer2) == true){
    //do stuff
}

Stuff would not be done here either.
« Last Edit: May 27, 2009, 10:05:21 PM by Drake »

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 #67 on: May 27, 2009, 10:29:36 PM »
Curiously, I didn't need it in the end. I now have an EPIC coding headache, though... but damn it, this PC animation code WILL BE PERFECT!!!

... need aspirin, brb

This Yuka PC is going to be amazing, I know it... but mark my words, it will be the first and last thing I ever submit on MotK. I cannot see myself continuing to code after all the headaches this has given me.

EDIT: Actually, here's a question for you guys. Aside from Dual Spark, what other bomb should I give Yuka? I was contemplating Reflowering the Gensokyo, but that's so... bland. It's not visually very interesting (I already have a deathbomb for her, and it will easily take a week to finish)
« Last Edit: May 27, 2009, 10:43:15 PM by Karfloozly »

Stuffman

  • *
  • We're having a ball!
Re: Danmakufu Q&A/Problem Thread
« Reply #68 on: May 27, 2009, 11:05:04 PM »
Quote
This Yuka PC is going to be amazing, I know it... but mark my words, it will be the first and last thing I ever submit on MotK. I cannot see myself continuing to code after all the headaches this has given me.

It gets easier.

Does Yuka even have named spellcards?

Drake

  • *
Re: Danmakufu Q&A/Problem Thread
« Reply #69 on: May 27, 2009, 11:09:52 PM »
Flower Sign "Reflowering of the Gensokyo", Double Spark I guess and Phantasm "Beauty of the Nature".

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

Re: Danmakufu Q&A/Problem Thread
« Reply #70 on: May 27, 2009, 11:16:47 PM »
Make your own.

Hat

  • Just an unassuming chapeau.
  • I will never be ready.
Re: Danmakufu Q&A/Problem Thread
« Reply #71 on: May 27, 2009, 11:16:47 PM »
That's the trouble, I don't WANT to use 'Reflowering of Gensokyo' because it's ugleah. D= And Phantasm "Beauty of Nature" I might use for the counterbomb, but I have something epic and awesome worked out for it already (that will involve more draw-coding than I'd like).

I'm just tired of trying to think of something, if someone could offer an idea...?

EDIT @Naut: NOOOOES I dun wanna. D; I've already made a counterbomb, I was asking for input...?
« Last Edit: May 27, 2009, 11:21:38 PM by Karfloozly »

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread
« Reply #72 on: May 27, 2009, 11:25:21 PM »
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."

Hat

  • Just an unassuming chapeau.
  • I will never be ready.
Re: Danmakufu Q&A/Problem Thread
« Reply #73 on: May 28, 2009, 12:00:07 AM »
Oh, I've seen that already... but that has given me an idea... >=3 Naut, what's the name of the spellcard before the survival one?

Oh, and Naut, there are actually TEN cards in an extra boss fight. Eight kill cards, one survival, and one final card.
« Last Edit: May 28, 2009, 12:02:51 AM by Karfloozly »

Drake

  • *
Re: Danmakufu Q&A/Problem Thread
« Reply #74 on: May 28, 2009, 12:06:54 AM »
Perennial Sign "Wilt"

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

Re: Danmakufu Q&A/Problem Thread
« Reply #75 on: May 28, 2009, 03:00:40 AM »
How do you do that sort of reverse danmaku? (like as if time was going backwards. Look at Keine's second midboss spellcard for extra and Utsuho's Subterranean Sun to see what I mean

Drake

  • *
Re: Danmakufu Q&A/Problem Thread
« Reply #76 on: May 28, 2009, 03:22:36 AM »
...Create bullets that move inwards and make them disappear once they get to wherever they end up. Just call spawning points where the bullets would normally end up and give it backwards velocty.

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

Re: Danmakufu Q&A/Problem Thread
« Reply #77 on: May 28, 2009, 03:25:34 AM »
Yeah, but I want to spawn from the edges of the playing field and have it still come back in a circle shape.

Also, how do I add things/change things on the HUD? (Extra point areas) And how do I change the font the game uses?
« Last Edit: May 28, 2009, 03:33:40 AM by Darkblizer »

Re: Danmakufu Q&A/Problem Thread
« Reply #78 on: May 28, 2009, 04:11:59 AM »
CreateShotA(0, GetX + 300*cos(angle), GetY + 300*sin(angle), 0);
SetShotDataA(0, 0, 3, angle - 180, 0, 0, 0, RED02);
SetShotKillTime(0, 100);
FireShot(0);

The 300 radius is far enough so that all the bullets are off the screen when they spawn. angle should be incremented appropriately for your ring of bullets (+=360/num), and their movement vector should be angle - 180, since you want them to move backwards. The SetShotKillTime is derived from dividing your radius (300) by your bullet speed (3), which is how many frames it will take for the bullets to hit the point (GetX, GetY). To have the bullets not just delete themselves as soon as they're spawned beyond the game window, use the function:
SetShotAutoDeleteClip(200, 200, 200, 200);

Which expands the deletion window 200 pixels in every direction, so that bullets will still be processed outside the game window instead of deleted. Be sure to call this function every frame, like SetCollisionA/B, or it will default to SetShotAutoDeleteClip(64, 64, 64, 64); (can somebody check if you actually need to call it every frame? I'm not so sure, and I haven't the time at the moment).

I haven't the slightest regarding your latter questions, so I won't comment on them and likely confuse you (and myself).

Hat

  • Just an unassuming chapeau.
  • I will never be ready.
Re: Danmakufu Q&A/Problem Thread
« Reply #79 on: May 28, 2009, 02:56:31 PM »
How does one troubleshoot a player script? DNH just kind of... aborts the script you're trying to play if the player script is faulty, without actually telling you what is wrong. I can't see any reason my player script won't run, other than that I haven't defined the pattern of the player's shots (unnecessary) or what the bombs actually DO (also unnecessary, as I've seen PCs that lack both)

Infy♫

  • Demonic★Moe
  • *
Re: Danmakufu Q&A/Problem Thread
« Reply #80 on: May 28, 2009, 07:11:16 PM »
how can i see if an object laser collides with an object bullet?

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread
« Reply #81 on: May 28, 2009, 07:53:06 PM »
Object collision is checked with:

Code: [Select]
Collision_Obj_Obj(obj1, obj2);
You'll get a true or false value.
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."

Stuffman

  • *
  • We're having a ball!
Re: Danmakufu Q&A/Problem Thread
« Reply #82 on: May 28, 2009, 10:03:30 PM »
How does one troubleshoot a player script? DNH just kind of... aborts the script you're trying to play if the player script is faulty, without actually telling you what is wrong. I can't see any reason my player script won't run, other than that I haven't defined the pattern of the player's shots (unnecessary) or what the bombs actually DO (also unnecessary, as I've seen PCs that lack both)

I'm pretty sure it is supposed to give an error box when a player script fails. I would need to see it to know what's wrong.

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem Thread
« Reply #83 on: May 29, 2009, 02:55:18 PM »
I have a question...

I'm new here and I've done some spell cards before. I have used all the functions I used in this spell card before, and they worked correctly, so I'm wondering why whenever I play it, Danmakufu crashes...

Code: [Select]
#TouhouDanmakufu
#Title[Laser Deflectors]
#Text[]
#BackGround[Default]
#PlayLevel[Test]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let frame = 0;
    let miny = GetClipMinY;
    let cx = GetCenterX;
    let imgExRumia="script\img\ExRumia.png";
    let BossCutIn = "player\Rumia\RumiaCutIn.png";
    let LaserA = Obj_Create(OBJ_LASER);
    let LaserB = Obj_Create(OBJ_LASER);

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

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

      while(Obj_BeDeleted(obj)==false) {
              Obj_SetAngle(obj, Obj_GetAngle(obj) + 2);

if (Collision_Obj_Obj(obj, LaserA) == true)
{
              Obj_SetAngle(obj, Obj_GetAngle(LaserA)+90);
}
if (Collision_Obj_Obj(obj, LaserB) == true)
{
              Obj_SetAngle(obj, Obj_GetAngle(LaserB)-90);
}
       }
yield;
}

task BulletB(x, y, angleB, v) {
      let obj=Obj_Create(OBJ_SHOT);

      Obj_SetPosition(obj, x, y);
      Obj_SetAngle(obj, angleB);
      Obj_SetSpeed(obj, v);
      ObjShot_SetGraphic(obj, BLUE21);
      ObjShot_SetDelay  (obj, 0);
      ObjShot_SetBombResist (obj, true);
Obj_SetCollisionToObject(obj, true);

      while(Obj_BeDeleted(obj)==false) {
              Obj_SetAngle(obj, Obj_GetAngle(obj) - 2);

if (Collision_Obj_Obj(obj, LaserA) == true)
{
              Obj_SetAngle(obj, Obj_GetAngle(LaserA)+90);
}
if (Collision_Obj_Obj(obj, LaserB) == true)
{
              Obj_SetAngle(obj, Obj_GetAngle(LaserB)-90);
}
       }
yield;
}

task Laser1(x, y, angle) {

Obj_SetPosition(LaserA, x, y);
Obj_SetAngle(LaserA, angle);
ObjShot_SetGraphic(LaserA, BLUE01);
ObjShot_SetDelay(LaserA, 0);
ObjShot_SetBombResist (LaserA, true);
ObjLaser_SetLength(LaserA, 100);
ObjLaser_SetWidth(LaserA, 10);
ObjLaser_SetSource(LaserA, true);
Obj_SetCollisionToObject(LaserA, true);

while(Obj_BeDeleted(LaserA)==false) {
Obj_SetAngle(LaserA, Obj_GetAngle(LaserA) + 2);
}
yield;
}

task Laser2(x, y, angleB) {

Obj_SetPosition(LaserB, x, y);
Obj_SetAngle(LaserB, angleB);
ObjShot_SetGraphic(LaserB, BLUE01);
ObjShot_SetDelay(LaserB, 0);
ObjShot_SetBombResist (LaserB, true);
ObjLaser_SetLength(LaserB, 100);
ObjLaser_SetWidth(LaserB, 10);
ObjLaser_SetSource(LaserB, true);
Obj_SetCollisionToObject(LaserB, true);

while(Obj_BeDeleted(LaserB)==false) {
Obj_SetAngle(LaserB, Obj_GetAngle(LaserB) - 2);
}
yield;
}

    @Initialize {
        SetLife(4000);
SetDamageRate(100,80);
SetTimer(50);
        SetInvincibility(120);
Concentration01(120);
        SetEnemyMarker(true);
        SetScore(1000000);
        SetEffectForZeroLife(120,51,1);
        LoadGraphic(imgExRumia);
        SetGraphicRect(1,1,64,64);
        CutIn(YOUMU, "Mirror Sign Border Trackers", BossCutIn, 0, 0, 200, 600);
SetX(GetCenterX);
SetY(miny+120);
    }

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

function Attack(x, y)
{
ascent (i in 0..20)
{
Bullet(x, y, 5+(i*5), 3);
BulletB(x, y, 175-(i*5), 3);
}
}
function Laser(x, y)
{
Laser1(x, y+150, -90);
Laser2(x, y+150, -90);
}

if (frame == 60)
{
Laser(GetX, GetY);
}
if (frame == 240)
{
Attack(GetX, GetY);
frame = 60;
}
frame++;
}

    @DrawLoop {
SetTexture(imgExRumia);
SetGraphicRect(64,1,127,64);
DrawGraphic(GetX,GetY);
    }

    @Finalize {
loop(8){
CreateItem(ITEM_SCORE,cx+rand(-100,100),rand(20,100));
}
DeleteGraphic(imgExRumia);
    }
}

As you can see, I'm making a spell card where the boss shoots out bullets that spin in a pattern below her and are reflected whenever they hit one of the 2 spinning lasers at the center of the screen. When the spell card only had the bullets it worked, but when I put in the lasers, the game kept on crashing when it reached the part where the lasers are spawned. Can someone help me? Thanks in advance.  :D
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Stuffman

  • *
  • We're having a ball!
Re: Danmakufu Q&A/Problem Thread
« Reply #84 on: May 29, 2009, 03:07:25 PM »
You need to take those yields in your tasks and put them inside the while loops, rather than outside.

Whenever Danmakufu freezes like that it's usually because it's stuck in an infinite while loop.

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem Thread
« Reply #85 on: May 29, 2009, 03:38:55 PM »
You need to take those yields in your tasks and put them inside the while loops, rather than outside.

Whenever Danmakufu freezes like that it's usually because it's stuck in an infinite while loop.

Thanks! It works now...  ;D
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Hat

  • Just an unassuming chapeau.
  • I will never be ready.
Re: Danmakufu Q&A/Problem Thread
« Reply #86 on: May 30, 2009, 04:12:58 PM »
Well, I'll throw in the shot data and all that stuff then post it here. I really don't understand why it refuses to work, though...

Re: Danmakufu Q&A/Problem Thread
« Reply #87 on: May 30, 2009, 04:22:44 PM »
Go on...

Cabblecorento

  • I'm a cat!
  • MEOW.
Re: Danmakufu Q&A/Problem Thread
« Reply #88 on: May 30, 2009, 10:02:43 PM »
I have two questions, then I should be able to get back to you with my first boss fight.

1. How do you make bullets move to a position, stop, then after 5 seconds move to another position?

2. How do you make bullets bounce of only the side walls. I'm new to C too, so I don't even know how to make them bounce.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread
« Reply #89 on: May 30, 2009, 10:22:29 PM »
1.
Depending on what you exactly you want to do, you may either program a bullet with the SetShotDataA funtcion or you'll have to learn object bullets.

2. Needs object bullets. A tutorial on what they are, why they are used and how to make one can be found here. It is even exemplified with the creation of bouncing bullets.  8)
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."