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

Mugen Hut

Re: Danmakufu Q&A/Problem Thread
« Reply #900 on: October 13, 2009, 08:47:16 PM »
How can I know what are the coordinates of multiple sprites on a spritesheet for the SetGraphicRect part?  What program can help to find the numbers?

Re: Danmakufu Q&A/Problem Thread
« Reply #901 on: October 13, 2009, 08:52:12 PM »
MSPaint. Scroll around with your mouse, the coordinates are displayed on the bottom right of the program. PROTIP: it's usually 2^x (2, 4, 8, 16, 32, 64, 128, 256, 512).

Re: Danmakufu Q&A/Problem Thread
« Reply #902 on: October 13, 2009, 11:03:00 PM »
Photoshop is more accurate since you can actually see the pixels if you have the background set to transparent

CK Crash

  • boozer
Re: Danmakufu Q&A/Problem Thread
« Reply #903 on: October 13, 2009, 11:11:27 PM »
Most CtC boss sprites are 128x128. For others, just divide the total image size by the number of columns/rows of sprites. It's usually around 64x64 or 64x80 for official Touhou sprites. (I don't really care about the JP sprite theft drama, we just simply don't have enough English spriters/composers to have original stuff for every fan game/fan creation)

Henry

  • The observer
  • Exploring to the new world of Danmaku
Re: Danmakufu Q&A/Problem Thread
« Reply #904 on: October 14, 2009, 12:16:12 AM »
Can the obj variable used in obj=Obj_Create(SHOT); be used for AddShot?
Old/Forgotten member.

Old Patchouli Project was outdated but new one is in progress.

CK Crash

  • boozer
Re: Danmakufu Q&A/Problem Thread
« Reply #905 on: October 14, 2009, 12:26:49 AM »
Nope, it doesn't quite work like that.

obj=Obj_Create() stores the ID of the object to obj so that it can be referenced later, but it's not the same as the CreateShot IDs.

Just use the regular CreateShot functions, with Obj_GetX(obj), Obj_GetY(obj), and Obj_GetAngle(obj) instead of the usual variables.

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: Danmakufu Q&A/Problem Thread
« Reply #906 on: October 14, 2009, 01:11:31 AM »
I have a question.

How can I have it set up so I can fire 70 bullets (or any other number higher than 60) over a period of 60 frames?

Actually, scratch that.  How can I fire "X" amount of bullets over a period of "F" frames?

Normally, the loop{ fire so,so bullets; loop(delay this many frames before repeating loop){yield;}}  does it enough for me, but it won't cut it this time. And it limits me to firing 60 bullets, or 30, or 20 bullets per second, and so on.


Note: I do not want it to be fired all at the same time, but all of it over a period of a controlled time (or frames).
« Last Edit: October 14, 2009, 01:14:03 AM by Fujiwara no Mokou »

Re: Danmakufu Q&A/Problem Thread
« Reply #907 on: October 14, 2009, 01:18:57 AM »
I have a question.

How can I have it set up so I can fire 70 bullets (or any other number higher than 60) over a period of 60 frames?

Actually, scratch that.  How can I fire "X" amount of bullets over a period of "F" frames?

Normally, the loop{ fire so,so bullets; loop(delay this many frames before repeating loop){yield;}}  does it enough for me, but it won't cut it this time. And it limits me to firing 60 bullets, or 30, or 20 bullets per second, and so on.


Note: I do not want it to be fired all at the same time, but all of it over a period of a controlled time (or frames).
imma take a shot at this one,

Try putting multiple loops, with an accent in delay.
« Last Edit: October 14, 2009, 01:21:31 AM by Demonbman »

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: Danmakufu Q&A/Problem Thread
« Reply #908 on: October 14, 2009, 01:21:36 AM »
I've tried that.
I've tried that, and failed miserabely.
I don't know how it works.  Can you give an example by code?
« Last Edit: October 14, 2009, 01:23:41 AM by Fujiwara no Mokou »

Re: Danmakufu Q&A/Problem Thread
« Reply #909 on: October 14, 2009, 01:48:24 AM »
I've tried that.
I've tried that, and failed miserabely.
I don't know how it works.  Can you give an example by code?
uhh....im not quite sure how the accent works but i think something like this should work:
Code: [Select]
#TouhouDanmakufu
#Title[..]
#Text[..]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{


@Initialize{
SetLife(1000);
SetMovePosition01(GetCenterX,GetCenterY,5);

mainTask;
}

@MainLoop{

yield;

}

@DrawLoop{

}

@BackGround{

}

@Finalize{

}


task mainTask{
yield;
fire;
}

task fire{
loop{
loop(60){
ascent(i in 1..60){
CreateShot01(GetEnemyX, GetEnemyY, 3, rand(0,360), RED02, 0*i);}}
loop(10){
ascent(i in 1..10){
CreateShot01(GetEnemyX, GetEnemyY, 3, rand(0,360), RED02, 0*i);}}

wait(10);
yield;
}
}

function wait(w){
loop(w){yield;}
}

}

i think...

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread
« Reply #910 on: October 14, 2009, 02:20:56 AM »
The way I would do it is to set up 3 variables, "shots" (total number to fire), "time" (total time to go through them), and "total" (I'll explain it later).

The best way to do this would be in a task, and loop this whole thing "time" times with a yield at the end of the loop. Shots divided by time gets you the amount to fire each frame, which you can store in another variable if you want. Take this number and add it to total each frame. Then while(total>=1){fire shot, total--;}.

This sounds perfect in my head, but I can't quite put it into words. If you need further explanation, I could throw together a simple script.

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: Danmakufu Q&A/Problem Thread
« Reply #911 on: October 14, 2009, 02:23:53 AM »
This sounds perfect in my head, but I can't quite put it into words. If you need further explanation, I could throw together a simple script.

Yeah, can you do that?

Re: Danmakufu Q&A/Problem Thread
« Reply #912 on: October 14, 2009, 02:30:25 AM »
Im sorry Fujiwara, i tried

IDEA!!!!

it wont be in a task tho, lets say that you want to fire 70 bullets in 1 sec, or 60 frames:

if(GetTimer<User Defined && GetTimer>one second away from first){
    Bullet Code}
then
if(GetTimer<Same as Above && frame%10==0 && GetTimer>Same as Above){
    Bullet Code}

this will fire 60 bullets over the first code,
then 10 over the second code,
thus 70 bullets over 1 sec!
« Last Edit: October 14, 2009, 02:43:18 AM by Demonbman »

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread
« Reply #913 on: October 14, 2009, 02:47:37 AM »
Here you go, easily customizable. Right now I just have it shoot out 20 RED05 bullets in random directions over 13 frames (I picked a strange number just to verify it will work with anything) every 200, and you can easily change the code in both MainLoop and the while loop in the task to do whatever you want. It will work with any two numbers, whether shots is greater than time or the other way around.

Code: [Select]
#TouhouDanmakufu
#Title [Shot test thingy]
#Text [firing x shots over y period of time]
#ScriptVersion [2]
#Player[FREE]

script_enemy_main {

let frame = 0;

    @Initialize {
        SetX(GetCenterX);
        SetY(GetClipMinY + 120);
        SetLife(1500);
        SetTimer(50);
        SetScore(1000000);


        LoadGraphic("script\img\ExRumia.png");

    }

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

yield;

frame++;
if(frame==200){
FireShots(20,13); //20 shots in 13 frames
frame=0;
}

}


    @DrawLoop {


        SetTexture("script\img\ExRumia.png");
        SetGraphicRect(0, 0, 63, 63);
SetGraphicAngle(0,0,0);
SetGraphicScale(1,1);
SetAlpha(255);
        DrawGraphic(GetX, GetY);

    }


    @Finalize {
        DeleteGraphic("script\img\ExRumia.png");
    }





task FireShots(shots, time){

let total=0;

loop(time){
yield;
total=total+(shots/time);
while(total>=1){
CreateShot01(GetX,GetY,2,rand(0,360),RED05,0);
total=total-1;
}
}

}



}
« Last Edit: October 14, 2009, 02:50:13 AM by Azure »

Re: Danmakufu Q&A/Problem Thread
« Reply #914 on: October 14, 2009, 02:50:50 AM »
Here you go, easily customizable. Right now I just have it shoot out 20 RED05 bullets in random directions over 13 frames (I picked a strange number just to verify it will work with anything) every 200, and you can easily change the code in both MainLoop and the while loop in the task to do whatever you want. It will work with any two numbers, whether shots is greater than time or the other way around.

Code: [Select]
#TouhouDanmakufu
#Title [Shot test thingy]
#Text [firing x shots over y period of time]
#ScriptVersion [2]
#Player[FREE]

script_enemy_main {

let frame = 0;

    @Initialize {
        SetX(GetCenterX);
        SetY(GetClipMinY + 120);
        SetLife(1500);
        SetTimer(50);
        SetScore(1000000);


        LoadGraphic("script\img\ExRumia.png");

    }

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

yield;

frame++;
if(frame==200){
FireShots(20,13); //20 shots in 13 frames
frame=0;
}

}


    @DrawLoop {


        SetTexture("script\img\ExRumia.png");
        SetGraphicRect(0, 0, 63, 63);
SetGraphicAngle(0,0,0);
SetGraphicScale(1,1);
SetAlpha(255);
        DrawGraphic(GetX, GetY);

    }


    @Finalize {
        DeleteGraphic("script\img\ExRumia.png");
    }





task FireShots(shots, time){

let total=0;

loop(time){
yield;
total=total+(shots/time);
while(total>=1){
CreateShot01(GetX,GetY,2,rand(0,360),RED05,0);
total=total-1;
}
}

}



}

wow........fancy

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: Danmakufu Q&A/Problem Thread
« Reply #915 on: October 14, 2009, 03:07:08 AM »
That's good.  Thanks a lot.

I use a lot of manipulation in my scripts, and usually NEVER use mainloop for my tasks.  I just load everything at initialize (even object effects. That yield at the beginning of the task keeps it from crashing, if you've never tried it).

This way, I can control everything. The time, task, when it happens, if it happens, make it happen only when a certai standard is met, and only after a previous task has finished, or even have it manipulate itself, based on what the player does, in which each thing lead to a different event based on how the player moves.  Like the firing rate increasing in contrast to the boss's life.

Anyway, I need a very flexible but simple way to make this about, and that kind of script is exactly what I need.  So thanks. 
« Last Edit: October 14, 2009, 03:26:08 AM by Fujiwara no Mokou »

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread
« Reply #916 on: October 14, 2009, 03:55:23 AM »
No problem. I actually used something very similar for a script I did a few days ago, so it was fresh in my mind. In my case, it was spawning x bullets along the length of a laser in y frames. I just used the same formula for timing but modified the positioning of it, so this was only five minutes of work.
I'm new here, so I might as well make a good image of myself, you know?

Re: Danmakufu Q&A/Problem Thread
« Reply #917 on: October 14, 2009, 05:00:58 AM »
I'm new here, so I might as well make a good image of myself, you know?

Good image? Tch. Overrated.

Rena-Ryuuguu

  • I can set a motherfucking ava D:
Re: Danmakufu Q&A/Problem Thread
« Reply #918 on: October 14, 2009, 02:52:32 PM »
Well, I have a question, How can I make enemies?
Like the Tenshi Mini stage and every touhou stage ._.

Stuffman

  • *
  • We're having a ball!
Re: Danmakufu Q&A/Problem Thread
« Reply #919 on: October 14, 2009, 04:08:30 PM »
Regular enemies follow the exact same script specifications as spellcards, except they don't use plural files. You load them as "CreateEnemyFromScript" in your stage file.

In the spellcard script you'll just have all the information about what the enemy does while it's onscreen, then have it fly off and auto-delete itself eventually.

Re: Danmakufu Q&A/Problem Thread
« Reply #920 on: October 14, 2009, 04:59:48 PM »
Proof nobody reads the tutorials :(

Re: Danmakufu Q&A/Problem Thread
« Reply #921 on: October 15, 2009, 01:17:18 AM »
ok right forum:
How do you replace the Background image in the danmakufu menus?
and the annoying Default Marisa and Reimu white colors?

Re: Danmakufu Q&A/Problem Thread
« Reply #922 on: October 15, 2009, 01:26:04 AM »
I have tried to do something new that I have not tried before: creating an enemy script inside of a boss script.

However, I have encountered a major flaw. When either the main boss or the sub-bosses' are attacked to the point where their health bars are depleted, or even when time runs out, Danmakufu crashes. I look through my script, but I see nothing wrong.

Code: [Select]
#TouhouDanmakufu
#Title[Clones]
#Text[Test script]
#Player[FREE]
#BGM[none]
#ScriptVersion[2]

script_enemy_main {
let ImgBoss = "script\img\ExRumia.png";

let count = 0;

@Initialize {
SetLife(2000);
SetTimer(60);
SetScore(10000000);

SetEnemyMarker(true);

   CreateEnemyFromScript("Rumia2",GetClipMinX-50,GetClipMinY+180,0,0,0);
   CreateEnemyFromScript("Rumia3",GetClipMaxX+50,GetClipMinY+180,0,0,0);

SetMovePosition01(GetCenterX, GetClipMinY + 120, 5);
CutIn(YOUMU, "Test Sign"\""Text"\", "", 0, 0, 0, 0);

LoadGraphic(ImgBoss);
SetTexture(ImgBoss);
SetGraphicRect(0, 0, 64, 64);
}

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

if(count == 60) {

count=0
}
count++;
}

@DrawLoop {
DrawGraphic(GetX, GetY);
}

@Finalize {
DeleteGraphic(ImgBoss);
}
}







script_enemy Rumia2
{
let ImgBoss2 = "script\img\ExRumia.png";
let count2 = 0;
 
@Initialize
{
  SetLife(2000);
  SetDamageRateEx(0,0,100,25);


  LoadGraphic(ImgBoss2);
  SetTexture(ImgBoss2);
  SetGraphicRect(0, 0, 64, 64);
 
  }

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

 if(count2 == 90){
  SetMovePosition03(GetCenterX + 50, GetClipMinY + 150, 20, 5);
  }

count2++;

}



@DrawLoop {
DrawGraphic(GetX, GetY);
}

@Finalize {
DeleteGraphic(ImgBoss2);
}
}







script_enemy Rumia3
{
let ImgBoss3 = "script\img\ExRumia.png";
let count3 = 0;
 
@Initialize
{
  SetLife(2000);
  SetDamageRateEx(0,0,100,25);


  LoadGraphic(ImgBoss3);
  SetTexture(ImgBoss3);
  SetGraphicRect(0, 0, 64, 64);
 
  }

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

 if(count3 == 90){
  SetMovePosition03(GetCenterX - 50, GetClipMinY + 150, 20, 5);
  }

count3++;

}



@DrawLoop {
DrawGraphic(GetX, GetY);
}

@Finalize {
DeleteGraphic(ImgBoss3);
}
}

What could be the possible issue here? Do I need to somehow state that the sub-bosses are erased from the script at the end of the spellcard? If so, how would I do that?
« Last Edit: October 15, 2009, 02:48:13 AM by Frazer »

Re: Danmakufu Q&A/Problem Thread
« Reply #923 on: October 15, 2009, 02:49:59 AM »
Could have something to due with deleting the same image twice, but I'm still pouring over it.

Re: Danmakufu Q&A/Problem Thread
« Reply #924 on: October 15, 2009, 03:14:31 AM »
Could have something to due with deleting the same image twice, but I'm still pouring over it.

Actually, that appears to have been the case. I just tested saving the same image as three different file names, and that actually worked than just sharing one image between each of the enemies. O.o

Thank you for that idea. That helped me solve the problem.


Then I have two more questions out of curiosity.

1. Is it possible to keep multiple bosses in a single script when they are killed (i.e. Prismriver Sisters)?

2. What kind of things would I put under the "user-defined argument" in certain pieces of scripting (like 'CreateEnemyFromScript')?
« Last Edit: October 15, 2009, 03:22:38 AM by Frazer »

Re: Danmakufu Q&A/Problem Thread
« Reply #925 on: October 15, 2009, 03:22:31 AM »
1. Yes

2. Anything you want to pass on to the other script. Mainly used if you want to spawn more than one of the same enemy, but only change one thing in it. Like an angle value. Just use "GetArgument" in the child script to get the value you declared for the argument parameter of CreateEnemyFromScript, or whatever.

CreateEnemyFromScript("lololol", GetX, GetY, 0, 0, 2);

...Then in the child script "lololol":

let v = GetArgument;

So v will assume a value of 2 for that script.


@Demonbman:
ok right forum:
How do you replace the Background image in the danmakufu menus?
and the annoying Default Marisa and Reimu white colors?

1. You can't. People make custom menus inside scripts using ObjEffects, that might be what you're thinking of.
2. They're different scripts (if I had to guess, I don't actually have the new textured Reimu and Marisa. Correct me if I'm wrong).
« Last Edit: October 15, 2009, 03:25:00 AM by Naut »

Re: Danmakufu Q&A/Problem Thread
« Reply #926 on: October 15, 2009, 03:25:58 AM »
Ah, I see. That makes sense.


Then, I am sorry, but I have two more questions (this happens every single time I make a post on these topics).


1. Is it possible to keep multiple bosses in a single script when they are killed (i.e. Prismriver Sisters)?

2. How would I be able to change the angle of an enemy automatically whenever they move, to the direction they are moving? This does not seem to happen when I select ShotDirectionType(SEQUENCE) [unless this is used in some other way?].


Re: Danmakufu Q&A/Problem Thread
« Reply #927 on: October 15, 2009, 03:29:55 AM »
1. Yes, use CommonData to pass along their last known position in the previous script to your next script and spawn familiars in @Initialize on the positions you store. Since the transition happens in one frame, you will never see them disappear.

2. SetAngle(GetAngle); ? I'm not sure what you're asking.

Re: Danmakufu Q&A/Problem Thread
« Reply #928 on: October 15, 2009, 03:39:06 AM »
1. Yes, use CommonData to pass along their last known position in the previous script to your next script and spawn familiars in @Initialize on the positions you store. Since the transition happens in one frame, you will never see them disappear.

2. SetAngle(GetAngle); ? I'm not sure what you're asking.

1. Okay.

2. SetShotDirectionType(SEQUENCE) makes 0 degrees as the angle the enemy is pointed towards, correct? If this is the case, then when the boss moves, wouldn't their angle of facing change as well? This does not appear to happen normally.

E.X.
Code: [Select]
#TouhouDanmakufu
#Title[Moving Test]
#Text[Test script]
#Player[FREE]
#BGM[none]
#ScriptVersion[2]

script_enemy_main {
let ImgBoss = "script\img\ExRumia.png";

let count = 0;
let a = 0;
let speed = 1;

@Initialize {
SetLife(4000);
SetTimer(60);
SetScore(10000000);

SetEnemyMarker(true);

SetMovePosition01(GetCenterX, GetClipMinY + 60, 5);
CutIn(YOUMU, "Test Sign"\""Text"\", "", 0, 0, 0, 0);

LoadGraphic(ImgBoss);
SetTexture(ImgBoss);
SetGraphicRect(0, 0, 64, 64);
}

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

if(count == 120) {
SetMovePositionHermite(GetX, GetY, 2000, 135, 2000, 225, 240);
}

if(count == 480) {
SetMovePositionHermite(GetX, GetY, 2000, 45, 2000, 315, 240);
}

if(count >= 120 && count <= 360 || count >= 480 && count <= 720){
loop(1){
SetShotDirectionType(SEQUENCE);
CreateShot01(GetX, GetY, 1, 0, RED12, 30);
CreateShot01(GetX, GetY, 1, 0, RED31, 30);

a += 0;
}
a += 27;
}

if(count == 240 || count == 600){
loop(10){
CreateShot01(GetX, GetY, speed, GetAngleToPlayer, RED01, 30);
CreateShot01(GetX, GetY, speed, GetAngleToPlayer + 20, RED01, 30);
CreateShot01(GetX, GetY, speed, GetAngleToPlayer - 20, RED01, 30);
CreateShot01(GetX, GetY, speed, GetAngleToPlayer + 40, RED01, 30);
CreateShot01(GetX, GetY, speed, GetAngleToPlayer - 40, RED01, 30);
CreateShot01(GetX, GetY, speed, GetAngleToPlayer + 60, RED01, 30);
CreateShot01(GetX, GetY, speed, GetAngleToPlayer - 60, RED01, 30);

speed += 0.5;
}
speed = 1;
}

if(count == 720){
count = 0;
}


count++;
}

@DrawLoop {
DrawGraphic(GetX, GetY);
}

@Finalize {
DeleteGraphic(ImgBoss);
}
}


I would expect, when the boss moves in a certain direction, they would be facing that angle. In this script, for example, no matter which direction the boss moves, their angle is always 0.

Re: Danmakufu Q&A/Problem Thread
« Reply #929 on: October 15, 2009, 04:21:25 AM »
What is the difference between GetX and GetX()?

is there a way to once a angle equals a certain...angle that it can switch?
im not sure if you can put an if statement in another if statement.