Author Topic: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)  (Read 190471 times)

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #30 on: April 27, 2012, 07:56:57 PM »
Thanks! So to make spiral patterns like a vortex i could use this

Btw, i tryed task metod and @mainloop metod to make scripts in danmakufu, but i prefer the tasks.

So, my question is: with task how can i create 2 streams of bullets, 1 stream in a task1 and the 2nd stream in a task2 and make the engine loop...
for example:

boss appears, wait 120 frames
task1 start, so the 1st stream is shot
wait 60 frames
task2 starts, so the second stream is shot
wait 60 frames
task3 starts, so the 3rd stream is shot

and at the end make it repeat, like in old pc-98 games where the bosses had for example betwheen 1000-2000 lifepoints 3-4 different attacks that kept repeating one after the other
(attack1 -> 2 -> 3 -> 4 -> 1 again ...) but not all in the same time.


Second question:

 I would like to understand how to set that for example if the spellcard is 60 seconds, i create 3 attack tasks called fire1, fire2 and fire3. fire1 work only for the first 20 seconds, than it "deleted" and start fire2-only for 20 seconds, than it deleted too and start fire3 till the end of the script.

So...
how to (using task metod!)

1- make stream of bullets
2- make different attacks that happens one after the other considering the lifepoints of the enemy or that simply loops not at the same time
3- make different attacks that don't loops and happear when the spellcard time reaches a certain value.

Sorry if that is confusing.

Oh, and last thing, so i can start scripting a bit more advanced, how to make a stream of bullet with gaps betwheen a bullet and another like the one in lotus land story where yuuka shoot a stream of bullets that after about 3-4 seconds go right or left (a stream that moves like a snake...)
« Last Edit: April 28, 2012, 07:51:38 AM by Matteo »

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #31 on: April 28, 2012, 09:58:22 AM »
First question:

Since you are using a task instead of @mainloop, you can put the following code, to halt the task:

Code: [Select]
loop(x){yield;}
Where x would be the ammount of frames to wait. So what you wanted would be like:

Boss appears.
loop(120){yield;}
1st stream
loop(60){yield;}
2nd stream
loop(60){yield;}
3rd stream

Also, if you want it to loop, just put it inside a loop like this:

loop{
Boss appears.
loop(120){yield;}
1st stream
loop(60){yield;}
2nd stream
loop(60){yield;}
3rd stream
}

As for the second question, you can use a variable to keep track of how many frames have passed. Then you can ensure that the 1st task is only used if the frame count is less than 1200, use the 2nd task while it's between 1200 and 2400 and the 3rd task while it's over 2400.

I'm not quite sure which of yuuka's attacks you mean. Could you describe it in a little more detail or show a picture?

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #32 on: April 28, 2012, 12:10:12 PM »
ok thanks! But how to write the "if frame betwheen 2000 and 4000"?

The attack i'm talking about...well i can't find a picture or a video so let's make a similar and more simple example: lotus land story, the very first attack of boss Reimu in which she shoots a stream of white and yellow bullets. White bullets behave like in fantasy seal-concentrate, but what i want to lear is to reproduce the patterns of the white bullets

mmm... could i see a script with the tasks?

i undestand that i have to create task fire1 fire2 fire3 and then i have to do something like

if time<1000
fire1;
if time betwheen 1000<x<2000
fire2;
if time over 2000
fire3;

but i keep doing errors (danmakufu freeze). Probably or:

1- I write the 3 fire tasks wrong so that when i need to execute them the program crashes

2- I write wrong the chain
"if time<1000
fire1;
if time betwheen 1000<x<2000
fire2;
if time over 2000
fire3;"

3- write wrong the "if" strings...well, if someone has a script to show me that works and that is similar i would be glad.
 
« Last Edit: April 28, 2012, 12:38:58 PM by Matteo »

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #33 on: April 28, 2012, 02:14:33 PM »
Code: [Select]
task fire{               
               let timer=1;
               angle = 360/36;
               angle += 20;
               while(timer>0) {
CreateShot01(GetX, GetY, 3, angle, BLUE12, 0);
                        angle ++;
                        timer++;
                        yield;       
}
                timer=0;
                angle += 5;
}

A big wonder... i wanted to make a circle of bullets that spin increasing angle of 5 each time.
Instead i have a SPIRAL with angle that increase too much...1 per frame!
So...
1- how to make the spiral or circle, and making bot increase their angle of 5 to make a spinning circle/spiral?
2- how to increase the angle?
3- and also, why i made a spiral and not a circle?

Obviously i messed big this time!
« Last Edit: April 28, 2012, 02:27:37 PM by Matteo »

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #34 on: April 28, 2012, 09:31:48 PM »
stuff
You don't use if statements at all. You would have to if you were using @MainLoop to run the bulk, but tasks are entirely thread-driven so it's all measured in frames. Say you have tasks main, fire1, fire2, and fire3, then you just have something like

Code: [Select]
@Initialize{
main; //main task starts when the script begins
}

task main{
loop{ //this loop runs infinitely
fire1; //starts at frame 0
loop(1000){yield;} //waits 1000 frames, or almost 17 seconds
fire2; //starts at frame 1000
loop(1000){yield;} //waits 1000 frames
fire3; //starts at frame 2000
loop(1000){yield;} //waits 1000 frames
} //once you're done, go back to the loop beginning
}

But then you have to make sure that each "fire" task only lasts that much time, or else you'll get some overlap, or the pattern will end prematurely.
Another thing you could do is have them link to each other, which is more effective but looks a bit messier:

Code: [Select]
@Initialize{
fire1; //start off running the first pattern
}

task fire1{
//the rest of your code bla bla bla
//once you're done or time is up or whatever
fire2;
}

task fire2{
//same deal
fire3;
}

task fire3{
//again
fire1; //go back to fire1
}



Honestly I'm not sure how I can explain the other question though. Here's a breakdown of your function.

Code: [Select]
task fire{               
let timer=1; //You set timer to 1.
angle = 360/36; //You set angle to 10.
angle += 20; //You increase angle by 20, so angle is now 30.
while(timer>0) { //When you first start this loop, timer is 1, so the condition is true and it runs.
CreateShot01(GetX, GetY, 3, angle, BLUE12, 0);
//Fire a bullet of speed 3 that goes straight in the "angle" direction. There is no turning.
angle ++; //Angle increases by 1. It will take 360 of these to make a full circle.
timer++; //Timer increases by 1.
yield; //This yield tells the task to wait a frame. Because of this, all of your bullets are separated by one frame.
}
//Loop back to the while condition. Note that since the timer is just increasing, the condition will always be true. This is an infinite loop.
//Also, if you get rid of the yield, you will then have an infinite loop without breaks, and DNH will crash.
//The next few statements will never happen.
timer=0;
angle += 5;
}
« Last Edit: April 28, 2012, 09:47:37 PM by Drake »

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

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #35 on: April 29, 2012, 06:27:26 AM »
Drake, i really really thank you for your help and kindness, but i still don't understand this and don't know what i do wrong...so:
THIS is my script (with errors):

http://pastebin.com/ShtJDgxu

What, where and why (mostly why, because if i understand not only i improve but also won't bother you anymore with these things) did i mess?

Angleacc also is maybe wrong...don't know what it did. I tryed to recreate in my way Blargel metod (but he uses mainloop instead of tasks)
 Now i will quote Blargel metod so you can see from my link of pastebin.com that i tryed to do a similar script, but i think that i messed with:

1- tasks
2- yield (i put it evrywhere, i read before what it does but still don't grasp the concept)

Oh, and i don't want to learn mainloop style because i don't really like it...i aim at learning tasks and, if it happens, combine them with a few actions in mainloop, but mostly is task metod the one i'm trying to master



Any help would be really appreciated!
My gift of gratitude will be a nice spellcard once i understand how to do this  :)
« Last Edit: April 29, 2012, 07:25:17 AM by Matteo »

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #36 on: April 29, 2012, 07:02:59 AM »
Firstly, you must have a yield; in your MainLoop, otherwise nothing will work properly.
Second, you have a stray closing bracket after mainTask. That will close the script_enemy_main section and everything afterwards will error.

That should fix up your problems, and you should be able to play around with your values. Also, if you could edit out Blargel's code in your post that would be great, since it's a bit long and doesn't really need to be on the page.

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

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #37 on: April 29, 2012, 07:39:16 AM »
Thanks Drake but... now i have mima standing around doing nothing, no matter what i do in the script  ???

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #38 on: April 29, 2012, 08:12:43 AM »
Wait crap sorry, that bracket was supposed to be there. It just has the same tabulation as the previous bracket and the loop has the same tabulation as the lines after it, so I didn't see the connection. Not sure if it was pastebin that did that or not, but please organize your brackets and tabbing properly. After every opening bracket {, if you're going onto a new line then tab the line forward once. Every closing bracket should also be tabbed back once to match its opening bracket.

The yield in MainLoop thing still holds, if you don't put one in there your tasks will never run more than one frame.

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

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #39 on: April 29, 2012, 09:26:15 AM »
Ok thanks Drake! Now that i praticed a bit in making cirles and spirals, i was interested in a thing about mainloop.

Let's say for example that i want to do:

wait 120
fire a bullets
fire b different bullets
wait 120
fire c bullets
wait 120
fire d bullets
STOP SCRIPT ( enemy stand still doing nothing even if spellcard time left is more than 0)

or instead of stopping the script, a nice loop that will bring me at the beginning (fire a ...)

You understand, a sequence of shots with pauses betwheen them

All of that using the Mainloop and not task?

puremrz

  • Can't stop playing Minecraft!
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #40 on: April 29, 2012, 06:02:55 PM »
Danmakufu doesn't seem to like variables that are longer than 8 digits.
By using DrawText I noticed that a variable whose value I gave "123456789" displays as "123456792", It increases in steps of 8.
If I increase the value by 1 each frame, it will stay as "123456792" for 7 frames and then suddenly skip to "123456800" on the 8th.

Does anyone know a way to get around this limit? I'm using that variable for score and high score, so it needs to be bigger than 8 digits.
Full Danmakufu game "Juuni Jumon - Summer Interlude" is done!
By the same person who made Koishi Hell 1,2 (except this game is serious)
Topic: http://www.shrinemaiden.org/forum/index.php/topic,9647.0.html

MMX

  • In Soviet Gensokyo...
  • ...bullets dodge you.
    • LiveJournal blog
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #41 on: April 29, 2012, 09:50:22 PM »
Danmakufu doesn't seem to like variables that are longer than 8 digits.
By using DrawText I noticed that a variable whose value I gave "123456789" displays as "123456792", It increases in steps of 8.
If I increase the value by 1 each frame, it will stay as "123456792" for 7 frames and then suddenly skip to "123456800" on the 8th.

Does anyone know a way to get around this limit? I'm using that variable for score and high score, so it needs to be bigger than 8 digits.
Split it into two variables (one for higher digits and one - for lower) and control them like a single virtual long one. This is the only solution that comes in mind.
i was interested in a thing about mainloop.

Let's say for example that i want to do:

wait 120
fire a bullets
Don't use wait in mainloop!
My danmakufu thread Most recent - "Kappa Mechanics" (Nitori fight)   My youtube channel Latest update - EoSD extra no bombs clear


Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #42 on: April 30, 2012, 12:23:09 AM »
Danmakufu numbers are floats. The wiki entry and such can explain it a lot better than I can, but I fear nobody will read it because of jargon and length.

Basically, it's like scientific notation. But in binary. You have a fraction portion and an exponent portion. There's also a sign bit to determine negative values but I'm going to ignore that. In decimal scientific notation, you have numbers like 4.296*10^3 to express the number 4296. 4.296 is the significant/precision/fraction portion, 10 is simply the base, and 3 is the exponent. With floating point, to express something like 5, it would be 1.25*2^2 (in decimal representation).

The fraction as also be expressed as a "mantisse", which is sort of just an easier way to visualize the numbers. The mantisse starts at 1.0. Rather, if your fraction portion is all zeroes, your mantisse is 1.0. If your fraction portion is a 1 and then all zeroes (1000...), that signifies the 1/2 bit is flipped, and your mantisse is 1.5. If the fraction is 01000..., the 1/4 bit is flipped and your mantisse is 1.25. If you want to think of it this way, each fraction bit starting from the left signifies "one, over its power of two", like 1/2, 1/4, 1/8, 1/16, etc. Following this, if it were 11000... the mantisse is 1 + 1/2 + 1/4 = 1.75. Likewise, 001101000... is 1 + 1/8 + 1/16 + 1/64 = 1.203125.

The exponent part itself is a twos-complement number. If all the bits are 0, you have -127. Each exponent bit starting from the right signifies its power of two. This also means the leftmost bit adds 128, so if your exponent is 10000000, your exponent is 1. Likewise, 00000001 is -126; 10000001 is 2; 10000011 is 4; 10010100 is 21.

Putting these together, say you want to express 8 as a floating point. This would be simply 1.0*2^3. Knowing the 1.0 is your mantisse and the 3 is your exponent, 8 in binary is:
S EEEEEEEE FFFFFFFFFFFFFFFFFFFFFFF
0 10000010 00000000000000000000000

Now as for the problem, look at 16777215 and 16777216:
0 10010110 11111111111111111111111
0 10010111 00000000000000000000000

But the next possible value is:
0 10010111 00000000000000000000001
which is (1+1/(2^23)) * 2^24 = 16777218. Oh no. This is the loss in precision that turns up when you have numbers too complex for the data structure to hold, and is why Danmakufu won't let you use 123456789 as a number.

You can play around with this converter for more examples.

Numbers that pass a certain value will screw up things randomly if you don't keep it under control, probably because memory starts leaking around. Naut and I were working on things a while back and after a significant amount of time, graphics would randomly begin to shit themselves because time counters and other arbitrary value counters started to pass the possible values. It was pretty weird. Your instance of DrawText is actually pretty smart, since it's actually still counting the number in memory somewhere. Normally, if you hit a maximum you'd have to explicitly start working with the next exponent upwards: say you had 16777216, you wouldn't be able to add 1 to it anymore, but you could keep adding 2, or 4, or 8, etc. Once you hit 33554432, you wouldn't be able to add 2. At 67108864 you can't add 4, and so on. 123456789 is greater than 67108864, so the lowest precision it can keep at that point is 8. Tada! You've learned why your number is increasing in increments of 8. Notice how this doesn't answer your question on how to get around it.
« Last Edit: April 30, 2012, 12:24:40 AM by Drake »

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

puremrz

  • Can't stop playing Minecraft!
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #43 on: May 01, 2012, 10:31:50 AM »
:wikipedia:

Yow, then I should keep in mind that very long variables == bad idea. This is probably the reason why my gui sometimes vanishes when playing through a 50 minute+ game...

But I got the solution. A good soul in chat told me to use arrays For example: score[1,2,3,4,5,6,7,8,9,0,etc]; (This also makes it easier to convert a number into custom text)
Now to work that into a script...
Full Danmakufu game "Juuni Jumon - Summer Interlude" is done!
By the same person who made Koishi Hell 1,2 (except this game is serious)
Topic: http://www.shrinemaiden.org/forum/index.php/topic,9647.0.html

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #44 on: May 02, 2012, 07:50:47 PM »
Hi all, i have some problems with objects.

1- If i understand well, objects are like normal bullets but instead of 1 bullet, a object can summon for example 10 bullets in the same time right? So, i i use createshot01 with angle = 90, i shoot a bullet down.  With objects i can shoot 10 bullets down in the same time. Right?

2- So... how to create objects that bounce on the walls??

I'm using both mainloop and tasks in my scripts.

Thanks!

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #45 on: May 02, 2012, 08:21:46 PM »
Not quite right, object bullets are bullets that you can keep track of easily because you can store its ID in a variable.

If you want an object bullet to bounce on walls, you'll need a task that keeps track of the bullet and constantly checks the bullets position. If the bullet then is outside of the screen, you simply move the bullet back to the screen and change it's angle based on which side it left the screen.

If the bullet leaves the screen at the top or bottom, you need to change it's angle to the negative counterpart, either by multiplying it's angle by -1 or by setting it's angle to 0 and subtract the angle it had before.

If the bullet leaves the screen at the left or right side, you need to change it's angle to 180 minus the angle it had before.

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #46 on: May 02, 2012, 08:33:30 PM »
Mmm, seems hard. But i have to insert the bounce bullets in my spellcard so slowly i will try to grasp that. Thanks!

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #47 on: May 16, 2012, 12:49:45 PM »
I'm having a constant problem with the boss graphic, and I can't really get what I'm doing wrong.

Code: [Select]
@DrawLoop {   
SetTexture(ImgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale (1, 1);
SetGraphicAngle (0, 0, 0);
SetGraphicMove;
DrawGraphic (GetX, GetY);
}

This one was copied right from this forum:

Code: [Select]
sub SetGraphicStop  { SetGraphicRect(  0,   0,  140,  80); }
sub SetGraphicLeft  { SetGraphicRect(  140,   0,  280,  80); }
sub SetGraphicRight  { SetGraphicRect(  280,   0,  420,  80); }
sub SetGraphicMove
{
        if (GetSpeedX < 0){SetGraphicLeft;}
else{
if (GetSpeedX > 0){SetGraphicRight;}
else{
if (GetSpeedX == 0){SetGraphicStop;}
}   
}
     }

Now, when I make the boss go right, left or stay in place, everything is fine.  But when it goes straight up or straight down, the graphic changes to the "SetGraphicRight". Is the SetGraphicMove; misplaced?  Or is there something wrong with GetSpeedX ?


EDIT:
Oh, I also encountered an another problem - non-spell backgrounds.  I found an answer on the forum:
Quote from: Helepolis
If you want background for non-spells, you need to work with stage scripts.
But no matter what I write in the stage script, I can't force the background to appear during the non-spells.
« Last Edit: May 16, 2012, 05:55:50 PM by adrian7 »

TheTeff007

  • Best Touhou 2015!
  • So much cuteness...!
    • Youtube Channel
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #48 on: May 16, 2012, 10:30:14 PM »
Get Speed X gets the horizontal velocity.

For what you're asking, GetSpeedY will do the job.

And the Backgrounds from the script are the backgrounds for the stage, not the boss. The backgrounds are meant for spellcards, but you can use Object Effects to have Backgrounds even on Nonspells
Small Teaser of my upcoming project~

No need to call me Teff007. Teff will do just as well~

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #49 on: May 16, 2012, 11:19:10 PM »
But I want it to completely ignore the Y velocity.
When GetSpeedX<0, use "fly left" graphic,
When GetSpeedX==0, use "don't move "graphic,
When GetSpeedX>0, use "fly right" graphic.
Instead, what happens is:
X speed==0 and Y speed==0 -> "don't move" graphic visible, OK.
X speed==0 and Y speed!=0 -> "fly right" graphic visible, I don't know why it happens :(

Thanks, I will try using the object effects tomorrow.

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #50 on: May 17, 2012, 01:41:29 AM »
Just to note, GetSpeedX is pretty wacky. If you really want a solid function you might want to make one. I've never really had a huge problem with this because in nearly all cases you aren't actually going to be moving an enemy straight up, so at its root this is more of a design problem than anything. Anyways, DNH seems to handle the function in hilariously bad ways; sometimes useful, sometimes not. In particular, if you use SetMovePosition01 and move straight up and down it'll return something like -0.003187, which would cause your problem. Try putting...
CreateDebugWindow;
OutputDebugString(5,"bla",GetSpeedX);

somewhere where it'll update every frame (like the draw loop) and see what you're getting.

In any case, this would be a more concise way to put your SetGraphicMove:
if(GetSpeedX < 0){SetGraphicLeft;}
else if(GetSpeedX > 0){SetGraphicRight;}
else{SetGraphicStop;}


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

TheTeff007

  • Best Touhou 2015!
  • So much cuteness...!
    • Youtube Channel
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #51 on: May 17, 2012, 06:07:48 AM »
Edit: Nevermind, didn't saw Drake's post.
« Last Edit: May 17, 2012, 06:09:33 AM by Teff007 »
Small Teaser of my upcoming project~

No need to call me Teff007. Teff will do just as well~

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #52 on: May 17, 2012, 09:45:40 AM »
Thanks, Drake! I used the debug window to get both X and Y velocity. I seems like whenever I use SetMovePosition03 (no matter the actual direction and speed), the X velocity is set to 1 or -1 and Y velocity is set to 0.

You were also right about the nonzero GetSpeedX value during  SetMovePosition01 movements.
you aren't actually going to be moving an enemy straight up, so at its root this is more of a design problem than anything.
You are right here, I suppose, In my script, the boss stayed in (GetCenterX,GetClipMinY + 100) during the non-spell and moved vertically outside the screen at the beginning of the spell card. This can be changed easily, but it's still inconvenient. I wonder, does the ph3 version behave similarly? If not, it could be a good excuse to port the code...

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #53 on: May 18, 2012, 09:35:44 AM »
Hi, i need a little help for a script i'm making.

I need to do a master spark like bullet, and i think it is in the supershot.txt

I'm using tasks btw... can someone please tell me how to do it starting from zero? (i mean, how to upload in the script the supershot.txt ; what to write to make it works , how to select a kind of bullet and insert it in the task)

Thank you for your kindness!

(Btw, where can i find the famous supershot.txt???)

TheTeff007

  • Best Touhou 2015!
  • So much cuteness...!
    • Youtube Channel
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #54 on: May 18, 2012, 11:36:55 AM »
The Master Spark can be done as a Object Bullet, but I'm not really sure, as I haven't tried it before.

You can find the different Shotsheets here: http://www.shrinemaiden.org/forum/index.php/topic,1050.0.html

To make it work, place the supershot inside the lib folder in Danmakufu (It's where the executable is located, if you don't see the folder, create it.) and dumpo it there.

Then, in any nonspell, just place #include_function ".\lib\insert the name of the folder of the shotsheet here\ insert the name of the file here" and that should do it,
Small Teaser of my upcoming project~

No need to call me Teff007. Teff will do just as well~

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #55 on: May 18, 2012, 09:42:28 PM »
Thanks! I have another question btw...

i need to make 2 tasks, 1 for the attack and the other for setting the object i use.

So i make a indestructible bullet like this:

task MyObjectBullet2 (x, y, velocity, angle, graphic, delay) {
    let obji = Obj_Create(OBJ_SHOT);
   
    Obj_SetPosition(obji, x, y);
    Obj_SetSpeed(obji, velocity);
    Obj_SetAngle(obji, angle);
    ObjShot_SetGraphic(obji, graphic);
    ObjShot_SetDelay(obji, delay);
    ObjShot_SetBombResist(obji, true);
}

But how can i insert this object bullet in my maintask? i need to make this indestructible bullet that is shoot from the boss and after 30 frames it stops.

I could use simply createshotA, but i need that the bullet remains even if the player dies because i have to Addshot and the Addshot function doesn't work if the main bullet is deleted.

How can i do this?

TheTeff007

  • Best Touhou 2015!
  • So much cuteness...!
    • Youtube Channel
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #56 on: May 19, 2012, 12:19:30 PM »
Just use this:

Code: [Select]
task MyObjectBullet2 (x, y, velocity, angle, graphic, delay) {
    let obji = Obj_Create(OBJ_SHOT);
   
    Obj_SetPosition(obji, x, y);
    Obj_SetSpeed(obji, velocity);
    Obj_SetAngle(obji, angle);
    ObjShot_SetGraphic(obji, graphic);
    ObjShot_SetDelay(obji, delay);
    ObjShot_SetBombResist(obji, true);

while(!Obj_BeDeleted(obji)
{

wait(30);
Obj_SetSpeed(obji, 0);

}
}


After the Obj_SetSpeed, then place whatever you want your bullet to do next.

An Advice though, having no wait or yield in a while function will freeze danmakufu. Take note of that.
Small Teaser of my upcoming project~

No need to call me Teff007. Teff will do just as well~

SparklingOrange

  • Is a scrub.
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #57 on: May 23, 2012, 02:09:34 AM »
Hi.

Been fiddling about with Danmakufu after a long hiatus, and I was thinking if it's possible to do a spellcard (cutin and everything) without changing the stage background. I noticed that if I SetScore to a nonzero value in the Initialize loop, the spellcard sound plays, and the background gets changed automatically to whatever's in the current script's DrawLoop.

I worked around this by doing AddScore in the Finalize loop instead and doing SetScore to 0. Unfortunately, even if the PC bombs, the score isn't forfeited, nor does it decrease as the timer goes. I also lose the sound, so I would have to play a custom one manually.

Is there another workaround, or am I doing this wrong? I have yet to learn more about custom objects and drawing things.

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #58 on: May 23, 2012, 03:35:53 AM »
SetScore sets the flag for which all of danmakufu's functions for Spell Cards activate. Even if you modify or remove the default graphics and such, the background will be black. In other words, you can't use SetScore, but if you don't it isn't technically a Spell Card (for danmakufu). Unfortunately, this means you have to make one yourself. However, this means you get to make one yourself!

You're on the right track though. You can use GetBombCountInThisSpell and GetMissCountInThisSpell, or OnPlayerMissed and OnBomb, and Spell Card bonus is arbitrary so yeah.

Code: [Select]
let spellCardBonus = 1000000;
@Initialize{
SetSpellCardBonus;
}
task SetSpellCardBonus(){
while(spellCardBonus>0){
spellCardBonus-=1000;
if(OnPlayerMissed||OnBomb){spellCardBonus=0;}
yield;
}
spellCardBonus=0;
}
@Finalize{
AddScore(spellCardBonus);
spellCardBonus=0;
}

Of course, there are many ways you could set this up instead. This is a reeeally crappy example and should only be used if it's a one-time thing. If you plan on doing a lot like this you might want to think up an actual system.
« Last Edit: May 23, 2012, 03:38:19 AM by Drake »

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

SparklingOrange

  • Is a scrub.
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #59 on: May 25, 2012, 01:26:47 AM »
Thanks, Drake. Yeah, it would be redundant if I had to put this into every single spellcard I have. What would be an example of a higher-scale system? Would it be something I'd put in the stage script or the boss script?

Also, I noticed from a long time ago that you can't play sounds in the Finalize loop. If I wanted to play a sound to indicate a spell card bonus, would it have to be in the Initialize loop instead?