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

0 Members and 1 Guest are viewing this topic.

WishMakers

  • Myouren's IT Guy
  • *
  • Console.WriteLine("h*ck");
    • Twitch
    • Twitter
    • YouTube
    • WishMakers#0385
    • Steam
    • Analogue Reverie Website
  • Gender: Male
Danmakufu Q&A Thread 4 - V3 Edition.
« on: April 19, 2020, 08:05:10 PM »
Welcome to the Danmakufu Q/A thread!  This is a continuation of the V2 thread, finally back in action.
Ask your questions here should you have a problem with Danmakufu, be it an error that you can't find, problem with the program, etc.

Previous thread
Danmakufu Wiki
DNH Function Docs
Major Info Thread
« Last Edit: May 15, 2020, 07:07:04 AM by Tom »
Also known as the Return of Eastern Wonderland and Danmakufu Woo Edition guy.

1ccs: SoEW (N), LLS (N), MS (N), EoSD (H), PCB (N), IN (H), PoFV (N, all shots), MoF (N), SA (N), UFO (N), TD (N), DDC (N), LoLK (N), HSiFS (L), WBaWC (N)
Extra 1ccs: All Windows mainline games, including PoFV.
Scoring: HSiFS Easy (PB: 1.1b)

Nickster206

    • Visit my Youtube channel! I document script progress regularly.
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #1 on: April 26, 2020, 02:18:17 AM »
I'm having trouble animating a "gravitational aura" around a boss. The only Danmakufu scripts I've come across that have made use of these can be found here (https://www.youtube.com/watch?v=2hVmjJrUzmM) and here (https://www.youtube.com/watch?v=bxf9Hvkx5oE). In case I'm not clear, I mean the circle around the boss that causes the background to pulsate and warp. I've examined both of these scripts' code and am still unsure how it was accomplished. Can someone help?

EDIT: Nevermind, I got it to work!
« Last Edit: April 30, 2020, 05:07:58 PM by Nickster206 »

Nickster206

    • Visit my Youtube channel! I document script progress regularly.
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #2 on: May 03, 2020, 03:13:29 AM »
I have a new question! I'm struggling with understanding packages. When I launch th_dnh.exe, I want it to immediately run the package declared in th_dnh.def like package.script.main = x/y/z.dnh. Despite having declared the package as such in the .def file, the package does not launch automatically, and I am instead brought to the regular Danmakufu menu. I checked to make sure the path was correct, and the package works if I select it from the menu. What am I missing?

Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #3 on: May 08, 2020, 08:16:37 PM »
Greetings! I am relatively new to Danmakufu, working my way through Sparen's tutorials, trying out my own stuff or to tinker with his provided code for learning's sake - long story short, for some reason the task TFinalize he provides only goes off in one of my scripts. I always call it in @Initialize, I have moved it into a function library outside of the pastebins below to ensure all my scripts make use of the same TFinalize task and, quite frankly, I am stumped. :( It does work in all my scripts when moved into @MainLoop, but then awards way too many points on spell capture for obvious reasons.

I've tried to search the old forum as well as Google for my issue before posting here, but have not found aught that could help me - doesn't mean it's not there, merely that I failed to find it.

https://pastebin.com/MucNFquT One of my scripts where TFinalize does not work.

https://pastebin.com/urXMyXZN My script where TFinalize does work.

Apologies if I missed out on anything else you might need!

EDIT: Please do notify me if I did. I... generally try to avoid getting help since most of the time, it's just me being stupid or my search engine fu being weak, so I'm far from used to making these posts...

EDIT 2: I am a fool thrice over and I have figured it out - I needed to yield; in @MainLoop... still leaving the post here in case anyone else stumbles over the same issue - my utmost apologies ;_;
« Last Edit: May 09, 2020, 02:30:05 PM by Icemoon »

WishMakers

  • Myouren's IT Guy
  • *
  • Console.WriteLine("h*ck");
    • Twitch
    • Twitter
    • YouTube
    • WishMakers#0385
    • Steam
    • Analogue Reverie Website
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #4 on: May 09, 2020, 11:26:03 PM »
Quote
Despite having declared the package as such in the .def file, the package does not launch automatically, and I am instead brought to the regular Danmakufu menu. I checked to make sure the path was correct, and the package works if I select it from the menu. What am I missing?

Here's a good example of a def file, just in case you're still stuck.
Code: [Select]
window.title = <redacted>
package.script.main = Script/package.dnh
screen.width=640
screen.height=480
I'm sure you have everything like that, but make sure the name of the .def file is th_dnh.def and in the same folder as the exe.  Other than that, I'm not sure personally, but I don't work with .def files very often.
Do you have any more info about the issue?  What does your setup look like?
« Last Edit: May 10, 2020, 06:12:52 AM by WishMakers »
Also known as the Return of Eastern Wonderland and Danmakufu Woo Edition guy.

1ccs: SoEW (N), LLS (N), MS (N), EoSD (H), PCB (N), IN (H), PoFV (N, all shots), MoF (N), SA (N), UFO (N), TD (N), DDC (N), LoLK (N), HSiFS (L), WBaWC (N)
Extra 1ccs: All Windows mainline games, including PoFV.
Scoring: HSiFS Easy (PB: 1.1b)

Nickster206

    • Visit my Youtube channel! I document script progress regularly.
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #5 on: May 10, 2020, 04:58:54 PM »
Thank you so much for your reply! I tried messing around with the .def file after seeing your sample, and I figured out the problem!

I had declared package.script.main before window.title, and my window title had a "~" character in it. Even though the window would work with the ~ and launch to the regular danmakufu window, after removing it, it launched the package!

For further context, I am using your Woo version of Danmakufu, if that makes any difference in how the .exe interprets the .def. Either way, thank you for your help! It is greatly appreciated.  :D

Hyouiibara

  • The bittersweet teacher of life
  • Best quote: "Hm, something smells weak~"
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #6 on: May 19, 2020, 09:51:53 AM »
I'm new to danmakufu, and each time I tried to run the engine, it crashes and leaves a file called "Gcprojectcrash", I already used locale emulator and I downloaded the Ph3 version

I already posted it in Moriya shrine, but no one replied

Thank you for your reply!

Pichuun!  :power: :power: :power: :bigpower: :power: :power: :power:
Ran is hard, Yukari is lunatic. Keep kalm and rember ur hepi dei

WishMakers

  • Myouren's IT Guy
  • *
  • Console.WriteLine("h*ck");
    • Twitch
    • Twitter
    • YouTube
    • WishMakers#0385
    • Steam
    • Analogue Reverie Website
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #7 on: May 21, 2020, 05:17:09 PM »
Quote
I'm new to danmakufu, and each time I tried to run the engine, it crashes and leaves a file called "Gcprojectcrash", I already used locale emulator and I downloaded the Ph3 version

Can you explain your problem in more detail?  What script were you trying to run, if any?  When and where does it crash?
For the record, for PH3 Locale Emulator shouldn't be necessary so if you turn that off I think you'll be fine.
Also known as the Return of Eastern Wonderland and Danmakufu Woo Edition guy.

1ccs: SoEW (N), LLS (N), MS (N), EoSD (H), PCB (N), IN (H), PoFV (N, all shots), MoF (N), SA (N), UFO (N), TD (N), DDC (N), LoLK (N), HSiFS (L), WBaWC (N)
Extra 1ccs: All Windows mainline games, including PoFV.
Scoring: HSiFS Easy (PB: 1.1b)

Lapis Lazuli

    • 🌈Lapis Lazuli🌈#1508
  • Gender: Trans girl
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #8 on: May 22, 2020, 10:42:32 PM »
Hello friends!
So I've been following Sparen's Danmakufu ph3 tutorials for a while, but I've gotten stuck at the process of creating a plural. Whenever I create a plural and try to run it in Danmakufu, the game refuses to give me an error warning and simply crashes on the spot, even though I've created the simplest plural imaginable. But, still, here's the text file for it:

Code: [Select]
#TouhouDanmakufu[Plural]
#ScriptVersion[3]
#Title["Vs. Momiji"]
#Text["For Kiiro"]

@Event
{

}
@Initialize
{
TPlural;
}
@MainLoop
{
yield;
}

task TPlural
{
    let dir = GetCurrentScriptDirectory();
    let obj = ObjEnemyBossScene_Create();
// ObjEnemyBossScene_Add(obj, 0, dir ~ "momiji 1.txt");
ObjEnemyBossScene_Add(obj, 0, dir ~ "momiji spell 1.txt");
ObjEnemyBossScene_LoadInThread(obj);
    ObjEnemyBossScene_Regist(obj);
    while(!Obj_IsDeleted(obj)){
        yield;
    }
    CloseScript(GetOwnScriptID());
}

Again, I get no error message, so I have no idea what could be going wrong. Can anyone give me a hand, please? Thank you so much.

EDIT: Figured it out! Turns out it has to do with how notepad++ saves .txt files.
« Last Edit: May 23, 2020, 02:54:36 PM by Lapis Lazuli »

Nickster206

    • Visit my Youtube channel! I document script progress regularly.
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #9 on: May 24, 2020, 03:56:16 PM »
I've got some trouble working with Package scripts now. When I run all my singles, plurals, and the stage through the normal menu everything works as intended. However, when I launch the game through the package script, something strange happens.

Whenever I hit "Retry from Beginning" in my pause script which returns RESULT_RETRY, it keeps the game paused, and a new instance of the game opens up in the same window while the previous instance remains paused. At this point, there will be a paused instance of the stage and a running instance of the stage, and only the running instance detects key inputs. If I repeatedly select retry, more instances of the stage will open in the same way.

If I hit "Return to Title" for RESULT_END, the currently running instance of the stage will close because of TerminateStageScene(), and the most recent previous instance of the game will render and begin accepting key inputs. This will continue until all instances of the stage are closed, at which point, the package will close.

The code for my package script is below.

EDIT: I found out what the problem was. I was restarting the stage from the pause menu, meaning I couldn't finalize the stage scene. I moved the recursive TStageScene call to a point after calling FinalizeStageScene and now it works.

Code: [Select]
#TouhouDanmakufu[Package]
#Title["Touhou ~ Forlorn Souls of Wicked Past"]
#Text["-NL"]
#System["./system/Default_System.dnh"]
#Player["./player/player_reimu.dnh"]

@Initialize{
  TStageScene(GetCurrentScriptDirectory ~ "x1/stage1.dnh", GetCurrentScriptDirectory ~ "player/player_reimu.dnh", "");
}

@MainLoop{
  yield;
}

@Finalize{}

// STAGE SCENE                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
task TStageScene(let stagePath, let playerPath, let replayPath){
  ClearCommonData;

  // Prepare the Stage Scene                    ------------------------------
  InitializeStageScene();

  // If a replay was called                     ------------------------------
  if(length(replayPath) > 0){
    SetStageReplayFile(replayPath);
  }

  let indexStage = 1;
SetStageIndex(indexStage);
SetStageMainScript(stagePath);
SetStagePlayerScript(playerPath);
StartStageScene();

  loop{
    // Hitting the pause key
if(GetVirtualKeyState(VK_PAUSE) == KEY_PUSH){
let resPause = RunPauseScene();
alternative(resPause)
case(RESULT_RETRY){
if(!IsReplay()){
TerminateStageScene();
TStageScene(stagePath, playerPath, replayPath);
          ClearCommonData;
}
}
case(RESULT_END){
TerminateStageScene();
        // ClosePackage();
}
}

let stgSceneState = GetStageSceneState();
if(stgSceneState == STAGE_STATE_FINISHED){

let stageResult = GetStageSceneResult();
alternative(stageResult)
case(STAGE_RESULT_CLEARED){
        TEndScene();
        break;
}
case(STAGE_RESULT_PLAYER_DOWN){
TEndScene();
break;
}
case(STAGE_RESULT_BREAK_OFF){
// TTitleScene();
        TEndScene();
        // ClosePackage();
break;
}
}

    yield;
  }
}

// PAUSE SCENE                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function RunPauseScene{
RenderSceneToTransitionTexture();
PauseStageScene(true);

let pathScript = GetCurrentScriptDirectory ~ "system/New_Pause.dnh";

let idScript = LoadScript(pathScript);
StartScript(idScript);

while(!IsCloseScript(idScript)){
yield;
}

PauseStageScene(false);

let res = GetScriptResult(idScript);
return res;
}

// END SCENE                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
task TEndScene{
if(IsReplay){
// TTitleScene();
return;
}

FinalizeStageScene();

  while(GetVirtualKeyState(VK_OK) != KEY_FREE){yield;}

let dirModule = GetModuleDirectory();
let pathScript = GetCurrentScriptDirectory ~ "system/New_EndScene.dnh";
let idScript = LoadScript(pathScript);
StartScript(idScript);

while(!IsCloseScript(idScript)){
yield;
}

let result = GetScriptResult(idScript);
alternative(result)
case(RESULT_SAVE_REPLAY){
TReplaySaveScene();
}
case(RESULT_END){
// TTitleScene();
    ClosePackage();
}
case(RESULT_RETRY){
TStageScene("","","");
}
}

// REPLAY SAVE SCENE                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
task TReplaySaveScene{
let dirModule = GetModuleDirectory();
let pathScript = GetCurrentScriptDirectory ~ "system/New_ReplaySaveScene.dnh";

let idScript = LoadScript(pathScript);
StartScript(idScript);

while(!IsCloseScript(idScript)){
yield;
}

// TTitleScene();
  ClosePackage();
}

function RenderSceneToTransitionTexture{
let textureName = GetTransitionRenderTargetName();
RenderToTextureA1(textureName, 0, 100, true);
}
« Last Edit: May 29, 2020, 03:32:50 PM by Nickster206 »

Hyouiibara

  • The bittersweet teacher of life
  • Best quote: "Hm, something smells weak~"
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #10 on: May 26, 2020, 10:00:21 AM »
Can you explain your problem in more detail?  What script were you trying to run, if any?  When and where does it crash?
For the record, for PH3 Locale Emulator shouldn't be necessary so if you turn that off I think you'll be fine.
I tried to run the EXRumia script, I'm on Windows 10, and every time I tried to run the Danmakufu it just crashes and left an error BMP. File. Had a Segurazo virus once, note that
Ran is hard, Yukari is lunatic. Keep kalm and rember ur hepi dei

MakiBlank

  • Maki
    • Twitch
    • Twitter
    • YouTube
    • MakiBlank#1653
  • Gender: Apache Helicopter
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #11 on: June 23, 2020, 09:00:02 AM »
Hello, been working on a coding a player for a while, I'm trying to figure out how to animate my character, which the tutorial I was using (Helepolis) didn't cover much, here's my code for rendering the player

https://pastebin.com/364tY5rd

For some reason, it doesn't seem to be animating, just staying on one static sprite based on the key presses. any ideas on why/ a better way to do it?


Tsukasa

  • Actually a white mage?
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #12 on: July 02, 2020, 11:34:45 PM »
Hello, been working on a coding a player for a while, I'm trying to figure out how to animate my character, which the tutorial I was using (Helepolis) didn't cover much, here's my code for rendering the player

https://pastebin.com/364tY5rd

For some reason, it doesn't seem to be animating, just staying on one static sprite based on the key presses. any ideas on why/ a better way to do it?

The way you have it now, every single frame, you're defining a new variable under those two names initialised to the value 0 -- you don't want that.

Instead, you want to define animFrame and animFrame2 outside of the while loop, not inside.

MakiBlank

  • Maki
    • Twitch
    • Twitter
    • YouTube
    • MakiBlank#1653
  • Gender: Apache Helicopter
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #13 on: July 04, 2020, 05:26:43 AM »
The way you have it now, every single frame, you're defining a new variable under those two names initialised to the value 0 -- you don't want that.

Instead, you want to define animFrame and animFrame2 outside of the while loop, not inside.
Ah, it seems that was what I have overlooked, thanks!

Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #14 on: July 24, 2020, 05:42:34 PM »
Hi!
It's being a long time since I came here for the last time (I mean, it was still the old MotK forum...).

I have just a question... where is the danmakufu wiki with all the functions now? Last time I checked it it was here: http://dmf.shrinemaiden.org/wiki/Main_Page
But it's dead now. Please tell me all this usefull stuff is not lost for ever. Tell me that the danmakufu comunity is not dead.

Sparen

  • Danmakufu Artist
    • YouTube
    • AFCDTech
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #15 on: July 25, 2020, 02:04:53 PM »
Hi!
It's being a long time since I came here for the last time (I mean, it was still the old MotK forum...).

I have just a question... where is the danmakufu wiki with all the functions now? Last time I checked it it was here: http://dmf.shrinemaiden.org/wiki/Main_Page
But it's dead now. Please tell me all this usefull stuff is not lost for ever. Tell me that the danmakufu comunity is not dead.

Wiki is down permanently as noted in one of the forum transfer threads. If it is resurrected, it will be in a different form.

If you need the function reference, the wiki is saved on the Wayback Machine and many parts have already been saved and backed up to websites (e.g. https://sparen.github.io/ph3tutorials/docs.html) and into various plugins for IDEs.

Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #16 on: July 25, 2020, 07:04:59 PM »
Thanks for the answer. That's not a good news for the wiki but I'm glad some people and The WaybackMachine saved the functions list.
I'm gonna work on a .doc to save this in one more place. This list is too precious to be lost.

Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #17 on: August 04, 2020, 12:51:47 PM »
Hello

Is there a way or a work around to add optional parameters with a default value in functions or tasks ?

Thanks

Sparen

  • Danmakufu Artist
    • YouTube
    • AFCDTech
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #18 on: August 06, 2020, 02:53:06 AM »
Hello

Is there a way or a work around to add optional parameters with a default value in functions or tasks ?

Thanks

In default Danmakufu ph3, there is no way to do this, unfortunately. There is also no reliable way to check the type of an input or check if a value has been assigned, so you also can't perform null checks.

The only real case where defaults exist is for built-in systems like object values and CommonData.

Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #19 on: August 06, 2020, 02:52:45 PM »
Found this active branch which does allow overcharging functions and type checking https://github.com/Natashi/Touhou-Danmakufu-ph3sx-2

Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #20 on: August 15, 2020, 02:30:43 PM »
Hi, im starting with danmakufu and i have trouble with lasers that they dont show in the battle.

Here is all the code: https://pastebin.com/Cmc6gw5b


Thanks
« Last Edit: August 15, 2020, 02:34:08 PM by ThisIsShort »

Sparen

  • Danmakufu Artist
    • YouTube
    • AFCDTech
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #21 on: August 16, 2020, 01:52:06 AM »
Hi, im starting with danmakufu and i have trouble with lasers that they dont show in the battle.

Here is all the code: https://pastebin.com/Cmc6gw5b


Thanks

Are the graphic IDs you used defined in your shot sheet?

Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #22 on: August 17, 2020, 04:21:07 PM »
How important / Useless  is the "Bullet Controll" Thing?

And what are the dhn archives?
« Last Edit: August 17, 2020, 05:29:30 PM by ThisIsShort »

Sparen

  • Danmakufu Artist
    • YouTube
    • AFCDTech
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #23 on: August 19, 2020, 01:19:05 PM »
How important / Useless  is the "Bullet Controll" Thing?

And what are the dhn archives?

I'm not sure what you're referring to by Bullet Controll

As for DNH Archives, they are a way of compressing a bunch of files (e.g. images, sound) into a single file. It makes it harder for people to access the contents inside.

Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #24 on: August 21, 2020, 11:34:19 AM »
I was wondering why Rumia just shoots at her spawn position
For the "shoots when she spawned" use a wait(60); before the loop

task Fire{
   let angleT = GetAngleToPlayer(objBoss);

        wait(60);
   loop(12){
      CreateShotA1(bossX, bossY, 2, angleT, DS_BALL_S_RED, 5);
      angleT += 360/12;      
   }
   
}
« Last Edit: August 21, 2020, 02:07:30 PM by ThisIsShort »

Sparen

  • Danmakufu Artist
    • YouTube
    • AFCDTech
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #25 on: August 21, 2020, 01:19:58 PM »
I'm just wondering if there's a way to make Rumia shoot for the entire length of the script

You're going to want to make your Fire task have a loop.

For starters, you can use the following to repeat some code over and over again.

while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0) {
  // Firing bullets + some wait time goes here
}



xChumbo

  • Beginner
    • Twitter
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #26 on: August 24, 2020, 04:14:59 AM »
Hi, I'm following Sparen's tutorial, but i noticed that it has no information about packages and the way they are handled; so I don't really know where to start to create one.

The question is: Should I use the ExRumia package as a reference? Is there some magical tutorial or something else that I can use to learn more about packages?

Thank you for your attention :cirnotan:

Tsukasa

  • Actually a white mage?
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #27 on: August 24, 2020, 08:39:38 AM »
packages

What don't you understand about the ExRumia package? The most basic package lesson would simply cover something like it, since it contains mostly everything you need to run a game anyway.

xChumbo

  • Beginner
    • Twitter
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #28 on: August 24, 2020, 08:04:42 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

Sparen

  • Danmakufu Artist
    • YouTube
    • AFCDTech
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #29 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.