Author Topic: I'm really lost @_@  (Read 29737 times)

JormundElver

  • Baron Von Parakeet
Re: I'm really lost @_@
« Reply #30 on: May 17, 2009, 04:30:12 AM »
Hmm ok, looking closer I think I may see the issue.  Now I'm not 100% sure all the ways the commands can be used in plural but generally I use #ScriptPathData once to start and #ScriptNextStep without any parameters to indicate the next set of health or so... a short example of one of mine.

#ScriptPathData
#ScriptPath[.\Attack1.txt]
#ScriptPath[.\Spell1.txt]
#ScriptNextStep
#ScriptPath[.\Attack2.txt]
#ScriptPath[.\Spell2.txt]

#EndScriptPathData

Stuffman

  • *
  • We're having a ball!
Re: I'm really lost @_@
« Reply #31 on: May 17, 2009, 05:41:44 AM »
Yeah the problem is the #ScriptNextStep[.Spell01.txt]. Change it to #ScriptPathData like the other.

#ScriptNextStep is its own line; it indicates a break in lifebars.

Halca

  • Kawaii Bastard
Re: I'm really lost @_@
« Reply #32 on: May 17, 2009, 03:59:54 PM »
Yeah the problem is the #ScriptNextStep[.Spell01.txt]. Change it to #ScriptPathData like the other.

#ScriptNextStep is its own line; it indicates a break in lifebars.


Thank you!

I just looked at what I put in the script and realized it was mainly me being retarded >_>

Halca

  • Kawaii Bastard
Re: I'm really lost @_@
« Reply #33 on: May 19, 2009, 11:57:08 PM »
I was wondering how you would do this pattern:

A large number of bullets appear and stay in the air
for a period of time then come at the enemy.

I'm not sure how to get individual bullets that are looped to all come together in a homing fashion.
Is using looped bullets even the right way to go about this?
Pweeze help!

Drake

  • *
Re: I'm really lost @_@
« Reply #34 on: May 20, 2009, 12:07:54 AM »
Object Bulleeeeeeetttttsss.

It's easy. You would just loop a task that makes object bullets a bajillion times, with random x positions and start a counter. When the counter hits whatever number, they all home in.

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

Nuclear Cheese

  • Relax and enjoy the danmaku.
    • My homepage
Re: I'm really lost @_@
« Reply #35 on: May 20, 2009, 02:05:06 AM »
I was wondering how you would do this pattern:

A large number of bullets appear and stay in the air
for a period of time then come at the enemy.

I'm not sure how to get individual bullets that are looped to all come together in a homing fashion.
Is using looped bullets even the right way to go about this?
Pweeze help!

Object Bulleeeeeeetttttsss.

It's easy. You would just loop a task that makes object bullets a bajillion times, with random x positions and start a counter. When the counter hits whatever number, they all home in.

As Drake mentions, this can be done with object bullets.  Specifically, an array of object bullets.

It can also be achieved using the CreateShotA() ... FireShot() functions.  The trick is to set them up, as you're launching them, so that they'll all change to move towards the player at the same time.  Like this:

Code: [Select]
#TouhouDanmakufu
#Title[Target]
#Text[by Nuclear Cheese]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{
   let count;
   let count2;

   @Initialize
   {
      count = 80;
      count2 = 360;
      SetLife(700);
      LoadGraphic("script\img\ExRumia.png");
      SetGraphicRect(64, 1, 127, 64);
      SetMovePosition02(GetCenterX(), 120, 60);
      SetScore(150000);
      SetTimer(60);
      SetDamageRate(15, 8);
      SetInvincibility(150);
      CutIn(YOUMU, "Target", 0, 0, 0, 0, 0);

      SetShotDirectionType(ABSOLUTE);
   }

   @MainLoop
   {
      // When count reaches zero, a new shot will spawn.
      // This is supressed if count2 is less than zero, since that is the phase of the attack where the shots start
      // moving.
      count--;
      if (count <= 0 && count2 >= 0)
      {
         // ID for CreateShotA ... entirely arbitrary, can be reused once a shot is fired.
         let id = 1;

         // This while loop chooses a random place to spawn the shot, ensuring that it is at least
         // 50 units away from the player's current position
         let bx;
         let by;
         bx = rand(GetClipMinX(), GetClipMaxX());
         by = rand(GetClipMinY(), GetClipMaxY());
         while ((((GetPlayerX() - bx) ^ 2 + (GetPlayerY() - by) ^ 2) ^ 0.5) < 50)
         {
            bx = rand(GetClipMinX(), GetClipMaxX());
            by = rand(GetClipMinY(), GetClipMaxY());
         };

         // Make sure we're using player-relative directions for the shots
         SetShotDirectionType(PLAYER);

         // Create the shot
         CreateShotA(id, bx, by, 10);

         // Initially, the shot stays still
         SetShotDataA(id, 0, 0, 0, 0, 0, 0, WHITE01);

         // This changes the shot to move to the player.
         // The time is count2 + 30.  Since count2 decrements every frame, this ensures that all bullets start moving
         //   at the same time.
         // Since our shot direction type, set above, is PLAYER, the bullet will re-aim for the player's position
         //   because we give it a new angle of zero.
         SetShotDataA(id, count2 + 30, 0, 0, 0, 0.02, 4, BLUE21);

         // This command actually spawns the shot
         FireShot(id);

         // Delay until the next shot
         count = 5;
      }

      // count2 deals with the timing of entire waves.  When count2 is >= 0, the boss is spawning bullets.  When
      // count2 drops below zero, the boss stops spawning bullets, and the bullets will all start moving when
      // count2 reaches -30 (due to how SetShotDataA is set up previously).  When count2 reaches -60, it is reset and
      // the pattern starts over again.
      count2--;
      if (count2 <= -60)
      {
         count2 = 300;
      }

      SetCollisionA(GetX(), GetY(), 32);
      SetCollisionB(GetX(), GetY(), 24);
   }

   @DrawLoop
   {
      SetTexture("script\img\ExRumia.png");
      DrawGraphic(GetX(), GetY());
   }

   @Finalize
   {
      DeleteGraphic("script\img\ExRumia.png");
      let amnt = 15;
      if (GotSpellCardBonus)
      {
         amnt = 45;
      }
      let i = 0;
      while (i < amnt)
      {
         CreateItem(ITEM_SCORE, GetCenterX() + prand(-100, 100), 100 + prand(-60, 60));
         i++;
      }
   }
}

Basically, for each shot it spawns, it sets up the delay until it starts moving (the second SetShotDataA command) so that they all start moving at the same time.



Looks like another vote for me doing an object bullets tutorial :V

... I'll get to it when I stop feeling lazy.  Working full-time has its downsides. :-\
to quote Naut:
"I can see the background, there are too many safespots."
:V

Halca

  • Kawaii Bastard
Re: I'm really lost @_@
« Reply #36 on: May 20, 2009, 05:40:33 PM »
Well, that's almost what I'm looking for, but I don't want the positions to be random.
I wanted the bullets to appear around the enemy in a circle, have a delay, then all attack at once.

I really just want to know how to stop the movement of a bullet after it's been created
and how to make several move at the enemy all together.
I hope that makes sense >_<

JormundElver

  • Baron Von Parakeet
Re: I'm really lost @_@
« Reply #37 on: May 20, 2009, 07:01:13 PM »
Looks like another vote for me doing an object bullets tutorial :V

I can do one if you can't find the time, although my tutorials would probably end up being about as eloquent as my scripting:  Not very.

Well, that's almost what I'm looking for, but I don't want the positions to be random.
I wanted the bullets to appear around the enemy in a circle, have a delay, then all attack at once.

I really just want to know how to stop the movement of a bullet after it's been created
and how to make several move at the enemy all together.
I hope that makes sense >_<

Code: [Select]
    task RoundAttack(){

let Length = 75;

let Angular = 0;

let RollerX;
let RollerY;

ascent(a in 0..10){
    RollerX = GetPlayerX + Length * cos(Angular+a*36);
    RollerY = GetPlayerY + Length * sin(Angular+a*36);
       CreateShotA(0, RollerX, RollerY, 30);
       SetShotDataA(0, 0, 0, atan2(GetPlayerY - RollerY, GetPlayerX - RollerX), 0, 0, 0, WHITE01);
       SetShotDataA(0, 60, NULL, NULL, 0, 0.03, 2, WHITE01);
       FireShot(0);
     }

}

I coded some of this in the post so I hope to god it all works (ok I just tested it, it does), but here's basically whats going on.  This task, when used, will fire a single ring of shots around the player with a delay lasting half a second; then for another half second they should be still.  At that point they'll accelerate towards the center where the player was; slowly, but to a max speed of 2.

How this is done is through dreaded trigonometry, the variables are all set as usual for the task, and ascent 0..10 gives us 10 shots of course.

RollerX = GetPlayerX + Length * cos(Angular+a*36);
RollerY = GetPlayerY + Length * sin(Angular+a*36);

are the variables I used to define the X and Y position of each shot, they get put in place for the X and Y coordinates in the CreateShotA line.  The math is relatively simple, for each of them you take the players coordinates and add the length (defined earlier as 75, this is how far away from the player these will be appearing; the same length should be used for both the X and Y math).  Then multiply by the cos (or sin, depending on whether or not we solve for X or Y) of Angular (initially defined as 0 for simplicity, this can be whatever) plus a*36; because a is increasing by 1 for every shot, multiplying each by 36 ensures a full ring of shots is made (cause 360 etc. blah blah).

RollerX and RollerY are now the coordinates of the shots, but now you gotta aim them at the player.  atan2(GetPlayerY - RollerY, GetPlayerX - RollerX) solves for this.  Since I'm actually bad at trig I can't really do well to explain the inner working of this function, but basically atan2(y - y2, x - x2) will point whatever's position is y2 and x2 at y and x when used for angle.  So now our ring of shots are all aimed at the middle of their own circle.

Second SetShotDataA will fire at the 60th frame these shots are out, make sure angle is NULL and not 0 or else all the bullets will fly to the right (cause 0 -----> is that way); and we just add a little acceleration, a cap on the speed and these shots will go from being still to speeding up towards their target.

Hope this helps.

Halca

  • Kawaii Bastard
Re: I'm really lost @_@
« Reply #38 on: May 22, 2009, 11:21:50 PM »
I was wondering, how do you go about
creating and controlling familiars?

Re: I'm really lost @_@
« Reply #39 on: May 23, 2009, 12:23:40 AM »

Halca

  • Kawaii Bastard

Halca

  • Kawaii Bastard
Re: I'm really lost @_@
« Reply #41 on: May 23, 2009, 02:44:08 AM »
Holy doo-doo...  Familiars are confusimafying!

Could some please tell me how I screwed up here?:

Code: [Select]
#TouhouDanmakufu
#Title[Obedience "Sacrificial White Dolls"]
#Text[Sends dolls that fire bullets in rings.]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let frame2 = 0;
    let frame = 0;
    let angle = 0;
    let Boss = "script\img\ExRumia.png"


    @Initialize {
    LoadGraphic(Boss);
    SetLife(5000);
    SetTimer(60);
    SetDamageRate(10,10);
    SetEnemyMarker(true);
    SetMovePosition02(GetCenterX, GetCenterY - 100, 120);
   

    }

    @MainLoop {
    SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
    v = GetArgument;
    frame++;
   
    if(frame ==120){

    CreateEnemyFromFile("script\Kakome\WhiteDoll.txt", 300, 300, 2, angle + GetAngleToPlayer, 2);
   
    CreateEnemyFromFile("script\Kakome\WhiteDoll.txt", 180, 300, 2, angle + GetAngleToPlayer, 2);
    angle = 0;
    frame = 60;
    }
         
  }

    @DrawLoop {
    SetColor(255,255,255);
SetRenderState(ALPHA);
SetTexture(Boss);
SetGraphicRect(64,1,127,64);
DrawGraphic(GetX,GetY);

       
    }

    @Finalize {
                DeleteGraphic(Boss);
   
    }
}

Re: I'm really lost @_@
« Reply #42 on: May 23, 2009, 02:46:38 AM »
We'll need the script for WhiteDoll.txt as well, love. A brief description of what you're trying to accomplish in the spellcard might aid in finding the problem as well.

Halca

  • Kawaii Bastard
Re: I'm really lost @_@
« Reply #43 on: May 23, 2009, 02:54:51 AM »
Oopsy.... ^_^;;

Ok, my goal here is to have destructable familiars come in your
direction firing bullets while the boss is doing some kind of attack (I'll script it later)

WhiteDoll.txt:
Code: [Select]
#TouhouDanmakufu
#Title[White Doll]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let frame = 0;
    let angle = 0;
    let BossImage = "script\Kakome\img\whitedoll.png";

    @Initialize {
        LoadGraphic(BossImage);
        SetLife(10);
        SetDamageRate(10, 10);
        SetEnemyMarker(true);
    }

    @MainLoop {
        SetCollisionA(GetCenterX, GetCenterY, 32);
        SetCollisionB(GetCenterX, GetCenterY, 16);
 
        frame++;
       
        if(frame==120){
        loop(20){
        CreateShot01(GetCenterX, GetCenterY, 3, angle, WHITE32, 5);
        angle+=360/20;
        }
        frame = 60;
        angle = 0;

        }
       
       
    }

    @DrawLoop {
SetColor(255,255,255);
SetRenderState(ALPHA);
SetTexture(BossImage);
SetGraphicRect(64,1,127,64);
DrawGraphic(GetCenterX,GetCenterY);
       
    }

    @Finalize {
    DeleteGraphic(BossImage);
    }
}

Re: I'm really lost @_@
« Reply #44 on: May 23, 2009, 04:03:15 AM »
Delete everything in WhiteDoll.txt before script_enemy_main (the stuff that begins with #). I'll have to test this tomorrow, on the way to bed, so expect a response then if this doesn't work.

Halca

  • Kawaii Bastard
Re: I'm really lost @_@
« Reply #45 on: May 24, 2009, 01:47:08 AM »
Whelp.. I tried that out and it didn't quite work :(

Re: I'm really lost @_@
« Reply #46 on: May 24, 2009, 02:42:46 AM »
Few things, all in the main spellcard. First is you don't have a ";" at the end of let Boss = "blahblah.png". The next thing is you set v = GetArgument inside the boss script... There is no argument for it to get. You could say "v = GetArgument" in the enemy script because it was spawned from CreateEnemyFromFile, which sets an argument as it's last parameter by default. You also have to declare that variable at some point (let v;). That should get your scripts to run, have fun.

Halca

  • Kawaii Bastard
Re: I'm really lost @_@
« Reply #47 on: May 25, 2009, 12:04:16 AM »
I kinda have just a general question.
How long does it generally take for you guys to complete a script?
How long for a set?
What's your work process, what gets you going?

Drake

  • *
Re: I'm really lost @_@
« Reply #48 on: May 25, 2009, 12:20:51 AM »
Coffee and imagination.

There's no real estimation for time, I don't think.

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

Stuffman

  • *
  • We're having a ball!
Re: I'm really lost @_@
« Reply #49 on: May 25, 2009, 01:09:49 AM »
Amount of time depends entirely on complexity, how close I'm paying attention to it (as opposed to looking at the internet every couple minutes), whether or not I need to look up functions, if I need to make media for it (like sprites), etc

I have a sluggish pace of work, I'd say the average spellcard takes me 30 minutes to an hour to make and playtest.

An interesting note would be that the spellcard turns out how I initially imagined it only about half the time. I'll be working on it and my code won't work quite as planned, but I'll decide "well this is cool too" and just adjust it accordingly.
« Last Edit: May 25, 2009, 01:13:51 AM by Stuffman »

Re: I'm really lost @_@
« Reply #50 on: May 25, 2009, 02:01:09 AM »
Amount of time depends entirely on complexity, how close I'm paying attention to it (as opposed to looking at the internet every couple minutes), whether or not I need to look up functions, if I need to make media for it (like sprites), etc.

I have a sluggish pace of work, I'd say the average spellcard takes me 30 minutes to an hour several hours to a half a week to make and playtest.

An interesting note would be that the spellcard turns out how I initially imagined it only about half the time. I'll be working on it and my code won't work quite as planned, but I'll decide "well this is cool too" and just adjust it accordingly.

Halca

  • Kawaii Bastard
Re: I'm really lost @_@
« Reply #51 on: May 30, 2009, 02:46:45 PM »
Well with my most recent spellcard that includes familiars, things have gotten weird...
I get massive, crazy amounts of bullets all over the screen!
Here's what my scripts look like:

White Doll:
Code: [Select]
#TouhouDanmakufu
#Title[White Doll]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let v;
    let frame = 0;
    let angle = 0;
    let BossImage = "script\Kakome\img\whitedoll.png";

    @Initialize {
        LoadGraphic(BossImage);
        SetLife(10);
        SetDamageRate(10, 10);
        SetEnemyMarker(true);
    }

    @MainLoop {
        v = GetArgument;

 
        frame++;
       
        if(frame==120){
        loop(20){
        CreateShot01(GetX, GetY, 3, angle, WHITE32, 5);
        angle+=360/20;
        }
        frame = 60;
        angle = 0;
       
        SetMovePositionRandom01(rand(10, 50), rand(10, 50), 2, 100, 40, 348, 150);
        frame = 60;

        }
       
       
    }

    @DrawLoop {
SetColor(255,255,255);
SetRenderState(ALPHA);
SetTexture(BossImage);
SetGraphicRect(64,1,127,64);
DrawGraphic(GetX,GetY);
       
    }

    @Finalize {
    DeleteGraphic(BossImage);
    }
}




Obedience "Sacrificial White Doll":
Code: [Select]
#TouhouDanmakufu
#Title[Obedience "Sacrificial White Dolls"]
#Text[Sends dolls that fire bullets in rings.]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let frame2 = 0;
    let frame = 0;
    let angle = 0;
    let Boss = "script\img\ExRumia.png";


    @Initialize {
    LoadGraphic(Boss);
    SetLife(5000);
    SetTimer(60);
    SetDamageRate(10,10);
    SetEnemyMarker(true);
    SetMovePosition02(GetCenterX, GetCenterY - 100, 120);
   

    }

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


    CreateEnemyFromFile("script\Kakome\WhiteDoll.txt", 300, 300, 2, angle + GetAngleToPlayer, 2);
   
 
   
   
         
  }

    @DrawLoop {
    SetColor(255,255,255);
SetRenderState(ALPHA);
SetTexture(Boss);
SetGraphicRect(64,1,127,64);
DrawGraphic(GetX,GetY);

       
    }

    @Finalize {
                DeleteGraphic(Boss);
   
    }
}


Pweese help @_@

Stuffman

  • *
  • We're having a ball!
Re: I'm really lost @_@
« Reply #52 on: May 30, 2009, 03:39:00 PM »
Well it's easy to see why, you're spawning one of those dolls every loop! Each doll spawns 20 shots, so for the first 60 ticks its 20 shots a frame, then 40, then 60...

Just need to add frame counter code to the spellcard.

Halca

  • Kawaii Bastard
Re: I'm really lost @_@
« Reply #53 on: June 21, 2009, 09:39:26 PM »
I'm pretty sure all the cool pplz have played Concealed the Conclusion so here's a lil question:

Ya know how Yuka Kazami splits into two and both versions of her take the same damage?
How would I go about doing that?

Re: I'm really lost @_@
« Reply #54 on: June 21, 2009, 11:45:44 PM »
SetDamageRateEx(Shot damage to enemy, Bomb damage to enemy, Shot damage to parent, Bomb damage to parent);

Call this function in your familiar script, where the enemy is the "familiar" and the "parent" is the main boss.

So here's the walkthrough: To spawn your enemy (or second version of the boss), use CreateEnemyFromScript in the spellcard file, which I explain how to do here (follow the second method). Instead of calling SetDamageRate in the enemy script, call SetDamageRateEx, which will harm both the enemy and the boss. The last two parameters of SetDamageRateEx is how much damage the enemy will do to the boss when it is getting shot (to have them take equal damage, make sure the boss' SetDamageRate = the last two parameters of the enemy's SetDamageRateEx).

Halca

  • Kawaii Bastard
Re: I'm really lost @_@
« Reply #55 on: July 13, 2009, 09:09:43 PM »
Wah...  I give up on Danmakufu

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: I'm really lost @_@
« Reply #56 on: July 22, 2009, 03:48:17 AM »
Code: [Select]
LastSpell(false);It won't run properly.
Of course not, you only run that line as:
Code: [Select]
LastSpell;not
Code: [Select]
LastSpell(false);

Drake

  • *
Re: I'm really lost @_@
« Reply #57 on: July 22, 2009, 04:04:13 AM »
Except it was already solved like two months ago so yeah

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

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: I'm really lost @_@
« Reply #58 on: July 22, 2009, 04:12:18 AM »
Except it was already solved like two months ago so yeah
Whoops. I never read everything, so yeah.

~ So yeah. ~