Author Topic: ※ Dnh Q&A/Problem ※ for Danmakufu ph3 (locked)  (Read 316062 times)

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #420 on: August 30, 2012, 12:18:34 AM »
SourceRect and DestRect are like the UVs and XYs, respectively, that you would use for effect objects in 0.12. It is used to draw a defined section of the texture, you just didn't do it correctly (or at least, how you wanted it to).

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

fondue

  • excuse me
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #421 on: August 30, 2012, 09:50:04 AM »
Ah, thanks got that sorted out, but I used ObjSprite2D_SetDestCenter instead; it's a lot easier. But since in my script attacks will be executed in succession, how do I make a plural script?

e: Yeah I said the boss graphic is on screen perfectly, but why isn't she moving? I wrote down ObjMove_SetDestAtWeight(); but nothing's happening...
http://pastebin.com/6sswr5aK

e2: Screw the problem I got it sorted out but it would be great if someone explained why the graphic wouldn't be drawn with that code. It would make great use in the future...


e3: OH LOOK ANOTHER QUESTION. Okay so I've set the intersection circles for the boss but she is taking to damage from the shots and the player wont die when I run into her. What's happening? http://pastebin.com/eduh9uiF
« Last Edit: August 30, 2012, 10:55:32 AM by fonduemaster »

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #422 on: August 31, 2012, 12:50:46 AM »
1. Can't draw things during @Initialize (or rather, on the very first frame of a script) actually the example scripts do this so uh hooray you can draw things on the first frame! \o/
2. MainLoop
« Last Edit: August 31, 2012, 01:13:04 AM by Drake »

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

fondue

  • excuse me
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #423 on: August 31, 2012, 07:56:14 AM »
great now i feel like a complete idiot  :persona:

fondue

  • excuse me
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #424 on: September 23, 2012, 05:34:10 PM »
How do I make a custom cut-in? I will be making the graphics and all but what are the requirements, functions, tasks etc for making one?

Ozzy

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #425 on: September 23, 2012, 06:53:44 PM »
How do I make a custom cut-in? I will be making the graphics and all but what are the requirements, functions, tasks etc for making one?
Funny that you should ask this since I just finished making my own for Ph3.

There are no "requirements" per say. What you'll probably want is a render object of the cut in image displayed with a priority that's below the bullets, player, etc. Then it's just as simple as manipulating the object to appear for a couple seconds, move where you want, then disappear.

Code: [Select]
task Cutin(CutImage,left,top,right,bottom) {
let obj = ObjPrim_Create(OBJ_SPRITE_2D);

ObjPrim_SetTexture(obj, CutImage);
Obj_SetRenderPriority(obj, 0.28); //This is the priority I used. Feel free to experiment with others
ObjSprite2D_SetSourceRect(obj, left, top, right, bottom);
ObjSprite2D_SetDestCenter(obj);
ObjRender_SetPosition(obj, x, y, 0); //Places the image wherever you want it to start

while(!Obj_IsDeleted(obj)) {
//Do stuff (like move the image where you want it to go)
yield;
}
}

Something like this should be a good start. For the spellcard name text you have a couple of options. You could make it a text object and use danamkufu's default text functions to display it (this is what I did and I find it the easiest). You could also make the spell name another render object like the cut in if you desire something other than danmakufu's text. However, this requires each spell name to have a different image as you will need to edit them separately in an image editor.

Anyway that should cover the basic requirements of a spellcard cut in. Any extra fluff (like the scrolling "Spell Card Attack!!") will usually just be more render objects.



fondue

  • excuse me
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #426 on: September 23, 2012, 07:07:25 PM »
Thanks, I will try this later. What does Obj_SetRenderPriority do?

Ozzy

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #427 on: September 23, 2012, 08:28:11 PM »
Thanks, I will try this later. What does Obj_SetRenderPriority do?
It's basically Ph3's version of Obj_SetLayer in 0.12m. The higher the number, the higher up it is drawn. Note that ph3 has several different versions of this function, some of which require a number from 1-100 or 0-1. I'm not familiar with all of them so be sure to check the wiki for more info on that.

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #428 on: September 23, 2012, 11:00:48 PM »
Making things like explosions and spell circles and cutins are all things that require no specific rules. It's all just a matter of knowing what you want the function to accomplish and knowing how to manipulate your images to do so.

Obj_SetRenderPriorityI(obj, n) is the function you usually want. Priorities range from 0 to 100, lower value means drawn higher (less priority).
20: Frame; anything lower is drawn over the frame
30: Player
40: Enemies
50: Bullets
60: Items
69: 2D Camera Focus; anything lower is ignored by the camera, i.e. moving the camera around won't move the image
80: Maximum priority for the scene; I haven't tested this value so I dunno what it does

Personally I figure the float version (Obj_SetRenderPriority) is only useful when you're actually using calculations to assign priorities rather than just numbers, since this is essentially the same thing using 20/100, 30/100, 69/100, etc.

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

fondue

  • excuse me
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #429 on: September 24, 2012, 07:37:24 PM »
The fucking fuck?
[attach=1]
[attach=2]
What happened here? All I wanted to do is to spin the border on a sine and it fucks up the whole thing...


e: Download both and place in the same folder.


And why is the thread so empty ;_;

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #430 on: September 24, 2012, 09:58:15 PM »
Obj_SetRenderPriority(border, 100) does not work. This is the function that just accepts values from 0 to 1. Even if you used Obj_SetRenderPriorityI(border, 100) which is the 0 to 100 function, you might not even see it as you're using the maximum priority.

ObjRender_SetPosition(border, 150, 150, 0) is going to throw it in 3D space. It's a simple object; just use ObjMove_SetPosition.

You don't need mainTask at all; ph3 lets you draw stuff on the first frame and it's just transparently tossing to spinborder, so why have it?

ObjRender_SetAngleXYZ(0,45,border,sin(angle2)*3) is probably the main issue. What is this even. ObjRender_SetAngleXYZ's parameters are object ID, X-angle, Y-angle and Z-angle, so you're throwing a 45-degree X-angle, a Y-angle rotated at whatever your border object's ID is, and actually affecting the object of ID 0. Use ObjRender_SetAngleZ. There is also no looping in your task, which you need in order to have your stuff run for more than one frame. Even if you had a loop your angle2 is just going to keep increasing (it currently doesn't), but using sin(angle2)*3 means it'll wiggle around from 0 to 1 to 0 to -1 to 0 degrees.
« Last Edit: September 24, 2012, 10:01:41 PM by Drake »

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

PJ

  • jesus christ it's all over the walls
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #431 on: September 29, 2012, 01:11:19 PM »
I keep getting this error message. This happened when I tried to make some parts impossible to select.
"Line 356 ")" is required."
It happens right before I start the "Character Select" task. I checked the task above that, and nothing looks wrong with it. wat do?

http://pastebin.com/rJGev356

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #432 on: September 30, 2012, 09:39:48 AM »
I keep getting this error message. This happened when I tried to make some parts impossible to select.
"Line 356 ")" is required."
It happens right before I start the "Character Select" task. I checked the task above that, and nothing looks wrong with it. wat do?

http://pastebin.com/rJGev356

Line 366:                 TMenuItem(iText, mx, my, texts[iText], (iText == 4 && !GetCommonData("unlockYUYUKO", false));

You are missing a closing parentheses. A syntax highlighter that bolds matching parentheses, braces, and brackets (NotePad++ is good) may be helpful in catching these mistakes more quickly.
« Last Edit: September 30, 2012, 09:41:28 AM by Blargel »
<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.

PJ

  • jesus christ it's all over the walls
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #433 on: September 30, 2012, 11:34:31 AM »
Line 366:                 TMenuItem(iText, mx, my, texts[iText], (iText == 4 && !GetCommonData("unlockYUYUKO", false));

You are missing a closing parentheses. A syntax highlighter that bolds matching parentheses, braces, and brackets (NotePad++ is good) may be helpful in catching these mistakes more quickly.

Oh. Looks like you're right.

I am using Notepad++, but it didn't seem to catch that for me.

fondue

  • excuse me
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #434 on: October 06, 2012, 03:53:59 PM »
can ph3 do things like slow time, speed up time and stop time?

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #435 on: October 06, 2012, 04:24:39 PM »
The StartSlow command can slow down time, speed up and stop time must be faked by changing player and bullet speed etc.

fondue

  • excuse me
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #436 on: October 06, 2012, 04:32:42 PM »
The StartSlow command can slow down time, speed up and stop time must be faked by changing player and bullet speed etc.
Thanks I'll try that later. Also I was just about to edit my previous question to ask something in addition but oh well I'll ask another one :V

I can't explain it much, but I read this thread and is there any more orbital rotating around orbitals? Like the complex ones, they look pwetty :3c If there are more, what are the maths needed to generate the orbitals?

e: Also not a question but apparently Danmakufu is now being updated to be able to have 12.0m functions...


e2: AND what does DnhViewer.exe and FileArchiver.exe do and how do they work?

e3:OH LOOK ANOTHER QUESTION HOW SURPRISING. When the boss moves left for example, how can I make the boss look like as if it's moving left? Like when it's not moving it has a normal graphic but when it moves left the boss will change graphic to look like she's moving left and when she stops moving her graphic changes back to normal. Or when the boss makes a pose to unleash a powerful attack.
And how do arrays work? How do you make/use them?
Thought of asking all my current questianos now instead of asking all of the later.
« Last Edit: October 06, 2012, 07:50:35 PM by fonduemaster »

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #437 on: October 06, 2012, 05:55:00 PM »
I ran out of script examples. So, i want to know how to do:
 - the wall of bullets like the one in the Seiga's midboss spell, but just straight wall.
 - the bullet with the wavy trajectory (functions?)

I'm actually learning it, so i need the ways.

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #438 on: October 07, 2012, 08:23:47 AM »
I can't explain it much, but I read this thread and is there any more orbital rotating around orbitals? Like the complex ones, they look pwetty :3c If there are more, what are the maths needed to generate the orbitals?

e: Also not a question but apparently Danmakufu is now being updated to be able to have 12.0m functions...

e2: AND what does DnhViewer.exe and FileArchiver.exe do and how do they work?

e3:OH LOOK ANOTHER QUESTION HOW SURPRISING. When the boss moves left for example, how can I make the boss look like as if it's moving left? Like when it's not moving it has a normal graphic but when it moves left the boss will change graphic to look like she's moving left and when she stops moving her graphic changes back to normal. Or when the boss makes a pose to unleash a powerful attack.
And how do arrays work? How do you make/use them?
Thought of asking all my current questianos now instead of asking all of the later.
1. http://en.wikipedia.org/wiki/Category:Curves
Go nuts, if you can understand what all the math and stuff means and how to turn that into code when you find something you want.

2. It's being updated regularly, getting some 0.12 functions back is just a part of its current growth.

3. haven't bothered with them yet tbh, filearchiver likely takes a project/script folder and packs it into one file to read from

4. http://www.youtube.com/watch?v=JUj6xG79-TY is probably enough to understand how the animation and selection concept works.
But to put it to work, you'll have to deal with the changes from 0.12 to ph3, such as the removal of the DrawLoop, which can instead be replaced by tasks or per-frame subroutines, and the removal of the linear "draw this then set graphic to this and draw that then this and this" that DrawLoop had and instead use sprite/render objects. I should get around to doing tutorials sometime. Very few people seem to be interested in dnh right now though :c

5. http://www.shrinemaiden.org/forum/index.php/topic,30.msg171.html#msg171
http://www.geocities.co.jp/SiliconValley-Oakland/9951/products/th_dnh_help_v3_data/syntax.html#VariableArray



I ran out of script examples. So, i want to know how to do:
 - the wall of bullets like the one in the Seiga's midboss spell, but just straight wall.
 - the bullet with the wavy trajectory (functions?)
1. I assume you want the bullets to split off randomly like Seiga's do, otherwise it's just firing bullets. But actually, this is almost just as easy.

loop(n){
   local{ //since you won't need the bullet objects after you fire them, the local scope lets you reuse the variable x
      let x = CreateShotA1(fire at some angle);   //you should know this
      ObjMove_AddPatternA1(x, frame, speed, angle); //tells the bullet to move at defined speed and angle when "frame" frames pass
      //in other words set the above "angle" to some random angle so that the bullets fire off in a spray
   }
   //wait two or three frames before firing the next bullet
}


Or you can use a function to make the bullet and set the angle and loop that instead. Or whatever. ObjMove_AddPatternA1() is the important bit.

2. Wavy trajectories are a thing. Fire the bullet at some angle, and then change the angle every frame to the original angle + sin(t)*something, where t constantly increases by some frequency. Will look like:

task bullet{
   let obj = CreateShotA1(fire at some angle);
   let a = that angle;
   let t = 0;
   while(!Obj_IsDeleted(obj)){
      ObjMove_SetAngle(obj, a + sin(t)*something );
      t = (t + something) % 360;    //t increases by something per frame
      yield;
   }
}


I think this should work, if you give it proper values.
Look up your basic trigonometry if you don't understand what I'm doing with SetAngle, also the dnh intermediate tutorial could help.
(Note, the modulo (%360) is there so t will go back to 0 when it hits 360. Mostly useless for you, but good for full-game scripters since it prevents overflow.)

« Last Edit: October 07, 2012, 08:28:57 AM by Drake »

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

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #439 on: October 07, 2012, 10:25:47 AM »
@Drake

It's look great, but can you send me the working scripts? I can't get how it works.

fondue

  • excuse me
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #440 on: October 07, 2012, 12:05:03 PM »
TOO MANY CURVES AAAA-
Oh god I don't understand any of them... what's the mathematical formula for the rose curve? If it's too tiring and too long to figure out please don't bother because I don't get a bit of it.

Also how do I work out the maths for each curve? Like I've read the formula for most of the curves but how do I "translate" the formula so Danmakufu can use it without errors?


e: if i have to ask ANOTHER question after this i will cut myself
1. http://www.mediafire.com/?dbtdzfbnuturnib; Put #include"./Cutin.txt" in the header for the file you want the cutins to be added for. Keep in mind that depending on your file structure, you may have to edit the image paths in Cutin.txt. This is true when only white squares appear instead of the proper image. When editing the image paths, keep in mind that it is relative to the script calling Cutin.txt, not relative to Cutin.txt itself. Instructions on how to use the cutins are in Cutin.txt
When I tried to use BYAKUREN I got an error?
« Last Edit: October 08, 2012, 08:19:41 PM by fonduemaster »

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #441 on: October 08, 2012, 09:10:26 AM »
It's look great, but can you send me the working scripts? I can't get how it works.
I'd much rather you figure it out, as giving you a finished script wouldn't solve anything. Providing a framework and getting you to understand should be enough~

1. To make a wall of bullets, you just have to continuously fire bullets in one direction. Easy enough? That's just looping CreateShots.
The next step is setting a variable (x in the example) to the bullet object returned by CreateShot. This lets you reference the object in later statements.
Next, you use ObjMove_AddPatternA1(x, frame, speed, angle) to give the bullet x a movement pattern. Specifically, this tells the bullet to move at the defined speed and angle after "frame" frames pass after you call the function (in this case, frames after the bullet is fired). For your purpose, you're going to want to set "angle" to something like rand(0,360) for a random angle.

Lastly, you can wrap the inside of the loop with a local scope. A local scope makes it so that all variables declared inside are only valid inside, and can be reused once you hit its end bracket. Putting this in the loop means you get to reuse the variable x for each bullet you fire. But on second thought, the local scope might not need to be used, since once the movement pattern is applied you reset the variable to the next bullet anyways. My bad, this is unnecessary.

2. cos(t) will go from 1 to 0 to -1 to 0 to 1, as t increases (as you should know, otherwise read the intermediate tutorial as I suggested). Therefore, some angle (say, 60) plus cos(t) will go from 61 to 60 to 59 to 60 and back to 61, as t increases.
Or, that angle plus (cos(t) times 5) will go from 65 to 60 to 55 to 60 to 65 as t increases. So just fire a bullet that follows this angle; I gave you a framework above (except I used sin instead of cos, use cos). At a constant speed, it should make a wavy shape. Although, you probably have to make a small adjustment somewhere; I think the wave will be a bit off-center from where you want. Get it working first, though.

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

Delfigamer

  • * Merry, bride, absolute (HR)
  • of course the best girl never wins
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #442 on: October 08, 2012, 12:29:41 PM »
2. cos(t) will go from 1 to 0 to -1 to 0 to 1, as t increases (as you should know, otherwise read the intermediate tutorial as I suggested). Therefore, some angle (say, 60) plus cos(t) will go from 61 to 60 to 59 to 60 and back to 61, as t increases.
Or, that angle plus (cos(t) times 5) will go from 65 to 60 to 55 to 60 to 65 as t increases. So just fire a bullet that follows this angle; I gave you a framework above (except I used sin instead of cos, use cos). At a constant speed, it should make a wavy shape. Although, you probably have to make a small adjustment somewhere; I think the wave will be a bit off-center from where you want. Get it working first, though.
Sin-cos replacement is an exercise, huh? :3
That is really nice pattern to follow. In the past, when my engine even didn't use DirectX, I used an Enhanced Multy-Wavy Bullet Pattern. Bullets here behave just as Drake said, though they are re-aimed multiple times.
Ah, and calculated angle is added to "player's angle", so waves follow you; but with other values that may become unnecessary.
So, trigonometry is actually a very wonderful discipline, you should learn it in order to make nice danmakus. :3

The Jealous Witch did nothing wrong.

fondue

  • excuse me
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #443 on: October 10, 2012, 09:00:48 PM »
When I tried to use BYAKUREN I got an error?
It still wont work. Any ideas why?

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #444 on: October 10, 2012, 09:23:43 PM »
What error? The only error I'm getting is completely unrelated to the cutin (CreateSpeechImageA1), and when I got rid of that error I could use BYAKUREN fine.
« Last Edit: October 10, 2012, 09:26:45 PM by Drake »

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

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #445 on: October 12, 2012, 03:25:58 PM »
I can't figure at last how to make more "independent" loops, where the pattern X is shoot, in example, at sixtieth frame, and then, at every fifth frame after the last shoot of pattern X, and the pattern Y is shoot at three hundredth frame and at every one hundred twentieth frame after the last shoot of pattern Y. Can somebody explain me how to do it?

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #446 on: October 12, 2012, 11:18:29 PM »
Threading. Use tasks. You've probably already done a bunch of it if you're posting in the ph3 thread.

task patternX{
   wait(60);
   loop{
      dosomething;
      wait(5);
   }
}
task patternY{
   wait(300);
   loop{
      dosomethingelse;
      wait(120);
   }
}

And just start both of them at the end of @Initialize. The tasks will start, and while running they will yield ("go do something else and put this on the yielding queue") over to the next task. Then on the next frame the program will go through the yielding queue, eventually get to the task and run it from where it yielded. That's the basic structure of threading.

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

fondue

  • excuse me
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #447 on: October 12, 2012, 11:59:04 PM »
drake, you've done enough helping for this month :V but thanks for all of it

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #448 on: October 13, 2012, 01:08:06 AM »
Ah yes, the microthreading. Well, they're more like microfibers, really.
The yield; statement decrements the current thread index, so that the instruction pointer resumes executing codes from that of the callee. Or, well, the previous called thread if  the callee has been removed from queue.
Tasks are useful for things such as parallel processes, so you could have a shoobullets(); and movecharacter();, these tasks running a loop within each one, but both executing at the same time.
It's not really at the same time, though. The one called first gets a turn to go first and then gives up its timeslice for the next one, so keep that in mind when dealing with global variables within tasks.
« Last Edit: October 13, 2012, 01:09:58 AM by Fujiwara no Mokou »

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #449 on: October 13, 2012, 12:50:25 PM »
I don't get it...
http://pastebin.com/KUZ9pAFA
Can somebody stoppping explaining it to me and starting giving the full examples?