Author Topic: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)  (Read 267209 times)

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #60 on: May 25, 2012, 01:39:38 AM »
Also, I noticed from a long time ago that you can't play sounds in the Finalize loop.
Huh? You can play sounds from @Finalize. Or at least I've always been able to

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #61 on: May 25, 2012, 04:12:03 PM »
I'm getting a problem with an animation I'm trying to do: the animation won't play. The code is supposed to do the following:
1. Draw the regular, unanimated sprite until the location specified in @initialize is reached (GetCenterX,120)
2. Once this point is reached, start doing the animation
3. Once the animation is over, the actual fight will start, keeping the sprite as the final frame of the animation.

The problem is, the animation won't play once the boss reaches it's destination. The boss won't start firing either, so the point where the animation is terminated is never reached.

Here's the pastebin for the code: http://pastebin.com/C75SrC9p

I can't figure out what I did wrong, so I hope one of you can help me.

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #62 on: May 25, 2012, 09:14:18 PM »
I'm getting a problem with an animation I'm trying to do: the animation won't play. The code is supposed to do the following:
1. Draw the regular, unanimated sprite until the location specified in @initialize is reached (GetCenterX,120)
2. Once this point is reached, start doing the animation
3. Once the animation is over, the actual fight will start, keeping the sprite as the final frame of the animation.

The problem is, the animation won't play once the boss reaches it's destination. The boss won't start firing either, so the point where the animation is terminated is never reached.

Here's the pastebin for the code: http://pastebin.com/C75SrC9p

I can't figure out what I did wrong, so I hope one of you can help me.

The problem I see is that in your mainTask, you check for whether introdone == 1. The task is called only once, so the script only checks once, when the task is first called in @Initialize. Try this instead:

Code: [Select]
task mainTask {
        while(introdone != 1) { yield; }
        wait(120); // The extra yield is unnecessary. You might as well write wait(121);
        fire;
        movement;
}

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #63 on: May 26, 2012, 08:01:16 AM »
That's odd. The mainTask is indeed only called once in @initialize, but somehow in my old version of this file (where mainTask is exactly the same save for the if-statement) it does keep on looping continuously. I'm confused  ??? Especially since the mainTask starts with a yield? Never mind, the yield will simply cause it to go back to @maintask once before it proceeds, although I still don't understand why the mainTask is in @initialize.

Removing the if-statement will cause the mainTask to run just fine though (though I have no idea how since it's only called once): It simply still won't play the animation. Apparently introdone isn't ever set to 1 for some reason. I don't know a good way to test to what point in the code the program gets before it jams since adding an error anywhere, even within an if-statement that doesn't evaluate to 'true' yet will cause an error regardless. Is there any way I can test to what point my script gets?

Also, I got the outlines of the script from this tutorial.

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #64 on: May 27, 2012, 06:32:33 AM »
That's odd. The mainTask is indeed only called once in @initialize, but somehow in my old version of this file (where mainTask is exactly the same save for the if-statement) it does keep on looping continuously. I'm confused  ??? Especially since the mainTask starts with a yield? Never mind, the yield will simply cause it to go back to @maintask once before it proceeds, although I still don't understand why the mainTask is in @initialize.

Removing the if-statement will cause the mainTask to run just fine though (though I have no idea how since it's only called once): It simply still won't play the animation. Apparently introdone isn't ever set to 1 for some reason. I don't know a good way to test to what point in the code the program gets before it jams since adding an error anywhere, even within an if-statement that doesn't evaluate to 'true' yet will cause an error regardless. Is there any way I can test to what point my script gets?

Also, I got the outlines of the script from this tutorial.

I see, I didn't test my solution, so my bad. I know what the additional problem is. You're increasing frame when the boss's coordinates are exactly GetCenterX and 120 which never happens. Because danmakufu is weird, the boss's position is never set exactly to GetCenterX and 120, it's always off by less than 1. To correct it, I had the rewrote the if statement as this:

Code: [Select]
if(introdone == 0 && round(GetEnemyX) == GetCenterX && round(GetEnemyY) == 120)

The script loops just fine without the if statement because fire and movement (called by mainTask) both loop on their own. Your mainTask should only ever be called once, just to start the fire and movement loops. When it is called, the script has just started and introdone is still 0. Thus, the if statement doesnt do anything and mainTask finishes. With the code I gave before, mainTask will wait until introdone = 1 and then run the remainder of the task.
 

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #65 on: May 27, 2012, 07:38:04 AM »
Thank you, the animation works now!  :D I used your solution for the attack loop from the previous post as well and added a ForbidShot to make sure the boss can't be hit during the animation.

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #66 on: May 27, 2012, 07:43:24 PM »
Rather than preventing the player from shooting, I would use SetInvincibility(frames) to make the boss invincible during the animation instead. Just stick in @Initialize. That will also prevent damage from bombs during prior attacks from carrying over.

xForeverFanaticx

  • Bomb ALL the Spellcards!
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #67 on: June 06, 2012, 12:24:53 AM »
Ugh, deciding to come back to Danmakufu and see if I can do much @@

Can anybody tell me how to *completely* remove, during a(all) script(s being used):

-default sound effects
-default images (pretty much I want to remove the point text that appears when you collect items, and the items that appear and autocollect when you complete an attack of any kind)

As for the HUD on the right, I know I can use a function to hide that text, which will be good enough for me.

Also, can somebody direct me to somewhere where I can find what all the layers of the game screen are?

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #68 on: June 06, 2012, 01:19:56 AM »
-Create a folder in the root dnh directory called se and create blank files with the names of the default sound effects:
sePlayerShot01.wav   
seGraze.wav   
sePlayerCollision.wav
sePlayerSpellCard.wav
se1UP.wav   
seScore.wav   
seBomb_ReimuA.wav   
seExplode01.wav   
seBomb_ReimuB.wav
seUseSpellCard.wav
seGetSpellCardBonus.wav
seEnemyExplode01.wav   
seSuperNaturalBorder1.wav   
seSuperNaturalBorder2.wav

-Same deal, create an img folder and make transparent png images and name them the same as the defaults (or just erase the necessary portions of the image if you have it)
http://www.shrinemaiden.org/forum/index.php/topic,3167.msg143460.html
There's a list and some "ripped" images are in there.

0: background
1: nothing
2: enemies
3: player, default effect objects
4: items
5: bullets
6: event images/dialog
7: nothing
8: frame (if you draw something on 8 the frame is set to redraw every frame)

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

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #69 on: June 06, 2012, 01:37:55 AM »
I always use DeleteSE in the beginning of scripts to get rid of the default sound effects. I image DeleteGraphic would also work for the default images but I have yet to try it for myself. I've noticed that sound effects deleted in this way remain deleted until Danmakufu itself is reset. So it only needs to be called once for a stage script for example.

xForeverFanaticx

  • Bomb ALL the Spellcards!
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #70 on: June 06, 2012, 02:22:34 AM »
Hmm... I looked through the existing img file (dunno if it was left from another game or something) but I see no "system.png"
Is there not supposed to be that file in the img folder initially? If I were do put a file with that name in it, would it override the original file if it exists elsewhere? :V

Havent tested it yet because its so late at night, but does this work to remove the score text that appears for each item collected as well? Having graphics that dont match with the gameplay bugs me.

(lol and yeah, I'm feeling quite lazy to learn some of the miniscule functions, so I'm planning on winging it and improv scripting to make things work xD)

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #71 on: June 06, 2012, 04:13:16 AM »
The folders and files don't exist on a fresh install, but adding the folders and making new images/sounds will get danmakufu to load those instsead.

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

xForeverFanaticx

  • Bomb ALL the Spellcards!
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #72 on: June 06, 2012, 11:08:41 AM »
The folders and files don't exist on a fresh install, but adding the folders and making new images/sounds will get danmakufu to load those instsead.

Ah, I see. Thanks to all of you! ^^

xForeverFanaticx

  • Bomb ALL the Spellcards!
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #73 on: June 06, 2012, 10:08:28 PM »
Sorry for the double post, but I'm wondering what exactly each type of blending in danmakufu does? :V

ie. Alpha, Additive, Subtractive, and Multiplicative Blending? :V

Drake

  • *

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

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #75 on: June 07, 2012, 02:14:39 AM »
This may seem like a stupid question, but to those out there who know how to do all of that editing stuff with making bullet-shot sounds different along with their looks could you please tell me how? I have been wanting to make my own custom (playable) character with his/her own things to shoot instead of like Reimu's cards or something. I was almost hoping you'd know how to change the sound of bullets and how to make a custom player spellcard? This all seems a bit confusing to explain on a forum, and since it's my first post I feel very awkward, but anyway, any replies with helpful (not hateful, malicious, or rude in general) words would be very much appreciated.  :3

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #76 on: June 07, 2012, 02:59:13 AM »
General Info and FAQ thread:
http://www.shrinemaiden.org/forum/index.php/topic,6181.0.html

...in which you will find the Player Script tutorial:
http://www.shrinemaiden.org/forum/index.php/topic,210.0.html

And then we have the two stickied Q&A threads if you have any further questions (which is likely).

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

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #77 on: June 14, 2012, 08:25:51 PM »
How do you make an effect object similar to medicine's poison or shikieiki's vortexes?

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #78 on: June 14, 2012, 10:35:07 PM »
Do you just mean "how do I make an effect object"? The only difference with Eiki's vortexes is that bullets are fired from it, and Medicine's is only slightly more complex. In any case, they do different things entirely, so I can only guess you mean to ask how to get an effect on screen.
Here's a tutorial on how to do so. Here's another. If there's anything after that you need help with, don't hesitate.


I'm going to personally note that modifying player movement as substantially and arbitrarily as Medicine's poison is a bad design choice. Youmu and Sakuya work well because their danmaku is designed around the notion that player motion will be affected and don't do anything silly while active. Youmu slows down the game and actually makes it somewhat easier, while Sakuya stops time so that the player actually gets to see the new bullets being spawned before they fire. Both of these use time shenanigans in a precise, patterned and predictable manner; firing poison clouds that slow you down is not timely and will affect you arbitrarily regardless of what else is on the screen.
« Last Edit: June 14, 2012, 10:36:48 PM by Drake »

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

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #79 on: June 17, 2012, 01:59:45 PM »
I already know how to make effect objects that sit there and look pretty, like yuyuko's fan.
I want to know how to make effect objects that actually have effects, like affecting enemy bullets or player movement.

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #80 on: June 17, 2012, 05:30:10 PM »
You're missing something quite significant here then, but I'm not sure exactly what. There is no difference between an object that sits there and an object that does something besides adding in the code for the "does something". Are you wondering how to actually run other code after the object's initial creation? How to do something during that period like firing bullets? How to get the condition for "the player hits this object", or some other condition? If you know how to do these three then you should have no problem, so...

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

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #81 on: June 17, 2012, 06:48:33 PM »
^That's exactly the part I need to know

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #82 on: June 17, 2012, 07:08:51 PM »
^That's exactly the part I need to know

If you want the object effect to manipulate bullets somehow, the easiest way to go about this is to make the bullets themselves objects as well. You're not giving too much detail here, so I'm guessing you want the bullets to behave some way when they come close to the effect object. You're going to have to do a proximity check as well as a branch routine.

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #83 on: June 17, 2012, 09:45:29 PM »
^That's exactly the part I need to know
...You never said which of the three you needed help with. You also haven't posted anything you've already done, so I'm literally going on nothing here dude, come on. I don't want to have to spoonfeed if I can help it.

From the beginning then; a basic rectangle effect object looks like this:
Code: [Select]
let obj = Obj_Create(OBJ_EFFECT);
Obj_SetPosition(obj, x, y);
ObjEffect_SetTexture(obj, texture);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetVertexUV(obj, i, bla, bla); //set four texture vertices
ObjEffect_SetVertexXY(obj, i, bla, bla); //set four render vertices
Generally you're going to plop this in a function to return or a task. If you haven't read it already, please go read (and understand) the intermediate tutorial. Actually, might be an idea to read it again anyways.
Code: [Select]
task effectbla{
//initializing effect object goes here
loop(60){
Obj_SetX(obj, Obj_GetX(obj) + 4);
yield;
}
ascent(i in 0..9){ CreateShot01(Obj_GetX(obj), Obj_GetY(obj), 4, i*15, RED01, 12); }
loop(60){
Obj_SetX(obj, Obj_GetX(obj) + 4);
yield;
}
Obj_Delete(obj);
}
Really, nothing special is going on here, it's just standard task handling. Effect is created, 60 frames of moving, fires bullets, another 60 frames of moving and it's deleted.

The condition for the player hitting the object is just "when the player gets to a certain distance from the object's center", depending on your effect, I guess. High school trig.
if(((GetPlayerY - Obj_GetY(obj))^2 + (GetPlayerX - Obj_GetX(obj))^2)^0.5 > distance) is the condition. You would just plop it into your task.

This is kind of why I don't know what your actual problem is. If you know how to make effect objects and you've read the intermediate tutorial, this should be easy, so I'm a bit confused.
« Last Edit: June 17, 2012, 09:59:26 PM by Drake »

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

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #84 on: June 23, 2012, 03:05:32 PM »
How can I do the Extend System? [Like when you have 50/50 points, geta nother life n bomb, then set it to 50/120?]
Yeah, i'm noobish xD

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #85 on: June 24, 2012, 05:01:17 PM »
How can I do the Extend System? [Like when you have 50/50 points, geta nother life n bomb, then set it to 50/120?]
Yeah, i'm noobish xD

Unfortunately you have to write a task to do it yourself. You can use SetNormPoint to set the number of point items that are required for an extra life. However, this just sets the display. When you reach the specified number, you won't automatically get an extra life. Here's a task you could run that manages the extends:

Code: [Select]
task Extend {
let p = 350;
loop {
if(GetPoint>=350 && p == 350) { ExtendPlayer(1); SetNormPoint(700); p = 700; }
if(GetPoint>=700 && p == 700) { ExtendPlayer(1); SetNormPoint(1100); p = 1100; }
if(GetPoint>=1100 && p == 1100) { ExtendPlayer(1); SetNormPoint(1600); p = 1600; }
if(GetPoint>=1600 && p == 1600) { ExtendPlayer(1); SetNormPoint(2000); p = 2000; }
if(GetPoint>=2000 && p == 2000) { ExtendPlayer(1); SetNormPoint(9999); p = 9999; }
yield;
}
}

The p variable is there to make sure that the task only gives the player 1 extra life per point threshold.

Now I have my own question. I've been toying around with 3D backgrounds (which has been very frustrating). I just want a scrolling floor texture to scroll out of the screen from another background. How can I get the floor texture to fade into the background? I though that SetFog to fade the floor texture into the same color of the background would work. However, SetFog seems to have made the entire texture the color rather than only that part that's far enough away (unless I'm doing something wrong). I can pastebin code if it helps.

Chau

  • Warning! Incoming Engrish post!
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #86 on: June 30, 2012, 06:01:38 PM »
No, I'm not dead yet! Still working on my full game, but very slowly...

I have a problem with color gradients. If I play in windowed mode, everything is fine, but when I switch to fullscreen mode, there are weird-looking stripes. I'm not sure whether this problem is Danmakufu-related, though.


« Last Edit: June 30, 2012, 06:03:28 PM by Chau »

TheTeff007

  • Best Touhou 2015!
  • So much cuteness...!
    • Youtube Channel
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #87 on: June 30, 2012, 07:01:47 PM »
My guess is because the image extends itself to fit the screen, then gets less resolution?

A possible solution: Make a bigger image and shrink it to fit the screen, this way, I suppose when enlarging the screen the effect will be less, if not, noticeable.
Small Teaser of my upcoming project~

No need to call me Teff007. Teff will do just as well~

fondue

  • excuse me
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #88 on: July 01, 2012, 04:02:31 PM »
My guess is because the image extends itself to fit the screen, then gets less resolution?

A possible solution: Make a bigger image and shrink it to fit the screen, this way, I suppose when enlarging the screen the effect will be less, if not, noticeable.
Also, the image canvas (width and length of the whole image itself) should be a power of 2 (2,4,8,16,32,64,128,256,512 etc). It will help prevent blurriness, it's not complementary but it's recommended.

Chau

  • Warning! Incoming Engrish post!
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #89 on: July 01, 2012, 04:50:45 PM »
I tried this with a test image (512*1024) and shrinked it to fit the screen: (left: windowed mode; right: fullscreen)
http://oi46.tinypic.com/288o6s2.jpg
I looked around in the internet and found that it maybe has something to do with "color banding" or 8/16/24-bit or my video card. I don't know much about this, these are just words I stumbled upon.