Author Topic: ※ Danmakufu Q&A/Problem thread 3 ※  (Read 490262 times)

Andi

  • World's Gayest Danmaku
  • PlaySE("./se/Nyaa.wav");
    • 2hu blog
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1080 on: March 26, 2018, 06:20:11 AM »
I'm finally venturing into the wonderful world of packages and have a basic main menu set up (though everything but "Game Start", "Option", and "Quit" is nonfunctional for now). I considered trying to just snag one from some other script to work off of, but couldn't find one that wasn't huge (most of them) and/or horrifying (TresserT's bracket placement). Ended up just doing my own from scratch, looking at Book of Star Mythology for reference when necessary. At this point you can select a difficulty and player and start the game, and mostly everything works. The exception is pausing, which does not happen.

I'm guessing starting the pause script is normally handled by the default package, so I need to do it manually? And same with the end scene? Is there anything else like that that I haven't noticed yet?
Literally everything in this script will crash and burn.
1CC tracker

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1081 on: March 26, 2018, 12:02:41 PM »
It was extra recollection 1, eternal meek. After I add the wait in the code it gives me an error of a bracket missing when there are none missing, but if I add a bracket that's when it gives me a get_center_x not defined error.

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1082 on: March 26, 2018, 12:21:52 PM »
Bracket mismatches can be caused by many things. It's likely you've misplaced a semicolon somewhere.

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

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1083 on: March 26, 2018, 01:28:35 PM »
It was extra recollection 1, eternal meek. After I add the wait in the code it gives me an error of a bracket missing when there are none missing, but if I add a bracket that's when it gives me a get_center_x not defined error.

First and foremost, the guides on my website are meant to be done in order - that is, there are things explained in earlier lessons that are used in later ones.

I highly suggest reviewing the first few guides (3-7) to review Danmakufu's syntax and to be acquainted with the helper functions that I assume you have access to. This should help with syntax errors like the one you are having as well as general variable/function naming and debugging.

In the future, I recommend usage of Ctrl-F. If the number of { does not equal the number of }, you typically have a problem somewhere in your script. Good text editors for programming typically show you where your parentheses (), brackets [], and braces {} match.

Finally, if you show us your code, we can figure out what is going wrong.
« Last Edit: March 26, 2018, 01:31:13 PM by Sparen »

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1084 on: March 26, 2018, 02:14:27 PM »
https://pastebin.com/hagSLxcM
My attempt at coding eternal meek.

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1085 on: March 26, 2018, 03:04:29 PM »
As said, you're missing the closing bracket for rand_int, and also are missing the semicolon in its return round(rand(min, max)). Following this you've also typo'd both in GetCenterU and GetStgFrameHeighr.

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1086 on: March 27, 2018, 12:43:47 AM »
Very sorry to ask again, but even when I made the modifications to the script I still got an error for brackets even though I ran through it multiple times and couldn't find one missing.

Here is the error.
http://tinypic.com/r/243l25j/9
Here is the code.
https://pastebin.com/NVCXSXub

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1087 on: March 27, 2018, 02:19:07 AM »
Semicolon missing at line 38. However, if I run the script I'm getting the expected error of missing brackets, not an undefined function. You shouldn't be getting the error posted unless you modified it further. Once the semicolon was added the script works.

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1088 on: March 27, 2018, 03:55:49 AM »
Thank you Drake.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1089 on: March 27, 2018, 05:38:06 AM »
I'm back again and I have to thank you for helping me last time. After trying out the different aspects of Danmakufu, it seems like I enjoy making player scripts the most. With that in mind I must pose a question.

1.I've been successful making player shots for my player, but I can never get the options (sub shooters, or whatever they're called) to shoot because I really don't know how to plug in that sort of thing. Here's some code I made for the option. Mind you that I'm not the most experienced so explain to me the process as if I'm a child. In short, try to dumb it down for me.

https://pastebin.com/MRC4ryCU

2. I've wanted to make NINE options for my player circling the player in the same fashion as Reimu's TH11 Yukari shot type. As you can see from the code, I've been successful in not only making the option, but mimicking the movement behavior of orbiting the player as well. The only thing I want to know is if there is a simple way of adding 8 more of the same options orbiting the player and how can I do it. Like I said in the first question, try to dumb it down for me.

If you need more information or context, just request it and I'll be sure to answer YOUR question about this question.

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1090 on: March 27, 2018, 07:21:36 AM »
So for the movement, the 50 refers to the radius, or distance between the player and the option, while the cos(angle) refers to the displacement in x-position at that angle. Similarly sin(angle) is the displacement in y-position at that angle. (Speaking of this, your cos and sin are swapped, but in this case it doesn't really matter, it's just as though the angle is moved 90 degrees.)



Given this, if you wanted another option, you would have to set them to a different position around the player, but all you need for that is a different angle (note that the current option moves by change in the angle around the player). So calling another rendernightmare but using angle+something instead would be enough. If you want nine of them, and all evenly spaced, you can divide the 360 degrees into 9 (40 degrees between each). You can do this automatically with an ascent loop:
Code: [Select]
let num_options = 9;
ascent(i in 0..num_options){
  rendernightmare(i * 360/num_options);
}
Then giving rendernightmare the angle as a parameter instead of making the initial angle random.

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1091 on: March 27, 2018, 08:50:29 AM »
So for the movement, the 50 refers to the radius, or distance between the player and the option, while the cos(angle) refers to the displacement in x-position at that angle. Similarly sin(angle) is the displacement in y-position at that angle. (Speaking of this, your cos and sin are swapped, but in this case it doesn't really matter, it's just as though the angle is moved 90 degrees.)



Given this, if you wanted another option, you would have to set them to a different position around the player, but all you need for that is a different angle (note that the current option moves by change in the angle around the player). So calling another rendernightmare but using angle+something instead would be enough. If you want nine of them, and all evenly spaced, you can divide the 360 degrees into 9 (40 degrees between each). You can do this automatically with an ascent loop:
Code: [Select]
let num_options = 9;
ascent(i in 0..num_options){
  rendernightmare(i * 360/num_options);
}
Then giving rendernightmare the angle as a parameter instead of making the initial angle random.


It seems I have trouble plugging it in. Perhaps I'm missing something? Also, I can never understand harnessing the power of parameters.

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1092 on: March 27, 2018, 10:55:26 AM »
Whereever you're calling rendernightmare, you would put that blurb instead. You'd then give the task itself an angle parameter, like task rendernightmare(angle), and remove the part in the code where you initialize it as a random angle. If you don't really get how parameters work you should probably go over tutorials.
« Last Edit: March 27, 2018, 10:57:06 AM by Drake »

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1093 on: March 27, 2018, 11:00:52 AM »
Whereever you're calling rendernightmare, you would put that blurb instead. You'd then give the task itself an angle parameter, like task rendernightmare(angle), and remove the part in the code where you initialize it as a random angle. If you don't really get how parameters work you should probably go over tutorials.

Thing is that I have gone over the tutorials and there is only one little snippet that I found that covers parameters  and it's fairly short to the point where I still dont get it.

JDude :3

  • tururu
  • boy with code
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1094 on: March 27, 2018, 10:12:10 PM »
How can I grow bullets, and their hitbox?
"dnh is hard" - said no one
"dnh is bullshit" - everyone making a creative pattern

Aka Kyuketsuki

  • Team αlternative Σnding
  • Making it rain
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1095 on: March 27, 2018, 10:58:24 PM »
How can I grow bullets, and their hitbox?

First, put your bullet in a pot of nice, moist soil. Sprinkle water at room temperature on a regular basis. Larger bullets need less water. Remember to keep your pot in a place where sunlight shines frequently, such as near a window. In about three weeks or so, your bullet will have become about three times bigger, and have sprouted a hitbox about a third of its size. It will be harder to tell for irregularly-shaped bullets, but in general, they should reach from the center halfway towards the transparent part of their graphic.

You do this by running a while loop, setting a custom hitbox each frame on the position of the bullet. This while loop terminates when your bullet is deleted.

Please refer to these functions for what you should call to set the custom hitbox.

As for expanding the graphic, please refer to these functions.

It may not be necessary to use all of the listed functions, but please use whatever is needed.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1096 on: March 28, 2018, 01:22:45 AM »
First, put your bullet in a pot of nice, moist soil. Sprinkle water at room temperature on a regular basis. Larger bullets need less water. Remember to keep your pot in a place where sunlight shines frequently, such as near a window. In about three weeks or so, your bullet will have become about three times bigger, and have sprouted a hitbox about a third of its size. It will be harder to tell for irregularly-shaped bullets, but in general, they should reach from the center halfway towards the transparent part of their graphic.

Truly quality shitposting. But the true solution is to sprinkle them with POWERBULLET :)

ILS

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1097 on: March 28, 2018, 02:26:05 PM »
For danmakufu ph3, it is not possible to set more vitual keys  for recording in replay, right?
Making one more fake player that can shot and be hit is simple, but the limiting vitual keys is clearly not enough for something, like a double-play stage or so. I hate when I have to cut the replay part when creating such script. :wat:

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1098 on: March 29, 2018, 05:21:01 PM »
For danmakufu ph3, it is not possible to set more vitual keys  for recording in replay, right?
Making one more fake player that can shot and be hit is simple, but the limiting vitual keys is clearly not enough for something, like a double-play stage or so. I hate when I have to cut the replay part when creating such script. :wat:

Please refer to https://dmf.shrinemaiden.org/wiki/Input_Functions

ILS

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1099 on: March 30, 2018, 02:31:56 AM »
Please refer to https://dmf.shrinemaiden.org/wiki/Input_Functions

AddVirtualKey(...) can only map key to a defined virtual key, like VK_LEFT, VK_RIGNT, etc. as shown in wiki (otherwise the program will report an error).
While argument of AddReplayTargetVirtualKey(...) should be a key registered with AddVirtualKey(...) (unregisted key crashes the program in the beginning of replay ).
Which means I can but only record these vitual keys already defined in ph3, not even one more.
Existing vitual keys are:
VK_LEFT VK_RIGHT VK_UP VK_DOWN VK_SHOT VK_BOMB VK_SLOWMOVE VK_USER1 VK_USER2 VK_OK VK_CANCEL VK_PAUSE

Clearly too short in number for two players both have movement, slow, bomb and shot.
Now I use GetKeyState(...) to utilize more keys. But like I said, the replay would fail to record them.
« Last Edit: March 30, 2018, 02:34:34 AM by ILS »

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1100 on: March 30, 2018, 06:06:09 AM »
That documentation is poor. It ignores the main functionality of AddVirtualKey which is exactly what you're looking for.

There are predefined ranges of potential virtual key codes that can be used; there is the range VK_USER_ID_STAGE to VK_USER_ID_STAGE + 255 and the range VK_USER_ID_PLAYER to VK_USER_ID_PLAYER + 255. These are all possible virtual keys you can add. For example, if you wanted a Player 2 shot button you could do
Code: [Select]
let VK_SHOT_P2 = VK_USER_ID_PLAYER + VK_SHOT;
AddVirtualKey(VK_SHOT_P2, KEY_Y, KEY_INVALID);

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

CrestedPeak9

  • Fangame Advocate
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1101 on: March 30, 2018, 09:11:43 AM »
I'm currently wrapping up on production of a Junko boss fight, but I'm now running into problems with bullets randomly not spawning in the later attacks, usually starting 9/10 attacks into the plural. Does anyone know what causes this?
(I'm also using Ultima's DDC ReimuB as the player.)
Lunatic 1cc: EoSD, PCB, IN, MoF, TD, DDC, LoLK, HSiFS, WBaWC

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1102 on: March 30, 2018, 09:32:04 AM »
By "randomly" do you mean actually randomly, intermittently, or suddenly stopping altogether? What does the log window say about the shot count? Do spawning effects still occur? Have you confirmed this with other player scripts, even though that is likely not the issue?

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

CrestedPeak9

  • Fangame Advocate
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1103 on: March 30, 2018, 03:02:50 PM »
By "randomly" do you mean actually randomly, intermittently, or suddenly stopping altogether? What does the log window say about the shot count? Do spawning effects still occur? Have you confirmed this with other player scripts, even though that is likely not the issue?

I don't have any spawning effects for my script, but bullets that don't spawn are actually randomly not spawning (like 2-4 bullets in a ring not necessarily in a row) and they're not just invisible since there's no hitbox where they should be. I tried other shots and they don't appear to cause this...
Lunatic 1cc: EoSD, PCB, IN, MoF, TD, DDC, LoLK, HSiFS, WBaWC

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1104 on: March 30, 2018, 03:07:39 PM »
I don't have any spawning effects for my script, but bullets that don't spawn are actually randomly not spawning (like 2-4 bullets in a ring not necessarily in a row) and they're not just invisible since there's no hitbox where they should be. I tried other shots and they don't appear to cause this...

Can you provide some code snippets and more details about your coding environment, libraries, etc? Are you using multiple shot sheets?

CrestedPeak9

  • Fangame Advocate
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1105 on: March 30, 2018, 03:42:04 PM »
Can you provide some code snippets and more details about your coding environment, libraries, etc? Are you using multiple shot sheets?
https://www.dropbox.com/s/4kyjx2fxxqy87hf/_generic%20junko.zip?dl=0
Lunatic 1cc: EoSD, PCB, IN, MoF, TD, DDC, LoLK, HSiFS, WBaWC

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1106 on: March 30, 2018, 04:29:22 PM »
https://www.dropbox.com/s/4kyjx2fxxqy87hf/_generic%20junko.zip?dl=0

Unable to replicate your issue. My best guess is that your computer's hardware is not capable of handling over 8000 ADD rendered bullets at once and something went wrong with Danmakufu.

CrestedPeak9

  • Fangame Advocate
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1107 on: March 30, 2018, 04:33:10 PM »
Unable to replicate your issue. My best guess is that your computer's hardware is not capable of handling over 8000 ADD rendered bullets at once and something went wrong with Danmakufu.

Given that I've only been experiencing this issue (not just with this script btw) with Ultima's DDC ReimuB I'll pin the blame on that, and just use another player then. Thanks for the help.
Lunatic 1cc: EoSD, PCB, IN, MoF, TD, DDC, LoLK, HSiFS, WBaWC

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1108 on: March 30, 2018, 06:33:27 PM »
Given that I've only been experiencing this issue (not just with this script btw) with Ultima's DDC ReimuB I'll pin the blame on that, and just use another player then. Thanks for the help.

It's rare for Player Scripts to interfere with a non-player script and vice versa. The only example I can think of is Mr. Blue's Reimu including the DNH Default shot sheet and messing up shot constants in scripts.

R. P. Genocraft

  • Craftsman of absolute unpredictability
  • Boundary of productive and lazy
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1109 on: March 30, 2018, 11:11:53 PM »
How do you check how many variables an array has?