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

8lue Wizard

  • Cobalt Magician
  • (Apparently)
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #570 on: March 08, 2013, 11:10:30 PM »
Ah, perhaps I should have phrased my question a little better. I'm working on a player script, (hence my request for the dps tester) and fully realize that if an enemy script is designed with, say, Time Stop compatibility in mind, and my player script doesn't support that, that it'll break the intended functionality of the script, since I'm not playing by its rules. My question was less about the technical details of CommonData support, and more about user expectations: is this widely accepted enough that people are going to assume a given script will support it, and then ding points when something breaks, or are they going to assume nothing and then give bonus points when they find out it does?

The other part of this question is: if I want to support these tasks (which I'm probably going to, eventually, regardless of the answer to the above), what are the big points I have to make sure I hit? Is there an easy reference implementation available, or, better yet, a library of compatible helper functions? I don't wanna be reinventing the wheel here if someone's already done the heavy lifting. In short, "What's the deal with this thing?"

Many thanks for the dps script, though, it's exactly what I was looking for.

gtbot

  • Master of ScreenSplit
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #571 on: March 09, 2013, 12:16:39 AM »
I'm not really sure, since I've never seen another script that utilizes the common data I've put in place (except my own), since I was mostly keeping the common data so I can use later if I wanted to change/retreive something, and just mentioned it at the top of the file if anyone else wanted to use it. One thing that I've done in a script is that if time stop isn't supported, it immediately skips the time stop and simulates what would've happened in time stop, effectively removing that gameplay downtime and makes the bullets seemingly spawn from no where. I've never used the time slow common data except in SakuyaB, but it was just to speed everything up when using the Danmakufu built in StartSlow/StopSlow functions.

I have a few functions that are relating to time stop common data, such as bullets responding to the time stop common data, but that's for enemy scripts, which I'm not sure if that what you want or player script functions, which I don't have any of. In short, you can effectively ignore it if you'd like; there's also the possibility that TimeStop will make an official return in ph3 at some point, though that may take a while or never happen.

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #572 on: March 09, 2013, 01:37:18 AM »
Never. You should never expect that an enemy script is going to implement some forced interaction with a player script unless it was specifically designed for use with that player script alone, such as if it's a game or other reasonably complete work. Such a thing should have player type restrictions in the first place, and it would probably include the player script alongside it. Otherwise whoever made the enemy script is simply doing it wrong.

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

8lue Wizard

  • Cobalt Magician
  • (Apparently)
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #573 on: March 09, 2013, 04:14:34 AM »
Duly noted. There was some chatter back on the first page or two of this topic about setting up some community-standard common data fields that I skimmed over, but I didn't know if anything had come of that; guess I was just making a mountain out of a molehill.  :V

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #574 on: March 09, 2013, 05:47:51 AM »
Yeah I didn't mention it back then, but I'm pretty opposed to a "community-wide" standard, if only because imposing such a thing would probably cause a lot of people to make enemy scripts that create the problem you're talking about. More than that, it alienates all the other scripters that aren't on this forum or aren't aware of there being a standard, effectively making it useless. A player Power variable would work but I don't really consider a CommonData like that being any sort of standard, especially since some scripts may implement the variable in unintended ways. It sounds nice in theory but I don't think anything good would really come of it.

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

Arcorann

  • hey catgirl
  • Surprisingly unkempt
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #575 on: March 09, 2013, 08:17:53 AM »
We already have a standard now that power has been built into the engine (GetPlayerPower / SetPlayerPower). I don't think anything outside what is inbuilt can be standardised, since the cooperation of everyone who is coding for ph3 will be practically impossible.

fondue

  • excuse me
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #576 on: March 16, 2013, 12:06:29 PM »
How to re-create Sakuya's timestop from EoSD?

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #577 on: March 18, 2013, 10:00:49 PM »
I would say use StartSlow with 0 frames, but that would freeze the game~

In truth, though, it really would be nothing more than darkening the screen and forcing the player to stop using common data...
The bullets can be stopped by using GetShotIdInCircleA2 and running the resulting array through an ascent loop...
So, to put it in coding terms...something like this, perhaps?
Freezing the player would be a chore though, because if I am correct (probably not, as I know very little about the engine) you have to force a freeze on the player itself through common data checks...ie SetCommonData("TimeFreeze", 1);

I decided to look into GtBot's time stop task, which is fairly simple, all it does is darken the screen by a set amount and set the common data "TimeStop" to 1...
Stopping bullets should be simple enough to do, because the functions ObjMove_GetSpeed and ObjMove_SetSpeed exist and are documented, which is nice.
I would check with GtBot before using any of his content, though, for he must have put in lots of time and effort getting his code to work just right.
« Last Edit: March 19, 2013, 04:50:33 AM by LegoCS »

Maths ~Angelic Version~

  • Aspiring Mathematician of Brilliant Laziness
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #578 on: March 19, 2013, 03:43:37 PM »
I would say use StartSlow with 0 frames, but that would freeze the game~

In truth, though, it really would be nothing more than darkening the screen and forcing the player to stop using common data...
The bullets can be stopped by using GetShotIdInCircleA2 and running the resulting array through an ascent loop...
So, to put it in coding terms...something like this, perhaps?
Freezing the player would be a chore though, because if I am correct (probably not, as I know very little about the engine) you have to force a freeze on the player itself through common data checks...ie SetCommonData("TimeFreeze", 1);

I decided to look into GtBot's time stop task, which is fairly simple, all it does is darken the screen by a set amount and set the common data "TimeStop" to 1...
Stopping bullets should be simple enough to do, because the functions ObjMove_GetSpeed and ObjMove_SetSpeed exist and are documented, which is nice.
I would check with GtBot before using any of his content, though, for he must have put in lots of time and effort getting his code to work just right.

I PMed him when I wanted to use his cutin function and he replied
Quote
Everything I make is free to be modified and redistributed.
I'd still give him credit for the function, obviously.
Also, feel free to ask him personally if you would prefer to.

gtbot

  • Master of ScreenSplit
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #579 on: March 20, 2013, 04:46:58 AM »
I PMed him when I wanted to use his cutin function and he replied
This is indeed true :)

How to re-create Sakuya's timestop from EoSD?
What LegoCS said is pretty much true, although I should add that the tedium amount of effort to do this can be a little too much for a relatively low reward (unless you're using the player for a specific game/script that will utilize this often),  and then there's always the possibility that TimeStop may be built into the ph3 version.

Another yet very cheap way of doing this would be to "freeze" the player by forcing the player on the same spot as when TimeStop was initiated, then saving an image of that same moment as well, while also disallowing bombs/shots. Then draw the image over the game so that the player's normal functions would appear as though they stopped. While this is happening, you can move your bullets and boss and any other effects temporarily above the priority of this fake image. Once TimeStop would have ended, you could then reset the priorities of the boss/bullets/effects and remove the fake game image. As I mentioned before, this is a very cheap way of doing it and it has its own problems, but as of now with no TimeStop equivalent, this is the only way I can envision a TimeStop that could work for any script without the need for commondata,

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #580 on: March 31, 2013, 04:03:35 AM »
Could someone please explain what a "Package Script" is? The wiki doesn't list it as a script type, but I think it's the most noticeable addition to that list. Also, what is CommonData and how is it used?

Ozzy

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #581 on: March 31, 2013, 05:38:02 AM »
Could someone please explain what a "Package Script" is? The wiki doesn't list it as a script type, but I think it's the most noticeable addition to that list. Also, what is CommonData and how is it used?
Since I'm the one who added the package script functions to the wiki, I guess I should answer this. A package script is, to put it simply, a full game script. You can use them to link separately scripted stages together. Probably the best way to show how package scripts work is to take a look at how the sample package script works and how it uses the listed functions.

To answer your second question, I'm going to point you to this. It works the same way in Ph3, only there is no GetCommonDataDefault. Instead, GetCommonData is the same thing as the old GetCommonDataDefault. The SaveCommonData and LoadCommonData functions in ph3 also work in a similar way to their 0.12m counterparts only with slightly different names. Check the function list on the wiki for more details.

Maths ~Angelic Version~

  • Aspiring Mathematician of Brilliant Laziness
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #582 on: April 18, 2013, 08:56:04 PM »
I have tried to make a double battle with Minoriko and Shizuha by defining Shizuha as an ordinary enemy (not a boss). It works fine, except for one annoying detail: When I try to play the plural script, every time I defeat an attack, Shizuha reappears from the upper left corner in the beginning of the next. I guess this has something to do with Shizuha's enemy object being deleted at the end of scripts or something like that, but I don't know. It only happens to Shizuha, not Minoriko.
Please, do you have any ideas? As an amateur, I'd prefer a solution that isn't too complicated if that's possible. Thanks in advance.

gtbot

  • Master of ScreenSplit
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #583 on: April 18, 2013, 09:52:58 PM »
The easiest solution would be to record Shizuha's X and Y coordinates into a common data in each script, and then in the @Initialize for each script, set the Shizuha enemy object ID's coordinates to the common data. Example (variables interchangeable):
Code: [Select]
@Initialize{
ObjRender_SetPosition(Shizuha, GetCommonData("ShizuhaX", 96), GetCommonData("ShizuhaY", -128), 0);
[..]

@MainLoop{
SetCommonData("ShizuhaX", ObjRender_GetX(Shizuha));
SetCommonData("ShizuhaY", ObjRender_GetY(Shizuha));
[..]

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #584 on: April 19, 2013, 12:22:30 AM »
That sounds like needless use of common data. Could I take a look at how you're implementing her as an enemy? It only becomes an issue if you're actually recreating the Shizuha enemy object every attack (and deleting it). As long as her object isn't being destroyed there should be little problem.

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

Maths ~Angelic Version~

  • Aspiring Mathematician of Brilliant Laziness
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #585 on: April 19, 2013, 11:12:42 AM »
The common data solution worked nicely. Thank you very much for your assistance, gtbot  :)

Drake: Is there a reason not to use common data? Using it seems to be pretty simple (at least for something like what I wanted to do). Anyway, I define Shizuha with this:
Code: [Select]
objFam = ObjEnemy_Create(OBJ_ENEMY);
ObjEnemy_Regist(objFam);
in Initialize and delete objFam at the end of "EnemyActions", a task that contains movement and bullet firing and a few other things. (objFam is short for objFamiliar which refers to the fact that Shizuha is defined as a familiar, not as a boss)
My problem has been solved, so I just wrote this in case you want to know and/or have an easier way to do the same thing.

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #586 on: April 19, 2013, 11:42:11 PM »
Common data in 0.12 was for most people a workaround for the lack of real global variables, i.e. variables that can be accessed across scripts when the hardcoded functions weren't enough. Thing is that it gives way to abusing how much common data is stored and manipulated, and makes a huge mess of scripts. It isn't clean, isn't very safe, is generally a pain, and is abusable enough that people just start shoving everything into common data just because. When you globalize everything it gets really gross very quickly, so needlessly using common data as an easy way out should be avoided. In 0.12, there was a lot that could only be accomplished by using common data, but in ph3 you have a lot more freedom and utility, so usually you don't need it.
also see http://c2.com/cgi/wiki?GlobalVariablesAreBad

The inclusion of common data areas and saving and loading makes it much more useful for other purposes though, such as saving scores, data for replays, unlocks, RNG seeds, etc.

Anyways, in ph3, by default, objects are not deleted across script transitions. If you don't delete and recreate Shizuha every new script, you can still just get her object ID back using GetAllEnemyID(). Depending on if there are other enemies existing, you should be able to just grab it if you know its index in the array of enemies. Note that the reason you don't need to do this with the boss object is that even though you delete the boss object at the end of a script, its position and stuff are still internally stored somewhere; likely in the boss scene object.

Speaking of which, you could also replace the use of common data by doing pretty much the same thing, only with the boss scene object, using Obj_SetValue(). With that, the values will only exist as long as the boss scene exists, and you'll only be able to access them within the scope of the boss scene, making it a bit nicer.

Actually, someone be the guinea pig for the above. If it works well enough then it might be an idea to create additional boss/boss scene functions to facilitate familiar creation and manipulation.

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

Maths ~Angelic Version~

  • Aspiring Mathematician of Brilliant Laziness
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #587 on: April 20, 2013, 08:22:14 PM »
The "don't delete and recreate Shizuha" sounds a little difficult because I want to allow the player to play individual attacks (what am I supposed to do, make separate scripts for "spell practice" or write something like "create Shizuha if she doesn't exist"?), but thanks for telling me about it anyway; it'll probably be useful later.
I tried the method with "Obj_SetValue()" and it works fine too, so I think I'll stick to that if it makes things nicer. Thank you for explaining it.  :)

TalosMistake

  • Master of Aura and Shade
  • I'm Talos, not Talo~~
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #588 on: April 30, 2013, 01:59:55 AM »
Can I ask a question ?

If I want to change BGM in plural file. How can I do it ?

Example: I have a plural script that contains 6 nonspells and 6 spells. During 1st nonspell - 3rd spell , I want to play BGM1, and during 4th nonspell - 6th spell, stop playing BGM 1 and play BGM2 instead.

I tried to use PlayBGM but it doesn't work  :V , or maybe I should do something with Sound Object Functions ?

Tao-Sensei

  • Wants to be Icemilk.
  • What do you mean I can't be Icemilk?
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #589 on: May 03, 2013, 01:07:45 AM »
Is there any place where I can find a written tutorial not in Japanese?

Either one doesn't exist or I'm blind (probably the latter).

TalosMistake

  • Master of Aura and Shade
  • I'm Talos, not Talo~~
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #590 on: May 03, 2013, 01:33:50 AM »
Is there any place where I can find a written tutorial not in Japanese?

Either one doesn't exist or I'm blind (probably the latter).

This ?

Tao-Sensei

  • Wants to be Icemilk.
  • What do you mean I can't be Icemilk?
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #591 on: May 04, 2013, 03:59:31 AM »
This ?
What.

Like I said, probably I'm blind, but thank you.

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #592 on: May 05, 2013, 02:26:22 PM »
Player Script question!

In 0.12m, I could do this in the description:
Code: [Select]
#Text[Wonderful Shrine Maiden of Paradise

Normal Shot: Homing
Focus Shot: Aimed
Normal Speed: ********
Focus Speed: ***
Spell card: Fantasy Seal]

And the description on the player select screen would take up several lines of text. However, if I try the same in ph3, it doesn't work, and \n doesn't force a newline either. Is there any way to have a player script's Text block be multiple lines long?

fondue

  • excuse me
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #593 on: May 05, 2013, 02:34:06 PM »
I usually spam the space bar until there is a new line whenever I test it.

gtbot

  • Master of ScreenSplit
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #594 on: May 05, 2013, 02:37:58 PM »
For all strings, new lines in ph3 are defined with [r]

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #595 on: May 06, 2013, 04:11:17 PM »
Does length still work in ph3? Didn't see it in the function list so I'm wondering.

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #596 on: May 06, 2013, 06:50:04 PM »
You could just have seen if it worked for yourself, but yes.

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

fondue

  • excuse me
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #597 on: May 06, 2013, 07:16:13 PM »
Does Danmakufu allow multiple shotsheets uploaded at once?

gtbot

  • Master of ScreenSplit
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #598 on: May 06, 2013, 10:43:19 PM »
If you mean multiple images being used at the same time, I don't believe so, but you could instead just reload different shotdata files (that use different images) as needed.

Maths ~Angelic Version~

  • Aspiring Mathematician of Brilliant Laziness
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #599 on: May 07, 2013, 02:06:43 PM »
I tried using two different shotsheets at once and got no ill effects at all. Apparently, the only thing you have to watch out for is the shot IDs. If you put something like this at the start of your script (like I did):
Code: [Select]
#include "script/default_system/ZUN_shotdata/ZUN_ShotConst.txt"
#include "script/default_system/Default_ShotConst.txt"
and some shot IDs are used in both shotsheets, the bullets from the latter sheets (in this case "Default_ShotConst.txt") override the bullets from the former. Of course, you can change the bullet IDs in the sheets if you want to prevent it. Note that ph3 does not have the 255 ID limit, so don't worry about that.