Author Topic: ※ Danmakufu Q&A/Problem thread 3 ※  (Read 140550 times)

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #90 on: March 20, 2016, 02:53:49 AM »
SetPlayerLife(GetPlayerLife() + 1); for increasing lives in general. For score extends, perhaps something like this:

Code: [Select]
task TExtends(){
let EXTENDS = [10000000, 30000000, 80000000];
let extend_count = 0;
while(extend_count < length(EXTENDS)){
if(GetScore() >= EXTENDS[extend_count]){
SetPlayerLife(GetPlayerLife() + 1);
extend_count++;
}
yield;
}
}

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #91 on: March 20, 2016, 06:59:07 AM »
What about pickup extends? CreateItemA1 ones don't work properly and I have no idea how to do it otherwise.

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #92 on: March 20, 2016, 07:18:09 AM »
Item behaviour is generally implemented by the player script. The preset items you can use with CreateItemA1 just skip the need to make your own item definitions and whatnot. To get an ITEM_1UP item to actually give you an extra life you toss something like this in the player script's @Event loop.

Code: [Select]
alternative(GetEventType())
case(EV_GET_ITEM){
if(GetEventArgument(0) == ITEM_1UP){
SetPlayerLife(GetPlayerLife() + 1);
}
}

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #93 on: March 20, 2016, 12:00:51 PM »
Are there any Danmakufu ph3 tutorials covering dialogue systems?
Lunatic 1CCs: PCB, IN, PoFV, HSiFS
Extra: All except PC-98.

Oh hey look I can do DNH scrips.

Random Sphere

  • It's been 3 years...
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #94 on: March 20, 2016, 12:22:07 PM »
No :_)
Normal 1CCs : PCB, IN, PoFV, MoF, UFO, TD, DDC, HSiFS, WBaWC.
Extra Clears: IN, MoF, HSiFS, WBaWC.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #95 on: March 20, 2016, 02:45:08 PM »
Well then...
Guess I have to figure it out myself.
Lunatic 1CCs: PCB, IN, PoFV, HSiFS
Extra: All except PC-98.

Oh hey look I can do DNH scrips.

Uruwi

  • Nightmare of Torrential Precipitation
  • 478 million goober
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #96 on: March 20, 2016, 03:13:54 PM »
A good way to figure out is to read other people's code.

Basically, you need sprite objects for the character portraits, as well as for either the dialogue bar at the bottom in older games, or speech bubbles if you're into those. The dialogue text itself uses text objects.
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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #97 on: March 20, 2016, 04:01:58 PM »
Oh, so it's as simple as "place some images and text objects". I seriously thought it was going to be some sort of pre-built function or something...
Thanks for the dialogue code, I'll look through it!
Lunatic 1CCs: PCB, IN, PoFV, HSiFS
Extra: All except PC-98.

Oh hey look I can do DNH scrips.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #98 on: March 20, 2016, 09:33:44 PM »
Well, this is depressing. My player script isn't even being recognized. It is in the player directory.
Code:
http://pastebin.com/9NkXFmFG
http://pastebin.com/TEbv6dCg

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #99 on: March 20, 2016, 09:42:03 PM »
Well, this is depressing. My player script isn't even being recognized. It is in the player directory.
Code:
http://pastebin.com/9NkXFmFG
http://pastebin.com/TEbv6dCg
Not sure which version of ph3 you're running, but try #TouhouDanmakufu[Player] instead of the Japanese expression.

Edit: Ok this seems to be a similar case of file encoding which Fluffy had pointed out here  :). If you use #東方弾幕風[Player] you need proper UTF-8 encoding for your player script to make it show up. Otherwise use the regular English expression.
« Last Edit: March 20, 2016, 09:45:24 PM by Helepolis »

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #100 on: March 20, 2016, 09:49:35 PM »
That's what I had originally, and then I changed it to see if this would work. Perhaps I mis-typed it originally? I'll try again...

EDIT: Looks like I did mis-type it. Working now. (Well, getting an actual error message, but at least it's being recognized lol)
« Last Edit: March 20, 2016, 09:51:16 PM by Youmu970 »

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #101 on: March 20, 2016, 09:51:11 PM »
That's what I had originally, and then I changed it to see if this would work. Perhaps I mis-typed it originally? I'll try again...
You need to completely close and restart Danmakufu in order to reload the script. Changing it on the fly won't make it appear.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #102 on: March 20, 2016, 09:51:52 PM »
You need to completely close and restart Danmakufu in order to reload the script. Changing it on the fly won't make it appear.

I know. :)

EDIT: Ok, fixed that error, got my crappy sprite to appear, but it has no hitbox collision and she can't shoot. :(
« Last Edit: March 20, 2016, 09:54:41 PM by Youmu970 »

Uruwi

  • Nightmare of Torrential Precipitation
  • 478 million goober
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #103 on: March 21, 2016, 12:37:48 AM »
Not sure which version of ph3 you're running, but try #TouhouDanmakufu[Player] instead of the Japanese expression.

Edit: Ok this seems to be a similar case of file encoding which Fluffy had pointed out here  :). If you use #東方弾幕風[Player] you need proper UTF-8 encoding for your player script to make it show up. Otherwise use the regular English expression.

Shift-JIS or UTF-16LE with BOM. Danmakufu does not recognize UTF-8.
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: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #104 on: March 21, 2016, 08:17:23 AM »
You're absolutely correct. Shift-JIS or UTF-16LE with BOM is much better.

I remember I struggled alot in Notepad++ which for some reason didn't allow me to save to that format and it would also keep ignoring my Shift-JIS encoding. I think Drake helped me out with Sublime back then. That was major rage.

Random Sphere

  • It's been 3 years...
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #105 on: March 21, 2016, 09:52:37 AM »
Code: [Select]
task Tran{
let target = GetTransitionRenderTargetName();
let obj = ObjPrim_Create(OBJ_SPRITE_2D);

ObjPrim_SetTexture(obj, target);
Obj_SetRenderPriority(obj, 0.1);
ObjSprite2D_SetSourceRect(obj, 0, 0, 640, 480);
ObjSprite2D_SetDestCenter(obj);
ObjRender_SetPosition(obj, 320, 240, 0);

while(true){
ObjSprite2D_SetSourceRect(obj, 0, 0, 640, 480);
yield;
}
}

The code up there is supposed to put an image of the stage when the script is paused, but it doesn't work. Why? Note : this code is used in a pause script, initialized in a package script.
« Last Edit: March 21, 2016, 10:55:56 AM by Sphe »
Normal 1CCs : PCB, IN, PoFV, MoF, UFO, TD, DDC, HSiFS, WBaWC.
Extra Clears: IN, MoF, HSiFS, WBaWC.

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #106 on: March 21, 2016, 05:55:19 PM »
1) Are you calling Tran(); ?
2) Are you rendering to GetTransitionRenderTargetName() before initiating the pause script? For some reason I had a bit of trouble with that before

Also unless you're planning on doing something else with the source rect continuously, I'm pretty sure calling ObjSprite2D_SetSourceRect in the while loop wouldn't change much visually ...

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #107 on: March 21, 2016, 06:25:13 PM »
Doesn't necessary have to be launched from package script. GetTransitionRenderTargetName specifically is triggered when a pause is happening. This can be also done during regular single attack script.

Did some testing in a single script, the image would sometimes not appear unless I hit ESC button once. The image got rerendered every time I hit escape without calling the testRender again which is interesting. Seems like the object is dynamic?
Code: [Select]
task testRender {
wait(60);
let tex = GetTransitionRenderTargetName;

let obj = ObjPrim_Create(OBJ_SPRITE_2D);
ObjPrim_SetTexture(obj,tex);
ObjRender_SetBlendType(obj,BLEND_ADD_ARGB);
ObjRender_SetAlpha(obj,255);
Obj_SetRenderPriorityI(obj,80);
ObjRender_SetScaleXYZ(obj,1,1,0);
ObjSprite2D_SetSourceRect(obj,0,0,256,256);
ObjSprite2D_SetDestCenter(obj);
ObjRender_SetPosition(obj,200,100,0);
}


About your code, if your goal is purely to snapshot the screen as a still, you could actually use way more shorter version:
Code: [Select]
let tex = GetTransitionRenderTargetName;
RenderToTextureA1(tex, 0, 100, true);

PauseStageScene(true);

// Summon your pause script.


Edit No duplication but actual dynamic refresh?
« Last Edit: March 21, 2016, 06:29:03 PM by Helepolis »

Random Sphere

  • It's been 3 years...
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #108 on: March 23, 2016, 08:51:52 PM »
Thanks for the help, the problem has been fixed. Andddd I have another question : how can I create bullets that do not destroy when they leave the frame / gamefield?
Normal 1CCs : PCB, IN, PoFV, MoF, UFO, TD, DDC, HSiFS, WBaWC.
Extra Clears: IN, MoF, HSiFS, WBaWC.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #109 on: March 24, 2016, 12:08:09 AM »
Thanks for the help, the problem has been fixed. Andddd I have another question : how can I create bullets that do not destroy when they leave the frame / gamefield?

ObjShot_SetAutoDelete(obj, false)

Jimmy

  • Shameless spender
  • gaining big pounds
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #110 on: March 24, 2016, 01:15:56 AM »
Thanks for the help, the problem has been fixed. Andddd I have another question : how can I create bullets that do not destroy when they leave the frame / gamefield?
You can also determine at which distance from each side outside of the stage frame the bullets should be deleted:

Code: [Select]
SetShotAutoDeleteClip( distance from the left side, top side, right side, bottom side);
Default distance is 64 from each side.
Normal 1cc: EoSD, PCB, IN, PoFV, MoF, UFO, TD, DDC, LoLK Legacy, HSiFS, WBaWC
Hard 1cc: IN, DDC, HSiFS
Extra clears: MoF, DDC, HSiFS, WBaWC

Goals: Going Extra Hard!

Random Sphere

  • It's been 3 years...
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #111 on: March 24, 2016, 08:42:48 AM »
Thanks :D
Normal 1CCs : PCB, IN, PoFV, MoF, UFO, TD, DDC, HSiFS, WBaWC.
Extra Clears: IN, MoF, HSiFS, WBaWC.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #112 on: March 31, 2016, 06:47:23 PM »
Maybe it will be a stupid question, but?
Is there really no way to improve ph3 graphics drawing?
It's really annoying, it kills graphic quality too much.

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #113 on: March 31, 2016, 08:10:30 PM »
Maybe it will be a stupid question, but?
Is there really no way to improve ph3 graphics drawing?
It's really annoying, it kills graphic quality too much.
I think you're going to have to be more specific. What aspects of Ph3's drawing do you think are inadequate? If it's the resolution, than that can be changed from the default 640x480 to most any resolutions that you may desire, which should improve graphical fidelity by a lot. The only caveat is that you'd need textures (particularly bullet graphics and sprites) that can work with that resolution.
« Last Edit: March 31, 2016, 08:15:47 PM by ExPorygon »

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #114 on: March 31, 2016, 10:09:34 PM »
Maybe it will be a stupid question, but?
Is there really no way to improve ph3 graphics drawing?
It's really annoying, it kills graphic quality too much.

Are you talking about the quality of textures or the number of primitives being drawn?
If it's the quality of textures, try asserting the criterion that the image dimensions are in discrete powers of two (32 x 32, 256 x 256, etc).
On the other hand, if it's the number of primitives you're having issues with, you can try using a single effect object with multiple primitive triangle list, and partition a set of triangles for each 'object', assuming each object uses the same image and render state. The way I know it, Danmakufu uses a single draw() call for each effect, so partitioning effects this way allows you to draw multiple 'objects' with a single draw call. Be weary of computational overhead, however. Since all the logic is done through a virtual machine, you'd want to optimize it where possible.

Random Sphere

  • It's been 3 years...
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #115 on: April 01, 2016, 06:57:26 PM »
How do MOF Marisa A`s familiar works? (I mean how do they move, not the shoot).
Normal 1CCs : PCB, IN, PoFV, MoF, UFO, TD, DDC, HSiFS, WBaWC.
Extra Clears: IN, MoF, HSiFS, WBaWC.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #116 on: April 02, 2016, 10:39:53 AM »
Not quite sure, but I think the closest familiar makes the same moves as the player, minus some distance to not end up inside the player, the second one moves like the first familiar, with the same rules, the third one moves like the second familiar, and so on.
Lunatic 1CCs: PCB, IN, PoFV, HSiFS
Extra: All except PC-98.

Oh hey look I can do DNH scrips.

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #117 on: April 08, 2016, 11:07:41 AM »
Alrighty, so out of personal interest I coded this up. Writing code for generic gradius options was pretty easy; setting it up like MoF where focus movement locks the options was much more difficult and I had to rework the approach a few times.

https://gist.github.com/drakeirving/1ef0f9a315468dc864a678caf550116b

As always, I aimed to make this as generic as possible. The number of options is arbitrary, and with the non-player version you can attach options to any Move object (e.g. a bullet).
You could very easily modify the for-player version to fire bullets and work properly when the player dies, which I didn't bother with.

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

Uruwi

  • Nightmare of Torrential Precipitation
  • 478 million goober
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #118 on: April 08, 2016, 01:44:28 PM »
You can save a different version of the same common data area per stage by calling SaveCommonDataAreaToReplay on each stage, right?

Edit: someone on LoCaA told me that this was possible. Thanks!
« Last Edit: April 08, 2016, 03:25:29 PM by Fluffy8x »
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

Random Sphere

  • It's been 3 years...
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #119 on: April 08, 2016, 03:06:43 PM »
Alrighty, so out of personal interest I coded this up. Writing code for generic gradius options was pretty easy; setting it up like MoF where focus movement locks the options was much more difficult and I had to rework the approach a few times.

https://gist.github.com/drakeirving/1ef0f9a315468dc864a678caf550116b

As always, I aimed to make this as generic as possible. The number of options is arbitrary, and with the non-player version you can attach options to any Move object (e.g. a bullet).
You could very easily modify the for-player version to fire bullets and work properly when the player dies, which I didn't bother with.


Thanks man! :D
Normal 1CCs : PCB, IN, PoFV, MoF, UFO, TD, DDC, HSiFS, WBaWC.
Extra Clears: IN, MoF, HSiFS, WBaWC.