Author Topic: Danmakufu Q&A/Problem thread number 4  (Read 205777 times)

Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #240 on: August 10, 2010, 06:54:48 AM »
The MotK Backspace Demon ate my post.


First of all, bullets autodelete when they hit 64 pixels outside of the game boundaries (by default), so passing GetClips shouldn't delete the bullet; and so you don't need the second bullet. You just change the angle, the position and switch a boolean that says to stop bouncing. So er, something like this:

Code: [Select]
      let obj1=Obj_Create(OBJ_SHOT);
      let bounced = false;

      Obj_SetPosition(obj1, x, y);
      Obj_SetAngle(obj1, angle);
      Obj_SetSpeed(obj1, v);
      ObjShot_SetGraphic(obj1, graphic);
      ObjShot_SetDelay  (obj1, 10);
      ObjShot_SetBombResist (obj1, true);
      Obj_SetAutoDelete(obj1,true);

      while(!bounced) {
              if(Obj_GetX(obj1)<GetClipMinX+4) {
                     Obj_SetAngle(obj1, 180 - Obj_GetAngle(obj1) );
                     Obj_SetX(obj1,  Obj_GetX(obj1) + 0.1);
                     bounced = true;
              }

              if(Obj_GetX(obj1)>GetClipMaxX-4) {
                     Obj_SetAngle(obj1, 180 - Obj_GetAngle(obj1) );
                     Obj_SetX(obj1,  Obj_GetX(obj1) - 0.1);
                     bounced = true;
              }
              yield;
       }

The reason I used !bounced instead of checking if the object is deleted is just because once the bullet bounces you just let it do its own thing; there aren't going to be any more triggers so checking it every frame is a waste of processing.

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

sumisumi127

Re: Danmakufu Q&A/Problem thread number 4
« Reply #241 on: August 12, 2010, 09:23:46 AM »
This is a noobish question, but why can't I access spellcards from CTC in the directory?

Re: Danmakufu Q&A/Problem thread number 4
« Reply #242 on: August 12, 2010, 09:41:10 AM »
They do not have the #TouhouDanmakufu in the scripts, this line makes the script selectable

sumisumi127

Re: Danmakufu Q&A/Problem thread number 4
« Reply #243 on: August 12, 2010, 11:56:31 AM »
Ah, that was easy.  Thanks. (=

Re: Danmakufu Q&A/Problem thread number 4
« Reply #244 on: August 13, 2010, 10:43:55 AM »
Hello I'm back, and I have a question

How do you remove those annoying somewhat huge lazer base ??   :V

Edit: How do I get ObjLaser_SetSource to work without using task

Edit Edit: So I've heard that you can delete a post you made in Motk, How do you do that ?
« Last Edit: August 13, 2010, 10:51:12 AM by Foremoster »
Hey There !

Fetch()tirade

  • serial time-waster
Re: Danmakufu Q&A/Problem thread number 4
« Reply #245 on: August 13, 2010, 01:52:12 PM »
Uhhh, you can't. For either one of those.
1. It's not possible in any other way for Danmakufu.
2. Only mods and admins have the power to delete posts, I think.

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 number 4
« Reply #246 on: August 13, 2010, 03:01:52 PM »
it IS actually possible to use objects without tasks, just painfully hard :V

for example
Code: [Select]
let laser=Obj_Create(OBJ_LASER);

...blah blah...

@MainLoop{
     frame++;
     if(frame==1){
          ObjLaser_SetSource(laser, false);
     }
...blah blah....
}
would actually work
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Marco

  • DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI
  • DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI
Re: Danmakufu Q&A/Problem thread number 4
« Reply #247 on: August 13, 2010, 04:57:27 PM »
Sorry...I've another problem![Well I've many problem but... for now...]
Code: [Select]
fire(WHITE01);
if(frame==30){
SetMovePosition02(***, ***, 10);
}yield;
if(frame==60){
yield;
SetMovePosition02(**,***, 10);}yield;
if(frame==90){
yield;
SetMovePosition02(***, **, 10);}yield;
if(frame==120){
yield;
SetMovePosition02(***,***, 10);}yield;
if(frame==150){
yield;
SetMovePosition02(***,***, 10);}yield;
if(frame==180){
yield;
SetMovePosition02(***,***, 10);}yield;
if(frame==210){
yield;
SetMovePosition02(***,***, 10);
frame=0;yield;
}yield;
frame++;
(xs and ys are top secret)
then...
Code: [Select]
task fire(graphic){
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, GetEnemyX, GetEnemyY);
ObjShot_SetDelay(obj, 30);
ObjShot_SetGraphic(obj, graphic);
Obj_SetAngle(obj, -90);
Obj_SetSpeed(obj, 0);
yield;}
If I want that after 210 frames(the movement) ALL objs TOGETHER IN THE SAME TIME go up (for example) changing the velocity to 3 (about).But even with Wait(210); Some bullet will move, then others and then.... well I think you have understood. I tried with stop time and works, but I have other bullet that doesn't have to stop...Well I hope you have understand, I tried to speak English as better I can but... It's warm and I'm in holiday, I can't speak correctly any language....
DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem thread number 4
« Reply #248 on: August 13, 2010, 06:48:38 PM »
(xs and ys are top secret)

Oh god jesus. If you're gonna keep them secret, why not just delete the freaking lines so we, the people who are trying to help solve your problem, won't have to do it ourselves?

Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #249 on: August 13, 2010, 06:51:20 PM »
I'll be quite honest here, I have no clue what the heck your code means, what the heck you said, what the heck you want, or how the heck to respond.

i have been beaten

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

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem thread number 4
« Reply #250 on: August 13, 2010, 06:54:49 PM »
For what I see, we have a major misunderstanding of what the yield command does. Since your code is basically wrong to such a degree that it is incomprehensible what you were trying to achieve, I will simply tell you to read this, and possibly this.
« Last Edit: August 13, 2010, 07:03:37 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."

Formless God

Re: Danmakufu Q&A/Problem thread number 4
« Reply #251 on: August 13, 2010, 07:27:45 PM »
I know I'm late but thanks a lot for the help Drake. That worked wonderfully :)



So I've been messing around with the Daifukkatsu player scripts, and I found a rather ... strange line.

Code: [Select]
SetAlpha([150, 255][(isHC)]);I just know that isHC is a boolean. What are the square brackets for ?

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem thread number 4
« Reply #252 on: August 13, 2010, 08:05:17 PM »
Code: [Select]
SetAlpha([150, 255][isHC]);

[150, 255] is the array, and isHC picks the element of said array.
So if isHC is true (1), Danmakufu returns 255. If false (0), DMF returns 150.
Erm, I'm not too good at explaining, so I need someone to help.

Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #253 on: August 13, 2010, 08:16:25 PM »
No, that's pretty much it. It's a nifty way to skip past if statements.

An array is notated by [entry, entry2], as you probably know. The zero'th element in that array is entry, and the first element is entry2. [entry, entry2][0] would be entry, and [entry, entry2][1] would be entry2. Some people seem to think that making an array can only be done by creating a variable for it, but that isn't right. Just the act of using [] creates a temporary array.
Secondly, simply because of machine code, false is the same thing as 0 and true is the same thing as 1.

So, SetAlpha([150, 255][isHC]) would be SetAlpha(150) if isHC were false, and SetAlpha(255) if it were true.

teletype
« Last Edit: August 13, 2010, 08:17:58 PM by Drake »

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

Re: Danmakufu Q&A/Problem thread number 4
« Reply #254 on: August 13, 2010, 11:22:49 PM »
I'm trying to create a spellcard where the boss fires a bullet using CreateShotA, then using AddShot to create bullets from the original bullet, then using AddShot again to create bullets from the bullets created in the first AddShot. Currently, I have it set up like this:
Code: [Select]
task fire01{
loop{
CreateShotA(1,GetEnemyX,GetEnemyY,5);
SetShotDataA(1,0,2,45,0,0,2,BLUE12);
CreateShotA(2,0,0,5);
SetShotDataA(2,0,2,135,0,0,2,BLUE12);
CreateShotA(3,0,0,5);
SetShotDataA(3,0,2,315,0,0,2,BLUE12);
AddShot(60,1,2,0);
AddShot(60,1,3,0);
CreateShotA(4,0,0,5);
SetShotDataA(4,0,2,45,0,0,2,BLUE12);
CreateShotA(5,0,0,5);
SetShotDataA(5,0,2,225,0,0,2,BLUE12);
AddShot(60,2,4,0);
AddShot(60,2,5,0);
AddShot(60,3,4,0);
AddShot(60,3,5,0);
FireShot(1);
wait(120);
yield;
}
}
The idea is that shot 1 fires shots 2 and 3, and 2 and 3 each fire shots 4 and 5. However, while shot 1 fires shots 2 and 3 fine, shots 2 and 3 do not fire shots 4 and 5. Can anyone please explain how to change this so that it works like I want it do?

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem thread number 4
« Reply #255 on: August 13, 2010, 11:34:10 PM »
Firstly, you can't add shot 4 and 5 to both 2 and 3, you need to make new shots for them.

Secondly, was your problem that only one of the child bullets fired additional childs, or did none of the child bullets fire further child bullets?
I haven't used AddShot in quite some time, but in the latter case I guess you should either add the shots 4 and 5 to 2 before adding 2 to 1,  or you need to change the time at which the bullets 4 and 5 are added to accommodate for the time it takes bullet 1 to spawn 2 and 3.
Old Danmakufu stuff can be found here!

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

Re: Danmakufu Q&A/Problem thread number 4
« Reply #256 on: August 13, 2010, 11:44:23 PM »
Adding 4 and 5 to 2 before adding 2 to 1 and making the shots added to 3 different than the ones added to 2 worked, thank you.

Marco

  • DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI
  • DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI
Re: Danmakufu Q&A/Problem thread number 4
« Reply #257 on: August 14, 2010, 10:27:47 PM »
Sorryyyy T_T that things it's so lunatic?No, Extra?Phatasm?No it's kefir... T_T sorrryyyy.....
However, how about make some bullet at GetAngleToPlayer but if the player move the bullet won't change angle?
DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem thread number 4
« Reply #258 on: August 14, 2010, 11:20:04 PM »
Holy fuck the engrishhhhh

Marco

  • DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI
  • DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI
Re: Danmakufu Q&A/Problem thread number 4
« Reply #259 on: August 14, 2010, 11:24:00 PM »
Holy fuck the engrishhhhh
YEEEESSSS!!!!
What does it mean?
DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI

CK Crash

  • boozer
Re: Danmakufu Q&A/Problem thread number 4
« Reply #260 on: August 15, 2010, 02:52:13 AM »
Sorryyyy T_T that things it's so lunatic?No, Extra?Phatasm?No it's kefir... T_T sorrryyyy.....
However, how about make some bullet at GetAngleToPlayer but if the player move the bullet won't change angle?
Make a variable equal GetAngleToPlayer. Shoot bullets using that variable for the angle. If you don't update the variable, it will shoot at where the player WAS.

Here's an example in task format.
Code: [Select]
task ShootLine
{
let angle = GetAngleToPlayer; //Variable "angle" equals the angle to player.
loop(10)
{
//Shoots the bullet towards "angle".
CreateShot01(GetX,GetY,4,angle,RED01,10);
loop(3){yield;}
}
}

Here's an example in @MainLoop format.
Code: [Select]
let frame = -60;
let angle;

@MainLoop
{
if(frame==0)
{
//Variable "angle" equals the angle to player.
angle = GetAngleToPlayer;
}
if(frame%3==0 && frame>=0)
{
//Shoots the bullet towards "angle".
CreateShot01(GetX,GetY,4,angle,BLUE01,10);
}
if(frame==30)
{
frame =- 30;
}
frame++;
}

Both examples shoot 10 bullets over 30 frames, all aimed at the same spot.

Re: Danmakufu Q&A/Problem thread number 4
« Reply #261 on: August 15, 2010, 12:03:56 PM »
Need some help here, I have made my own sprites...



I have the idle, left, and right animations working I just need help getting the firing sprites to show when it's firing bullets.

This is what I have so far.

Code: [Select]
@DrawLoop{
SetTexture(spr);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);


if(int(GetSpeedX())==0){

if(f<10){ SetGraphicRect(0,0,96,96); }
if(f>=10 && f<20){ SetGraphicRect(96,0,192,96); }
if(f>=20 && f<30){ SetGraphicRect(192,0,288,96); }
if(f>=30 && f<40){ SetGraphicRect(288,0,384,96); }
f2=0;

}

if(GetSpeedX()>0){

if(f2<5){ SetGraphicRect(0,96,96,192); }
if(f2>=5 && f2<10){ SetGraphicRect(96,96,192,192); }
if(f2>=10 && f2<15){ SetGraphicRect(192,96,288,192); }
if(f2>=15){ SetGraphicRect(288,96,384,192); }
f2++;

}

if(GetSpeedX()<0){
if(f2<5){ SetGraphicRect(0,192,96,288); }
if(f2>=5 && f2<10){ SetGraphicRect(96,192,192,288); }
if(f2>=10 && f2<15){ SetGraphicRect(192,192,288,288); }
if(f2>=15){ SetGraphicRect(288,192,384,288); }
f2++;

}

DrawGraphic(GetX,GetY);

f++;
if(f==40){f=0;}

}

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem thread number 4
« Reply #262 on: August 15, 2010, 12:31:08 PM »
The mystery of danmakufu not playing music continues :V

Turns out when I play Phantasm Romance the midi music works but mp3s and wav don't like concealed the conclusion etc.
hmmmm.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem thread number 4
« Reply #263 on: August 15, 2010, 07:13:39 PM »
Need some help here, I have made my own sprites...

I have the idle, left, and right animations working I just need help getting the firing sprites to show when it's firing bullets.

Code: [Select]

let attack = 0;
. . .

if(int(GetSpeedX())==0){

// idle animation
if(attack == 0) {
if(f<10){ SetGraphicRect(0,0,96,96); }
if(f>=10 && f<20){ SetGraphicRect(96,0,192,96); }
if(f>=20 && f<30){ SetGraphicRect(192,0,288,96); }
if(f>=30 && f<40){ SetGraphicRect(288,0,384,96); }
f2=0;
}
// attack animation
if(attack == 1) {

<< Here SetGraphicRect ranges for the attack animation. >>
f2=0;
}
}

Declare for example:  "let attack = 0;" at the top and create simply a second animation range inside the idle statement (speed == 0) then call attack = 1; for example inside the task or function where the boss is firing. At the end of the attack sequence, simply call attack = 0; to return to idle statement.

Maybe bit strange method for most, but it works. Unless someone has a more efficient and easier method.


A question of my own:
I want to give my Marisa a laser like MarisaB dnh, however, I cannot seem to make it proper penetrate the familiars/bosses to deal equal damage along the laser.

Code: [Select]
    task testLaser(x,y) {
let obj = Obj_Create(OBJ_LASER);
let c = 0;

Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,22);
Obj_SetAngle(obj,270);
ObjShot_SetGraphic(obj,254);
    ObjLaser_SetSource(obj,false);
ObjLaser_SetLength(obj, 1000);
    ObjShot_SetDelay(obj,0);
ObjShot_SetDamage(obj,0.5);
ObjShot_SetPenetration(obj,25);
ObjLaser_SetWidth(obj,15);

while(!Obj_BeDeleted(obj)) {
Obj_SetPosition(obj,GetPlayerX,GetPlayerY);
c++;
if(c>=30) { Obj_Delete(obj); }
yield;
}
    }
Penetration isn't working. Somehow Danmakufu calculates the first target as a hit and the laser will keep penetrating that target continuously.
« Last Edit: August 15, 2010, 07:25:53 PM by Helepolis »

Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #264 on: August 15, 2010, 07:23:44 PM »
What you could do is ascent through every enemy and check if their coordinates intersect a line (the laser). If so, damage them.

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

Re: Danmakufu Q&A/Problem thread number 4
« Reply #265 on: August 15, 2010, 07:59:33 PM »
Object lasers don't use Obj_SetSpeed or ObjShot_SetPenetration, don't include them. There's also no reason to set delay to zero.

My Remilia lasers use both lasers to damage the enemies and enemy enumeration loops to spawn explosions on their position. You can just copy either code for your laser.

Marco

  • DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI
  • DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI
Re: Danmakufu Q&A/Problem thread number 4
« Reply #266 on: August 15, 2010, 10:56:40 PM »
Code: [Select]
if(frame%3==0)What does it means?
DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI

Re: Danmakufu Q&A/Problem thread number 4
« Reply #267 on: August 15, 2010, 10:59:06 PM »
Code: [Select]
if(frame%3==0)What does it means?

the % is called a Modulus, this statement says, if frame divided by 3 equals 0, then code

Re: Danmakufu Q&A/Problem thread number 4
« Reply #268 on: August 15, 2010, 11:08:01 PM »
the % is called a Modulus, this statement says, if frame divided by 3 equals 0, then code
Not exactly. It says, if frame divided by 3 has a REMAINDER of 0, then code.

Also how can you divide something and end up with 0? :V

Re: Danmakufu Q&A/Problem thread number 4
« Reply #269 on: August 15, 2010, 11:09:41 PM »
Not exactly. It says, if frame divided by 3 has a REMAINDER of 0, then code.

Also how can you divide something and end up with 0? :V
...whoops, my bad, thanks for the correction.

Dividing it by 0 of course :V