Maidens of the Kaleidoscope

~Hakurei Shrine~ => Rika and Nitori's Garage Experiments => Topic started by: Halca on April 30, 2009, 09:47:14 PM

Title: I'm really lost @_@
Post by: Halca on April 30, 2009, 09:47:14 PM
Well I read all of Blargel's tutorial and was able to perform all of the tasks that were shown, but I really don't understand how to put it all together.  What I mean is that, I just can't figure out how to get all the images and attacks into one boss fight.  I've tried looking at scripts that I've downloaded as a reference but they really didn't help. 

So could someone tell me how to put this all together?

(btw, I can't figure out how to get the target version of the enemy character to appear)
Title: Re: I'm really lost @_@
Post by: Suikama on April 30, 2009, 11:06:52 PM
Try poking around http://touhou.wikia.com/wiki/Touhou_Danmakufu:_Functions
Title: Re: I'm really lost @_@
Post by: Stuffman on April 30, 2009, 11:17:22 PM
Basically, each attack/spellcard script you make should be self-sufficient. You don't need to share resources between them or anything. When you go to make a full boss, it's a matter of creating a Plural file. The Plural file is pretty simple, it just runs each spellcard in the order you list them.

Take a look at the ExRumia that comes with Danmakufu to get an idea of how it all comes together. "ExRumia.txt" is her plural file.
Title: Re: I'm really lost @_@
Post by: Naut on April 30, 2009, 11:45:53 PM
I just can't figure out how to get all the images and attacks into one boss fight. So could someone tell me how to put this all together?

A Plural file is what you're looking for, sir. Plural files look like this:

Code: [Select]
#TouhouDanmakufu[Plural]
#Title[ExRumia Boss Stage]
#Text[ExRumia boss fight, including regular attacks and spell-cards.]
#Image[.\img\ExRumia(¯•„uƒ~ƒbƒhƒiƒCƒgƒŒƒ”ƒ@ƒŠƒGv).png]
#BackGround[Default]
#Player[FREE]
#ScriptVersion[2]

#ScriptPathData
#ScriptPath[.\ExRumia01.txt]
#ScriptPath[.\ExRumiaSpell01.txt]
#ScriptPath[.\ExRumiaSpell02.txt]
#ScriptNextStep
#ScriptPath[.\ExRumia02.txt]
#ScriptPath[.\ExRumiaSpell03.txt]
#ScriptPath[.\ExRumiaSpell05.txt]
#ScriptNextStep
#ScriptPath[.\ExRumiaSpell04.txt]

#EndScriptPathData

Alrighty, the first little bit should be self-explanatory. Declare that this is a TouhouDanmakufu script, indicate that it is a plural script on the same line, set a title for the script, set some descriptive text, set an image to appear when you're selecting the script from Danmakufu's menu, set the background, set what player characters may be used, then indicate it's script version two.

Now, onto some of these new parameters.

#ScriptPathData starts the script path data (no wai). Be sure to declare this at the beginning of this string, it tells Danmakufu that the following is data for your plural script.
#ScriptPath[] tells Danmakufu to load and play the script you indicate in it's braces. It's relative to this file, so if your scripts are located in a subfolder, be sure to show that with [.\Sub Folder Name\script.txt]
#ScriptNextStep tells Danmakfu how to arange the life bars at the top of the screen. Everytime you call this, a new life bar is broken up and created, so all the scripts inbetween #ScriptNextStep will appear on the same lifebar. Test it out to see what I mean.
#EndScriptPathData does exactly what it says. Declare this at the end of your plural script.

And that's about it. Playing this script will tell Danmakufu to play all the scripts you've indicated inside this file, in decending order. So in the example, ExRumia01.txt will be played first, then when that script ends, ExRumiaSpell01.txt will be played, then ExRumiaSpell02.txt will be played, then a new lifebar will be created, then we'll move onto ExRumia02.txt, etc.



(btw, I can't figure out how to get the target version of the enemy character to appear)


Declare a variable to equal your boss graphic at the beginning of the script, so that you can easily reference it many times:
Code: [Select]
let BossImg = "script\ExRumia\img\ExRumia.png";
Load the graphic in @Initialize:
Code: [Select]
LoadGraphic(BossImg);
Declare the texture you want to edit, set the coordinates on the graphic of the area you want to display, then draw the graphic on the boss' position in @DrawLoop:
Code: [Select]
SetTexture(BossImg);
SetGraphicRect(0, 0, 64, 64);
DrawGraphic(GetX, GetY);

When the script finishes, you'll want to delete everything to free up space, so you'll delete the graphic in @Finalize:
Code: [Select]
DeleteGraphic(BossImg);
If you've strung together spells, don't worry about the boss disappearing in-between spells with DeleteGraphic();, since you'll redeclare the boss image information in the next spell anyway.

Nuclear Cheese has a drawing tutorial (http://touhou.wikia.com/wiki/Touhou_Danmakufu:_Nuclear_Cheese%27s_Drawing_Tutorial) if you'd like a more in-depth lesson on drawing things in Danmakufu.
Title: Re: I'm really lost @_@
Post by: Halca on May 01, 2009, 07:10:14 PM
My scripts keep getting errors and I'm not sure what I'm doing wrong.
Title: Re: I'm really lost @_@
Post by: Naut on May 01, 2009, 07:27:46 PM
Unfortunately, that doesn't tell us much. You can post your script here and we can troubleshoot it for you, if you like.
Title: Re: I'm really lost @_@
Post by: Halca on May 01, 2009, 11:09:00 PM
Ok, here's what my script looks like:

Code: [Select]
#TouhouDanmakufu
#Title[Attack Name]
#Text[Attack Description]
#BGM[.\bgm.mp3]
#PlayLevel[Normal]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let BossImage = ".\img\moe.png";
    let BossCutIn = ".\img\moetancut.png";
    @Initialize {
        LoadGraphic(BossImage);
        SetLife(1000);
        SetDamageRate(10, 10);
        SetTimer(50);
        SetInvincibility(30);
        CutIn(YOUMU, "Learning Sign"\"Magic Pencil"\", BossCutIn, 0, 0, 512, 512);
        SetScore(500000);
        SetEnemyMarker(true);
        SetDurableSpellCard;
        LastSpell;
        Concentration01(60);
        Concentration02(0);
        MagicCircle(false);
        SetEffectForZeroLife(180, 100, 1);
    }

    @MainLoop {
    }

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

    @Finalize {
    }
}

When I try to run it, it bugs out.
Title: Re: I'm really lost @_@
Post by: Drake on May 01, 2009, 11:24:24 PM
SetGraphicRect(0, 0, 64, 64);
Title: Re: I'm really lost @_@
Post by: Naut on May 01, 2009, 11:27:53 PM
Your CutIn script is missing a quotation for it's name declaration. It should be:
Code: [Select]
CutIn(YOUMU, "Learning Sign "\""Magic Pencil"\", BossCI, 0, 0, 512, 512);
Notice the extra quotation between "\" and Magic Pencil. Don't ask how this works out, it's just a really confusing way of writing quotations in a text string. It works, no need to confuse you on why it's like this.


It should also be noted, in your @DrawLoop, "SetGraphic" doesn't exist, you left out the "Rect" part. So it should be:

Code: [Select]
SetGraphicRect(0, 0, 64, 64);
PFF Drake noticed this too.

Your code should run properly without any errors if you make these adjustments.

When you see a pop-up error message, it usually features a little snippet of code where the problem originates. Be sure to check for quotations, semi-colons, and proper brackets, as they're the most common problems that you'll see. The next most common is the one doesn't give you any code snippets, but instead has the characters {...} in it. This means that your squiggly braces {} don't pair up with eachother and need to be changed.

If the snippet of code is small, then I recommend just re-typing it out. If it's large, or you just don't know what's going on, then you should probably look for help. We'll be happy to assist you.
Title: Re: I'm really lost @_@
Post by: Halca on May 01, 2009, 11:55:02 PM
Thank you very much :D

But still there's an issue @_@
The script runs fine now but the cut in image is completely white and the boss image does not appear on screen.  Help?

EDIT!:

Figured it out!
According to what I did it seems that scripts like to take images out of the scriptimg folder.
Correct?

I'm going to start scripting the bullets now! <3
Title: Re: I'm really lost @_@
Post by: Naut on May 02, 2009, 12:48:31 AM
It takes them out of the folder you designated in your script. So since you said:

Code: [Select]
let BossCutIn = ".\img\moetancut.png";
It will move into the script folder (you said .\ at the start, I think this gets the script folder when declared outside of square braces...? Not sure...), move into the img folder, then look for a file called moetancut.png. If you'd like to base everything on the current script (which is what most people do), you could have Danmakufu look for the image like this:

Code: [Select]
let BossCutIn = GetCurrentScriptDirectory~"img\moetancut.png";
Which would find the path of the current script, move into the subfolder img from the folder that this script is in, then locate moetancut.png.

Good luck with your bullet script~.
Title: Re: I'm really lost @_@
Post by: Halca on May 02, 2009, 01:40:12 AM
Ok, my bullets are doing great so far, I was just wondering though...
How would you create a semicircle pattern that bursts from a point?
Kind of would look like this:
  /   /  |   \   \
 /   /   |    \   \
/   /    |     \   \

I hope that makes sense >_<
Title: Re: I'm really lost @_@
Post by: Naut on May 02, 2009, 01:47:33 AM
I won't mess with looping structures since your pretty new, so here's the bare-bones way:

Code: [Select]
CreateShot01(GetX, GetY, 3, angle - 20, RED01, 0);
CreateShot01(GetX, GetY, 3, angle - 10, RED01, 0);
CreateShot01(GetX, GetY, 3, angle, RED01, 0);
CreateShot01(GetX, GetY, 3, angle + 10, RED01, 0);
CreateShot01(GetX, GetY, 3, angle + 20, RED01, 0);

This creates a 5 bullets, each aimed slightly off from eachother (notice the direction parameter), and will cause a fanning pattern, hopefully like the one you're looking for.
Title: Re: I'm really lost @_@
Post by: Halca on May 02, 2009, 03:07:54 PM
I tried to add the fanning pattern, but the script won't run.  Here's my current @MainLoop:
Code: [Select]
    @MainLoop {
        SetCollisionA(240, 150, 32);
        SetCollisionB(240, 150, 24);
        if(frame==60){
            CreateShot01(GetX, GetY, 3, -20, RED12, 0)
            CreateShot01(GetX, GetY, 3, -15, RED12, 0)
            CreateShot01(GetX, GetY, 3, -10, RED12, 0)
            CreateShot01(GetX, GetY, 3, -5, RED12, 0)
            CreateShot01(GetX, GetY, 3, 0, RED12, 0)
            CreateShot01(GetX, GetY, 3, 5, RED12, 0)
            CreateShot01(GetX, GetY, 3, 10, RED12, 0)
            CreateShot01(GetX, GetY, 3, 15, RED12, 0)
            CreateShot01(GetX, GetY, 3, 20, RED12, 0)
        }   
        if(frame==20){
            CreateShot01(240, 150, 3, GetAngleToPlayer, YELLOW01, 10);
            CreateShot01(230, 150, 3, GetAngleToPlayer, YELLOW01, 10);
            CreateShot01(250, 150, 3, GetAngleToPlayer, YELLOW01, 10);
            CreateShot01(260, 150, 3, GetAngleToPlayer, YELLOW01, 10);
            CreateShot01(270, 150, 3, GetAngleToPlayer, YELLOW01, 10);
            CreateShot01(220, 150, 3, GetAngleToPlayer, YELLOW01, 10);
            CreateShot01(210, 150, 3, GetAngleToPlayer, YELLOW01, 10);
            frame = 0;
        }   
        frame++;
    }

Where did I go wrong?  Another thing- when I try to set the LastSpell to false like this:
Code: [Select]
LastSpell(false);It won't run properly.
Title: Re: I'm really lost @_@
Post by: Cyclone722 on May 02, 2009, 03:23:19 PM
Ok, I'm not too good at this myself.
But your bullet angles are wrong, you can't have negitive angles.
and Naut seems to use a variable to control the angle here.

Try this.
Code: [Select]
if(frame==60){
            CreateShot01(GetX, GetY, 3, 60, RED12, 0);
            CreateShot01(GetX, GetY, 3, 65, RED12, 0);
            CreateShot01(GetX, GetY, 3, 70, RED12, 0);
            CreateShot01(GetX, GetY, 3, 85, RED12, 0);
            CreateShot01(GetX, GetY, 3, 90, RED12, 0);
            CreateShot01(GetX, GetY, 3, 95, RED12, 0);
            CreateShot01(GetX, GetY, 3, 100, RED12, 0);
            CreateShot01(GetX, GetY, 3, 105, RED12, 0);
            CreateShot01(GetX, GetY, 3, 110, RED12, 0);
        }   
This will shoot a fan of bullets with the center one going straight down.
 
Your frame = 0; should be in the attack with (frame==60) if you call it before,
frame will never reach 60 and the red shots won't be fired.



Title: Re: I'm really lost @_@
Post by: Garlyle on May 02, 2009, 03:35:45 PM
First off, that's incorrect: you CAN have Negative angles on your bullets.  In fact, in the manual text with Danmakufu, it refers to up as -90, not 270.

With that said, it's important to remember that Right = 0', and Down = 90', so you may want to adjust for that.

Also, your error is in this:
LastSpell(false);

LastSpell doesn't call a parameter.  It's either present in a script as LastSpell; (In which case it's a last spell), or it's not in at all (in which case it's a normal spell).
Title: Re: I'm really lost @_@
Post by: Cyclone722 on May 02, 2009, 03:41:59 PM
Oh. Well, I just learned something new!
Title: Re: I'm really lost @_@
Post by: Halca on May 02, 2009, 07:26:52 PM
I used your advice and now the script runs, but the bullets won't appear >_<
Here's what the code looks like:
Code: [Select]
    @MainLoop {
        SetCollisionA(240, 150, 32);
        SetCollisionB(240, 150, 24);
        if(frame==60){
            CreateShot01(GetX, GetY, 3, 60, RED12, 0);
            CreateShot01(GetX, GetY, 3, 65, RED12, 0);
            CreateShot01(GetX, GetY, 3, 70, RED12, 0);
            CreateShot01(GetX, GetY, 3, 85, RED12, 0);
            CreateShot01(GetX, GetY, 3, 90, RED12, 0);
            CreateShot01(GetX, GetY, 3, 95, RED12, 0);
            CreateShot01(GetX, GetY, 3, 100, RED12, 0);
            CreateShot01(GetX, GetY, 3, 105, RED12, 0);
            CreateShot01(GetX, GetY, 3, 110, RED12, 0);
            frame = 0;

        }   
        if(frame==20){
            CreateShot01(240, 150, 3, GetAngleToPlayer, YELLOW01, 10);
            CreateShot01(230, 150, 3, GetAngleToPlayer, YELLOW01, 10);
            CreateShot01(250, 150, 3, GetAngleToPlayer, YELLOW01, 10);
            CreateShot01(260, 150, 3, GetAngleToPlayer, YELLOW01, 10);
            CreateShot01(270, 150, 3, GetAngleToPlayer, YELLOW01, 10);
            CreateShot01(220, 150, 3, GetAngleToPlayer, YELLOW01, 10);
            CreateShot01(210, 150, 3, GetAngleToPlayer, YELLOW01, 10);
            frame = 0;
        }   
        frame++;
    }
Title: Re: I'm really lost @_@
Post by: Naut on May 02, 2009, 07:42:15 PM
Hmm, your collision detection should be on GetX, GetY, so even if you move the boss moves around it will still accurately detect her hitbox.

Those yellow bullets should spawn, but keep in mind that GetAngleToPlayer gets the angle from the boss to the player. So because you're not spawning the bullets on GetX, GetY, the bullet angle will probably be inaccurate. The red bullets won't spawn because when frame = 20 (when you spawn the yellow bullets), you set frame back to 0 again, so frame will never go above 20, or high enough to spawn the red ones. If you take out "frame = 0;" from the yellow bullet spawning tree, then it should run properly and spawn both red and yellow bullets, then repeat.
Title: Re: I'm really lost @_@
Post by: Halca on May 02, 2009, 07:45:19 PM
Hmm, your collision detection should be on GetX, GetY, so even if you move the boss moves around it will still accurately detect her hitbox.

Those yellow bullets should spawn, but keep in mind that GetAngleToPlayer gets the angle from the boss to the player. So because you're not spawning the bullets on GetX, GetY, the bullet angle will probably be inaccurate. The red bullets won't spawn because when frame = 20 (when you spawn the yellow bullets), you set frame back to 0 again, so frame will never go above 20, or high enough to spawn the red ones. If you take out "frame = 0;" from the yellow bullet spawning tree, then it should run properly and spawn both red and yellow bullets, then repeat.

Oh, the yellow bullets are fine, I'm having an issue with the red ones.
Title: Re: I'm really lost @_@
Post by: Naut on May 02, 2009, 11:25:46 PM
Well, that's because you didn't finish reading the paragraph, sir.
Title: Re: I'm really lost @_@
Post by: Halca on May 03, 2009, 12:15:18 AM
Well, that's because you didn't finish reading the paragraph, sir.

Sorry... I feel so embarassed now :X
Thank you!
Title: Re: I'm really lost @_@
Post by: Halca on May 03, 2009, 12:23:32 AM
My spell is beggining to have the effect I want.  How can I make the different types of shots appear at a different rate from eachother?
Title: Re: I'm really lost @_@
Post by: Naut on May 03, 2009, 12:43:57 AM
There are a few ways for that effect. I'll explain two of them, the first is extremely easy to understand, but requires making a variable for every section.

If you want to maker things spawn at different rates, then you could make a couple frame variables, like "frame1", "frame2", "frame3", etc., and have them all counting up in your @MainLoop. Then it's just a matter of resetting them everytime you use them. So your @MainLoop could look something like this:

Code: [Select]
@MainLoop{
 SetCollisionA(GetX, GetY, 32);
 SetCollisionB(GetX, GetY, 16);

 frame1++;
 frame2++;
 frame3++;

 if(frame1==60){
  CreateShot01(GetX, GetY, 3, GetAngleToPlayer, RED01, 0);
  frame1 = 0;
 }

 if(frame2==40){
  CreateShot01(GetX, GetY, 4, GetAngleToPlayer, BLUE02, 0);
  frame2 = 0;
 }

 if(frame3==16){
  CreateShot01(GetX, GetY, 2.4, GetAngleToPlayer, GREEN03, 0);
  frame3 = 0;
 }
}

Another way is using a function called modulus (%). When we say frame%15, it returns the remainder of frame if it was divided by 15. So if frame was 45, frame%15 would equal 0, because 15 evenly divides into 45 three times, with no remainder. If frame was 38, frame%15 would equal 8 because 38 divided by 15 equals 2, with a remainder of 8. If frame was 1573, frame%15 would equal 13, etc.
So by using this modulus function, we can have one incrementing frame counter in MainLoop, and still have many bullets spawning at different intervals. Here's an example:

Code: [Select]
@MainLoop{
 SetCollisionA(GetX, GetY, 32);
 SetCollisionB(GetX, GetY, 16);
 frame++;

 if(frame%15==0){
  CreateShot01(GetX, GetY, 3, GetAngleToPlayer, RED01, 0);
 }

 if(frame%20==0){
  CreateShot01(GetX, GetY, 2, 90, YELLOW03, 0);
 }

 if(frame%42==0){
  CreateShot01(GetX, GetY, 5, GetAngleToPlayer, GREEN02, 0);
 }
}

In this MainLoop, we have a small red bullet being fired towards the player every 15 frames, a large yellow bullet being fired straight downwards every 20 frames, and a medium green bullet being fired towards the player every 42 frames.
Title: Re: I'm really lost @_@
Post by: Halca on May 03, 2009, 01:29:09 AM
It worked beautifully :D
Now to the next spell card! <3
(Thanks Naut :3)
Title: Re: I'm really lost @_@
Post by: Halca on May 13, 2009, 10:06:33 PM
Does anyone know how to go about making dialogue between characters?
Title: Re: I'm really lost @_@
Post by: Garlyle on May 13, 2009, 10:37:32 PM
Last post here:
http://www.shrinemaiden.org/forum/index.php?topic=382.0
Title: Re: I'm really lost @_@
Post by: Halca on May 17, 2009, 02:53:12 AM
Whelp- I started a new project that is already farther than the last :D

I have a little issue with the plural script though, check it for me pweeze :3

Code: [Select]
#TouhouDanmakufu[Plural]
#Title[Stage 1 Midd-Boss, Jiao Lan]
#Text[Boss Fight with Jiao Lan]
#BackGround[Default]
#Player[FREE]
#ScriptVersion[2]


#ScriptPathData
#ScriptPathData[.\Pre-Spell01.txt]
#ScriptNextStep[.\Spell01.txt]

#EndScriptPathData

This script won't run and I'm not sure why.
Title: Re: I'm really lost @_@
Post by: JormundElver on May 17, 2009, 03:07:19 AM
I think I've had that issue with plurals not running and I think it was resolved by changing your first line there into

#?????e????[Plural]

If that works, I don't know how it makes a difference.
Title: Re: I'm really lost @_@
Post by: Halca on May 17, 2009, 03:44:46 AM
Still not working, still don't know why D:
Title: Re: I'm really lost @_@
Post by: JormundElver 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
Title: Re: I'm really lost @_@
Post by: Stuffman 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.
Title: Re: I'm really lost @_@
Post by: Halca 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 >_>
Title: Re: I'm really lost @_@
Post by: Halca 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!
Title: Re: I'm really lost @_@
Post by: Drake 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.
Title: Re: I'm really lost @_@
Post by: Nuclear Cheese 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. :-\
Title: Re: I'm really lost @_@
Post by: Halca 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 >_<
Title: Re: I'm really lost @_@
Post by: JormundElver 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.
Title: Re: I'm really lost @_@
Post by: Halca on May 22, 2009, 11:21:50 PM
I was wondering, how do you go about
creating and controlling familiars?
Title: Re: I'm really lost @_@
Post by: Naut on May 23, 2009, 12:23:40 AM
I dunno, lol. (http://www.shrinemaiden.org/forum/index.php?topic=352.msg9851#msg9851)
Title: Re: I'm really lost @_@
Post by: Halca on May 23, 2009, 01:42:43 AM
I dunno, lol. (http://www.shrinemaiden.org/forum/index.php?topic=352.msg9851#msg9851)

ily :P
Title: Re: I'm really lost @_@
Post by: Halca 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);
   
    }
}
Title: Re: I'm really lost @_@
Post by: Naut 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.
Title: Re: I'm really lost @_@
Post by: Halca 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);
    }
}
Title: Re: I'm really lost @_@
Post by: Naut 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.
Title: Re: I'm really lost @_@
Post by: Halca on May 24, 2009, 01:47:08 AM
Whelp.. I tried that out and it didn't quite work :(
Title: Re: I'm really lost @_@
Post by: Naut 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.
Title: Re: I'm really lost @_@
Post by: Halca 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?
Title: Re: I'm really lost @_@
Post by: Drake on May 25, 2009, 12:20:51 AM
Coffee and imagination.

There's no real estimation for time, I don't think.
Title: Re: I'm really lost @_@
Post by: Stuffman 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.
Title: Re: I'm really lost @_@
Post by: Naut 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.
Title: Re: I'm really lost @_@
Post by: Halca 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 @_@
Title: Re: I'm really lost @_@
Post by: Stuffman 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.
Title: Re: I'm really lost @_@
Post by: Halca 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?
Title: Re: I'm really lost @_@
Post by: Naut 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 (http://www.shrinemaiden.org/forum/index.php?topic=352.msg9851#msg9851) (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).
Title: Re: I'm really lost @_@
Post by: Halca on July 13, 2009, 09:09:43 PM
Wah...  I give up on Danmakufu
Title: Re: I'm really lost @_@
Post by: Chronojet ⚙ Dragon 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);
Title: Re: I'm really lost @_@
Post by: Drake on July 22, 2009, 04:04:13 AM
Except it was already solved like two months ago so yeah
Title: Re: I'm really lost @_@
Post by: Chronojet ⚙ Dragon 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. ~