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

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #960 on: March 13, 2012, 01:07:40 AM »
So I'm trying to get a code framework in place to put stage backgrounds into my current project. However, something isn't working.

Code

Then, when I run the code, it looks like this:



I know that ".\bg.png" is legitimate, because I'm using it under #Image, and it shows up there, but all I get in execution is a black void. Is there a step I'm missing here?

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #961 on: March 13, 2012, 01:35:36 AM »
Use GetCurrentScriptDirectory. When you use .\ in a header it links relative to the file's directory, but inside script_enemy the path defaults to danmakufu's script directory. I'd imagine it's looking for script\bg.png currently.

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

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #962 on: March 13, 2012, 02:36:09 PM »
How do you make an object bullet/laser move in a certain angle only with the command Obj_SetPosition(obj,x,y); ? For example, I want the base of the object laser to follow the player with the speed of 1 pixel per second. Another example is that I wish to create 6 object lasers in 6 different directions.

MMX

  • In Soviet Gensokyo...
  • ...bullets dodge you.
    • LiveJournal blog
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #963 on: March 13, 2012, 03:19:50 PM »
How do you make an object bullet/laser move in a certain angle only with the command Obj_SetPosition(obj,x,y); ? For example, I want the base of the object laser to follow the player with the speed of 1 pixel per second. Another example is that I wish to create 6 object lasers in 6 different directions.
I asked the same question a time ago. Lasers can only be moved with Obj_SetPosition like this
Code: [Select]
task lazor(x0,y0,ang,speed){
let obj=Obj_Create(OBJ_LASER);

//some laser setup goes here

Obj_SetPosition(obj,x0,y0);
Obj_SetAngle(obj,ang);
let count=0;
while(!Obj_Bedeleted(obj)){
Obj_SetPosition(obj,x0+cos(ang)*count*speed,y0+sin(ang)*count*speed);
count++;
yield;
}
}
This will move laser straight in a given direction. You may control angle and speed from a task for some fancy movements.
« Last Edit: March 13, 2012, 03:21:59 PM by MMX »
My danmakufu thread Most recent - "Kappa Mechanics" (Nitori fight)   My youtube channel Latest update - EoSD extra no bombs clear


Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #964 on: March 13, 2012, 06:32:50 PM »
Use GetCurrentScriptDirectory. When you use .\ in a header it links relative to the file's directory, but inside script_enemy the path defaults to danmakufu's script directory. I'd imagine it's looking for script\bg.png currently.
Yup, that was it. Thanks, everything's looking good now.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #965 on: March 13, 2012, 11:13:37 PM »
I'm trying to learn how to use Danmakufu, and I read the tutorials. Heck, I even learned a bit of Java!

But still, I am completely lost.

Thanks to some analysis (and copying) of the samples included with the game, I can get a simple stage to work.
« Last Edit: March 13, 2012, 11:40:15 PM by ParallelNebulae »

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #966 on: March 14, 2012, 02:35:24 AM »
Which tutorials did you read? Was there anything unclear? Maybe watching the video tutorials may help you more.

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #967 on: March 14, 2012, 05:13:51 AM »
Before I answer your question, just know that questions like these belong in the Q/A thread, located here. Next time you have a question, be sure to post there instead of a new topic.

1. Is it possible for me to use snippets of a SFX file with different voices? (I got a voice pack I found with the voices seperated. I don't wanna have to cut it all apart, seeing as it takes hours).[quote
No, unfortunately the only way to play sound effects is with PlaySE which always plays the file from the beginning. StopSE could be used to stop the sound effect before it reached the next sound in the file, but you still wouldn't have any way to play any sounds other than the first on on the file without playing the ones before it. You have no choice but to make each sound a separate file. Exactly how many voices are on the file that will make it take hours to separate anyway?

2. Any possible way to make the character say something when they die and respawn?
Yes, you should be able to do that by simply adding PlaySE to the @Missed portion of the player script. Just be aware that that segment loops for as long as the player is dead and respawning so if you just stick it there with no other activation condition, it will loop every frame until the player completely respawns. Also know that @Missed is called when the player is hit, even if they deathbomb. I don't really know what you could do to avoid accidentally playing the sound effect on deathbombs that, but perhaps someone else here knows.

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #968 on: March 14, 2012, 07:27:38 AM »
The way I would do it is to set flags in @MainLoop and @Missed because they don't run at the same time:

let dFlag=0;
@MainLoop{
    if(dFlag==75){ PlaySE(se_respawn); }
    dFlag=0;
}
@Missed{
    if(dFlag<GetRebirthFrame){ dFlag++; }
    else if(dFlag==GetRebirthFrame){ PlaySE(se_death); dFlag=75;}
}

1. Using 75 is simply because regardless of how high your counterbomb period is, @Missed only runs for 75 frames)
2. GetRebirthFrame gets your available deathbomb window, in number of frames (it varies depending if you've already deathbombed, etc)


Or throw it in a task and run it at @Init:

task dTask{
    let dFlag=0;
    loop{
        if(OnMissed){
            if(dFlag<GetRebirthFrame){ dFlag++; }
            else if(dFlag==GetRebirthFrame){ PlaySE(se_death); dFlag=75;}
        }else{
            if(dFlag==75){ PlaySE(se_respawn); }
            dFlag=0;
        }
        yield;
    }
}
@Initialize{
    dTask;
}
@MainLoop{
    yield;
}
@Missed{
    yield;
}

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

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #969 on: March 14, 2012, 09:15:38 PM »
Video tutorials? Thanks! Also, I finally managed to make a basic spell card!

Any advice for how to improve? My only problem right now is that I can't get my background to work.

http://pastebin.com/3JtapP6P 

Large code goes in Pastebin -Hele
« Last Edit: March 28, 2012, 04:46:29 PM by Helepolis »

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #970 on: March 14, 2012, 10:54:42 PM »
Please use pastebin when posting large segments of code.

Also get rid of the quotes in the BackGround declaration.

EDIT: Wait you're using ph3. You're in the wrong thread, man. It says it in thread title, come on.
#BackGround no longer takes the same arguments as in 0.12. It now links to a background script that you create separately. If you want a simple scrolling background, learn to use the @BackGround loop.
« Last Edit: March 14, 2012, 11:02:11 PM by Drake »

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

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #971 on: March 14, 2012, 11:40:07 PM »
Oh? I tried to start a new topic, but when the post was "mod-approved", they moved the it here.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #972 on: March 17, 2012, 01:31:46 AM »
So I'm working on my stage 4 boss which is a battle against two characters at once, and here's how it's done: I have a nonexistant boss who acts as the referee basically while two child scripts manage the two bosses. But now I'm wondering how do I get the health of the main boss enemy, the one who isnt doing anything, to drop when either one of the child scripts get hit, hit boss_A the main script takes damage, hit boss_B, the main script takes damage.

Tried several methods but no success thus far. ><

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #973 on: March 17, 2012, 01:48:48 AM »
So I'm working on my stage 4 boss which is a battle against two characters at once, and here's how it's done: I have a nonexistant boss who acts as the referee basically while two child scripts manage the two bosses. But now I'm wondering how do I get the health of the main boss enemy, the one who isnt doing anything, to drop when either one of the child scripts get hit, hit boss_A the main script takes damage, hit boss_B, the main script takes damage.

Tried several methods but no success thus far. ><
SetDamageRateEx may work. Called in the child enemy's script, this function lets you set damage rate values for the damage done to the child boss and damage transferred from the child to the main boss. It works just like SetDamageRate, only it has 2 extra parameters which set the damage rate for damage given to the main boss.

SetDamageRateEx(0,0,<damage rate from normal shots>, <damage rate from bombs>);

Calling this function with the first 2 parameters as 0 and the second 2 parameters as something else should transfer all of the damage done to the child enemies to the main boss.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #974 on: March 17, 2012, 02:23:23 AM »
SetDamageRateEx may work. Called in the child enemy's script, this function lets you set damage rate values for the damage done to the child boss and damage transferred from the child to the main boss. It works just like SetDamageRate, only it has 2 extra parameters which set the damage rate for damage given to the main boss.

SetDamageRateEx(0,0,<damage rate from normal shots>, <damage rate from bombs>);

Calling this function with the first 2 parameters as 0 and the second 2 parameters as something else should transfer all of the damage done to the child enemies to the main boss.

Wow! Easy fix, thanks ^^ Now I just need to find out how to deal with this next problem, when a spell ends the two bosses explode like normal enemies, I tried vanishing them at the last minute but it does the same, how can you get rid of a child enemies popping explosion?

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #975 on: March 17, 2012, 05:20:21 AM »
Wow! Easy fix, thanks ^^ Now I just need to find out how to deal with this next problem, when a spell ends the two bosses explode like normal enemies, I tried vanishing them at the last minute but it does the same, how can you get rid of a child enemies popping explosion?

That I've never actually done myself but I think you can do it by, first off, deleting the delete the default enemy explode sound effect from memory so it won't play (if you haven't done that already). Of course that may not be an option if you're actually using that sound effect. Then I think you can make the illusion of the boss enemies sticking around by instantly creating them again at the same coordinates that it was at previously in the next boss attack. You may have to store the coordinates of the enemy in common data or something for that. Then call the the last known coordinates of the enemies from the common data and respawn the bosses at those locations in @Initialize of the next attack. It should be seamless.

Of course, there might be another way with VanishEnemy, but I don't know of it.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #976 on: March 17, 2012, 09:14:53 PM »
So I'm having a problem with the FadeOutMusic function - specifically, the problem that it doesn't work. No matter what I put for the frames to fade, the music just cuts out immediately.

Has anyone ever gotten this function to work like it's supposed to?

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #977 on: March 18, 2012, 10:25:47 AM »
That's not in frames, it's more like "quickness of fade". 1 gives the slowest fade-out, higher numbers make it quicker.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #978 on: March 18, 2012, 04:03:05 PM »
That's not in frames, it's more like "quickness of fade". 1 gives the slowest fade-out, higher numbers make it quicker.
That... would explain a lot, actually. So when I'm putting FadeOutMusic(Song1A, 240), it IS fading, just so fast that it might as well be an instant cut.

  • I just can't stop bandodging!
  • "You can eat me if you want"
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #979 on: March 22, 2012, 04:23:18 PM »
One question. Might be stupid, but how to use a font at danmakufu?

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #980 on: March 26, 2012, 10:17:09 AM »
One question. Might be stupid, but how to use a font at danmakufu?

I do not believe that version 0.12m supports alternate fonts. If you want to use other types of text, then unfortunately you are going to have to use effect objects to make them. I think that Ph3 supports additional fonts though I'm not completely sure.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #981 on: March 28, 2012, 05:04:54 AM »
Here again, but with a new request. I wanted to make a script w/ Yukari (almost done) and one for Koishi. The problem is, I want Koishi to sway like she does ingame. I can't have my Koishi without swaying D:. She looks stupid without it. Help please >.<!

EDIT: I also want her to throw her hands up like she does when she attacks. Thanks :D. And could someone also tell me (and I need this really bad) why when I make a shot fire shots from it and then  delete the initial shot, random shots come from the top-left of the screen. It lags danmakufu horribly...
« Last Edit: March 28, 2012, 06:29:45 AM by XxYukariYakumoxX »

  • I just can't stop bandodging!
  • "You can eat me if you want"
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #982 on: March 28, 2012, 04:08:23 PM »
You mean you want her to be animated? Maybe this would help you:
http://www.shrinemaiden.org/forum/index.php/topic,4711.0.html

Also, for the lag part, That depends on how fast your computer is( I think... ). If your computer is slow, try to delete junk stuff( NOT SYSTEM32!! ). If it's a fast computer, then maybe you ascent bullets too much, or spawn them too slow. Sorry I could not be much help.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #983 on: March 28, 2012, 05:27:48 PM »
OK, I got the image working but my swaying looks too...rough. i looked at the way Nue sways and it looks believable but mine doesn't. I CAN'T HAVE MY LOLI WITHOUT SWAYING >.<! It's like Suwako without her hat D:!

EDIT: Heres the code if anyone can help.

http://pastebin.com/x1ENNBwk

MOAR EDITS: Nvm has another problem. When I make her move, she moves, but she cant move after that. any suggestions on how to fix? (i'll update link w/ new code).
« Last Edit: March 28, 2012, 06:05:46 PM by XxYukariYakumoxX »

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #984 on: March 28, 2012, 07:50:43 PM »
And could someone also tell me (and I need this really bad) why when I make a shot fire shots from it and then  delete the initial shot, random shots come from the top-left of the screen. It lags danmakufu horribly...

I'm not quite sure what you mean, perhaps you can pastebin your code so we can take a look?

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #985 on: March 28, 2012, 08:21:57 PM »
I already emptied that code, seeing as it became way too hard how it was turning out anyways. Rotating stars + those walls (even if they woudlve been fixed) + a narrow line to get through + the boss moving around = way too hard of a spell. I made it a lot more simpler. XD. But in the future, it'd be nice to know how it happens and how to prevent it. It happens when i do something along the lines of...

task Bullet(x,y,v,angle,graphic,delay){
        object crap goes here...

      wait(60);
      loop(8){
                    CreateShot01(get object position X, get object position Y, speed, dir , graphic, delay); dir+=360/8; dir++;
                     yield;
        }

i couldn't remember if i added dir++; or not. Could you tell me the results if I did/didn't?

Now, it usually works first few times, but they come from the top-left of screen as well. to the point where i have to close danmakufu after about 5 waves of these.

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #986 on: March 28, 2012, 11:26:28 PM »
You shouldn't be using dir++; if you're already increasing dir, what you have there is just dir += (360/8)+1;. Also, the information you omitted is exactly the information that we wanted to know, so uh, try typing out the script again.

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

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #987 on: March 28, 2012, 11:28:47 PM »
mmm i see. well what information do you need? ive got the basic object bullet setupd if you need that :l.

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #988 on: March 28, 2012, 11:30:07 PM »
Yeah. It's likely that the problem is either the original object position, or how you're getting said position.

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

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #989 on: March 29, 2012, 12:04:20 AM »
ah i see. Well hold on.

task Bullet(x,y,v,angle,graphic,delay){
        let obj=Obj_Create(OBJ_SHOT);

      Obj_SetPosition(obj, x, y);
      Obj_SetAngle(obj, angle);
      Obj_SetSpeed(obj, v);
      ObjShot_SetGraphic(obj, graphic);
      ObjShot_SetDelay  (obj, 0);
      ObjShot_SetBombResist (obj, true);

this is what i use. i dont change anything at all, but someone said i needed to delete the child bullets. any idea on how i could do that?