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

Kingault

  • Insert witty description here.
Re: Need help with Danmakufu
« Reply #780 on: May 18, 2010, 12:52:29 AM »
These sort of things belong in the Q&A thread that we have in here.


But IOW your problem is likely because you havent defined Frame as a variable
Ah.
I can't believe I forgot that.
Thanks.

Also, I can't believe I didn't see the Q&A thread.
Going to try what you said.


EDIT: It works! Thanks.
« Last Edit: May 18, 2010, 12:54:32 AM by Kingault »

Alfred F. Jones

  • Estamos orgullosos del Batall?n Lincoln
  • *
  • y de la lucha que hizo por Madrid
Re: Danmakufu Q&A/Problem Thread v3
« Reply #781 on: May 18, 2010, 12:55:55 AM »
These sort of things belong in the Q&A thread that we have in here.

Oh what a good idea for a merge

Re: Danmakufu Q&A/Problem Thread v3
« Reply #782 on: May 18, 2010, 12:57:13 AM »
Thank you Mr./Ms. Ichigo Rurouni

Kingault

  • Insert witty description here.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #783 on: May 18, 2010, 01:13:03 AM »
Thank you Mr./Ms. Ichigo Rurouni

And thank you!

Elementoid

  • Having a heated affair with feux-familiars
Re: Danmakufu Q&A/Problem Thread v3
« Reply #784 on: May 18, 2010, 10:46:13 PM »
Having a problem that makes me want to rip my hair out. I even wrote up a diagram and everything to make sure I had it right, and I'm pretty sure I do.

The problem is, I want to spawn 13 bullets on top of the boss that will move in neat half-circles and end up 200 dist away from their starting point. For some reason, the bullets either don't move, or spawn around one of the circles that one of the bullets is supposed to travel along.

Code: [Select]
let ShootAngle=0;

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

if(frame==120){
loop(13){
DreamBullet(ShootAngle, 200);
ShootAngle+=360/13;
}
}
frame++;
}
Code: [Select]
task DreamBullet(ANGLE, MaxDist){

let obj_DBUL=Obj_Create(OBJ_SHOT);

let AngleToBoss=atan2(GetEnemyY-Obj_GetY(obj_DBUL), GetEnemyX-Obj_GetX(obj_DBUL));

Obj_SetPosition(obj_DBUL, GetX, GetY);
Obj_SetAngle(obj_DBUL, ANGLE);
Obj_SetSpeed(obj_DBUL, 0);
ObjShot_SetGraphic(obj_DBUL, WHITE02);
ObjShot_SetDelay  (obj_DBUL, 20);
ObjShot_SetBombResist (obj_DBUL, true);

yield;

while(Obj_BeDeleted(obj_DBUL)==false){

ascent(var in 0..(180/5)+1){
Obj_SetPosition(obj_DBUL, (GetX+(0.5*MaxDist)*cos(ANGLE)) +(0.5*MaxDist)*cos((var*5)+AngleToBoss), (GetY+(0.5*MaxDist)*sin(ANGLE)) +(0.5*MaxDist)*sin((var*5)+AngleToBoss));

yield;
}

yield;
}
}

Re: Danmakufu Q&A/Problem Thread v3
« Reply #785 on: May 18, 2010, 10:49:21 PM »
I believe your problem is that you don't have "ANGLE" increasing by anything resulting in the Bullet spawning at the right place but does not move

Drake

  • *
Re: Danmakufu Q&A/Problem Thread v3
« Reply #786 on: May 18, 2010, 11:29:46 PM »
That is not the problem considering he's moving the bullet manually instead of using angles and speed.

First of all, you don't need the yield before the while loop.
Second, you don't even need the while loop considering you have nothing deleting the bullet, as well as yields inside the ascent anyways. What will end up happening in this case is that it'll reach the end of the ascent, then loop back around because of the while and do everything over, which I presume you don't want.
Third, I find it odd that you're using an ascent for the bullet behaviour and that you use a while loop with an extra variable for spawning the bullets in a circle. You should probably switch those around.

In addition you could probably compute the half-circles in a different way, but fix those things first and see what happens.

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

Gc

  • youtu.be/pRZpjlrKM8A
Re: Danmakufu Q&A/Problem Thread v3
« Reply #787 on: May 18, 2010, 11:45:49 PM »
Code: [Select]
let ShootAngle=0;

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

if(frame==120){
loop(13){
DreamBullet(ShootAngle, 200);
ShootAngle+=360/13;
}
}
frame++;
}
No yield; in MainLoop

Elementoid

  • Having a heated affair with feux-familiars
Re: Danmakufu Q&A/Problem Thread v3
« Reply #788 on: May 19, 2010, 12:03:04 AM »
Demonbman: The angle is actually increased back when ShootAngle is modified in the loop that calls DreamBullet.

Drake: I fixed points one and two (nothing changed, unfortunately). That yield that was stuck in before the while statement is what caused the bullets to either spawn on top of the boss or in a circle; either way the bullets don't move at all.

The reason I keep changing the bullet position is because it's an easier way of moving them in a circle, at least I think. Instead of telling the bullet to move a certain distance and then turn at a certain angle, I'm just resetting the position of the bullet every frame in order to make it look like it's moving. Then all I have to do is use trig on a single changing angle variable. For this particular pattern, the bullet is supposed to move around a radius that itself lies on a circle around the boss. I can draw a diagram to help illustrate this if it would help.

The Cube: DERPA DERPA DERP  :V

Well now the bullets move in a half circle but as a uniform ring starting from where the other ring spawned. At least they're moving though.

Drake

  • *
Re: Danmakufu Q&A/Problem Thread v3
« Reply #789 on: May 19, 2010, 12:21:37 AM »
The reason I keep changing the bullet position is because it's an easier way of moving them in a circle, at least I think. Instead of telling the bullet to move a certain distance and then turn at a certain angle, I'm just resetting the position of the bullet every frame in order to make it look like it's moving. Then all I have to do is use trig on a single changing angle variable. For this particular pattern, the bullet is supposed to move around a radius that itself lies on a circle around the boss. I can draw a diagram to help illustrate this if it would help.
I know that. I use it in pretty much everything I do.

also GFDI

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

Elementoid

  • Having a heated affair with feux-familiars
Re: Danmakufu Q&A/Problem Thread v3
« Reply #790 on: May 19, 2010, 12:35:27 AM »
Oh, I thought that was what your point three was about. I'm not sure what you meant then.  :ohdear:

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 v3
« Reply #791 on: May 19, 2010, 05:18:18 AM »
Shot replace script error I can't understand :ohdear:
Code: [Select]
---------------------------
error
---------------------------
弾定義ファイルにエラーがあります。
**************insert path to replace script here*************
tokenizer:不正なファイルの終端です
---------------------------
OK   
---------------------------

scripts:
Code: [Select]
#UserShotData

ShotImage = ".\shot_all.png"

ShotData{ id = 1 rect = (38,0,214,173) render = ALPHA delay_color = (255,0,0) }
...
insert id's 2-99 here
...
ShotData{ id = 100 rect = (458,1551,498,1580) render = ALPHA delay_color = (255,128,0) }
and
Code: [Select]
let RED05=3;let ORANGE05=4;let YELLOW05=5;let GREEN05=6;let AQUA05=7;let BLUE05=8;let PURPLE05=9;let WHITE05=2;
...
insert replace things for every other id here
...
function initmeh{
LoadUserShotData(GetCurrentScriptDirectory~"shot_all.txt");
}

yes... the script calling it is in the same directory as both scripts and the image...
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Re: Danmakufu Q&A/Problem Thread v3
« Reply #792 on: May 19, 2010, 05:35:22 AM »
The tokenizer error pops up randomly in a shot sheet. It happens when something isn't quite right with your sheet.


My way to solve this, is to comment out ids 1-50, then test the sheet, if it works, then the error is somewhere in the below 50 ids, if it doesn't, then its in the above 50 ids, and repeat as neccesary until you find the id that is causing the error

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 v3
« Reply #793 on: May 19, 2010, 06:16:35 AM »
The tokenizer error pops up randomly in a shot sheet. It happens when something isn't quite right with your sheet.


My way to solve this, is to comment out ids 1-50, then test the sheet, if it works, then the error is somewhere in the below 50 ids, if it doesn't, then its in the above 50 ids, and repeat as neccesary until you find the id that is causing the error

you wouldn't believe this...

it worked after I REMOVED all of the comments on the text file... (comments to help me remember what id is what color and stuff)
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread v3
« Reply #794 on: May 19, 2010, 08:43:42 AM »
My guess is with your previous error that somewhere a  "/'  was forgotten in front of the ******  or forgot to end with a slash. As I notice the ****** part showed up in the error msg. Just a wild guess because bad termination of the /*   */ comment block causes very weird errors that make you rage.


Gc

  • youtu.be/pRZpjlrKM8A
Re: Danmakufu Q&A/Problem Thread v3
« Reply #795 on: May 19, 2010, 01:44:19 PM »
you wouldn't believe this...

it worked after I REMOVED all of the comments on the text file... (comments to help me remember what id is what color and stuff)
yep, Danmakufu is retarded with shot sheets. // comments make it crash (tokenizer), but you can use /* */ comments in the beginning. (I did not try /* */ lower in the shot definition files)

My guess: it's because there's no end-of-line ( ; ) in shot sheets and if you // comment, it goes to the end of the file, it comments out the end-of-file flag and DMF doesn't know what to do then, making it crash.

But don't quote me on that

Drake

  • *
Re: Danmakufu Q&A/Problem Thread v3
« Reply #796 on: May 19, 2010, 04:18:12 PM »
Shotsheets are entirely determined by tokens. Why it's this way instead of code, I have no idea. But it does mean that // comments can possibly fuck up tokenizing hard, even if it doesn't look it.

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

Re: Danmakufu Q&A/Problem Thread v3
« Reply #797 on: May 19, 2010, 04:22:37 PM »
yep, Danmakufu is retarded with shot sheets. // comments make it crash (tokenizer), but you can use /* */ comments in the beginning. (I did not try /* */ lower in the shot definition files)

My guess: it's because there's no end-of-line ( ; ) in shot sheets and if you // comment, it goes to the end of the file, it comments out the end-of-file flag and DMF doesn't know what to do then, making it crash.

But don't quote me on that
This explains a lot...

Shade

  • Narb Overlord
  • There are OVER 9000! Bullets flying on the screen!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #798 on: May 19, 2010, 07:18:00 PM »
Pffft. I got a awesome new computer, and now when I try to load danmakufu, it lets me make a selection, but when I click on Concealed the conclusion, or anything that's supposed to load regularly, it immediately takes me out of the game, and says that th_dfh has stopped working, windows is now checking for a solution: A problem is preventing the game from loading.

No duh. >.>


« Last Edit: May 19, 2010, 07:45:24 PM by Shade »
I don't have a life, I has thousands! :D

Re: Danmakufu Q&A/Problem Thread v3
« Reply #799 on: May 19, 2010, 08:00:59 PM »

Shade

  • Narb Overlord
  • There are OVER 9000! Bullets flying on the screen!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #800 on: May 19, 2010, 08:01:47 PM »
I can try that, but the thing is I can play plural.

I guess it's worth a shot.
I don't have a life, I has thousands! :D

puremrz

  • Can't stop playing Minecraft!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #801 on: May 20, 2010, 05:44:41 PM »
Question~

I want to make a flag-like motion on an effect object, so I figured it needs more than 4 vertices for that. But the problem is, how do I set that up? All I understand now is how to make 4-vertices objects.
For example, I want to make a rectangle that has its vertices like this:



How do I do this without making the image look undistorted?
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

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #802 on: May 20, 2010, 06:26:57 PM »
Let's assume the picture is width x height.

Relevant code parts:

On creation:
Code: [Select]
ObjEffect_CreateVertex(obj, 2*(n));
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);

let bgphi=0;
let wave= whatever ;
let n= whatever ;

In the while(){} loop, something like this:
Code: [Select]
bgphi-=2.5;

ascent(i in 0..n){

ObjEffect_SetVertexUV(obj, 2*i, 0, 512*2*i/n);
ObjEffect_SetVertexUV(obj, 1+2*i, width, 512*2*i/n);

ObjEffect_SetVertexXY(obj, 2*i,  -width/2  + width*i/n + 50*sin(bgphi+wave*i)*0.01^(1-i/n) ,height/2 + 10*sin(bgphi+wave*i) );
ObjEffect_SetVertexXY(obj, 1+2*i,  -width/2 + width*i/n + 50*sin(bgphi+wave*i)*0.01^(1-i/n) , -height/2 + 10*sin(bgphi+wave*i) );

}

With a sufficiently high n, it should look alright.
The higher the value of wave, the more ripples the flag will have. A higher n requires a proportionally lower wave.
The values of 15 and 8 determine by how much the picture waves up/down and towards/away from the viewpoint. Adjust the values according to the height of the picture and the supposed strength of the wave effect.


The code might have some typing errors, please watch warmly until the testing is done...

Done.

...say, did  you actually want the "flag" to be "fixed" at a "pole" on the left side, or something different?
« Last Edit: May 20, 2010, 06:52:08 PM by Tin Man vs. Rust Monster Musical Act Part 1: The End »
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."

SparklingOrange

  • Is a scrub.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #803 on: May 20, 2010, 07:12:18 PM »
Hi. Excuse me for butting in, but since this is a Q&A thread...I have a couple of things to ask (which may have been answered already...I dunno)

1.) I can't play bgm at all...I've tried calling the file into a variable (or calling the file directly) and playing it with PlayMusic(), but it won't play. This works with sound effects, but I can't seem to get my mp3 files to work. Is it the file I'm using, or am I just scripting it wrong? If it's the file, what are supposed to be the proper specs for Danmakufu to play the file?

Here's the code for my stage script:
Code: [Select]
#?????e????[Stage]
#Title[EoMT Stage 1]
#Text[]
#Image[]
#BackGround[Default]
#Player[.\player\robo_b.txt]
#ScriptVersion[2]

script_stage_main
{
let get = GetCurrentScriptDirectory;
let cx = GetCenterX();
let cy = GetCenterY();

@Initialize{
Stage();
}
@MainLoop{yield;}
@Finalize{
}

task Stage{
PlayMusic(get~"bgm\st1.mp3");
wait(60);
CreateEnemyFromFile(get~"stg1enemy1.txt",cx+25,0,0,0,0);
CreateEnemyFromFile(get~"stg1enemy1.txt",cx-25,0,0,0,0);
wait(30);
CreateEnemyFromFile(get~"stg1enemy1.txt",cx,0,0,0,0);
CreateEnemyFromFile(get~"stg1enemy1.txt",cx+45,0,0,0,0);
CreateEnemyFromFile(get~"stg1enemy1.txt",cx-45,0,0,0,0);
wait(30);
CreateEnemyFromFile(get~"stg1enemy1.txt",cx+25,0,0,0,0);
CreateEnemyFromFile(get~"stg1enemy1.txt",cx-25,0,0,0,0);
CreateEnemyFromFile(get~"stg1enemy1.txt",cx+75,0,0,0,0);
CreateEnemyFromFile(get~"stg1enemy1.txt",cx-75,0,0,0,0);
WaitZeroEnemy();
wait(60);
CreateEnemyBossFromFile(get~"stg1midboss_normal.txt",cx,0,0,0,0);
WaitZeroEnemy();
CreateEventFromScript("Talk1");
while(OnEvent()){yield;}
wait(120);
CreateEnemyBossFromFile(get~"stg1boss_normal.txt",cx,0,0,0,0);
WaitZeroEnemy();
wait(60);
CreateEventFromScript("Talk2");
while(OnEvent()){yield;}
wait(60);
Clear();
}
//wait function, simulates if statement
function wait(w){
loop(w){yield;}
}
//halts script until there aren't any enemies on screen
function WaitZeroEnemy(){
while(GetEnemyNum()!= 0){yield;}
}
}

And here's the gist of the code for my starting boss event script...do I need to stop the last bgm first before playing the next one?
Code: [Select]
script_event entertalk(){
let get = GetCurrentScriptDirectory;
@Initialize{
}
@MainLoop{
TextOutA("\c[AQUA]Gist of text");
PlayMusic(get ~ ".\bgm\st1b.mp3");
TextOutA("\c[RED]Text");
SetStep(2); //sets life to 0 so it moves to the next boss subscript
}

@Finalize{
}

//wait function, simulates if statement
function wait(w){
loop(w){yield;}
}
}


2.) How do I put in frames? By frames I mean the decorative window around the playing area and the scorelists.

puremrz

  • Can't stop playing Minecraft!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #804 on: May 20, 2010, 07:37:01 PM »
*omgmaths*

Wooh, thanks, it worked! ^_^
It's not really a flag, but that's just the best way to describe the effect. I'm aiming to use this as a background object for a boss, so it doesn't need to be attached to anything.
It looks great as it is now, but I'll be sure to mess around with it and see what terrible things happen if I input the wrong numbers :V
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

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #805 on: May 20, 2010, 07:41:34 PM »
Wooh, thanks, it worked! ^_^
It's not really a flag, but that's just the best way to describe the effect. I'm aiming to use this as a background object for a boss, so it doesn't need to be attached to anything.
It looks great as it is now, but I'll be sure to mess around with it and see what terrible things happen if I input the wrong numbers :V

Are you trying to make a background that looks like waves on a river of blood and fire, by any chance? Because I have perfectly copypastable code for that *points to sig*  :V


In any case, if the waving picture is larger than the screen and is supposed to wave the same everywhere, just remove the *0.01^(1-i/n) from the SetVertexXY commands.
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."

Kingault

  • Insert witty description here.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #806 on: May 20, 2010, 11:13:29 PM »

1.) I can't play bgm at all...I've tried calling the file into a variable (or calling the file directly) and playing it with PlayMusic(), but it won't play. This works with sound effects, but I can't seem to get my mp3 files to work. Is it the file I'm using, or am I just scripting it wrong? If it's the file, what are supposed to be the proper specs for Danmakufu to play the file?

Here's the code for my stage script:
Code: [Select]
#?????e????[Stage]
#Title[EoMT Stage 1]
#Text[]
#Image[]
#BackGround[Default]
#BGM[.\bgm.mp3]
#Player[.\player\robo_b.txt]
#ScriptVersion[2]
Fixed the BGM problem.

Or did you mean something else?
EDIT: Yeah, you meant something else. Sorry
« Last Edit: May 21, 2010, 12:22:51 AM by Kingault »

Bitz

  • So Moe!
  • *heart attack*
Re: Danmakufu Q&A/Problem Thread v3
« Reply #807 on: May 21, 2010, 12:18:00 AM »
Hi. Excuse me for butting in, but since this is a Q&A thread...I have a couple of things to ask (which may have been answered already...I dunno)

1.) I can't play bgm at all...I've tried calling the file into a variable (or calling the file directly) and playing it with PlayMusic(), but it won't play. This works with sound effects, but I can't seem to get my mp3 files to work. Is it the file I'm using, or am I just scripting it wrong? If it's the file, what are supposed to be the proper specs for Danmakufu to play the file?

You have to call LoadMusic(path) before calling PlayMusic(path).

Re: Danmakufu Q&A/Problem Thread v3
« Reply #808 on: May 21, 2010, 12:45:28 AM »
Sorry if this has been asked before (i looked through this thread first and nothing about it showed up)
Newbie/mathematical question:
how does one make a circle of bullets (that spawns around the player) that follow the circle's circumference (and stay there) without using tasks? i hope its possible, because i've been experimenting with CreateShotA, SetShotDataA and SetShotDataA_XY for the past 3 days and nothing >.>  I get the spawning circle part right....i just can't seem to get the bullets to go along the circle's circumference. I'm sure it works with atan2 or something like that, but i fail at math D: can someone explain please  :derp:?

here is the snippet of code i've been working on, maybe it helps:

Code: [Select]
    @MainLoop {
SetCollisionA(GetX, GetY, 31);
SetCollisionB(GetX, GetY, 31);
count++;
angle++;
circle++;

if(count==200){
loop(6){
CreateShotA(1, GetPlayerX + 100*cos(angle), GetPlayerY + 100*sin(angle), 15);
SetShotDataA_XY(1, 0, 1, 0, 0, 0, 0, 0, 213);
angle += 360/6;
FireShot(1);
}
angle = 0;
count = 0;
}
 }

Notes: Currently the bullets just go to right and all spawn facing right.

Elementoid

  • Having a heated affair with feux-familiars
Re: Danmakufu Q&A/Problem Thread v3
« Reply #809 on: May 21, 2010, 12:56:18 AM »
Is there any particular reason you don't want to use tasks? It would make things a lot easier, and using them isn't hard, if that's what you think.

Anyways, the easiest thing I think would be to define a point that lies on the player than then if the point's position changes, have the bullet's positions change by the same amounts.