Author Topic: Danmakufu Q&A Thread 4 - V3 Edition.  (Read 9787 times)

0 Members and 1 Guest are viewing this topic.

Sparen

  • Danmakufu Artist
    • YouTube
    • AFCDTech
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #30 on: August 26, 2020, 01:55:12 PM »
There are some tasks that I can't understand well, like TStageScene() or RunPauseScene() for example; When are this kind of tasks executed in the package? I recently started to create stage scripts with bosses, so I know that maybe I need more experience but I'm just looking for some advice to start with packages because I'd like to do something bigger. I'll accept anything.

Thanks for the answer

Take a look at the package for how they are defined and used. I don't recommend working with packages until you have a firm understanding of how tasks and scripts work in Danmakufu.

Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #31 on: August 28, 2020, 10:08:10 AM »
I really dont understand how does sprite sheets work. I mean, i have 2 questions

1: Where can i find them?

i tried the "The sprite recourses" web (https://www.spriters-resource.com/pc_computer/touhoufuujinrokumountainoffaith/sheet/51906/) but in the image appears all the bosses, but i only need 1

2: The coordinates

Is there a way to know the sprite's coordinates to dont make it glitch in battle? (Same problem with shot sheets)

thanks
« Last Edit: August 28, 2020, 10:33:33 AM by ThisIsShort »

Sparen

  • Danmakufu Artist
    • YouTube
    • AFCDTech
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #32 on: August 28, 2020, 01:19:51 PM »
I really dont understand how does sprite sheets work. I mean, i have 2 questions

1: Where can i find them?

i tried the "The sprite recourses" web (https://www.spriters-resource.com/pc_computer/touhoufuujinrokumountainoffaith/sheet/51906/) but in the image appears all the bosses, but i only need 1

2: The coordinates

Is there a way to know the sprite's coordinates to dont make it glitch in battle? (Same problem with shot sheets)

thanks

1. You already have what you need. Any image editor can crop the image down to the boss you want

2. Most image editors will tell you the coordinates of a given pixel. In addition, in a sprite sheet, most sprites are the same size, so knowing the height and width of the area with the boss sprites is usually enough to determine the dimensions of a single sprite (e.g. width/#sprites)

xChumbo

  • Beginner
    • Twitter
  • Gender: Male
Stage enemies
« Reply #33 on: August 31, 2020, 01:34:17 AM »
Hello, I'm having troubles creating stage enemies; the thing is, I can create the stage enemies well, but is there a way to make the boss wait until the other enemies are defeated? I've tried some solutions by myself but still all the enemies appear with the boss and I can't make it work.


Another doubt I got is: In the StageEnemy creation, there's the following line: "SetDamageRateAtFrameEnm(objEnemy, 80, 50, 30);". This is a function/task that I'm not really sure what it does; the enemies still work but It would be nice if you can tell me its purpose.

Here's some code if you want to see:

Stage code: [ Attachment: You are not allowed to view attachments ]
STGEnemy code: [ Attachment: You are not allowed to view attachments ]

Thank you for your attention.


Sparen

  • Danmakufu Artist
    • YouTube
    • AFCDTech
  • Gender: Male
Re: Stage enemies
« Reply #34 on: September 01, 2020, 01:24:24 PM »
Hello, I'm having troubles creating stage enemies; the thing is, I can create the stage enemies well, but is there a way to make the boss wait until the other enemies are defeated? I've tried some solutions by myself but still all the enemies appear with the boss and I can't make it work.

Personally, I use this function from Ultima:

Code: [Select]
/* *************************************************************************
*void WaitForZeroEnemy() -- Waits for there to be no enemies on screen
************************************************************************* */
function WaitForZeroEnemy(){ //ULTIMA
    while(length(GetAllEnemyID()) > 0){yield;}
}

Skelly

  • Da-da-daisaku Ikeda
  • Gender: Male
Extend function using item points
« Reply #35 on: November 06, 2020, 02:11:35 PM »
Hello, I'm not so new to danmakufu but have stopped messing with it for a while and wanted to warm up again.

Recently I've been working on a simple function in PH3. Basically a function that extends the player whenever it gets a certain amount of points(Like PCB). The major problem I'm having is with the GetPoint function. It basically doesn't work, not returning the actual points collected.

I have tried checking if my function was written wrong. But I have noticed it works using GetGraze instead. I have also noticed that whenever I try to print the number of points collected(Using text functions), it basically doesn't update the actual count(Notice I am calling the function every frame). So I really wonder if the GetPoint function actually works on PH3...

Here is the function I am refering to(I have called it on the stage script btw): https://pastebin.com/cUxjiM2x

(Apologies if the post is messy, it's my first time posting here.)
Airmoto should be Touhou canon

Sparen

  • Danmakufu Artist
    • YouTube
    • AFCDTech
  • Gender: Male
Re: Extend function using item points
« Reply #36 on: November 08, 2020, 02:21:30 PM »
Recently I've been working on a simple function in PH3. Basically a function that extends the player whenever it gets a certain amount of points(Like PCB). The major problem I'm having is with the GetPoint function. It basically doesn't work, not returning the actual points collected.

I have tried checking if my function was written wrong. But I have noticed it works using GetGraze instead. I have also noticed that whenever I try to print the number of points collected(Using text functions), it basically doesn't update the actual count(Notice I am calling the function every frame). So I really wonder if the GetPoint function actually works on PH3...

Here is the function I am refering to(I have called it on the stage script btw): https://pastebin.com/cUxjiM2x

Danmakufu doesn't actually automatically add points - you need to do so manually via AddPoint.

Personally, I would have a task running in the system script that's checking a CommonData value in order to handle extends, and I'd use a CommonData value to track your custom points.

Skelly

  • Da-da-daisaku Ikeda
  • Gender: Male
Re: Extend function using item points
« Reply #37 on: November 11, 2020, 08:58:43 PM »
Danmakufu doesn't actually automatically add points - you need to do so manually via AddPoint.

Personally, I would have a task running in the system script that's checking a CommonData value in order to handle extends, and I'd use a CommonData value to track your custom points.

I see, gonna check your common data tutorials, thanks for the help!
Airmoto should be Touhou canon

Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #38 on: December 19, 2020, 05:29:02 PM »
Hi, i need help with some bullets. I want to make a hammer fall when the other one is deleted, however, i tried it and this is how it ended: https://gyazo.com/8fcff2a6ef204c393af1559907373f65

Here is the whole code for if i did something wrong with the speed or delay: https://pastebin.com/EEULKn2r

Thanks for the help

Luminous_DNH

  • help the ph3sx broke
  • microintervals of dawn
    • Twitch
    • Twitter
    • Luminous & Dawn#7351
  • Gender: its complicated she/they
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #39 on: February 05, 2021, 07:29:07 PM »
Hi, i need help with some bullets. I want to make a hammer fall when the other one is deleted, however, i tried it and this is how it ended: https://gyazo.com/8fcff2a6ef204c393af1559907373f65

Here is the whole code for if i did something wrong with the speed or delay: https://pastebin.com/EEULKn2r

Thanks for the help

It's a bit embarrassing replying to such an old topic. Do you still need help?  :cirnotan:

Note that I can't see your gyazo video as the link is invalid. Well, first off, your "move", "fire", and "fire2" tasks don't seem to be used anywhere. I would recommend not keeping unused tasks like these around your code.

Second,
Code: [Select]
ascent(i in 30 .. 3300)
{
if(Obj_IsDeleted(GoldHam)){break;}
let shotSpeed = rand(0.5,1.5);
let sx = ObjMove_GetX(GoldHam);
let sy = ObjMove_GetY(GoldHam);
CreateShotA1(sx, sy - 10, rand(0.5,1.5), rand(0,360), 226, 30);
yield;
}

You don't need an ascent loop for this. You could handle this code with a normal loop. Only use an ascent or descent loop when you need to use the iteration variable that comes with it. (in this case, that would be "i")

Now, I'm a bit confused, but are you trying to fire bullets when GoldHam is deleted? If so, then you will never be able to do this because of the following line:
Code: [Select]
if(Obj_IsDeleted(GoldHam)){break;}
This line of code terminates the loop if GoldHam has been deleted. With this line of code, you'll never be able to spawn bullets because GoldHam is deleted, the loop terminates and shots from firing.

Instead, I would handle this with a "while" loop that runs as long as the GoldHam object has *not* been deleted. In this loop, I will save GoldHam's position to a variable and then "yield;". (if you dont put a yield in an infinite loop, DNH will freeze up as it tries to do infinite things all at once.) The yield also makes DNH stay parsing the loop until the condition becomes false (in this case, until GoldHam is deleted). Meanwhile, there's a reason GoldHam's position has to be saved and updated within this loop. By the time you fire shots, GoldHam has already been deleted. If you try to spawn another object at the X and Y position of an object that does not exist, it will instead spawn at the top left corner of the playing field. Because of this, you will have to save the hammer's last position in the "while" loop. I would do it like so:
Code: [Select]
let sx = 0;
let sy = 0;
while(!Obj_IsDeleted(GoldHam)){
         sx = ObjMove_GetX(GoldHam);
sy = ObjMove_GetY(GoldHam);
         yield;
}
CreateShotA1(sx, sy - 10, rand(0.5,1.5), rand(0,360), 226, 30);

Hopefully this is a clear example, but when GoldHam gets deleted, DNH will stop processing the while loop and will continue to what's directly below. At this point, it will spawn your new shot at the X and Y position GoldHam was at just before it got deleted.

Again, I hope I described this in a way that makes sense. If you still need help, I suggest you join the Bullet Hell Engines Discord server. (https://discord.gg/4wNvvPHxeU)

 
« Last Edit: February 05, 2021, 07:33:40 PM by Luminous_DNH »
aCTUALLY HELP

Katach314

  • Existence Participation Award-Winner
  • Aren't you that guy who likes masks too much?
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #40 on: April 21, 2021, 08:57:54 PM »
I have a question pertaining to (what appears to be) a (relatively) popular script, ExPorygon's ZUN Expanded Shotsheet (https://www.bulletforge.org/u/ozzy/p/zun-expanded-shotsheet-for-ph3).

After installing this script, I attempted to use it by #include-ing a specific one of its .txt files (as the readme told me to). However, once I tried to play the script and selected my character, Danmakufu froze for a few seconds and then closed itself.

According to this site (https://sites.google.com/site/sparensdanmakufututorials/dnh-0-12m-tutorials-part-3/014-intro-to-danmakufu-part-4#TOC-ERR-A01:-Danmakufu-crashes), the problem seems to have to do with system locale. However, my locale has been set to Japanese for some time now, so I have no idea what could be causing the problem.

Does anyone know what is causing this problem? (I would prefer not to switch to a different bullet script, as this one seems to be of the highest quality, and... I've already spent an hour or so making a reference sheet for the bullets used by this script.)

EDIT: I tried reverting my script back to when it used the default shots, but it still crashes Danmakufu just before the spell begins for no apparent reason. The part that makes it crash is as follows:

Code: [Select]
task MainTask{
    wait(120);
    while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){
        let angleT = GetAngleToPlayer(objBoss);
        loop(13) {
CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2,
angleT, DS_BALL_S_RED, 5);
angleT += 360/13;
}
    }
}

EDIT 2: I found what was causing the crash... I forgot to add a yield in that task. My apologies.
« Last Edit: April 22, 2021, 05:02:56 AM by Katach314 »

Pivot Lever

  • Silly writer/artist just starting out in code.
  • The vase took a break.
    • Twitter
    • Pivot Whiteground Lever#9299
    • Steam
  • Gender: Female
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #41 on: May 07, 2021, 04:07:47 AM »
Hi there! Just started coding in Danmakufu (basically a beginner), got a small Single script going, but I ran into a slight issue. While it may seem simple, I wasn't sure where to ask, so I'll ask here. How would I make a bullet that has gravity (as in, would fall down after a delay when initially shot upwards)? If it's a specific shot function, please direct me to the correct one, or if it requires extra steps, please provide some tips! Given I'm just starting out, I'm not familiar with all of the shot functions yet, so that's why I'm asking. Any help would be greatly appreciated!

Katach314

  • Existence Participation Award-Winner
  • Aren't you that guy who likes masks too much?
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #42 on: May 12, 2021, 09:38:41 PM »
Try using this (https://sparen.github.io/ph3tutorials/docs_standard.html#fxn_CreateShotA2) function. Have the bullet's Y speed accelerate to create the illusion of falling. Have the X speed decelerate instead so it dips down the longer it's there.

I'm a newbie too! I guess the regulars don't check this thread too often.

EDIT: Wait, I had some questions, too!
  • How does one modify what sprites are used by default system stuff (like the border or the numbers used for the score)? I think the default dnh sprites for the items are grody and wish to replace them with different ones.
  • Are there any scripts that replace the default lifebar system with the ring lifebar system?
  • Same as above, but for a symbol- rather than number-based lives/bullets system? BulletForge doesn't seem to have anything relevant related to either.
« Last Edit: May 12, 2021, 09:54:03 PM by Katach314 »