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

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #780 on: September 19, 2013, 04:52:18 AM »
DNH paths start at its root, not the drive root. You don't need to yield the MainLoop if there's nothing else yielding for it.

Also look at the previous page for rest of comments because page'd.

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

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #781 on: September 19, 2013, 05:53:13 AM »
And, yes, Helepolis, I was looking at your how-to video. ::)
That is good to hear people picking it up, although as Drake and Formless have pointed out, there is a lot of things wrong with your script. Are you sure you viewed my how-to video correctly? I don't remember using parentheses instead of curly brackets :( You might want consider re-watching it carefully and view the sample script and compare it with your own.

Also you might want to read into this regarding setting directories for your images.
Quote
Golden rule: Never, EVER use full pathnaming directly from your Harddisk, personal folders or anything.

Good luck  :ohdear:

KuroArashi100

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #782 on: September 19, 2013, 06:55:27 PM »
So, I just started with ph3 and it is kind of confusing.
There is so much stuff that I don't know where to start...

But I had a question.
While trying to animate the boss sprite, I ran into a problem.
The task is here.
It displays the animation, and the attack sprite displays correctly, but while moving the the character it instantly skips to the last picture instead of displaying them all.
Does anybody know what I'm doing wrong?

And is there a kind of SetMovePosition03 for ph3?
I know about ObjMove_SetDestAtWeight, but is there a version that works with a specified amount of time instead of a maximum speed?

Shadow

  • Forever waiting for tomorrow
  • ...
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #783 on: September 19, 2013, 07:06:28 PM »
You are increasing "f" every frame when the boss is moving, but you are also declaring "f" as "0" in each iteration of the while loop; this must be interfering with the animation itself. Also, what you are looking for is ObjMove_SetDestAtFrame.

Monkeypro257

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #784 on: September 19, 2013, 09:50:37 PM »
Thanks for the responses. I NOW understand what you meant by full pathnaming from my harddisk.

PS: The curly brackets looked like regular parentheses in the vid. (damn, got to get my glasses up-to-date >.<)


EDIT: Well I fixed some things, but I'm glad that it at least appears when I select it in danmakufu. (obviously I still have some errors to attend to)
« Last Edit: September 19, 2013, 10:52:29 PM by Hard-To-Destroy-Reptile »

KuroArashi100

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #785 on: September 20, 2013, 05:48:29 AM »
You are increasing "f" every frame when the boss is moving, but you are also declaring "f" as "0" in each iteration of the while loop; this must be interfering with the animation itself. Also, what you are looking for is ObjMove_SetDestAtFrame.
I managed to find that out myself, somewhere during four 'o clock at night.
It is an error that I made a few times before, because the usually new thing I am trying(such as effect objects or the new engine) diverts all of my concentration.
But thanks anyway, and I'll try not to make this error again.

Also, I guess I worded my second question wrong.
What I meant to ask was "Is there a movement function that has a weight system(it slows down at the end of the movement) but works with a specified time instead of movement speed like the SetMovePosition03 from the old engine?"
Because ObjMove_SetDestAtFrame doesn't seem to slow down at the end of the movement. It doesn't have a weight parameter either.

Shadow

  • Forever waiting for tomorrow
  • ...
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #786 on: September 20, 2013, 05:59:30 AM »
There is currently no such movement function, though you can define one yourself, of course. An easier way (though not 100% accurate) way to achieve what you want would be calculating the distance from the boss to the target coordinates, and then dividing it by the desired amount of frames--this should then go in the "speed" parameter.

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #787 on: September 20, 2013, 07:38:17 AM »
It should be easy enough to define yourself, the main issue is figuring out exactly how you want your movement to be regulated. If you want to travel for a certain amount of frames it would be really easy to just have another time parameter that starts slowing you down at that point until the end.

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

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #788 on: September 23, 2013, 09:36:06 AM »
I am still heavily confused with the 3D stage drawing issues/glitches. Either I am doing something wrong or there is something wrong with the ph3 engine.

My code is ported from 0.12m to ph3 style functions. 3D sprites in my stages are bleeding through the 3D sprites "closer" to the camera. As if the sprites behind other sprites are forcefully drawn instead of partially obscured/blocked by the sprites in front of them. I thought Z-buffering manages this but somehow it doesn't occur.

I'll try to post some screenshots soon to clarify this, right now just raising the point in case someone else has encountered this as well.

Edit:
Ok it seems I was doing something wrong, but only with version 0.16+ / 17. Because I am bloody sure in 0.14/15 this wasn't correctly working.

Here is what you need to keep in mind for painless 3D stage modelling and mesh usage. ObjRender_SetZWrite(obj,true); for 3D sprites and SetCameraPerspectiveClip(1,param2); The minimum draw distance has to be one according to the author. I cannot explain it technically, maybe someone else can.

This is what happens if you're using no SetZWrite on the 3Dsprites and set it to true after setting CameraPerspective to minimum of 1 as well.

We can clearly note the floor bleeding through the left wall. There is a drawing order going on here as well. Leftwall >> Floor >> Rightwall.
[attach=1]

The drawing order has not been changed, only ZWriting is enabled on the sprites.
[attach=3]


If we turn our camera bit more around, we can note the lantern is bleeding through the wall. SetCameraPerspectiveClip(0,4096);  and no ZWrite. Same drawing order.
[attach=2]

Applying ZWrite and minimum of the perspectiveclip takes away all problems it seems. Drawing order remains unchanged.
[attach=4]


ZWriting was not functional in 0.14, as I had discussed this on IRC with Azure and Blargel before. Apparently after my bug report, the mkm-san has fixed it. This makes me a very very happy person. As yesterday I was tearing my hair out for the annoying bleeding on my 3rd stage. When I get home, I will confirm 100% that this method works. Right now I am at work, orz.


Edit 2:
Confirmed, applying ZBuffer for meshes and sprites takes away all your headaches. Drawing order only matters in sense of logic, instead of headache fixing

Also I would advise to use SetCameraPerspectiveClip(10,<yourdesiredmaximumclip>); Basically a minimum of 10, as this seems to give the best drawing results.
« Last Edit: September 23, 2013, 07:43:40 PM by Helepolis »

Monkeypro257

Re: ※ Dnh Q&A/Problem ※ for Danmakufu ph3 (latest version pre17)
« Reply #789 on: September 24, 2013, 01:44:56 AM »
My script is going out pretty good. The only thing that's wrong is that the boss won't show up when I start the match. Any suggestions to why?

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ for Danmakufu ph3 (latest version pre17)
« Reply #790 on: September 24, 2013, 04:39:24 AM »
No, because you've given basically no information about what you're already doing. Answer might as well be "you never drew it".

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

Monkeypro257

Re: ※ Dnh Q&A/Problem ※ for Danmakufu ph3 (latest version pre17)
« Reply #791 on: September 24, 2013, 05:10:11 AM »
Sorry, I thought I lost it for a sec, but I found it somewhere in my folders.  :X

Code: [Select]
#TouhouDanmakufu[Single]
#ScriptVersion[3]
#Title["Decisive battle"]
#Text["A random battle"]

let bossObj;
let bossX = 0;
let bossY = 0;
let imgBoss = "script/tutorial/system ~ HTDRB.png";

@Initialize {
// define a boss in bossObj and register it
bossObj = ObjEnemy_Create(OBJ_ENEMY_BOSS);
ObjEnemy_Regist(bossObj);

// texture the boss, set centre as true centre.
ObjPrim_SetTexture(bossObj,imgBoss);
ObjSprite2D_SetSourceRect(bossObj,0,0,240,311);
ObjSprite2D_SetDestCenter(bossObj);

// move boss to desired x y locations at desired speed
ObjMove_SetDestAtSpeed(bossObj,192,120,5);

}

@Event {
// setting the boss timer and life
alternative(GetEventType())
case(EV_REQUEST_LIFE) {
SetScriptResult(1000);
}
case(EV_REQUEST_TIMER) {
SetScriptResult(45);
}
}

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem ※ for Danmakufu ph3 (latest version pre17)
« Reply #792 on: September 24, 2013, 05:53:49 AM »
Code: [Select]
let imgBoss = "script/tutorial/system ~ HTDRB.png";
Don't you think something looks odd in this line? I have no idea what you're trying to do with system ~ HTDRB.png image, but the tilde usually goes when you use:  GetCurrentScriptDirectory ~ "........." and such.


Drake

  • *
Re: ※ Dnh Q&A/Problem ※ for Danmakufu ph3 (latest version pre17)
« Reply #793 on: September 24, 2013, 06:19:27 AM »
"script/tutorial/system ~ HTDRB.png" is not the string you want.

These are arrays:
[1, 7, 9, 10, 9]
['D', 'r', 'a', 'k']
"Drak"

In particular, "Drak" is the same thing as ['D', 'r', 'a', 'k']. Strings are just arrays of characters.

Now ~ is the concatenation operator. A ~ B attaches the array B to the end of A given they have the same dimension. Since strings are arrays of characters, they work the same.
['D', 'r', 'a', 'k'] ~ ['e'] and "Drak" ~ "e"  will both give "Drake" and ['D', 'r', 'a', 'k', 'e'].

However "Drak" ~ 'e' does not work since it's essentially trying to do ['D', 'r', 'a', 'k'] ~ 'e', but 'e' is not an array so it will fail. "Drak" ~ ['e'] would work though!

When you use GetCurrentScriptDirectory(), it returns a string with the script's folder, from the DNH root. Like if your script was in the script/tutorial/system folder, GetCurrentScriptDirectory() would return "script/tutorial/system/". This is why when you see it it's usually in the form GetCurrentScriptDirectory() ~ "file.png": this would give "script/tutorial/system/" ~ "file.png" which would be "script/tutorial/system/file.png".

Now the problem by now should be obvious, your string is not what you intend it to be, it's currently looking for a file called "system ~ HTDRB.png" in the script/tutorial directory. While "script/tutorial/system/" ~ "HTDRB.png" would work, it's pretty much redundant since you can just do "script/tutorial/system/HTDRB.png". Clear enough?


Also you need to load the graphic.
« Last Edit: September 25, 2013, 06:10:07 AM by Drake »

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

Ozzy

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
Re: ※ Dnh Q&A/Problem ※ for Danmakufu ph3 (latest version pre17)
« Reply #794 on: September 24, 2013, 07:29:18 AM »
Also you need to load the graphic.
As of ph3 you actually don't have to manually load graphics for them to show up anymore.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem ※ for Danmakufu ph3 (latest version pre17)
« Reply #795 on: September 24, 2013, 07:41:11 AM »
True, you don't need to load your graphic any more in advance, though I would heavily suggest people to do so. Just to keep the flow going of understand that you're preloading textures in order to improve load-times later on your game. For small scripts it is logically not noticeable but better to discipline from the beginning.

Although ph3 makes it dead easy later on to write a separate function/task to load them.

Monkeypro257

Re: ※ Dnh Q&A/Problem ※ for Danmakufu ph3 (latest version pre17)
« Reply #796 on: September 24, 2013, 01:13:09 PM »
So there are 2 options with it.
Code: [Select]
let imgBoss = GetCurrentScriptDirectory ~ "HTDRB.png";or
Code: [Select]
"script/tutorial/system/HTDRB.png";

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem ※ for Danmakufu ph3 (latest version pre17)
« Reply #797 on: September 24, 2013, 01:36:02 PM »
So there are 2 options with it.
Code: [Select]
let imgBoss = GetCurrentScriptDirectory ~ "HTDRB.png";or
Code: [Select]
"script/tutorial/system/HTDRB.png";
Don't just assume solutions as they are. The reason Drake has explained it is to make you aware of what you're trying to do with the tilde.

GetCurrentScriptDirectory is a build in function that retrieves the path where the script is located. GetCurrentScriptDirectory ~ "HTDRB.png"; is only going to work if your image is inside the same directory as the script. Roughly guessing; I suspect it is not, so it won't work.

You need to understand what the function does and how pathing works in order to properly apply it. Did you read the tutorial about relevant and absolute pathing? It is quite insightful and will save you headache for the future.

Darkness1

  • Nothing to see here.
  • Enigmatic, isn't it?
Re: ※ Dnh Q&A/Problem ※ for Danmakufu ph3 (latest version pre17)
« Reply #798 on: September 24, 2013, 07:21:46 PM »
Apparently I don't really know that well how vertexes are connected together, or something else just got entirely wrong. So, if anyone feels like enlightening me about the subject:
http://pastebin.com/iJQkXuCu

To answer some questions first:
- Yes, it is really messy.
- HBobj is defined in another part of the script.
- The script works fine for creating a circular graphic, but when the life value changes, the vertexes at the edge between the full bar and the empty bar graphic starts pointing in strange directions.

Monkeypro257

Re: ※ Dnh Q&A/Problem ※ for Danmakufu ph3 (latest version pre17)
« Reply #799 on: September 24, 2013, 09:44:50 PM »
Well I do now understand how relative and absolute works so thanks. (Didn't get it the first time that much)
Though the problem still exists.
Code: [Select]
let imgBoss = GetCurrentScriptDirectory ~ "systemHTDRB.png";The graphic is in the system folder now.

PS: The image was in the same directory as in the script in my other attempt with just "HTDRB.png".
« Last Edit: September 25, 2013, 02:20:00 AM by Hard-To-Destroy-Reptile »

Re: ※ Dnh Q&A/Problem ※ for Danmakufu ph3 (latest version pre17)
« Reply #800 on: September 24, 2013, 10:00:11 PM »
Well I do now understand how relative and absolute works so thanks. (Didn't get it the first time that much)
Though the problem still exists.
Code: [Select]
let imgBoss = GetCurrentScriptDirectory ~ "system\HTDRB.png";The graphic is in the system folder now.

PS: The image was in the same directory as in the script in my other attempt with just "HTDB.png".
"\" is an escape character, so the program parses "\H" as one character. You can use this for special characters,  for example: "\n" is a new line.

If you want to insert a slash inside a string, you can either use "\\" (which the program will parse as one real slash) or a backwards slash "/".
I personally prefer using the "/".

Formless God

Re: ※ Dnh Q&A/Problem ※ for Danmakufu ph3 (latest version pre17)
« Reply #801 on: September 25, 2013, 01:55:40 AM »
Code: [Select]
system/
"HTDB.png" won't give anything if your file is HTDRB.png

Monkeypro257

Re: ※ Dnh Q&A/Problem ※ for Danmakufu ph3 (latest version pre17)
« Reply #802 on: September 25, 2013, 02:08:27 AM »
Code: [Select]
system/
"HTDB.png" won't give anything if your file is HTDRB.png

 That was a typo. . .  :derp:

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem ※ for Danmakufu ph3 (latest version pre17)
« Reply #803 on: September 25, 2013, 06:28:22 AM »
If you used forward slashes and your image still doesn't show up, it can only mean your image is most likely corrupt or faulty. Try to load an alternative image or any image just to secure your code is working. If your code works then you can safely conclude the image is corrupt. Try to re-save it as PNG in Gimp/photoshop.

Monkeypro257

Re: ※ Dnh Q&A/Problem ※ for Danmakufu ph3 (latest version pre17)
« Reply #804 on: September 25, 2013, 10:16:19 PM »
Finally the image showed up, thanks for all the trouble. (The re-saving it in GIMP suggestion, worked!)

Re: ※ Dnh Q&A/Problem ※ for Danmakufu ph3 (latest version pre17)
« Reply #805 on: September 27, 2013, 03:54:20 AM »
Is there any way to change the rendering priority of specific bullets to ensure that they appear over other bullets? Obj_SetRenderPriority doesn't seem to be working.

Ozzy

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
Re: ※ Dnh Q&A/Problem ※ for Danmakufu ph3 (latest version pre17)
« Reply #806 on: September 27, 2013, 04:01:41 AM »
Is there any way to change the rendering priority of specific bullets to ensure that they appear over other bullets? Obj_SetRenderPriority doesn't seem to be working.
I'm PRETTY sure that Obj_SetRenderPriority works on bullets now. Is your ph3 up to date?

Re: ※ Dnh Q&A/Problem ※ for Danmakufu ph3 (latest version pre17)
« Reply #807 on: September 27, 2013, 04:09:22 AM »
Oh hey, I'm five builds behind. I guess it's time to see if updating will break any of my scripts.

edit: YUP that fixed it, hooray.
« Last Edit: September 27, 2013, 04:14:35 AM by professor_scissors »

Ozzy

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
Re: ※ Dnh Q&A/Problem ※ for Danmakufu ph3 (latest version pre17)
« Reply #808 on: September 27, 2013, 04:24:34 AM »
Oh hey, I'm five builds behind. I guess it's time to see if updating will break any of my scripts.
Unless your scripts were somehow relying on some kind of glitch that updates fixed, I wouldn't worry about anything ever breaking. Nothing is ever removed in these updates, things are only added.

Darkness1

  • Nothing to see here.
  • Enigmatic, isn't it?
Re: ※ Dnh Q&A/Problem ※ for Danmakufu ph3 (latest version pre17)
« Reply #809 on: September 27, 2013, 04:56:18 AM »
Apparently I don't really know that well how vertexes are connected together, or something else just got entirely wrong. So, if anyone feels like enlightening me about the subject:
http://pastebin.com/iJQkXuCu

To answer some questions first:
- Yes, it is really messy.
- HBobj is defined in another part of the script.
- The script works fine for creating a circular graphic, but when the life value changes, the vertexes at the edge between the full bar and the empty bar graphic starts pointing in strange directions.
Anyone? Just wondering if there's a solution.