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

Re: Danmakufu Q&A/Problem Thread v3
« Reply #630 on: April 24, 2010, 03:34:04 AM »
Hurrrrrrrrrr why must Danmakufu be so specific

Because ambiguous code sucks.

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread v3
« Reply #631 on: April 24, 2010, 03:40:30 AM »
How is it supposed to know you mean "01" when you just type "1"? Name all your files/variables with the same convention and you shouldn't have that problem.
(Though I admit that I've screamed at it a few times too...)

KrackoCloud

  • I don't mean to be greedy...
  • ... but white rice is my favorite food.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #632 on: April 24, 2010, 09:02:32 PM »
Is there a difference in whether you change an attack's amount of health, or if you change the enemy's damage-taken ratio? Like, maybe in how the life bar looks or works?

Furienify

  • Yeehaw!
  • Equestrian Fansubber
    • Youtube Channel
Re: Danmakufu Q&A/Problem Thread v3
« Reply #633 on: April 24, 2010, 09:16:55 PM »
Is there a difference in whether you change an attack's amount of health, or if you change the enemy's damage-taken ratio? Like, maybe in how the life bar looks or works?

It changes the length of the health bars. The usual Touhou process is a high-health nonspell, followed by a spellcard with low health but high damage resistance that fades over time. A lot of Danmakufu users emulate this with delayed tasks that set the damage resistance lower and lower over time.

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem Thread v3
« Reply #634 on: April 25, 2010, 01:06:24 PM »
Danmakufu Hates Me Epic(not)sode 2

All scripts with music WONT PLAY.
Even CtC!
Any Halp?
I use vista.
Also, if i get any halp I can't try it until next weekend when I get to use a PC again... :(


Re: Danmakufu Q&A/Problem Thread v3
« Reply #635 on: April 25, 2010, 05:56:03 PM »
Danmakufu Hates Me Epic(not)sode 2

All scripts with music WONT PLAY.
Even CtC!
Any Halp?
I use vista.
Also, if i get any halp I can't try it until next weekend when I get to use a PC again... :(

Gonna have to be a bit more specific. When does Danmakufu crash (if at all)? If music was the issue then the script would play normally, you just wouldn't hear anything.

Anyway, I have a hueg problem of my own:

(code)

There is nothing wrong with your code, other than being inefficient. Post the whole file.

Furienify

  • Yeehaw!
  • Equestrian Fansubber
    • Youtube Channel
Re: Danmakufu Q&A/Problem Thread v3
« Reply #636 on: April 25, 2010, 07:43:46 PM »
How about that? Pretty sure that that might be the problem.

Anyway, I have a hueg problem of my own:

Code: [Select]
This piece of code creates a
---------------------------
ScriptError
---------------------------
script_enemy_main内で
「{...}」が対応していません。
---------------------------
OK   
---------------------------

In my experience, this error almost exclusively comes up because you're missing a closing bracket for the script_enemy_main portion. If you're not missing it, it's been placed in the wrong spot (such as you're closing it appropriately, but before a task, etc.)

8lue Wizard

  • Cobalt Magician
  • (Apparently)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #637 on: April 26, 2010, 03:21:14 AM »
Quote
if(InnerCirc5 >= 0 && FrontalAssault >= 1 && GetPlayerX-15 <= -GetClipMinX && GetPlayerY+25 <= -GetClipMaxY){SetX((GetPlayerX+cos(45)*1)){SetX((GetPlayerX+cos(60)*1)); SetY((GetPlayerY-sin(60)*1))} else
   if(InnerCirc6 >= 0 && FrontalAssault >= 1 && GetPlayerX-15 <= -GetClipMinX && GetPlayerY+25 <= -GetClipMaxY){SetX((GetPlayerX+cos(45)*1)){SetX((GetPlayerX+cos(75)*1)); SetY((GetPlayerY-sin(75)*1))} else

Bolded {'s are mismatched. This may happen on other lines, too, these were just the first I caught.

When in doubt, use your search function.

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem Thread v3
« Reply #638 on: April 26, 2010, 07:00:35 AM »
Gonna have to be a bit more specific. When does Danmakufu crash (if at all)? If music was the issue then the script would play normally, you just wouldn't hear anything.


danmakufu doesn't crash. It just doesn't play music from ANY script. Only sound effects work.
scripts work fine only lacking bgm....

Furienify

  • Yeehaw!
  • Equestrian Fansubber
    • Youtube Channel
Re: Danmakufu Q&A/Problem Thread v3
« Reply #639 on: April 26, 2010, 07:15:06 AM »
danmakufu doesn't crash. It just doesn't play music from ANY script. Only sound effects work.
scripts work fine only lacking bgm....

It might be an issue with the sound file's container/format, but if you just raw downloaded CtC it should work fine. Hmm. I can only think that a danmakufu option is off, our somehow the sound output isn't being processed to the correct medium (external speakers, headset, etc.). But if SFX works, the latter is unlikely.

ChaoStar

  • Dark History Boy
Re: Danmakufu Q&A/Problem Thread v3
« Reply #640 on: April 26, 2010, 05:16:09 PM »

There is nothing wrong with your code, other than being inefficient. Post the whole file.

rong, there was something. I found it with the help of someone

shot replace script
« Reply #641 on: April 27, 2010, 03:05:16 AM »
I have been using danmakufu for a while but just recently i had the idea of making my own bullets for it but i dont quite understand how to code the replace script can some one please help

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: shot replace script
« Reply #642 on: April 27, 2010, 06:29:35 AM »
First of all, please post questions about Danmakufu in the Q&A thread to prevent clutter in the topic list.

To answer your question, there are two parts of making a shot replace script. First, you need to make a definition file that contains the graphical behavior of every bullet you want to make. If you read everything on that page, you should be able to make the definition file fairly easily. After creating the file, you need to call LoadUserShotData(path to your definition file) and your script will be able to use the bullets that you created by putting the id numbers that you defined into the graphics parameter of the shot creation functions. Note that at this point, you can use both the default Danmakufu bullets as well as the new ones that you defined. The second part of a shot replace script is making a file that reassigns the constants that Danmakufu uses for the default graphics to hold the values of the new bullets. For example, if you defined a red circular bullet with an id of 1, you could put let RED01 = 1;.

It would probably be best to look at other people's examples to learn so you can take a look at working code. Here is a thread with some of the shot data and shot replace scripts that other people have made.
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

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 #643 on: April 27, 2010, 10:12:28 AM »
Is there any easy-ish or a universal way to tilt 3d objects? I can't figure out how to tilt/rotate the 3d objects I make... for example... a simple cube is like this

Code: [Select]
ascent(i in 0..4)
{
SetGraphicAngle(i*90, 0, 90);
DrawGraphic3D(45*sin(i*90), 0, 45*cos(i*90));
}
SetGraphicAngle(90, 90, 90);
DrawGraphic3D(0, -45, 0);
DrawGraphic3D(0, 45, 0);
Note: I'm not that sure... I haven't tested it (no danmakufu in this comp), but you get the point...

Now, how would I tilt that cube? to for example, a cube standing on one point...
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 #644 on: April 28, 2010, 05:44:59 AM »
I believe you would have to have the Y and Z parameters of DrawGraphic3D to make it tilt.




KrackoCloud

  • I don't mean to be greedy...
  • ... but white rice is my favorite food.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #645 on: April 28, 2010, 06:14:38 AM »
Sometimes I see percentage signs (%) in scripts. What is it used for? I can't seem to figure this out.

Also, since I'm still very bad at Danmakufu - How would one get a bullet to bounce off walls twice?

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #646 on: April 28, 2010, 06:18:26 AM »
Is there any easy-ish or a universal way to tilt 3d objects? I can't figure out how to tilt/rotate the 3d objects I make... for example... a simple cube is like this

Code: [Select]
ascent(i in 0..4)
{
SetGraphicAngle(i*90, 0, 90);
DrawGraphic3D(45*sin(i*90), 0, 45*cos(i*90));
}
SetGraphicAngle(90, 90, 90);
DrawGraphic3D(0, -45, 0);
DrawGraphic3D(0, 45, 0);
Note: I'm not that sure... I haven't tested it (no danmakufu in this comp), but you get the point...

Now, how would I tilt that cube? to for example, a cube standing on one point...

To rotate an object in 2D, you would specify a point to rotate about, get the distance and angle to that point, and move it by incrementing the angle while keeping the distance the same, correct? At the same time, you would need to rotate the graphic at the same speed that you are incrementing the angle.

In 3D, it would be similar. You would need to specify a 3D point to rotate around, get the 3D distance and the three angles (x, y, and z angles). Then you increment the angles (in different ways likely) while changing the graphic angles the same way as well.

However, due to Danmakufu's terrible 3D engine, the angles happen to come across a phenomenon called gimbal locking where it can't rotate in certain angles under certain conditions. Also, Danmakufu only takes integer values for the SetGraphicAngle function, possibly due to a bug. If you put in a float, it will truncate it which means that if you rotate the graphic slowly, it will be jerky.

Sometimes I see percentage signs (%) in scripts. What is it used for? I can't seem to figure this out.

Also, since I'm still very bad at Danmakufu - How would one get a bullet to bounce off walls twice?
% is a math operator called modulus. Basically it divides the first number with the second number and tells you what the remainder is. For example, 17%5 would be 2 because 17/5 is 3 remainder 2.

For your second question, it sounds like you already know how to bounce a bullet off once. Why don't you just get a variable to hold how many times the bullet bounced and if it exceeds however many times you want, then you don't bounce it anymore?
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

KrackoCloud

  • I don't mean to be greedy...
  • ... but white rice is my favorite food.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #647 on: April 28, 2010, 10:46:06 PM »
For your second question, it sounds like you already know how to bounce a bullet off once. Why don't you just get a variable to hold how many times the bullet bounced and if it exceeds however many times you want, then you don't bounce it anymore?
Pfft, why didn't I see this. Alright, thanks.

EDIT : There seem to be some inconsistencies and problems if I change speed, the bounce limit, etc, but this will work for now...
« Last Edit: April 28, 2010, 11:20:39 PM by 1000clouds »

空SoraのNo鏡Kagami

  • Wolven Wind Warrior of the West (That's catchy)
  • Occupation: Hopeless Amazing Young Scriptor
Doesn't get objects
« Reply #648 on: April 29, 2010, 12:36:53 AM »
I've been at this for a whole day. While I'll admit I don't get variables, I decided I'd learn from them...
However I don't get how the Object shots (etc) are supposed to be set up... And no, the wiki isn't helping.
Me: Rapture is comin'
Person: OMG WHEN!
Me: Naow, APOCALYPSE SIGN "RAPTURE"!

Furienify

  • Yeehaw!
  • Equestrian Fansubber
    • Youtube Channel
Re: Doesn't get objects
« Reply #649 on: April 29, 2010, 12:56:53 AM »
I've been at this for a whole day. While I'll admit I don't get variables, I decided I'd learn from them...
However I don't get how the Object shots (etc) are supposed to be set up... And no, the wiki isn't helping.

Here's basic object code, at least for a bullet:

Code: [Select]
task Bullet(x, y, v, angle, graphic, delay) {
      let obj=Obj_Create(OBJ_SHOT);
//defines a variable so we don't have to constantly reference the object with Obj_Create(OBJ_SHOT);

      Obj_SetPosition(obj, x, y); //This sets the XY coordinates of the bullet's spawn. Note how this is called up in the task.
      Obj_SetSpeed(obj, v); //Sets the object's spawned speed
      Obj_SetAngle(obj, angle); //Like the above, but this sets the angle.
      ObjShot_SetGraphic(obj, graphic); //Object's graphic
      ObjShot_SetDelay  (obj, 0); //Delay before the object is created and fires
      ObjShot_SetBombResist (obj, true); //An alternative option to set whether or not the object is destroyed by bombs.

      while(Obj_BeDeleted(obj)==false) {

//A while loop. Essentially, while this object has not been deleted (aka, 'while this object exists') the bracketed code will be taken into account
//This is where you can, in a way, dynamically control your object using variables. An example is below.
              yield;
       }

Code: [Select]

let timer = 0; //<--- define this before script_enemy_main, I should note

while(Obj_BeDeleted(obj)==false) {
//again... while object exists, we'll do this:
timer++;
//every frame, the 'timer' counter increases by one.

if(timer ==120){
//120 frames, or two seconds after the object's creation (not counting the time you put in the object's delay), the bracketed action occurs.

Obj_SetAngle(obj, Obj_GetAngle(obj) +45)
//Changes the object's angle. Uses the GETANGLE function to retrieve the object's current angle, and then increments it by 45 degrees.

let timer = 0
//Sets the timer back to 0. After two more seconds, the angle will be incremented by 45 again, on and on until the bullet is somehow deleted.

} //closes the if-statement
     yield; //it's a type of loop, so you always yield your loops
} //closes the 'while object is existing' statement, AKA the while loop.

This is always the way I understood it. You can then call the 'Bullet' object anywhere else, IE:

Bullet(GetEnemyX,GetEnemyY,GetAngleToPlayer,3,RED01,60);
^For a bullet that spawns on the enemy after a 1 second delay, moving at a speed of 3 towards wherever the player was at its spawn time.


Furienify

  • Yeehaw!
  • Equestrian Fansubber
    • Youtube Channel
Re: Danmakufu Q&A/Problem Thread v3
« Reply #650 on: April 29, 2010, 01:05:11 AM »
Here, check this link out as well. Onthenet can explain most of the basic danmakufu functions, with practical examples, far better than I can. It's where everything started making sense to me, at least!

(That ought to be linked in the Tutorial thread, also.)

Drake

  • *
Re: Danmakufu Q&A/Problem Thread v3
« Reply #651 on: April 29, 2010, 01:15:40 AM »
Obj_Create is not a value in itself. It simply creates an object. You can't store this object anywhere unless you give it a memory address i.e. the variable. If you use Obj_Create in everything it'll attempt to create a new object for each command and will just generally fail.

also that example can be simplified:
while(!etcdeleted)
    loop(120){yield;}
    setangle;
}

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

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Doesn't get objects
« Reply #652 on: April 29, 2010, 07:50:10 AM »
I've been at this for a whole day. While I'll admit I don't get variables, I decided I'd learn from them...
However I don't get how the Object shots (etc) are supposed to be set up... And no, the wiki isn't helping.

If you don't get variables, then it isn't a great idea to learn about objects for the time being. A variable is basically container where you can put whatever information you want to save for later. For example, if you put let asdf;, you would have a variable called asdf that can store whatever information you want now. Then later, if you put asdf = 11;, the container called "asdf" will hold the number 11. Then, you can use this variable in place of regular numbers in math and such like this:

let jklSemicolon = asdf + 5; // Now we have a variable called jklSemicolon that contains 16
CreateShot01(GetX, GetY, 1, asdf, RED01, 10); // This shot will shoot at an angle of 11 because asdf is 11.


There's a lot more things you can do with variables so you should read some of the beginner tutorials in the tutorial thread to fully understand it. Objects rely heavily on manipulation of variables so it would be best if you learned variables first.
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

Henry

  • The observer
  • Exploring to the new world of Danmaku
Re: Danmakufu Q&A/Problem Thread v3
« Reply #653 on: April 30, 2010, 04:12:13 AM »
I have some little questions about the use of "yield;" command. As I know, it is used to link the @MainLoop to other task.

1. Can 1 yield; command in @MainLoop be connected to all other yield; in tasks?
2. Can 1 yield; command in tasks be connected to all other yield;s?
3. Can I put a yield; command in @DrawLoop?
Old/Forgotten member.

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

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: Danmakufu Q&A/Problem Thread v3
« Reply #654 on: April 30, 2010, 04:32:51 AM »
I have some little questions about the use of "yield;" command. As I know, it is used to link the @MainLoop to other task.

1. Can 1 yield; command in @MainLoop be connected to all other yield; in tasks?
2. Can 1 yield; command in tasks be connected to all other yield;s?
3. Can I put a yield; command in @DrawLoop?

1)You mean if it actually affects the tasks themselves? No.
2)No, all tasks are independent of one another. They can run simultaneously.
3) Yes, but you don't ever want to do that. Generally, MainLoop and DrawLoop have a hidden yield; of their own. It just doesn't exactly "stop and look for other tasks to run", like the written function.

Generally, the yield; function delays a later function or task by said amount of frames.
For example, if you have this in you @Initialize...

@Initialize{
this;
loop(60){yield;}
that;
task this{dostuff; yieldyieldyield;}
task that{dootherstuff; yield;yield;yield;}
}

task that will happen 60 frames after task this.
However, the yields in the actual tasks do not affect one another. What happens in the brackets, stays in the brackets. This allows tremendous flexibility in scripting.
« Last Edit: April 30, 2010, 04:34:56 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 v3
« Reply #655 on: April 30, 2010, 04:36:16 AM »
To simplify that point, you should always just have a single yield; in MainLoop. Then you can put yield; in any task, and the code will wait one frame when it reaches that statement.

Henry

  • The observer
  • Exploring to the new world of Danmaku
Re: Danmakufu Q&A/Problem Thread v3
« Reply #656 on: April 30, 2010, 04:39:49 AM »
So after tasks (with  yield;) is called, 1 yield; in MainLoop traces back to all yield;s in the tasks and vice versa?
Old/Forgotten member.

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

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread v3
« Reply #657 on: April 30, 2010, 04:43:17 AM »
Yes. You only ever need a single yield; in MainLoop, and that will handle all the ones that are in tasks.

Bitz

  • So Moe!
  • *heart attack*
Re: Danmakufu Q&A/Problem Thread v3
« Reply #658 on: April 30, 2010, 04:47:45 AM »
Essentially:
When a task is first called, Danmakufu immediately enters that task and runs until it reaches the end or a yield, at which it returns to where it was called, like a function or sub.
When yield is called anywhere but in a task, Danmakufu will start up all tasks from where they left off before and run them until they reach their end or a yield.
When yield is called in a task, that task will pause its running until a yield is called somewhere that is not a task.

Henry

  • The observer
  • Exploring to the new world of Danmaku
Re: Danmakufu Q&A/Problem Thread v3
« Reply #659 on: April 30, 2010, 04:52:58 AM »
Another problem:

I would like to make a SFX for shooting boss like in Touhou games (best demonstrated in SA Phantasm's script)

However, what's the difference between GetEnemyLife and GetLife?

For functions without parameters, the brackets not necessary, right?
Old/Forgotten member.

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