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

CK Crash

  • boozer
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #600 on: May 08, 2013, 11:36:07 PM »
Is there a decent translation of the package script function descriptions yet? There are a few features I'm interested in, like linking stage replays, and I feel like I'm stumbling along in the dark using Google Translate... An English package script to use as an example would be helpful as well.

EDIT: DUMB I mistyped "package" when searching the wiki, and assumed that it just wasn't written up yet because it's a new addition...
« Last Edit: May 08, 2013, 11:57:09 PM by Lucas »

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #601 on: May 08, 2013, 11:38:47 PM »
Is there a decent translation of the package script function descriptions yet? There are a few features I'm interested in, like linking stage replays, and I feel like I'm stumbling along in the dark using Google Translate... An English package script to use as an example would be helpful as well.

http://dmf.shrinemaiden.org/wiki/Package_Functions

(Miransu told me to post this)

Ozzy

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #602 on: May 09, 2013, 12:17:47 AM »
EDIT: DUMB I mistyped "package" when searching the wiki, and assumed that it just wasn't written up yet because it's a new addition...
It was a relatively new addition to the wiki. Myself and a friend filled in the information somewhat recently, and since then I've experimented with the functions enough that I can (mostly) say that the translated descriptions are accurate.

Maths ~Angelic Version~

  • Aspiring Mathematician of Brilliant Laziness
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #603 on: May 09, 2013, 10:53:43 AM »
"ObjShot_SetSpellResist" doesn't seem to protect the bullets from deathwaves. I tried using the function on a bullet and playing as gtbot's Arbiter and Eientei Teams. When the player died, the bullet disappeared even though I had used ObjShot_SetSpellResist(obj,true). Do you know any way to fix this?

gtbot

  • Master of ScreenSplit
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #604 on: May 09, 2013, 01:00:05 PM »
That's a problem with my old deathwave code than with danmakufu. You may have older versions of my scripts since the updated ones have this fixed (although Eientei only has one version so it should still work, if not PM me)

Maths ~Angelic Version~

  • Aspiring Mathematician of Brilliant Laziness
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #605 on: May 09, 2013, 05:13:18 PM »
Whoops, looks like I forgot to update the Arbiter players. Sorry about that  :ohdear: The new version doesn't seem to have a deathwave at all. I tried re-downloading just in case I had messed with it and forgotten about it, but still, I didn't see any bullets being removed. I tested the Eientei team again, and now it worked perfectly. I don't know why I thought a deathwave removed spell resistant bullets, but I blame my faulty memory and my lack of programming skills  :V

Ozzy

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #606 on: May 09, 2013, 06:26:04 PM »
Whoops, looks like I forgot to update the Arbiter players. Sorry about that  :ohdear: The new version doesn't seem to have a deathwave at all. I tried re-downloading just in case I had messed with it and forgotten about it, but still, I didn't see any bullets being removed. I tested the Eientei team again, and now it worked perfectly. I don't know why I thought a deathwave removed spell resistant bullets, but I blame my faulty memory and my lack of programming skills  :V
The reason is that the "death wave" is actually just a DeleteShotAll command, which does not have any restrictions when it comes to spell resistant bullets. There is no built in "death wave" that ignores spell resistant bullets like there is in 0.12m. The way to do it would be to make the death wave in the player script be something like this (I suspect that gtbot did something similar with his newer versions):

Code: [Select]
function DeleteEnemyBullets {
let Bullets = GetShotIdInCircleA1(GetPlayerX,GetPlayerY,10000);
ascent(i in 0..length(Bullets)) {
if(!ObjShot_IsSpellResist(Bullets[i])) {
ObjShot_FadeDelete(Bullets[i]);
}
}
}
This function gets the IDs of all bullets in play and checks if they are spell resistant. If they aren't, then it deletes them. Otherwise it ignores them.

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #607 on: May 09, 2013, 07:42:35 PM »
What.

DeleteShotInCircle(TYPE_SHOT, TYPE_FADE, x, y, r)

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

gtbot

  • Master of ScreenSplit
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #608 on: May 09, 2013, 09:04:53 PM »
DeleteShotInCircle also removes spell resistant bullets.


edit: @Maths ~Angelic Version~ I thought I may have just changed the deathwave for testing purposes but it turns out I actually never fixed it to work with the faster respawn, I'll fix that real quick
« Last Edit: May 09, 2013, 10:33:33 PM by gtbot »

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #609 on: May 09, 2013, 09:54:57 PM »
Nnnnot if you specify TYPE_SHOT.

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

gtbot

  • Master of ScreenSplit
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #610 on: May 09, 2013, 10:33:22 PM »
wow i'm really oblivious  :X

Ozzy

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #611 on: May 10, 2013, 12:53:44 AM »
Nnnnot if you specify TYPE_SHOT.
But then it won't destroy lasers, right?

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #612 on: May 10, 2013, 03:21:56 AM »
I actually have a question, how do I attach a script to a user defined item?

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #613 on: May 10, 2013, 04:29:35 AM »
But then it won't destroy lasers, right?
Lasers are set by default to be spell-resistant. You can make them not so, but they aren't really ever supposed to be destroyed by deathwaves or whatever anyways. Why would they need to be?

How are you supposed to dictate how they disappear? Pretty much any method you're going to use to delete some long object is going to look awful unless you're shrinking it to nothing.

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

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #614 on: May 13, 2013, 04:48:29 PM »
Is there any ph3 tutorial or code snippet out there with an example of a non-boss enemy loaded into a stage script? I'm floundering hardcore tryinng to figure out the proper structure and syntax for the use case.

Edit: Never mind, I'm getting this figured out.
« Last Edit: May 13, 2013, 11:29:52 PM by professor_scissors »

Ozzy

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #615 on: May 14, 2013, 06:41:18 AM »
Is there any ph3 tutorial or code snippet out there with an example of a non-boss enemy loaded into a stage script? I'm floundering hardcore tryinng to figure out the proper structure and syntax for the use case.

Edit: Never mind, I'm getting this figured out.
I know you already said you're getting it figured out, but I'm just going to say that the best way to make non boss enemies in a stage script would be in a task, very similar to how you would make an object bullet in 0.12m.

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #616 on: May 14, 2013, 03:03:33 PM »
Yup! Looked at a Japanese long-form ph3 script, and that was how they did it.

Incidentally, is there built-in logic for any of the following in ph3, or am I going to have to implement them myself:

-Fast-forward button (Space in 0.12)
-Invincibility toggle button ('I' in 0.12)
-Spell Card cutins
-Changing how close the player can get to the edges of the field (default behavior lets them poke halfway off)
-The standard Touhou point item collection logic, where the value depends on where you are on the screen when you capture it
-Fairy Wars/Ten Desires-style circular boss lifebars
« Last Edit: May 14, 2013, 03:25:47 PM by professor_scissors »

Maths ~Angelic Version~

  • Aspiring Mathematician of Brilliant Laziness
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #617 on: May 14, 2013, 03:40:52 PM »
This is what I know about:
-Ctrl is used for fast-forward.
-gtbot has made a cutin function and a GFW/TD lifebar. As far as I know, he's fine with his work being reused, but please give him credit for it. I think Fondue has made a TD-like lifebar too, but I don't know if he's okay with it being reused (of course, you can try asking for permission). I think gtbot's is closer to the original lifebar if that matters to you.
-I believe SetPlayerClip(MinX,MinY,MaxX,MaxY) changes how close the player can get to the edges of the field.
« Last Edit: May 14, 2013, 03:52:11 PM by Maths ~Angelic Version~ »

Ozzy

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #618 on: May 14, 2013, 04:44:50 PM »
-Invincibility toggle button ('I' in 0.12)
-Spell Card cutins

You'll have to implement these yourself. Fortunately, I've already coded the debug keys you're looking for. Feel free to use my code:
Code: [Select]
if(GetKeyState(KEY_I)==KEY_PUSH) { SetPlayerInvincibilityFrame(100000); }
if(GetKeyState(KEY_U)==KEY_PUSH) { SetPlayerInvincibilityFrame(0); }
Once I'm confident that my cut in function doesn't need improvement, I'll release it publicly. However, if you want it in its current state, which is 99% complete and functional, shoot me a PM.

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #619 on: May 15, 2013, 12:41:10 AM »
Thanks for the information! I'll look into gtbot's scripts, and can figure the rest out myself.

As I continue to dig relentlessly deeper into ph3, I'm running into trouble with detecting the collection of user-defined items. I've got this for a simple item script:

Code: [Select]
task CreateLeaf(x, y) {
let turnSpeed = 10;
let angle = 0;

let item = CreateItemU1(T_ITEM_LEAF, x, y, 0);
ObjItem_SetRenderScoreEnable(item, false);
ObjItem_SetDefinedMovePatternA1(item, ITEM_MOVE_TOPLAYER);

while(!Obj_IsDeleted(item)) {
angle += turnSpeed;
ObjRender_SetAngleZ(item, angle);
yield;
}
}

The item appears and behaves as expected, moves towards the player while spinning, and disappears upon contact with them. However, no event is generated. The player's @Event isn't called at all. I tried using a NotifyEvent(playerID, EV_USER, params) call, but still nothing. How do I make my item trigger an event when collected?

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #620 on: May 15, 2013, 01:40:35 AM »
I think Fondue has made a TD-like lifebar too, but I think gtbot's is closer to the original lifebar if that matters to you.

Well, Fondue reused Gt's health bar. I am also going to be using it for some of my scripts in a modified form...more of me nitpicking his work to try to make it more like the original than what was already there. (ie. the "notches" on the health bars are stretched across the bar and there is not supposed to be one at the top of the bar.)

Also I want to say right now that Gt is also a total bro about reuse of his work. I will definitely give credit for all of this.

Maths ~Angelic Version~

  • Aspiring Mathematician of Brilliant Laziness
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #621 on: May 15, 2013, 09:17:50 AM »
Well, Fondue reused Gt's health bar.
I thought I remembered it being slightly different. Well, maybe I remembered Miransu Uwabami's (from BulletForge) lifebar, which looks different from gtbot's. I don't know how Miransu feels about having his/her work reused though.
Edit: Fondue has made a cutin function too. While gtbot's is more or less a recreation of various post-MoF cutins, Fondue's cutin has a more original design.
« Last Edit: May 15, 2013, 12:30:34 PM by Maths ~Angelic Version~ »

fondue

  • excuse me
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #622 on: May 15, 2013, 03:53:35 PM »
 Ohhh, all this talk about me is making me feel wanted C:
-gtbot has made a cutin function and a GFW/TD lifebar. As far as I know, he's fine with his work being reused, but please give him credit for it. I think Fondue has made a TD-like lifebar too, but I don't know if he's okay with it being reused (of course, you can try asking for permission). I think gtbot's is closer to the original lifebar if that matters to you.
Got his permission, used it and credited him.
I thought I remembered it being slightly different. Well, maybe I remembered Miransu Uwabami's (from BulletForge) lifebar, which looks different from gtbot's. I don't know how Miransu feels about having his/her work reused though.
Edit: Fondue has made a cutin function too. While gtbot's is more or less a recreation of various post-MoF cutins, Fondue's cutin has a more original design.
P sure Miransu made his own.
And yes I did make my own.

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #623 on: May 15, 2013, 05:08:52 PM »
Argh, working with custom item logic keeps getting more frustrating and confusing.

I still can't get custom item collection events to work. I try just putting the logic for the item at the end of the item's task, but then it triggers whether the player collects it or it falls off the bottom of the stage. I try to do any logic related to the item's position, but ObjMove_GetX/Y seem to always return 0, no matter where the item is. I try to use GetObjectDistance, but it crashes the game. I try to add dynamic score based on player location, but there's no way to change the Score value of an item after it's been created.

Am I missing something, or are Item objects so wonky that I'd be better off tossing out all the provided Item framework and using ObjRenders for all my items?

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #624 on: May 19, 2013, 02:50:44 AM »
Is there a way to take apart strings?
I'm referring to checking the character at a given position of a string. Like...if you were to check the second position of the word "word", it would return "o".
I know it's possible to do in other languages such as C++...I'm just not sure if it can be done here.

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #625 on: May 19, 2013, 03:07:00 AM »
Just the same. Strings work as arrays of characters.
let str = "word";
str[1] is 'o'
str[1..4] is "ord"
length(var) is 4
erase(str, 1) is "wrd"
str ~ "soup" is "wordsoup"

Moreover booleans are analogous to 0 and 1 so you can do something like
let num = 26;
str[num < 10]
is 'w'

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

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #626 on: May 19, 2013, 03:08:51 AM »
That is...interesting. Thank you very much.

Ozzy

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #627 on: May 19, 2013, 03:11:12 AM »
Is there a way to take apart strings?
I'm referring to checking the character at a given position of a string. Like...if you were to check the second position of the word "word", it would return "o".
I know it's possible to do in other languages such as C++...I'm just not sure if it can be done here.
You would do it the same way you were to do it to an array, since strings are just arrays of characters. For example, if string = "word", then string[1] would equal "o".

Edit: Sorry, I somehow didn't see that Drake beat me to it.
« Last Edit: May 19, 2013, 06:16:37 PM by Ozzy »

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #628 on: June 02, 2013, 03:20:30 PM »
Okay, can someone help me understand ph3's music looping functionality? The numbers you put in really don't seem to reflect its behavior. Like, I do PlayMusic(song, 19, 20) and I'd expect that to mean that the song loops back to 0:19 every time it reaches 0:20, but the looped segment is about 11 seconds long, which doesn't make an ounce of sense. Also, putting in certain pairs of numbers seems to crash the game.

gtbot

  • Master of ScreenSplit
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #629 on: June 02, 2013, 04:12:23 PM »
Are you using an .mp3 file? I've had trouble when working with mp3s, but .wavs work fine.

edit: oops, i didn't check that i was actually using .ogg instead of .wav; fondue is right, .ogg is the one with no problems
« Last Edit: June 02, 2013, 05:50:39 PM by gtbot »