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

Shadow

  • Forever waiting for tomorrow
  • ...
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #690 on: August 07, 2013, 06:29:29 AM »
Oh, you can. Just use ObjRender_SetAlpha with the bullet object's ID and you are set.

Byronyello

  • "The Western Non-Otaku That Respects and Likes Touhou"
  • I guess that'd be my title in a Touhou game...
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #691 on: August 07, 2013, 06:36:20 AM »
Oh, you can. Just use ObjRender_SetAlpha with the bullet object's ID and you are set.
Much appreciated. When I was looking through the wiki for such a function, I found that. I had no idea that bullet objects were also render objects though, so I thought nothing of it. Again, thank you.
(Strike-through indicates a clear)
Hard Clears: EoSD, PCB, IN, MoF, SA, UFO, TD, DDC.
Lunatic Clears: Someday, perhaps.
Extra Clears: EoSD, PCB, PCB Phantasm, IN, MoF, SA, UFO, TD, DDC.

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #692 on: August 07, 2013, 07:02:48 AM »
« Last Edit: August 07, 2013, 07:07:51 AM by Drake »

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 #693 on: August 07, 2013, 07:19:40 AM »
In ph3, everything that is made as an object will listen to object funtions. So if you want to modify rendering -> Render Object Functions. If you want to influence movement -> Object Movement Functions. Etc etc. Do keep in mind that for some reason not all functions respond to the objects. I've just noticed that Primitive 2D sprites do not respond to ObjMove_SetSpeed while it did in 0.12. Even though some functions are implemented in ph3, they aren't always truly working. PlaySE for example won't play any sounds at all. You need to use Object Sounds.

Regarding Object Sounds, a small explanation:
If you think Object Sounds are independent unique sounds which will no longer be "overwritten" by the same sound (when repeated), you've got it wrong. While it almost looks as if the author intended this, it is either unfinished or he failed. Let me explain further.
Code: [Select]
let objSound = ObjSound_Create;
ObjSound_Load(objSound,<Marisa's Master Spark>);
ObjSound_SetDivision(objSound,SOUND_SE);
ObjSound_Play(objSound);
loop(120) { yield; }
Obj_Delete(objSound);
Let us say our sound sample is Marisa's master sparks sound. A quite lengthy sfx. So the above code is a simple object sound spawn, setting the path, division and playing it. After 120 frames (2s at 60fps) it will be deleted. So if we play this 2x with 0,5s interval, we will have 2 sounds technically. Sounds simple right? Wrong.

First of all, the previous master spark sound is instantly interrupted by the new one. You might think due to the object ID handling, it should have a unique ID and therefore not interfere. Second disappointment is that upon calling Obj_Delete, all master spark sounds will stop playing. Again this is baffling as we though the Object Style scripting would solve all this. My guess is that each sound file (wav/mp3) can be called once in the memory of ph3. Just like 0.12m, playing the similar sound will interrupt the previous.

I am guessing SoundDivision was intended, however, not responding or working at all. Not sure if the author is aware of this.

So there you have it folks, more knowledge for your work. Oh and if you want to mimic PlaySE use this handy function:
Code: [Select]
task PlaySFX(path)
let objSound = ObjSound_Create;
ObjSound_Load(objSound,path);
ObjSound_SetDivision(objSound,SOUND_SE);
ObjSound_Play(objSound);
loop(120) { yield; }
Obj_Delete(objSound);
}
Above can be expanded with more parameters for the delay to delete. It is though important you delete your object sounds eventually, otherwise it will possibly cause performance issues.

Ozzy

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #694 on: August 07, 2013, 07:31:52 AM »
PlaySE for example won't play any sounds at all. You need to use Object Sounds.
That is actually not correct. PlaySE fails to play sound effects if they are not loaded into memory first with LoadSound. It's very strange though that they now require loading while they did not in v0.12m, while the opposite is now true for images.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #695 on: August 07, 2013, 08:26:00 AM »
That is actually not correct. PlaySE fails to play sound effects if they are not loaded into memory first with LoadSound. It's very strange though that they now require loading while they did not in v0.12m, while the opposite is now true for images.
In that case, the wiki mentions nothing about this. We might want to update that.

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #696 on: August 16, 2013, 10:26:17 PM »
I wanna start using ph3. But I noticed there is no Cutin function. Is there is script I can use that does it?

Or will I have to steal it from Mystical Power Plant?

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #697 on: August 16, 2013, 10:34:23 PM »
Why do you need a cut-in effect if you're just starting to use ph3? It isn't a necessary element in any sort of beginner script. If you want a simple picture-and-text thing, then it's easy enough to whip up yourself if you're used to tossing graphics on the screen and moving them around.

But seriously please start using ph3, we need more ph3 up in here.

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 ※ ONLY for NEWEST engine (ph3 beta)
« Reply #698 on: August 16, 2013, 10:54:28 PM »
When I do start learning ph3 I want to atleast be able to get a spell card working, complete with a cutin, name, score bonus.
Pretty much, I want it as close to Touhou as I can get. Especially since I started on a full game and I have been thinking about moving it to ph3. I guess I'll look at MPP.

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #699 on: August 16, 2013, 11:46:50 PM »
I'm saying that if you're "just starting" with ph3, you don't start by attempting to make a Touhou-like, and if you want to make a full game you definitely shouldn't just be yanking other code simply because you can't yet make it yourself.

1. Can you make a cutin image simply render on the screen?
2. Can you pop the image from one place to another?
2b. Can you gradually move the image from one place to another?
3. Can you modify the image's transparency?
3b. Can you make the image fade in and out?
4. Can you make text simply render on screen?
5. Can you pop the text from one place to another?
5b. Can you gradually move the text from one place to another?
6. Can you make the text correspond with some decreasing bonus variable?
7. Can you make the text disappear when you're done the card?
8. Can you award the bonus when you're done the card?

Then you have a simple cutin and score bonus.

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 ※ ONLY for NEWEST engine (ph3 beta)
« Reply #700 on: August 17, 2013, 12:42:59 AM »
You make it look soo simple. I'll do it once I'm familiar with the different functions.

gtbot

  • Master of ScreenSplit
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #701 on: August 17, 2013, 01:44:11 AM »
the cool part is that it is that simple

you can take a look and also use my cutin code (download) if you'd like, however, it's quite messy since this was one of the earlier things i had made for ph3 and i haven't got around to cleaning it up

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #702 on: August 17, 2013, 03:10:46 AM »
the cool part is that it is that simple

you can take a look and also use my cutin code (download) if you'd like, however, it's quite messy since this was one of the earlier things i had made for ph3 and i haven't got around to cleaning it up

Thank you. It works perfectly.

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #703 on: August 19, 2013, 03:35:04 PM »
I noticed that even though I set the score of the spell card the bonus isn't given. But this doesn't seem to work either.

Code: [Select]
let score = ObjEnemyBossScene_GetInfo(objEnemy,INFO_SPELL_SCORE);

AddScore(score);

Can someone help me with this?

gtbot

  • Master of ScreenSplit
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #704 on: August 19, 2013, 05:09:11 PM »
Perhaps you didn't set the attack as a spellcard by using ObjEnemyBossScene_StartSpell?

As for the AddScore not working either, I noticed you are using objEnemy, which implies its the enemy object itself, as the object ID for the function, it should instead be the boss scene object rather than the boss itself. You can get the scene ID by using GetEnemyBossSceneObjectID. You must also use the scene object for ObjEnemyBossScene_StartSpell too, as this could also be another reason the score bonus isn't being given.

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #705 on: August 19, 2013, 05:30:08 PM »
Yup, I changed it to objscene. So now The player gets a spell bonus, but even if the player fails the bonus is still being given.

The "ObjEnemyBossScene_GetInfo(objScene,INFO_SPELL_SCORE)" should update the spell card score with 0 if the player dies right?

Ozzy

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #706 on: August 19, 2013, 05:43:12 PM »
Yup, I changed it to objscene. So now The player gets a spell bonus, but even if the player fails the bonus is still being given.

The "ObjEnemyBossScene_GetInfo(objScene,INFO_SPELL_SCORE)" should update the spell card score with 0 if the player dies right?
The spell card bonus will only be zero if the card is timed out. A death or bomb will not automatically make the bonus zero. You must manually check whether the player bombed or died and add the bonus accordingly.

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #707 on: August 19, 2013, 05:58:27 PM »
I'm trying to use something like this.

Code: [Select]
       
 if(GetPlayerState(STATE_DOWN)==true){
        fail = 1;
       }
        if(fail==1){

        score = 0;
}

But Danmakufu tells me that I'm missing arguments. Even though the Wiki says GetPlayerState only needs 1.

Ozzy

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #708 on: August 19, 2013, 07:26:29 PM »
I'm trying to use something like this.

Code: [Select]
       
 if(GetPlayerState(STATE_DOWN)==true){
        fail = 1;
       }
        if(fail==1){

        score = 0;
}

But Danmakufu tells me that I'm missing arguments. Even though the Wiki says GetPlayerState only needs 1.
There is an easier way to do what you're trying to do. Use ObjEnemyBossScene_GetInfo. This function can return both the number of times the player bombed and died during the current attack with the parameters INFO_PLAYER_SPELL_COUNT and INFO_PLAYER_SHOOTDOWN_COUNT. Look here for more info on this function.

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #709 on: August 19, 2013, 10:30:08 PM »
I still can't get it. No matter what, Danmakufu won't force the "score" varible to = 0.

Code: [Select]

score = ObjEnemyBossScene_GetInfo(objScene,INFO_SPELL_SCORE);

            if(ObjEnemyBossScene_GetInfo(objScene,INFO_PLAYER_SPELL_COUNT)>=1){
            fail = 1;

            }
if(fail==1){
score = 0;
}


Ozzy

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #710 on: August 19, 2013, 11:25:19 PM »
I still can't get it. No matter what, Danmakufu won't force the "score" varible to = 0.

Code: [Select]

score = ObjEnemyBossScene_GetInfo(objScene,INFO_SPELL_SCORE);

            if(ObjEnemyBossScene_GetInfo(objScene,INFO_PLAYER_SPELL_COUNT)>=1){
            fail = 1;

            }
if(fail==1){
score = 0;
}
There doesn't seem to be anything wrong with that logic. Perhaps you should post the rest of the script.

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #711 on: August 19, 2013, 11:56:50 PM »
Ok.
http://pastebin.com/EjVJx0A3


Also, is there a function that is like CreateShotA from 0.12m? I'm trying to see if I can recreate my latest boss battle that I made(check my thread if you want to see it) in 0.12m which uses that function.

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #712 on: August 20, 2013, 03:44:19 AM »
Better:

Code: [Select]
@Event{
alternative(GetEventType())
case(EV_START_BOSS_SPELL){
SPELL_SCORE = 9999; //or whatever other initial value
}case(EV_PLAYER_SHOOTDOWN){
SPELL_SCORE = 0;
}case(EV_PLAYER_SPELL){
SPELL_SCORE = 0;
}
//others
}

Personally I would ignore the default spell score system entirely since getting INFO_SPELL_SCORE depends on things like an active timer and less importantly being an active spell card. It also changes values with its own system so yeah. Well, in the above EV_START_BOSS_SPELL requires an active spell by default too, but you can always hijack the event by calling NotifyEventAll(EV_START_BOSS_SPELL, 0) wherever you want.

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 ※ ONLY for NEWEST engine (ph3 beta)
« Reply #713 on: August 20, 2013, 06:56:21 PM »
Thanks.

One more question, how do I make enemy and familiar scripts? The wiki doesn't say how to build a enemy script.

Imosa

  • Any sufficiently advanced technology
  • is indistinguishable from magic
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #714 on: August 21, 2013, 12:22:03 AM »
Thanks.

One more question, how do I make enemy and familiar scripts? The wiki doesn't say how to build a enemy script.
I looked at Tree of Life by professor_scissors to see how it was done there, and then boiled it down a bit. Essentially you have three things. A function to create a general fairy (helpful since you'll be making a lot of these), a task to maintain the fairy (so the fairy dies when it should and all that sort of stuff), and a task to control the specific type of fairy. This stuff can be collapsed together to an extent, and ToF expands on it. The things look like this:

Code: [Select]
//A task that controls the movements of the fairies.
//Since some fairies fly in formation , I find it useful to make tasks for formations instead of individual fairies
task mixerFormation(x, dir) {
//create a fairy
//while(something) {
//move to some location
//yield;
//}
}

function CreateFairy(img, hp) { //Creating the fairy and passing the image and the hp of the fairy
let e = ObjEnemy_Create(OBJ_ENEMY); //lets create the enemy!
ObjEnemy_SetLife(e,hp); //seting HP
ObjEnemy_Regist(e); //regestering the enemy, whatever that exactly means
ObjPrim_SetTexture(e, GetCurrentScriptDirectory() ~ img);  //adding a texture
ObjSprite2D_SetSourceRect(e, 0, 0, 32, 32); //selecting the right texture
ObjSprite2D_SetDestCenter(e); //positioning the texture
FairyMaintenance(e); //starting the maintaining function
return e; //returning the ID of the fairy
}

task FairyMaintenance(fairy) {
while(!Obj_IsDeleted(fairy) && ObjEnemy_GetInfo(fairy, INFO_LIFE) > 0) { // tests if the fairy is still alive
ObjEnemy_SetIntersectionCircleToShot(fairy, ObjMove_GetX(fairy), ObjMove_GetY(fairy), 16); // if not, give it a radius to be hit by stuff
yield; //... you know what this does, right?
}
if(ObjEnemy_GetInfo(fairy, INFO_LIFE) <= 0 && !Obj_IsDeleted(fairy)) { //tests if the fairy is dead
Obj_Delete(fairy); //makes the fairy dead
}
}

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #715 on: August 21, 2013, 01:20:09 AM »
So do I include this in Stage scripts? Or make single scripts and include them there?

« Last Edit: August 21, 2013, 01:54:22 AM by Infinite Ultima Wave »

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #716 on: August 21, 2013, 03:57:22 AM »
Building an enemy script and launching it to spawn an enemy is the same as spawning a boss enemy, the main difference is the lack of a need for a boss scene. At least, from a stage.

You can just keep creating enemy objects from a boss script if you want familiars that don't run from their own scripts. You can even look at ExRumia for an example.

In other words it's even easier.

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 ※ ONLY for NEWEST engine (ph3 beta)
« Reply #717 on: August 21, 2013, 05:57:03 AM »
Your way seems to work the easiest(it's pretty much like 0.12m), but after some testing I noticed that if I start the same script twice it will only show up once.

So say I use your method to create a enemy that shoots a bullet at the player, and I want 5 of the those enemies, Danmakufu will only create one even though I put StartScript in five times.
IDK, i'll see if Imosa's method works.

Nope tasking it didn't work. Danmakufu tells me I can't use @Initialize in the script I include it in.(Single or even Stage)

Here's the task. http://pastebin.com/w3GWVQYv
« Last Edit: August 21, 2013, 08:14:27 PM by Infinite Ultima Wave »

Imosa

  • Any sufficiently advanced technology
  • is indistinguishable from magic
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #718 on: August 21, 2013, 09:04:45 PM »
So do I include this in Stage scripts? Or make single scripts and include them there?
I had that code in a stage script and called it from the stage script. A more sophisticated and complex stage would probably want to include  it from another file.

Nope tasking it didn't work. Danmakufu tells me I can't use @Initialize in the script I include it in.(Single or even Stage)
I'm a little confused. I've never seen an error tell me that I can't use @Initialize, but the code you posted didn't seem to do anything radical so I don't see why it should be the cause. Clarify, are you putting this code in a new file and including that file, or are you just putting this code in your stage file.
The code you posted is wrong in a few places. Line 26 for example just says, GetX and GetY, and I have no idea what those variables are.

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #719 on: August 21, 2013, 10:01:28 PM »
I had that code in a stage script and called it from the stage script. A more sophisticated and complex stage would probably want to include  it from another file.
Ok, so include it stages like any other task.

I'm a little confused. I've never seen an error tell me that I can't use @Initialize, but the code you posted didn't seem to do anything radical so I don't see why it should be the cause. Clarify, are you putting this code in a new file and including that file, or are you just putting this code in your stage file.
The code you posted is wrong in a few places. Line 26 for example just says, GetX and GetY, and I have no idea what those variables are.

I gave variables in the script. But if I use that script the only way it works is if I include in another task and even then nothing happens.