Author Topic: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry  (Read 243865 times)

Drake

  • *
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #780 on: October 09, 2015, 10:59:33 PM »
Manually, and what Sparen was talking about:
Code: [Select]
if (((ObjMove_GetX(player) - ObjMove_GetX(bullet))^2 + (ObjMove_GetY(player) - ObjMove_GetY(bullet))^2 )^0.5 < radius) {
  doStuff();
}

The distance between two points (x1, y1) and (x2, y2) is sqrt((x1 - x2)^2 + (y1 - y2)^2).

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

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #781 on: October 10, 2015, 06:43:23 PM »
I need a help!
How can I make spell, that not depends of boss life.
For example: Spell without boss life, and it finishes, only when time is threw. But, also there should be a SpellCardBonus!

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #782 on: October 10, 2015, 09:05:25 PM »
Set the following in your spellcard @Event
Code: [Select]
case(EV_REQUEST_IS_DURABLE_SPELL) {
SetScriptResult(true);
}

Make sure the boss has no collision (so you cannot harm it). Unless you do want to harm it but prevent HP going down, set Damage rates to 0.


In case of custom system scripts > Timeout triggers the following event which you can catch in a system script or somewhere. You can use this to do something special in case of a time out (FX, SFX etc).
Code: [Select]
case(EV_TIMEOUT) {
if(!ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_IS_DURABLE_SPELL)) {
// Show custom FAIL SPELLCARD etc.
}
}

case(EV_GAIN_SPELL)  is automatically triggered when a spellcard is set to durable and the player captures it, so scoring and such can be handled there.

Hope that helps out.

Edit:
Did some adjustments.
« Last Edit: October 10, 2015, 09:10:35 PM by Helepolis »

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #783 on: October 11, 2015, 07:28:56 PM »
@Helepolis
Thanks a lot! All is working!

(P.S. I'm making Touhou Treasure Castle Labyrihtn Extra Stage full! Will be super.Soon coming.)

Failure McFailFace

  • I'm h...a...p...p...y...
  • Impor
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #784 on: October 21, 2015, 06:47:39 AM »
Is there any specific scripting/programming language Danmakufu is based off on? It feels like JavaScript, but you can do multiple things at once...
1cc Easy: DDC (all) | 1cc Normal: UFO (SanA autobomb),  DDC (ReiA, SakA) , LoLK (Sanae PD)| EX clears: DDC (MarB Ultra) | Puzzle Games: StB: 10-X, DS: Hatate unlock, ISC: All clear

Drake

  • *
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #785 on: October 21, 2015, 07:34:41 AM »
The script engine (and assumedly the game engine as well) is written in C++ and script syntax is meant to resemble a C-like language with some special extras for working with the engine's event loops and tasks and stuff.

Also, to clarify, Danmakufu does not run any sort of "true" parallelism either, it performs its multitasking through a coroutine implementation, not that that's super important to know for scripters.

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

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #786 on: October 21, 2015, 02:39:12 PM »
JavaScript, and dnh only has it's C syntax in common. There are alot of things that dnh doesn't do, such as how all functions in JS are considered objects and can be stored as variables with their own invocation methods, etc... Certain implementations of JavaScript support coroutines for asynchronous like behavior btw. Although, you'd have to control it yourself.

Danmakufu gives you bare bones syntax with no real special qualities, which is fine given the ultimate goal of the engine is to make Touhou fanworks easy.

Lollipop

  • stay woke
  • literally and figuratively dying
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #787 on: October 23, 2015, 06:22:41 PM »
How would I make it so that the boss starts with an idle animation, but when it moves, it switches to a moving animation which overrides the idle animation until it stops moving?
Touhou 1CCS:
Hard: LLS, EoSD(NB), PCB(NB), IN, MoF, TD, DDC(NB), LoLK
Lunatic: EoSD, PCB, DDC, LoLK
Extra: LLS, EoSD, PCB(Extra&Phantasm), IN, MoF, SA, DDC, LoLK
Current Focus: 1cc SA Hard, or an Extra

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #788 on: October 23, 2015, 06:50:40 PM »
How would I make it so that the boss starts with an idle animation, but when it moves, it switches to a moving animation which overrides the idle animation until it stops moving?

One way to implement this is to set the idle source rect, and then check if the boss is moving (i.e. ObjMove_GetSpeed() > 0). If so, set a new source rect.

Lollipop

  • stay woke
  • literally and figuratively dying
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #789 on: October 23, 2015, 09:21:40 PM »
Oh, there's a function for that? (I feel like an idiot)

edit:
Another question, when I declare a variable (say, a bullet) in a loop{} (which is in a task), it seems to be local to the loop{} only, not public i.e I can't call it outside of the loop{} in the same task or outside of the task. Anyone know how to make them public? (At least to the task, but to the whole script would be cool.)
« Last Edit: October 24, 2015, 06:57:16 AM by Helepolis »
Touhou 1CCS:
Hard: LLS, EoSD(NB), PCB(NB), IN, MoF, TD, DDC(NB), LoLK
Lunatic: EoSD, PCB, DDC, LoLK
Extra: LLS, EoSD, PCB(Extra&Phantasm), IN, MoF, SA, DDC, LoLK
Current Focus: 1cc SA Hard, or an Extra

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #790 on: October 24, 2015, 01:51:06 AM »
Another question, when I declare a variable (say, a bullet) in a loop{} (which is in a task), it seems to be local to the loop{} only, not public i.e I can't call it outside of the loop{} in the same task or outside of the task. Anyone know how to make them public? (At least to the task, but to the whole script would be cool.)

If you would like to make a variable global to a block, simply declare it outside of the block. If you want to make true global variables, define them outside all blocks. The usual place to declare global variables is between the Danmakufu Header and @Initialize.

For further reading: http://sparen.github.io/ph3tutorials/ph3u1l4.html#sub6

Edit: I've added an additional example of scope. It should make things clearer for now.
« Last Edit: October 24, 2015, 02:03:05 AM by Sparen »

GuardianTempest

  • Adorably Awkward Android
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #791 on: October 29, 2015, 01:25:02 AM »
Is it possible to make the BGM persist between phases when you declared it within the first single script instead of the stage or plural script?

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #792 on: October 29, 2015, 02:37:52 AM »
Is it possible to make the BGM persist between phases when you declared it within the first single script instead of the stage or plural script?

Technically speaking, a BGM loaded in one script cannot be accessed outside of that script.

If you want a BGM to persist throughout part of or most of a boss battle, you must control the music in the plural, in the stage, or you must use a NotifyEvent to trigger the start and stop of the sound.

Nefer007

  • Nefer007, Shinto God of Insects, Doctorate in Referralology
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #793 on: October 31, 2015, 01:20:56 PM »
Hello. This is Nefer Nightbug, Shinto God of Insects here.

I've had an idea sitting in the back of my head for, like, ages now.
My original intention was to do it in Blender, but, there's no way to aim bullets.

Is Danmakufu capable of handling...
  • Circular combat, like in a circular arena?
  • Actual stages, with fairies and things?
  • Six stages, the Extra Stage, the Phantasm Stage, and one more stage?
  • Stages without midbosses or bosses?
  • Heavy amounts of Blender modeling and animation?
  • Multiple hitpoints, but no lives (a bit like a cross between Legacy and Pointdevice Modes?)

Thank you.
Looking for Desunoya music! Help me obtain these ill-gotten goods!

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #794 on: October 31, 2015, 01:39:17 PM »
Hello. This is Nefer Nightbug, Shinto God of Insects here.

I've had an idea sitting in the back of my head for, like, ages now.
My original intention was to do it in Blender, but, there's no way to aim bullets.

Is Danmakufu capable of handling...
  • Circular combat, like in a circular arena?
  • Actual stages, with fairies and things?
  • Six stages, the Extra Stage, the Phantasm Stage, and one more stage?
  • Stages without midbosses or bosses?
  • Heavy amounts of Blender modeling and animation?
  • Multiple hitpoints, but no lives (a bit like a cross between Legacy and Pointdevice Modes?)

Thank you.
I am not quite sure if this is a joke question or not. I'll answer them regardless:
1) Yes
2) Yes
3) Yes
4) Yes
5) Until you hit limits, yes
6) Yes, if you script it yourself.

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #795 on: November 01, 2015, 01:28:28 AM »
It seems like you haven't researched the engine at all. There have been a number of full Touhou fangames made in danmakufu.

Your 5th question is abit concerning, you cannot go crazy with heavy model rendering, dnh is very fragile with performance and things like that aren't it's specialty at all. Animations are supported by a japanese animating program but the it is a moot point, the animation functions error. The author of the engine has taken an unexpected leave and it doesn't seem like he will be back soon. If this is something essential to your game then I would gladly direct you to use something that could better suit that requirement.

Danmakufu does alot but it isn't your all in one anything. It is designed primarily for danmaku games but obviously through exploiting the flexibility of the engine you can achieve other things. Should you settle for cheap tricks? no. Use something that better suits your requirements.

tldr: with the exception of the 5th question, everything else is highly possible.
« Last Edit: November 01, 2015, 01:30:36 AM by Sage Ω (Ultima) »

Uruwi

  • Nightmare of Torrential Precipitation
  • 478 million goober
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #796 on: November 01, 2015, 02:28:15 AM »
Another 3D question: what is the standard method to render a long, endless path or hallway?
foo = foldl $ flip ($)
Highest difficulty 1CCed for each game, by shot type in the original order. (-: never 1CCed on any difficulty, or never used; E: easy, N: normal, H: hard, L / U: lunatic / unreal.)
EoSD [NNNE] PCB [EE--N-] IN [NEEE + Ex Border] PoFV [Mystia N, Mystia E no charge] MoF [EN--H- + Ex Marisa B] SA [N-----] UFO [----EN] TD [NENE] DDC [EE-EHE + Ex Marisa B & Sakuya A] LoLK [PD --N- Legacy ---N] EE [N- + Ex Yabusame] EMS [N-- + Ex Yabusame] RMI [NHN + Ex YaoSuku]
Avelantis (demo) Easy YuukiB 426,077,200

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #797 on: November 01, 2015, 08:17:50 AM »
Another 3D question: what is the standard method to render a long, endless path or hallway?
There is no standard method, only preferred method. For simplicity with little to no 3D-elements you can use Texture UV scrolling. For more control + complexity you can use Z-position scrolling and resetting the pieces behind fog / vision.

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #798 on: November 03, 2015, 03:22:49 AM »
Are there any ph3 player scripting tutorials out there? I can't find any and most player scripts I do find are for 0.12m. If there aren't, how would I go about learning how to make one myself?

Uruwi

  • Nightmare of Torrential Precipitation
  • 478 million goober
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #799 on: November 03, 2015, 04:35:51 AM »
Are there any ph3 player scripting tutorials out there? I can't find any and most player scripts I do find are for 0.12m. If there aren't, how would I go about learning how to make one myself?

You can use this example.
foo = foldl $ flip ($)
Highest difficulty 1CCed for each game, by shot type in the original order. (-: never 1CCed on any difficulty, or never used; E: easy, N: normal, H: hard, L / U: lunatic / unreal.)
EoSD [NNNE] PCB [EE--N-] IN [NEEE + Ex Border] PoFV [Mystia N, Mystia E no charge] MoF [EN--H- + Ex Marisa B] SA [N-----] UFO [----EN] TD [NENE] DDC [EE-EHE + Ex Marisa B & Sakuya A] LoLK [PD --N- Legacy ---N] EE [N- + Ex Yabusame] EMS [N-- + Ex Yabusame] RMI [NHN + Ex YaoSuku]
Avelantis (demo) Easy YuukiB 426,077,200

TalosMistake

  • Master of Aura and Shade
  • I'm Talos, not Talo~~
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #800 on: November 03, 2015, 05:17:06 AM »
Are there any ph3 player scripting tutorials out there? I can't find any and most player scripts I do find are for 0.12m. If there aren't, how would I go about learning how to make one myself?

I started with downloading one of gtbot's players (you can find it on bulletforge). Gtbot really wrote well-organized code that you can easily understand it. Then I started to make my own player by using gtbot's code as a template. xD

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #801 on: November 04, 2015, 03:56:26 AM »
I started with downloading one of gtbot's players (you can find it on bulletforge). Gtbot really wrote well-organized code that you can easily understand it. Then I started to make my own player by using gtbot's code as a template. xD
You can use this example.

Thanks! I'd already downloaded a few players to see if I could learn from them but it's good to know that GtBot was a good choice. He also made an awesome cutin function that I've used, really good stuff.

Thanks for the help!
« Last Edit: November 04, 2015, 04:14:42 AM by Chrysalis »

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #802 on: November 04, 2015, 04:21:24 AM »
Hi. The only way to deal with the Magic Circle that follows the boss (like, changing the sprite, deleting it, etc) is creating a custom system script and adding it in #System in the single/plural/etc?

Thanks!
Paty

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #803 on: November 04, 2015, 05:10:27 AM »
Hi. The only way to deal with the Magic Circle that follows the boss (like, changing the sprite, deleting it, etc) is creating a custom system script and adding it in #System in the single/plural/etc?

Thanks!

You can create a magic circle for a boss wherever you want as long as it is not in a package script. Keeping one in the system script is a good idea if it will only be used on bosses. However, if you do not want to do that, you can create a magic circle in a task and call that task from a script that either has that magic circle code or #includes the file containing it. In this case, make sure you are either deleting the magic circle manually or have Object AutoDelete set to true.

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #804 on: November 04, 2015, 05:49:59 AM »
Thanks for the answer. However, I don't know how to get rid of the default Magic Circle that comes with danmakufu (actually, the only way I found is modifying the default_system folder's files, but I don't think it is a good idea).

I also tried to copy-paste the default_system folder in my own script folder, modify the copied files, and call them in #system in my plural scrpit (I'm making only plural scripts so far). But it seems that they are ignored and it's used the default ones anyway.

Sorry if my explanation is a bit weird, English is not my first language.
Paty

TalosMistake

  • Master of Aura and Shade
  • I'm Talos, not Talo~~
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #805 on: November 04, 2015, 07:26:27 AM »
Thanks for the answer. However, I don't know how to get rid of the default Magic Circle that comes with danmakufu (actually, the only way I found is modifying the default_system folder's files, but I don't think it is a good idea).

I also tried to copy-paste the default_system folder in my own script folder, modify the copied files, and call them in #system in my plural scrpit (I'm making only plural scripts so far). But it seems that they are ignored and it's used the default ones anyway.

Sorry if my explanation is a bit weird, English is not my first language.

You can copy-paste default_system folder to your script folder. At the top of your script, write this
Code: [Select]
#System["./default_system/Default_System.txt"]then you can modify Default_System_MagicCircle.txt in the system folder that you copied. Hope this help xD

Edit : Just saw that you already tried it, but I think you were doing it wrong. Try to put the above code to every single file you have (and of course, plural) , because it worked fine for me  :)
« Last Edit: November 04, 2015, 07:33:27 AM by TalosMistake »

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #806 on: November 04, 2015, 02:19:21 PM »
Thanks to you both and sorry. I wasn't puting #system in the non-spells, seems that was the problem.
Paty

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #807 on: November 04, 2015, 09:08:44 PM »
http://fat.gfycat.com/PaleDistantAxisdeer.webm

I was messing around with changing patterns into new ones, trying to get ideas for fun things I could do, but I noticed that bullets that fly off the screen are triggered and altered early (as you can see in the top of the screen), most of the pattern is transformed properly but the part that goes offscreen transforms instantly and doesn't home the player, but goes from one side of the screen to the other before being deleted instead.

I tried a whole bunch of things to counteract this but nothing seems to work. I tried having the task not trigger if the bullets disappear with this

Code: [Select]
if(Obj_IsVisible(objD2) == false){Obj_Delete(objD2);}
But that didn't seem to do anything. Any suggestions? I altered the code so the circles would make a flower pattern with the homing butterflies in the end, but the missing piece at the top really messes it up visually. I really hope this is fixable.

Here's the pattern's code in case it's relevant.

http://puu.sh/l9tnh/c5911d58a9.txt

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #808 on: November 04, 2015, 11:26:34 PM »
http://fat.gfycat.com/PaleDistantAxisdeer.webm

I was messing around with changing patterns into new ones, trying to get ideas for fun things I could do, but I noticed that bullets that fly off the screen are triggered and altered early (as you can see in the top of the screen), most of the pattern is transformed properly but the part that goes offscreen transforms instantly and doesn't home the player, but goes from one side of the screen to the other before being deleted instead.

I tried a whole bunch of things to counteract this but nothing seems to work. I tried having the task not trigger if the bullets disappear with this

Code: [Select]
if(Obj_IsVisible(objD2) == false){Obj_Delete(objD2);}
But that didn't seem to do anything. Any suggestions? I altered the code so the circles would make a flower pattern with the homing butterflies in the end, but the missing piece at the top really messes it up visually. I really hope this is fixable.

Here's the pattern's code in case it's relevant.

http://puu.sh/l9tnh/c5911d58a9.txt

You are spawning bullets from a deleted object, most likely. When creating objects at another object's position, the position of the new object will default to (0,0) if the parent object does not exist. To counteract this, make sure that parent bullets are not deleted before you spawn new bullets at their positions.

Obj_IsVisible(objD2) only toggles whether or not the bullet will be rendered on screen and has no relation to whether the object exists or the position of the object.

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #809 on: November 05, 2015, 01:03:54 AM »
So, would verifying whether the object is deleted before spawning from its location be possible? Also, is it possible to work with offscreen bullets?