Maidens of the Kaleidoscope

~Hakurei Shrine~ => Rika and Nitori's Garage Experiments => Topic started by: Iryan on June 19, 2010, 09:13:50 PM

Title: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on June 19, 2010, 09:13:50 PM
Old topic here. (http://www.shrinemaiden.org/forum/index.php?topic=4771.0)

Now, lie down on that bed and tell me about your script.

 BV
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on June 19, 2010, 09:17:52 PM
As I were saying, what's with not being able to use certain functions in certain types of scrips?
Now I have to use common data, goddammit.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on June 19, 2010, 09:23:42 PM
The creator didn't think you'd need to use those functions outside of their respective script types. The only way to do it is common data.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Shade on June 20, 2010, 08:26:17 PM
Sorry for having really stupid/lame topics, and/or if this doesn't belong here, but how do you unlock extra mode in Concealed the Conclusion?

Many say you have to 1cc Normal or higher with all four, two, or 1 of Marissa's shots. Which is it? D: And I'm talking about the regular extra mode, not the phantasm.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on June 20, 2010, 09:16:06 PM
Just 1cc normal with everyone and see what happens.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Shade on June 20, 2010, 09:18:51 PM
Do I have to clear all of Reimu's last word spells? The barriers and Visionary Miko are insane. -_-

Oh and does it have to be patched?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on June 20, 2010, 09:29:21 PM
No clue.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Shade on June 20, 2010, 09:50:11 PM
Alrighty, thanks.

Hmph.. I beat All of the choices, but I didn't really capture all of Reimu's last words. I'll try MarissaA again since I haven't done that scenario in a while... Oh well.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Prime 2.0 on June 21, 2010, 03:44:31 AM
1cc all scenarios with their respective shot types on normal mode to unlock Extra. Beat Extra, 1cc all scenarios as a single shot type on normal mode(And it has to be normal mode, can't be hard or lunatic) and start games on hard and lunatic to unlock Phantasm.

This stuff is on the wiki, shouldn't you have tried that first?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: 空SoraのNo鏡Kagami on June 21, 2010, 08:20:32 PM
Uhh, this code I had was working... Until I tried to make a spell while looking at the advanced tutorial... Now it doesn't work

This...
Code: [Select]
#TouhouDanmakufu
#Title[Marksman]
#Text[Prybetier has been gaming too much...]
#PlayLevel[Oni]
#BackGround[User(\script\Slackin\GapBridge.png, 0, 0)]
#BGM[\script\Slackin\Necrofantasia.mp3]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let frame = 0;
    @Initialize {
        SetLife(1000);
        SetEnemyMarker(true);
        MagicCircle(true);
        SetDamageRate(30, 10);
        SetTimer(60);
        SetInvincibility(20);
       


    }

    @MainLoop {
       
        SetCollisionA(220, 120, 32);
        SetCollisionB(220, 120, 24);
        if(frame==60){

       
       

        CreateLaser01(GetX, GetY, 2.5, GetAngleToPlayer, 100, 10, WHITE02, 5); 
        CreateLaser01(GetX, GetY, 2.5, GetAngleToPlayer, 100, 10, YELLOW02, 15);
         CreateLaser01(GetX, GetY, 2.5, GetAngleToPlayer+40, 100, 10, WHITE02, 5); 
        CreateLaser01(GetX, GetY, 2.5, GetAngleToPlayer+40, 100, 10, YELLOW02, 15);
         CreateLaser01(GetX, GetY, 2.5, GetAngleToPlayer-40, 100, 10, WHITE02, 5); 
        CreateLaser01(GetX, GetY, 2.5, GetAngleToPlayer-40, 100, 10, YELLOW02, 15);
        CreateLaser01(GetX, GetY, 2.5, GetAngleToPlayer+15, 100, 10, WHITE02, 5); 
        CreateLaser01(GetX, GetY, 2.5, GetAngleToPlayer+15, 100, 10, YELLOW02, 15);
        CreateLaser01(GetX, GetY, 2.5, GetAngleToPlayer-15, 100, 10, WHITE02, 5); 
        CreateLaser01(GetX, GetY, 2.5, GetAngleToPlayer-15, 100, 10, YELLOW02, 15);
       
        CreateLaser01(GetX, GetY, 5, GetAngleToPlayer, 100, 8, ORANGE02, 5); 
        CreateLaser01(GetX, GetY, 5, GetAngleToPlayer, 100, 8, RED02, 10);
        CreateLaser01(GetX, GetY, 5, GetAngleToPlayer+3, 100, 8, ORANGE02, 5); 
        CreateLaser01(GetX, GetY, 5, GetAngleToPlayer+3, 100, 8, RED02, 10); 
        CreateLaser01(GetX, GetY, 5, GetAngleToPlayer-3, 100, 8, ORANGE02, 5); 
        CreateLaser01(GetX, GetY, 5, GetAngleToPlayer-3, 100, 8, RED02, 10); 

        CreateLaser01(GetX, GetY, 10, GetAngleToPlayer, 100, 5, BLUE02, 5); 
        CreateLaser01(GetX, GetY, 10, GetAngleToPlayer, 100, 5, PURPLE02, 8);

        CreateLaser01(GetX, GetY, 6.5, GetAngleToPlayer+2, 100, 7, AQUA02, 5);
        CreateLaser01(GetX, GetY, 6.5, GetAngleToPlayer+2, 100, 7, GREEN02, 10);
        CreateLaser01(GetX, GetY, 6.5, GetAngleToPlayer-2, 100, 7, AQUA02, 5);
        CreateLaser01(GetX, GetY, 6.5, GetAngleToPlayer-2, 100, 7, GREEN02, 10);
        frame = 30;




       
        }
        frame++;
    }

    @DrawLoop {       
    }

    @Finalize {
    }
}
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Fetch()tirade on June 21, 2010, 08:25:38 PM
Forgot the yield; in MainLoop. Also, the enemy doesn't appear onscreen at all. If the yield; is put in, then the shots will just come from the top of the screen, where the boss starts off.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on June 21, 2010, 08:36:19 PM
Yes. Because you didn't tell the boss to move somewhere, the lasers get spawned outside of the playing field where they get deleted instantly.

Just put SetMovePosition02(GetCenterX, 128, 30); or something into your @Initialize.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: 空SoraのNo鏡Kagami on June 21, 2010, 11:10:33 PM
Yes. Because you didn't tell the boss to move somewhere, the lasers get spawned outside of the playing field where they get deleted instantly.

Just put SetMovePosition02(GetCenterX, 128, 30); or something into your @Initialize.

Hmm... I guess the Random Movement was a big deal... I recently had it so the boss was moving to random positions. Thank you.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: 空SoraのNo鏡Kagami on June 22, 2010, 12:23:07 AM
Yes, i know... I am a trouble magnet... That comes with me not fully comprehending the Intermediate Tutorial...

I'm trying to find a way to make it so the frame rate of my shots get higher at a certain time...
How would you set up the variable? [Yes I do suck]
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on June 22, 2010, 12:26:32 AM
Code: [Select]
let time = 60;


if(frame==time){do stuff; time--;}


if(time<21){time=20;}


Have it so every time the condition is met that it subtracts the number you want
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: 空SoraのNo鏡Kagami on June 22, 2010, 12:48:23 AM
Well, it doesn't crash when I put it in... I'm probably going to run back about in a few minutes, so I'll postpone it until tomorrow. meanwhile, I'll tamper with it. Sorry for being so hopeless by the way.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on June 22, 2010, 12:12:13 PM
How do I make a bullet spawn another bullet, I used the ascent thingy but it spawn 1 bullets persecond, If I want it to spawn bullet less often how do i do ?

CreateShotA(1, GetX, GetY, 10);
SetShotDataA(1, 0, 2, angle, 0, 0, 0, 216);

ascent(i in -10..100){
CreateShotA(2, 0, 0, 10);
SetShotDataA(2, 0, 3, angle, 0.5, 0, 0, RED11);
AddShot(i*2, 1, 2, 0);
}
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on June 22, 2010, 12:29:45 PM
Firstly, the bullets appear to spawn in the wrong place because AddShot makes the x and y coordinates of the added bullet orient themselves after the bullet to which you add them. For example, adding a bullet with a presumed X coordinate of GetX to a mother bullet that is already placed on the position GetX would make the spawned bullet appear on the position 2*GetX, which will usually be far to the right of the playing field if, not so far to the right that it won't get spawned at all.

Secondly, the ascent function.

ascent(variable in i..n){
       Stuff that has to do with variable;
}

This code has the following effect:
First, it creates a variable of the specified name. Then it preceeds to do the "Stuff" you have put into the {} brackets several times, but each time, it assignes a different value to the variable. The "Stuff" is done once for variable = i, once for variable = (i + 1) and so on, increasing the value of the variable by 1 every time. It continues until doing the "Stuff" in the brackets for the case variable = (n - 1).

For an example, this code:

Code: [Select]
ascent(i in 1..6){ CreateShot01(GetX, GetY, i/2, GetAngleToPlayer, RED21, 0); }
...will create five RED21bullets at the position of the boss and aimed at the player. One bullet with a speed of (1/2) = 0.5, one with a speed of (2/2) = 1, one with a speed of (3/2) = 1.5, one with a speed of (4/2) = 2 and one with a speed of (5/2) = 2.5.



Edit: Editing your post while I am replying to it is no fair.  :fail:

Also, I don't get your question as that code definitely does not spawn a bullet once every second.

If you want your mother bullet to spawn one bullet every second, you need to make every added bullet have a difference of 60 frames in the time it is fired. That means you want to change the first parameter in AddShot to 60*i.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on June 22, 2010, 12:55:33 PM
IT WORKS  :o
Thanks Iryan

Edit : It's fair when your the Editor  :derp:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: 空SoraのNo鏡Kagami on June 22, 2010, 11:20:24 PM
I don't get how to set up the descent, and ascent statements... As usual, explain where to put it and blah.
(You guys should get like, points or something for this...)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: CK Crash on June 22, 2010, 11:39:28 PM
ascent(i in a..b){Stuff;} makes a new variable i that starts at a. It then runs the code in the brackets, with i being increased by 1 each time. Once i equals b, it stops looping.

ascent(i in 0..5){Stuff;} does i=0, i=1, i=2, i=3, and i=4, but it stops and doesn't include i=5.

Code: [Select]
ascent(i in 0..10){Stuff;}
=

Code: [Select]
let i = 0;
while(i<10)
   {
   Stuff;
   i++;
   }

descent(i in a..b){Stuff;} does the exact same values of i, but in reverse order. You can use any variable name instead of i, in the event you need more than one ascent/descent.

Code: [Select]
ascent(i in 0..5){CreateShot01(GetX,GetY,1+i,GetAngleToPlayer,RED01,10);} //A line of 5 bullets.

ascent(i in -2..3){CreateShot01(GetX,GetY,1,GetAngleToPlayer+i*5,RED01,10);} //A wall of 5 bullets.

ascent(i in 0..18){CreateShot01(GetX,GetY,1,GetAngleToPlayer+i*20,RED01,10);} //A ring of 18 bullets.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: 空SoraのNo鏡Kagami on June 22, 2010, 11:49:12 PM
Well... That really clarified all this... Thank you.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on June 23, 2010, 03:19:02 AM
So now that schools out for most of you youngin's, how do we feel about holding the next Danmakufu contest sometime soon?

What, it's a Danmakufu question.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Bitz on June 23, 2010, 05:11:40 AM
Yes.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Furienify on June 23, 2010, 05:28:41 AM
Sure.

So long as it isn't the idea you were tossing around on IRC. Most people won't bother to learn a new engine.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on June 23, 2010, 05:48:14 AM
Hell yeah.
ADD bullets only! Reimu A and Marisa A only! Hakurei Shrine!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Prime 2.0 on June 23, 2010, 08:39:36 AM
A contest to pimp out or perform other absurdities to an existing script provided by the contest maker?

Naw, it wouldn't be fair to make everyone compete with Azure like that.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Kylesky on June 23, 2010, 10:46:08 AM
Just when school started? :ohdear:

BRING IT ONI need to learn myself some time management skillz
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on June 23, 2010, 10:54:46 AM
And of course such ideas come up on IRC when I'm already asleep.  ::)

My idea:

A stage creation contest, but still judged primarily on playability, not on prettyness of backgrounds or sprites.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on June 23, 2010, 06:54:12 PM
Too bad playability and enjoyment is heavily based on those factors as well.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Bitz on June 23, 2010, 09:10:29 PM
You could always prevent prettiness from causing possible bias by outright not letting people use any backgrounds, sprites, shotsheets, etc. except for approved ones, such as the TH-like Supershot shotsheet or some approved spritesheets or whatnot (for enemies and bosses).
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on June 23, 2010, 09:11:56 PM
Actually, getting people to make a script with pre-determined graphics would be kinda neat.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on June 23, 2010, 09:15:42 PM
Predetermined advanced shotsheet and default background only. Final Destination!

I like the idea~
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on June 24, 2010, 03:53:56 AM
Alright, lemme throw some stuff together for thursday or friday. I'll host. If anybody is interested in co-judging, gimme a shout. And just like that, I have a co-judge.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: 空SoraのNo鏡Kagami on June 24, 2010, 04:03:40 PM
I guess it's a good I already do all that...  :derp:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: 空SoraのNo鏡Kagami on June 24, 2010, 04:05:25 PM
Anyways... For some reason, when i draw the BossImage, it tiles the image across the whole screen. And... I've really no idea...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Fetch()tirade on June 24, 2010, 04:12:56 PM
When you draw anything, you have to specify the image's size, giving the distances of the sides of a rectangle which contains that image.

For example, if I had a 900 x 900 image (including white space), then the SetGraphicRect function would have (0, 0, 900, 900) because Danmakufu calculates images, along with some other things, by (left side, top side, right side, bottom side). SetMovePositionRandom01 is another example.
If your image is tiled, then most likely the sides you specified are wrong. Hmmm.... did you copy the same code for @BackGround and put it in @DrawLoop, except change the names of the images?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: 空SoraのNo鏡Kagami on June 24, 2010, 05:16:22 PM
Yeah, it was SetGraphicRect. I hadn't started drawing stuff until now so I didn't know  :derp:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on June 24, 2010, 05:47:10 PM
I have another question  :( [Unrelated to the contest thingy] If I want to make 3 stages run into one script, how do I do it ?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on June 24, 2010, 05:53:45 PM
You take the main code that determins the stage (which should consist of a couple of variable, object and function definitions, as well as the tasks that regulate the actual flow of the script), and then either put it all in the same script or make a script that contains all these information by the means of #include_function. Then make it so that the ending of one stage calls an event script that covers the screen with a "Stage Clear!" picture or something, then segues into the other stage.

Yeah, it is not easy...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on June 25, 2010, 11:15:28 AM
Is there any trick to getting music to loop right? It has something to do with the file length, but I'm lost on the specifics. Worst case scenario I can just loop everything twice then fade out, but I'd like to not have double the filesize if I can prevent it...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on June 25, 2010, 11:18:51 AM
Is there any trick to getting music to loop right? It has something to do with the file length, but I'm lost on the specifics. Worst case scenario I can just loop everything twice then fade out, but I'd like to not have double the filesize if I can prevent it...

To have a precise music loop, I believe you need to have a music file that has a length in seconds of an integer, or slightly below that. Something like 137.9990 seconds.

If your music can't be cut that way, well, sorry.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on June 25, 2010, 11:37:11 AM
Is there any trick to getting music to loop right? It has something to do with the file length, but I'm lost on the specifics.
That is only on the sound effects, not on music. (assuming you are not trying to load music with playSE.) (( Unless I am missing the point then you can ignore this ))

This I would like to know exactly as well, as it is very important for like anybody's game. Listening to Mitori's theme makes me notice the music lit. cut off suddenly, but loops perfect in danmakufu.

I haven't tried Iryan's thing out yet. Anybody who knows the exact details please make a tutorial out of it. I think it would be valuable information.

Also I'll try to dig out the thing about the sound effect limitations, not that it probably matters. Cannot remember if it was in the old Q&A thread or in the FAQ.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on June 25, 2010, 11:53:46 AM
I make the length an integer, but looping still messes up. It doesn't just loop at the wrong point either, it stutters and mixes the end with the beginning. I've been trying this for about two hours now with no luck, so I give up. I'll just take the lazy way out (looping in the file a few times) then have an optional download with all WAV files (which loop perfectly) for better looping and quality. Thanks for trying to help, anyway.
If you find a music file that loops perfectly in DMF, link it here so I can examine it a bit...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on June 25, 2010, 11:59:22 AM
If you find a music file that loops perfectly in DMF, link it here so I can examine it a bit...

Listen and analyze Mitori's theme download it here (http://www.shrinemaiden.org/forum/index.php?topic=3244.msg136696#msg136696).
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on June 25, 2010, 04:42:20 PM
Mitori's theme doesn't work either; it just repeats for ten minutes. After so many fluid manual repeats it isn't that big a deal.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Formless God on June 26, 2010, 08:33:09 PM
Code: [Select]
script_enemy_main {
#include_function ".\function_cutin.txt";
LoadUserShotData("stuff\supershot_v4.1\supershot.txt");
let frame=0;
let cut="script\tutorial\Nazrin.png";
@Initialize {
LoadGraphic(cut);
cutin("NAZRIN","sc",cut,0,0,291,472);

The script simply skips to the stuff in @MainLoop without any cutin animations. I'm sure I put function_cutin.txt and the portrait into my script's folder :/
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Mr. Sacchi on June 26, 2010, 09:10:26 PM
This is my question:

So, I'm going with the video tutorials, and, well.
I want to know exactly where to put the "MainTask", like, how to make danmakufu actually know it exists, according to the video I'm doing everything right, the task is down there just like in the video, though when I put it into the script the game crashes, and when I don't the boss does nothing.

When It Crashes:
Quote
@Initialize {
        SetLife(1000);
        SetTimer(320);
   SetScore(10000000);
   SetMovePosition01(GetCenterX,GetCenterY,5);
   LoadGraphic(imgBoss);
   LoadGraphic(cut);
   LoadGraphic(bg);
   
   CutIn(YOUMU,"Red icicle - Fail -",cut,0,0,300,384);

   mainTask;
    }

When it does nothing:
Quote
  @Initialize {
        SetLife(1000);
        SetTimer(320);
   SetScore(10000000);
   SetMovePosition01(GetCenterX,GetCenterY,5);
   LoadGraphic(imgBoss);
   LoadGraphic(cut);
   LoadGraphic(bg);
   
   
CutIn(YOUMU,"Red icicle - Fail -",cut,0,0,300,384);
    }

"mainTask" in both occasions:
Quote
// main task, activates stuff
   task mainTask; {
      yield;
      fire;
      movement;
   }

Some one knows what's happening?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on June 26, 2010, 09:32:42 PM
Saigyouji - Read the readme for the Cut-In


Sacchi - Danmakufu crashes because of most likely an infinate loop. try putting : loop(1){yield;} in each task, fire and movement.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on June 26, 2010, 09:39:07 PM
Sacchi - Danmakufu crashes because of most likely an infinate loop. try putting : loop(1){yield;} in each task, fire and movement.
No. That is not how it's done...

@Sacchi, post your entire code in http://www.pastebin.org and show the link here.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Formless God on June 26, 2010, 09:41:22 PM
1) Extract the content of this zip in your scripting directory - check
2) Include 'function_cutin.txt' with '#include_function' in your spellcard - check. Actually I'm not sure what he meant by "in your spellcard".
3) load the cutin portrait - check
4) call the new function in @Initialize with the command 'cutin' - check

(http://img63.imageshack.us/img63/9474/76517260.png)

And the result would be the piece of code above. I'm not sure if I misplaced anything (especially that #include_function).
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on June 26, 2010, 09:45:37 PM
Same goes to you Saigyouji Formless Nirvana, post entire code in pastebin. It's hard to check like this.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Formless God on June 26, 2010, 09:54:24 PM
Here it is: http://www.pastebin.org/360788
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on June 26, 2010, 10:00:19 PM
Here it is: http://www.pastebin.org/360788
Ok, just as I expected. The Cutin function (regular or my custom) can only be seen if the card is a spell card. A spell card is triggered in Danmakufu by setting a score: SetScore(value); 

If you don't do this, Danmakufu will ignore @BackGround and Cutin functions. Also you might want to yield you mainloop at the end as well, because the custom cutin is a tasked based script and thus requires the mainloop to yield at the end. You can still use functions in there as long as you yield it at the end.

Here is how it should look like: http://www.pastebin.org/360797

Edit PS:

You may want to swap SetScore , SetLife to the beginning so they are the first things run during @initialize (just incase)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Mr. Sacchi on June 26, 2010, 10:42:41 PM
Alrighty Then,here it is:
http://www.pastebin.org/360831 (http://www.pastebin.org/360831)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on June 26, 2010, 10:47:27 PM
Alrighty Then,here it is:
http://www.pastebin.org/360831 (http://www.pastebin.org/360831)


Just as I thought! First of all you need a yield; in MainLoop to make danmakufu check if their is a task going on. and 2) you have an infinate loop in your fire task, put a wait(what ever number you feel like); in there to make it not crash. Oh, and your missing your movement task.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on June 26, 2010, 10:49:31 PM
Ah...

1. You don't have a "movement;" task or function defined, it seems, so if danmakufu crashed with an error, that would be perfectly normal.

2. If that is the code where you have the MainTask "in the code", then you are making a classic mistake:
You need to put your tasks somewhere inside the {} brackets of script_enemy_main for them to be recognized. To avoid confusion, they are usually put at the end of your script. That means behind the @Finalize{} part, but still within the script_enemy_main{} brackets. you need to move the closing } bracket behind @Finalize way down below the closing bracket of your last task.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on June 26, 2010, 11:28:08 PM
I wonder...what happens to the graphics that you don't delete? Are they deleted anyway? Lets say that perhaps you forgot to put DeleteGraphic(what ev); in Finalize, would that cause the image to remain there forever?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on June 26, 2010, 11:29:55 PM
I wonder...what happens to the graphics that you don't delete? Are they deleted anyway? Lets say that perhaps you forgot to put DeleteGraphic(what ev); in Finalize, would that cause the image to remain there forever?
I believe it stays loaded into memory until you close danmakufu or at least until you reach the main menu again, wasting processing power.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Mr. Sacchi on June 27, 2010, 01:33:53 AM
The Whole Code: http://www.pastebin.org/361009 (http://www.pastebin.org/361009)

Image to the error http://img37.imageshack.us/f/oshitj.png/ (http://img37.imageshack.us/f/oshitj.png/)

Explanation:
Alright so danmakufu just decided to randomly cause a error on the wait function, a function I haven't touched in ages since I began going through the video tutorials.
Anybody know what caused this?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on June 27, 2010, 01:39:35 AM
After the definition of your "fire" task, you have a superfluous closing } bracket, making danmakufu dismiss the code after that from the script. The dismissed code includes the definition of the wait function.

Just remove the superfluous } bracket.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on June 27, 2010, 01:45:57 AM
Code: [Select]
        task fire{
                        superbullet(GetEnemyX,GetEnemyY,3,GetAngleToPlayer,Aqua01,30);
                        superbullet(GetEnemyX,GetEnemyY,3,GetAngleToPlayer-20,Aqua01,30);
                        superbullet(GetEnemyX,GetEnemyY,3,GetAngleToPlayer+20,Aqua01,30);
               
                }
        }

You have an extra closing bracket there (or more likely, you're forgetting an opening one). That closes the entire script before wait; is declared, hence the error. You probably meant to do this:

Code: [Select]
        task fire{
               loop{
                        superbullet(GetEnemyX,GetEnemyY,3,GetAngleToPlayer,Aqua01,30);
                        superbullet(GetEnemyX,GetEnemyY,3,GetAngleToPlayer-20,Aqua01,30);
                        superbullet(GetEnemyX,GetEnemyY,3,GetAngleToPlayer+20,Aqua01,30);
                        wait(20);
                }
        }
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Mr. Sacchi on June 27, 2010, 02:16:16 AM
Did that, didn't work, it looks like the problem is at the "wait(120)" on the MainTask.
yay, danmakufu is screwing with me, >_>''

Edit:
Nevermind, I removed the Wait function and checked the "extra }" looks like I was missing "loop{"

Bah, lack of attention sucks...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Formless God on June 27, 2010, 05:30:40 AM
Thanks a lot Hele. That worked like a charm :)

Oh, another thing. Why is the score displayed in-game always approx. three times the number I used in SetScore() ? For example, SetScore(2000000) gave a random number between 6000000 and 6027997. And shooting the enemy increases the number unless SetTimer() is also included :/
I thought I messed up my code somewhere, but it happened to this piece (http://www.shrinemaiden.org/forum/index.php?topic=30.msg178#msg178) as well.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Furienify on June 27, 2010, 05:35:19 AM
Thanks a lot Hele. That worked like a charm :)

Oh, another thing. Why is the score displayed in-game always approx. three times the number I used in SetScore() ? For example, SetScore(2000000) gave a random number between 6000000 and 6027997. And shooting the enemy increases the number unless SetTimer() is also included :/
I thought I messed up my code somewhere, but it happened to this piece (http://www.shrinemaiden.org/forum/index.php?topic=30.msg178#msg178) as well.

Danmakufu errors like that with numbers over a certain value, if I remember correctly. Kinda sad, but it's an engine thing.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on June 27, 2010, 05:21:03 PM
I think I need some of your help with getting my thinking straight here. I'm trying to make it so that a bunch of script enemies move to a predefined coordination and then start moving in a perfect circle around the player character. Let's say that an enemy is positioned at coordinates GetPlayerX+150 and GetPlayerY-100, how does the logic look to make it move in a circle around the player? I really can't seem to wrap my head around it at the moment..

Edit: I'll add that my ideal goal is to make it so that the script enemies maintain their distance from the player as they move in circles, regardless of what the player himself is doing. I would need a nudge in the right direction to get anywhere at this stage though.  :blush:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on June 27, 2010, 05:49:16 PM
Hm, first of you should make shure the enemies don't do collision damage to the player, otherwise they would probably ram him when entering the circle formation.

Second, give every enemy a different value for a new variable "delta" so that so that they spread even on 360 degrees around the player. For example, if there are 4 enemies, give them delta values of 0, 90, 180 and 270. Also give the a variable "speedtime" with an integer value of 60 or so.

Third, insert this code in the enemies' MainLoop{}

Code: [Select]
delta+=angv;
if(speedtime>5){ speedtime--; }

SetMovePosition02(GetPlayerX+rad*cos(delta), GetPlayerY+rad*sin(delta), speedtime);

"rad" is here the radius around the player and "angv" the angular velocity at which the enemies circle you.


Note that I didn't test this code, so there may be typoes, but in theory it should work nicely.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on June 27, 2010, 06:06:23 PM
That worked brilliantly. To think that it would look so easy now that it's all there on paper...

Thanks a bunch. :)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: AzraelYvstyr on June 27, 2010, 07:15:51 PM
Mmmm, where to start from?

I've various problems with danmakufu and I'd like you to help me if you can, please.

1) BGM -> I've found me totally unable to put a damn bgm into the game. I've tried LoadMusic & PlayMusic, the #BGM at the start of the script, and even attempted to play it like a SE in the mainTask (when I went mad about it). Please help me stop my headache.

2) Delete Bullets after a time -> I've attempted to make a "spellcard" (not sure if "that" deserves to be called spellcard) that make the enemy to follow the player, while shooting "bombs" of bullets that explode and then form swirls of bullets, but these swirls don't disappear so after escaping the enemy for a while the screen is filled with bullets and it's impossible to dodge. I don't know if it's possible to make bullets disappear after a time.

3) Make the familiars shoot -> Well, this is what's making me rage the most. I can't make the familiar shoot. I've tried GetEnemyX-Y, Obj_GetX-Y(starFam) (being starFam the name of the familiar script) but I keep receiving error messages THAT TELL ME THE MISTAKE IS IN THE WAIT FUNCTION, WTF. Here is the script if it can help...

Code: [Select]
script_enemy starFam{

let CSD = GetCurrentScriptDirectory;
let imgFam = CSD ~ "system\familiar.png";

let dir = 0;
let r = 100;

let famAngle = GetArgument;

let spin = 0;

@Initialize{
SetLife(2000);
SetDamageRateEx(1,1,30,20);
LoadGraphic(imgFam);
mainTask;

}

@MainLoop{
SetCollisionA(GetX,GetY,16);
SetCollisionB(GetX,GetY,16);
yield;
}

@DrawLoop{
SetTexture(imgFam);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(0.3,0.3);
SetGraphicAngle(spin,0,0);
SetGraphicRect(0,0,128,128);
DrawGraphic(GetX,GetY);

SetTexture(imgFam);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(0.3,0.3);
SetGraphicAngle(0,spin,0);
SetGraphicRect(0,0,128,128);
DrawGraphic(GetX,GetY);

spin-=3;
}

@Finalize{
DeleteGraphic(imgFam);
}

task mainTask{
yield;
movement;
wait(60);
fire;
}

task movement{
loop{
SetMovePosition03(GetEnemyX+r*cos(dir+famAngle),GetEnemyY+r*sin(dir+famAngle),20,10);
dir++;
yield;
}
}

task fire{
loop{
CreateShot01(Obj_GetX(starFam),Obj_GetY(starFam),3,0,PURPLE23,10);
CreateShot01(Obj_GetX(starFam),Obj_GetY(starFam),3,72,PURPLE23,10);
CreateShot01(Obj_GetX(starFam),Obj_GetY(starFam),3,144,PURPLE23,10);
CreateShot01(Obj_GetX(starFam),Obj_GetY(starFam),3,216,PURPLE23,10);
CreateShot01(Obj_GetX(starFam),Obj_GetY(starFam),3,288,PURPLE23,10);

wait(10);
yield;
}
}

task lazor(x,y,v,dir,length,width,graphic,delay){
let lobj = Obj_Create(OBJ_LASER);

Obj_SetPosition(lobj,x,y);
Obj_SetSpeed(lobj,v);
Obj_SetAngle(lobj,dir);
ObjLaser_SetLength(lobj,length);
ObjLaser_SetWidth(lobj,width);
ObjShot_SetGraphic(lobj,graphic);
ObjShot_SetDelay(lobj,delay);
ObjLaser_SetSource(lobj,true);
}

}

Ignore the lazor task because I'm not using it in the fire task.

4) Shot replacement -> I've tried to do it and miserably failed. U_U


Please forgive my ignorance, and my poor english.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on June 27, 2010, 07:45:21 PM
Mmmm, where to start from?

I've various problems with danmakufu and I'd like you to help me if you can, please.

1) BGM -> I've found me totally unable to put a damn bgm into the game. I've tried LoadMusic & PlayMusic, the #BGM at the start of the script, and even attempted to play it like a SE in the mainTask (when I went mad about it). Please help me stop my headache.

2) Delete Bullets after a time -> I've attempted to make a "spellcard" (not sure if "that" deserves to be called spellcard) that make the enemy to follow the player, while shooting "bombs" of bullets that explode and then form swirls of bullets, but these swirls don't disappear so after escaping the enemy for a while the screen is filled with bullets and it's impossible to dodge. I don't know if it's possible to make bullets disappear after a time.

3) Make the familiars shoot -> Well, this is what's making me rage the most. I can't make the familiar shoot. I've tried GetEnemyX-Y, Obj_GetX-Y(starFam) (being starFam the name of the familiar script) but I keep receiving error messages THAT TELL ME THE MISTAKE IS IN THE WAIT FUNCTION, WTF. Here is the script if it can help...

Code: [Select]
bunch of code
Ignore the lazor task because I'm not using it in the fire task.

4) Shot replacement -> I've tried to do it and miserably failed. U_U


Please forgive my ignorance, and my poor english.

1) Your BGM probably has the wrong codec format. Open an original touhou song or a song that works in danmakufu and check the properties such as the Hz, channels, bitrate etc. Use Audacity (or some other program) to save it in correct codec.

2) Yes it is possible. Depends on if you are using regular bullets (createshot01 etc) or object bullets. In case of regular bullets, you need to use DeleteEnemyShot and the similar ones (see the wiki). Incase of Object bullets > obj_delete(obj);  when ever you want to delete it

3) Shooting the familiar is the same as bosses. You need to use  GetX and GetY for the familiar location. Obj_GetX or Y is NOT for familiars, it is for objects.

If this is your entire code, then where the hell is your wait function? If it gives you error on the wait function, it means it is not there (or you didnt post your entire code using Pastebin.org). Either way, the  wait function is not shared with the familiar as obviously it must be in your enemy_script_main section. You need to define it for the familiar as well (unless you know how to create included scripts).

4) Shot replacement >>
- Declare at the top let ShotData = "pathname to the shotdata.txt";
- Inside @Initialize >> LoadUserShotData(ShotData);
- Then use the ID codes inside the data to spawn the bullet: example >> CreateShot01(x,y,v,dir,ID,delay);
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: AzraelYvstyr on June 27, 2010, 08:04:42 PM
I've solved the familiars' problem, thank you very much.

My failure with the shot replacement was not declaring the ShotData variable ^^U. By the way, can I use the standard bullets while having the shot replacement? (I mean mix both bullets in a same spellcard). Ah, I guess I've to declare again the ShotData and LoadUserShotData in the familiar script, right?

And with DeleteEnemyShot (It's CreateShotA so I suppose it has to be with that one), I've no idea of how it works.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on June 27, 2010, 08:09:54 PM
I've solved the familiars' problem, thank you very much.
(  '.')b

My failure with the shot replacement was not declaring the ShotData variable ^^U. By the way, can I use the standard bullets while having the shot replacement? (I mean mix both bullets in a same spellcard). Ah, I guess I've to declare again the ShotData and LoadUserShotData in the familiar script, right?
Afaik, shot data is somehow shared between both the familiar and the boss. You just need to load it in the main section.

There is a huge difference between shotreplacement and  shotsheet. Read it here in the FAQ (http://www.shrinemaiden.org/forum/index.php?topic=6181.msg345024#msg345024) (click to read)

And with DeleteEnemyShot (It's CreateShotA so I suppose it has to be with that one), I've no idea of how it works.

Read the wiki (http://touhou.wikia.com/wiki/Touhou_Danmakufu:_Bullet_Control_Functions#DeleteEnemyShot)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: AzraelYvstyr on June 27, 2010, 09:14:00 PM
There is a huge difference between shotreplacement and  shotsheet. Read it here in the FAQ (http://www.shrinemaiden.org/forum/index.php?topic=6181.msg345024#msg345024) (click to read)

Well, I didn't remember that ^^U

And with the DeleteEnemyShot, I've already read the wiki when I asked, but the wiki says 1 parameter and is the type of bullet. What I want is erasing the bullets after a while, what I don't know how to do with a function that doesn't have a time parameter.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on June 27, 2010, 09:19:09 PM
Well, I didn't remember that ^^U

And with the DeleteEnemyShot, I've already read the wiki when I asked, but the wiki says 1 parameter and is the type of bullet. What I want is erasing the bullets after a while, what I don't know how to do with a function that doesn't have a time parameter.

I advise you to read the danmakufu tutorials, especially this part of the basics tutorial (http://www.shrinemaiden.org/forum/index.php?topic=30.msg202#msg202). It will teach you what you need to know.

Edit: what the hell is wrong with my typing?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on June 30, 2010, 09:34:29 AM
Trying my best learning how to use task, but this is so confusing  :ohdear:

So I'm trying to learn how to use functions with task thingy but couldn't get the script to work. Also in the task part, no matter what I try I cannot get the bullets to bounce off the top part of the screen x_x. confusing confusing (head explodes)

What I have in mind (ze)
bullets spawn with those "tail" bullets after then and they bounce off the top and the sides

My script so far :(

Code: [Select]
#TouhouDanmakufu
#Title[1]
#Text[1]
#Player[FREE]
#ScriptVersion[2]
#BGM[]
#PlayLevel[Normal]

script_enemy_main{

let SupaShot = GetCurrentScriptDirectory~"\c6shots.txt";
let BossImage = GetCurrentScriptDirectory~"\enem1.png";
let frame = 0;
let angle = 0;
let move = 0;
let s = 0;
   
   
   @Initialize{
LoadGraphic(BossImage);
LoadUserShotData(SupaShot);
SetLife(2500);
SetTimer(60);
SetInvincibility(30);
Concentration01(100);
MagicCircle(true);
SetMovePosition02(GetCenterX, GetCenterY - 100, 120); //Move the boss to the top center of the screen.
   }
   
   @MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
frame++;
omg++;
move++;
   
   if(frame==100){
function wow;
frame = 0;
}



if(move== 500){
SetMovePosition03(rand(100,400), 200, 5, 5);
move = 0;
}
   

yield;

 }

    @DrawLoop {
SetTexture(BossImage);
SetGraphicRect(0,0,100,100);
DrawGraphic(GetX, GetY);
DrawText("I'm a boss", 50, 50, 12, 255);


    }

    @Finalize {
    }

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

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

      while(Obj_BeDeleted(obj)==false) {

              if(Obj_GetX(obj)<GetClipMinX) {
                     Obj_SetAngle(obj, 180 - Obj_GetAngle(obj) );
                     Obj_SetX(obj,  Obj_GetX(obj) + 0.1);
              }

              if(Obj_GetX(obj)>GetClipMaxX) {
                     Obj_SetAngle(obj, 180 - Obj_GetAngle(obj) );
                     Obj_SetX(obj,  Obj_GetX(obj) - 0.1);
              }

              yield;
       }
}

function wow(x, y){
ascent(i in 0..10){
ascent(k in 0..6){
Bullet(x, y, 0.5*(1+k), i*40);
 }   
 }
}



}

Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Kylesky on June 30, 2010, 09:42:08 AM
First of all... you're calling wow like this
Code: [Select]
function wow;
when it's supposed to be like this
Code: [Select]
wow;

also, if you want it to bounce on top of the screen, you need this:
Code: [Select]
  if(Obj_GetY(obj)<GetClipMinY) {
                     Obj_SetAngle(obj, 0 - Obj_GetAngle(obj) );
                     Obj_SetY(obj,  Obj_GetY(obj) + 0.1);
              }

other than that... I'm too lazy to look at your code right now :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Fetch()tirade on June 30, 2010, 09:56:49 AM
In addition you have two more problems:

1.
Code: [Select]
omg++
You have not defined this variable in any way at the top, so you can't do anything with it.

2.
Code: [Select]
function wow(x, y){
ascent(i in 0..10){
ascent(k in 0..6){
Bullet(x, y, 0.5*(1+k), i*40);
 }   
 }
}

   if(frame==100){
function wow;
frame = 0;
}

Not only did you needlessly add "function" when calling the wow function, you also called it without specifying the (x,y) values that you made for it.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on June 30, 2010, 10:16:30 AM
Quote
other than that... I'm too lazy to look at your code right now
Thankyou for you time  :)

Code: [Select]
omg++*facepalm

Code: [Select]
function wow(x, y){ Ohhhh
*double facepalm
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Elementoid on July 01, 2010, 01:47:44 AM
I believe I remember someone a while back mentioning that you didn't need applocale to run danmakufu if you went to certain files and changed Japanese text into something else? Does anyone know what to change or if it works?

I'm trying to use danmakufu on this new computer and I don't want to have to go through the hassle of getting all that stuff to work again.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Fetch()tirade on July 01, 2010, 02:05:56 AM
Sorry, I dunno. I've actually come here with a question of my own.

When you kill a boss familiar or just any enemy that isn't the boss, Danmakufu automatically makes that "shhk" (you know what I mean)  sound. Is there any possible way I can get rid of it and replace it with another sound?

EDIT: Another question. How would one go about stopping background music set using PlayMusic?

EDIT AGAIN: Forget the second. I just inserted a blank .wav file right after the song ended. I had trimmed it down to exactly 2:23, so it was relatively easy.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Dr. Katz on July 01, 2010, 02:57:19 AM
I believe I remember someone a while back mentioning that you didn't need applocale to run danmakufu if you went to certain files and changed Japanese text into something else? Does anyone know what to change or if it works?

I'm trying to use danmakufu on this new computer and I don't want to have to go through the hassle of getting all that stuff to work again.

I don't need applocale to run danmakufu, but it crashes in scripts with things
like this s???u??, so i just erase that and danmakufu works perfectly.

Sorry, I dunno. I've actually come here with a question of my own.

When you kill a boss familiar or just any enemy that isn't the boss, Danmakufu automatically makes that "shhk" (you know what I mean)  sound. Is there any possible way I can get rid of it and replace it with another sound?

EDIT: Another question. How would one go about stopping background music set using PlayMusic?

EDIT AGAIN: Forget the second. I just inserted a blank .wav file right after the song ended. I had trimmed it down to exactly 2:23, so it was relatively easy.

I'm not entirely sure but have you tried using StopSE in that moment?, i hope it helps...

Now my question: is there a way to reduce the lag from CreateLaserC?.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Elementoid on July 01, 2010, 03:06:38 AM
Nevermind, I figured it out. Deleting the Rumia Player and ExRumia Scripts solved the issue for me.

Edit: Except now all the rumia images are gone. Oooooooooops.

And for the CLC problem, might you be able to just make a train of regular bullets? If you used the right graphics, you could probably make something nearly the same with less power needed to make it work.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Fetch()tirade on July 01, 2010, 03:11:39 AM
EDIT 3: Welp. Second problem still not solved.

It would work for the first one, on the condition that I knew the specific name of the audio file to stop playing, but it wouldn't work for the second one.

Danmakufu differentiates between SE (sound effects) and Music. SE clips have a maximum size limit (which was discovered in one of the previous threads), but Music clips do not. Because of this, they are handled differently by Danmakufu, and each type has its own defined functions. The problem is that Danmakufu doesn't have a StopSE equivalent for music. It does have FadeOutMusic, but that doesn't seem to be working out for me. I'm running more tests as I type, and it appears that the problem lies how long I wait to insert the blank .wav file.

As for your question, the only way to reduce that is to get a better computer. No seriously. CreateLaserC's just take a lot of processing power.



FUCKING EDIT NUMBER 4: There's no problem at all with just shoving another blank .wav right into the point where you want the looping to stop. The problem was with my tests.

When Danmakufu plays a sound, it plays it at the same speed as the original file, regardless of type, size, or the state of time (sped up, slowed) when it is inserted into the script. Like the 10-second countdown at the end of Hourai Elixir (http://www.youtube.com/watch?v=THstfpHAGzQ), it is not affected at all by the slowing of time.
However, the timer itself IS affected by the slowdown, and thus any programming based on that timer will be affected by the state of time.
The code I was using, if left unchecked, could cause significant slowdown that was programmed into it using the Slow function. Even worse is the fact that the slow effect was dispersed randomly depending on what time it activated.
I'm such an idiot.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Elementoid on July 01, 2010, 05:16:07 AM
Does Obj_BeDeleted test for whether an object currently exists or not,  or whether there was ever an object that was later deleted?

Basically, would
Code: [Select]
if (Obj_BeDeleted(CertainObject)==true){
wait(90);
CreateCertainObject();
}
work if I'd never created a CertainObject before?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Fetch()tirade on July 01, 2010, 06:07:06 AM
Yes and no. In a sense it checks the existence of an object, but it does so by checking whether or not the specified object has been deleted. It cannot check for objects that do not exist. It is usually used to script while the value returns false, otherwise functions like Obj_GetX(thing) and Obj_SetAngle(thing) will not work [because there is no object anymore].

Code: [Select]
let timer = 0;
while( Obj_BeDeleted(CertainObject) == false && timer >= 0){
   if(timer == 90){
      CreateCertainObject();
   }
   timer++;
}
This is how I usually do it in object bullets. This way, the timer will stop counting (and running the function inside the task) when the object is deleted, saving processing power and reducing lag.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Sapphire Flame on July 02, 2010, 10:32:36 PM
Hey, I have a problem with transparency. I tried to set up a custom shot, and it's mostly working, but there are a few white pixels around the shot that should be transparent. I tried opening the image up with GIMP, and quite frankly I can't see why they're there, since it looks to me like I set the entire background as transparent.  Here's the image:

http://i74.photobucket.com/albums/i255/Sapphire_flame2/Coinstrans.png (http://i74.photobucket.com/albums/i255/Sapphire_flame2/Coinstrans.png)

And here's the code, just in case that's the problem. I doubt it is, but whatever:

Code: [Select]
#UserShotData

ShotImage = ".\img\Coinstrans.png"

ShotData {
    id               = 1     
    rect             = (0, 0, 20, 20)   
    render           = ALPHA       
    delay_color      = (255, 128, 255)
    angular_velocity = rand(-5, 5) 
}

}

Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on July 02, 2010, 11:26:05 PM
If you're setting the bullet as alpha-blend, you don't want any extra black anywhere. {0,0,0} will be rendered as transparent, but everything else will not and it'll look weird. Instead, set the original coins on a transparent background. How did you set this up to begin with? It should just be take image -> move to new image.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on July 03, 2010, 05:19:23 AM
I have some more question, why doesn't this work ? I did this for my music and it worked ???

let Crystal1 = GetCurrentScriptDirectory~"\Crystal1.txt";
let Crystal2 = GetCurrentScriptDirectory~"\Crystal2.txt";

   if(spawn==1){
CreateEnemyFromFile(Crystal1);
CreateEnemyFromFile(Crystal2);
}

 :/
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on July 03, 2010, 06:24:16 AM
   if(spawn==1){
CreateEnemyFromFile(Crystal1);
CreateEnemyFromFile(Crystal2);
}

That is like logical =| CreateEnemeyFromFile  has more than just the name of the file you know.

Quote from: Touhou wiki
CreateEnemyFromFile, Create a child enemy which behavior is defined in the file. Plural-script files can not be passed.
6 Parameters
    1) path of the enemy script (string)
    2) x-coordinate
    3) y-coordinate
    4) velocity
    5) direction
    6) user-defined argument

Wiki people, the wiki. These are all standard explained.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Wotan Manasal on July 05, 2010, 06:27:05 AM
Hello. I have a problem when loading shots from shotsheets.

Can anybody point out what's wrong in the following code? In the task fire, 134 is supposed to be the id of the custom shot I want to use. At least, that's the id that the shotsheet I used points out. But the shot aren't fired at all. Is there anything wrong in the CreateShot01 functions, or in the LoadUserShotData function, or am I missing something else?

(The path to the shotsheet is correct, by the way; maybe its syntax isn't.)

Code: [Select]
#TouhouDanmakufu
#Title[Spellcard 1]
#Text[A spellcard I made just for fun.]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{

let CSD = GetCurrentScriptDirectory;

let imgBoss = CSD ~ "images\img1.png";
let cut = CSD ~ "images\img2.png";
let bg = CSD ~ "images\bg1.png";
let bgm = CSD ~ "sound\track.mp3";

@Initialize{

LoadUserShotData(CSD ~ "\shots\supershot.png");

SetLife(10000);
SetTimer(99);

SetScore(200000);

SetMovePosition01(GetCenterX,GetCenterY,5);
LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);
LoadMusic(bgm);
PlayMusic(bgm);
CutIn(YOUMU,"XXXXXXXXXX - XXXXX",cut,0,0,300,384);

mainTask;
}

@MainLoop{
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,16);
yield;
}

@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,300,300);

SetGraphicScale(0.25,0.25);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);
}

@BackGround{
SetTexture(bg);
SetRenderState(ALPHA);
SetAlpha(100);
SetGraphicRect(0,0,512,512);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX,GetCenterY);
}

@Finalize{
DeleteGraphic(imgBoss);
DeleteGraphic(cut);
DeleteGraphic(bg);
DeleteMusic(bgm);
}

task mainTask{
yield;
fire;
fire_laser;
fire_laser_2;
movement;
}

task movement{
loop{
SetMovePosition01(rand_int(GetCenterX-100,GetCenterX+100),rand_int(90,140),5);
wait(60);
SetMovePosition01(rand_int(GetCenterX-100,GetCenterX+100),rand_int(90,140),5);
wait(60);
yield;
}
}

task fire_laser{
loop{
CreateLaser01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer,100,10,BLUE02,0);
wait(60);
yield;
}
}

task fire_laser_2{
loop{
CreateLaser01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-10,50,8,BLUE02,0);
CreateLaser01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+10,50,8,BLUE02,0);
CreateLaser01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-15,50,8,BLUE02,0);
CreateLaser01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+15,50,8,BLUE02,0);
wait(10);
yield;
}
}

task fire{
loop{
CreateShot01(GetEnemyX,GetEnemyY,3,0,134,10);
CreateShot01(GetEnemyX,GetEnemyY,3,45,134,10);
CreateShot01(GetEnemyX,GetEnemyY,3,90,134,10);
CreateShot01(GetEnemyX,GetEnemyY,3,135,134,10);
CreateShot01(GetEnemyX,GetEnemyY,3,180,134,10);
CreateShot01(GetEnemyX,GetEnemyY,3,225,134,10);
CreateShot01(GetEnemyX,GetEnemyY,3,270,134,10);
CreateShot01(GetEnemyX,GetEnemyY,3,315,134,10);


CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer,AQUA01,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-10,AQUA01,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+10,AQUA01,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-20,AQUA01,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+20,AQUA01,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-30,AQUA01,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+30,AQUA01,10);

CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-5,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+5,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-15,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+15,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-25,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+25,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-35,AQUA01,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+35,AQUA01,10);


wait(30);
yield;
}
}

function wait(w){
loop(w){yield;}
}
}
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on July 05, 2010, 06:35:11 AM
Code: [Select]
LoadUserShotData(CSD ~ "\shots\supershot.png");

I'm not sure if this is the only problem, but you should remove the "\" before "shots." GetCurrentScriptDirectory includes the last slash, so that would double it up and make the directory incorrect.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Wotan Manasal on July 05, 2010, 06:40:18 AM
I'm not sure if this is the only problem, but you should remove the "\" before "shots." GetCurrentScriptDirectory includes the last slash, so that would double it up and make the directory incorrect.
I've modified that, but it's still not working.

Still, many thanks.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on July 05, 2010, 06:44:33 AM
Your loading an image, not a shotdata


Shotdata must be a .txt, you can't load a image and call it shotdata
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Wotan Manasal on July 05, 2010, 06:46:28 AM
Your loading an image, not a shotdata


Shotdata must be a .txt, you can't load a image and call it shotdata
Indeed, that's what was going wrong. Many, many thanks.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Thaws on July 05, 2010, 01:16:14 PM

Code: [Select]
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-5,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+5,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-15,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+15,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-25,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+25,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-35,AQUA01,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+35,AQUA01,10);


wait(30);
yield;

Err, I know your question has been answered, but just some things I'd like to mention...
I quoted a segment of a task in your script.
First of all, there is no need for writing out the CreateShot01s again and again, not only is it bothersome, it also makes it more difficult to make changes. You could use a loop to do something similar easily. For example:
Code: [Select]
let i = -35;
while(i <= 35)
{
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+i,AQUA01,10);
                        i += 5;
}
Can replace the bunch of CreateShot01s in the quote.

Secondly, you called the function wait(30), which basically is identical to writing " yield; yield; yield;... " 30 times, therefore the yield; at the end of your task is actually unnecessary. I just thought I'd mention this as the additional yield might throw off the timing of your danmaku pattern a bit. (Which I think it will because instead of every loop having yield;s in multiples of 10, you have them as numbers like 11, 61, etc. )

Finally, the yield; in the task mainTask is not necessary because you're not trying to loop anything and you need not stop the task for a frame.

Hope this helps with your scripting.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on July 05, 2010, 06:24:26 PM
I personally prefer using ascents. Arbitrary variables etc. You can use a local wrapper to do the same thing, but massive sigh anyways. Also, as a general guideline, similar bullets in any one pattern should all have the same amount of delay, and instead be launched later.
Code: [Select]
ascent(i in -3..4){
    CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+(i*10),AQUA01,10);
}
wait(10);
ascent(i in -7..8){
    if( (| (i*5)%10 |) == 5 ){
        CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+(i*5),AQUA01,10);
    }
}
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on July 06, 2010, 01:52:22 PM
Sum more questions  :]

I don't know why but why does the background and the drawloop connects to each other ?

http://s477.photobucket.com/albums/rr139/namethecool/Games/?action=view&current=b5.png

Code: [Select]
    @DrawLoop {
DrawAnimatedSprite("reimu", GetX, GetY);
DrawText("Minoriko Aki", 50, 50, 12, 255);

    }

   @BackGround
   {

LoadGraphic(BossImage2);
SetGraphicScale(5, 5);
SetTexture(BossImage2);
SetGraphicRect( 0, 0, 256, 256 );
SetGraphicAngle(0, 0, rotation);
DrawGraphic(GetCenterX , GetCenterY );


   }

    @Finalize {
      DeleteGraphic(BossImage2);
    }

And why can't you have backgrounds for non- spell cards ?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on July 06, 2010, 05:37:24 PM
Sum more questions  :]

I don't know why but why does the background and the drawloop connects to each other ?

http://s477.photobucket.com/albums/rr139/namethecool/Games/?action=view&current=b5.png

Code: [Select]
    @DrawLoop {
DrawAnimatedSprite("reimu", GetX, GetY);
DrawText("Minoriko Aki", 50, 50, 12, 255);

    }

   @BackGround
   {

LoadGraphic(BossImage2);
SetGraphicScale(5, 5);
SetTexture(BossImage2);
SetGraphicRect( 0, 0, 256, 256 );
SetGraphicAngle(0, 0, rotation);
DrawGraphic(GetCenterX , GetCenterY );


   }

    @Finalize {
      DeleteGraphic(BossImage2);
    }

- LoadGraphic has to go to @initialize, not in @background
- I don't know what exactly DrawAnimatedSprite does, seems like a function or library. Cannot fully judge what your problem is.


And why can't you have backgrounds for non- spell cards ?
Because it is Danmakufu. If you want background for non-spells, you need to work with stage scripts.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on July 06, 2010, 09:35:58 PM
He's using Blargel's Animation Library.

In any case, don't load the background graphic in the BG loop. Load it in Initialize.

Have you even tried resetting the values to normal during DrawLoop? SetGraphicScale(1, 1);? SetGraphicAngle(0, 0, 0);?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: puremrz on July 07, 2010, 07:32:45 AM
I'm trying to make a caterpillar-like effect for a chain of object bullets/effects.
In other words, one bullet/effect will lead, and the others will follow its exact path with a set time and/or distance between them.

How would I properly code that in danmakufu? It has left me clueless!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on July 07, 2010, 07:47:25 AM
I have an idea, but it would depend on how many bullets you wanted to do the  caterpiller affect  too
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: puremrz on July 07, 2010, 07:50:45 AM
I have an idea, but it would depend on how many bullets you wanted to do the  caterpiller affect  too

I got various uses for it, so it's pretty variable. But the most important one is about 10-15.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on July 07, 2010, 07:56:54 AM

It pretty much works like this, the ID of the object would have to be a number, and it would pretty much go like this:


if(count%howmanybulletsyouwant==(Id of the Object){
SetPosition(Id of the Object,LastX,LastY,2);
LastX = Obj_GetX(Id of the Object);
LastY= Obj_GetY(Id of the Object);
}


While having count increasing MainLoop, put this in the object bullet's code. It would cause that when the condition is met, to but the bullet at the last know X and Y, which would be the previous bullet's, so now this bullet is taking the other bullet's place


Does this work for you?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: puremrz on July 07, 2010, 08:12:20 AM
I'll try it out when I get home. ^_^
I'm not too familiar with how % works, but it seems it'll be useful in more ways than 1 if you can also use it for this.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on July 07, 2010, 08:28:45 AM
He's using Blargel's Animation Library.

In any case, don't load the background graphic in the BG loop. Load it in Initialize.

Have you even tried resetting the values to normal during DrawLoop? SetGraphicScale(1, 1);? SetGraphicAngle(0, 0, 0);?

I tried moving LoadGraphic(BossImage2); to @Initialize and did what you said, it's still connected  :/
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on July 07, 2010, 09:46:08 AM

I tried moving LoadGraphic(BossImage2); to @Initialize and did what you said, it's still connected  :/

Have you tried setting back the Angle and Scale like Drake also said?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on July 07, 2010, 11:07:27 AM

Have you tried setting back the Angle and Scale like Drake also said?


yes  :V still connected
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on July 07, 2010, 11:15:08 AM
Try putting the SetScale after you call the Texture
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Thaws on July 07, 2010, 11:45:22 AM
Wouldn't something like
Code: [Select]
SetGraphicScale(5, 5);
SetTexture(BossImage2);
SetGraphicRect( 0, 0, 256, 256 );
SetGraphicAngle(0, 0, rotation);
DrawGraphic(GetCenterX , GetCenterY );
SetGraphicScale(1, 1);
work?
That way, it doesn't matter if the loops are connected or not.

Edit : Oops Drake already said it long time ago. What are you trying to achieve by making them not connect though?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on July 07, 2010, 02:38:35 PM
I'm trying to make a caterpillar-like effect for a chain of object bullets/effects.
In other words, one bullet/effect will lead, and the others will follow its exact path with a set time and/or distance between them.

How would I properly code that in danmakufu? It has left me clueless!
Eh.....
Why not just use a sinuate laser, or maybe you're trying to make something out of this effect??

Or you can just add delay to the trailing bullets. I think.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Kylesky on July 07, 2010, 02:41:04 PM
Eh.....
Why not just use a sinuate laser...?

Uhhh... maybe to split the bullets from the line at some point? or maybe because caterpillars are circles instead of a smooth line...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on July 07, 2010, 04:36:31 PM
Edit : Nvm thankyou all for your time helping me  :)

Quote
Wouldn't something like
Code: [Select]
SetGraphicScale(5, 5);
SetTexture(BossImage2);
SetGraphicRect( 0, 0, 256, 256 );
SetGraphicAngle(0, 0, rotation);
DrawGraphic(GetCenterX , GetCenterY );
SetGraphicScale(1, 1);
work?
That way, it doesn't matter if the loops are connected or not.

Edit : Oops Drake already said it long time ago. What are you trying to achieve by making them not connect though?

Almost >_< the background is working now but, minoriko is still spinning even though she doesn't have rotation. Do not want them to connect because it looks weird if the boss is huge and spinning.

This is why I can't script nice things  :colonveeplusalpha:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Thaws on July 07, 2010, 04:57:46 PM
Edit : Nvm thankyou all for your time helping me  :)


Almost >_< the background is working now but, minoriko is still spinning even though she doesn't have rotation. Do not want them to connect because it looks weird if the boss is huge and spinning.

This is why I can't script nice things  :colonveeplusalpha:

Code: [Select]
SetGraphicScale(5, 5);
SetTexture(BossImage2);
SetGraphicRect( 0, 0, 256, 256 );
SetGraphicAngle(0, 0, rotation);
DrawGraphic(GetCenterX , GetCenterY );
SetGraphicScale(1, 1);
SetGraphicAngle(0, 0, 0);


Basically you reset the scale and angle values to normal after you draw your background, so whatever you draw in your DrawLoop comes out normally.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on July 07, 2010, 06:12:53 PM
If you're really having that much trouble with it, take your entire script and talk to Blargel about it.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Zerro on July 08, 2010, 04:34:42 AM
I need help on making events different depending on which character you use.

I have found the GetPlayerType function but I don't know how I would use it for
a custom player and not Reimu or Marisa.

Or how to use it period, really.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on July 08, 2010, 06:11:50 AM
I need help on making events different depending on which character you use.

I have found the GetPlayerType function but I don't know how I would use it for
a custom player and not Reimu or Marisa.

I'm a beginner myself, but I think it's something to do with
Code: [Select]
if ((GetPlayerType == REIMU_A) || (GetPlayerType == REIMU_B))
and you can do SetStep(1); if the character is Reimu A and SetStep(2); if it's Reimu B. I think if you want to change the character you link the file your character is in. like GetCurrentScriptDirectory ~ "something".

Code: [Select]
else if ((GetPlayerType == MARISA_A) || (GetPlayerType == MARISA_B))and if it's not reimu and it's either marisa A or marisa B then stuff happens

or just any character you can just do
Code: [Select]
else
{

Bleh source from nimble's script  :getdown: this is in @MainLoop
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Alpha Werewolf on July 09, 2010, 03:28:30 PM
So I got Dnamakufu 0.12m, installed East Asian language files, tried to run it with Applocale... and still it crashes on opening.

Without applocale, it opens fine but crashes when I pick an option in the menu. I'm running XP.

Halp?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on July 10, 2010, 12:34:30 AM
So I got Dnamakufu 0.12m, installed East Asian language files, tried to run it with Applocale... and still it crashes on opening.

Probably running it under the wrong language? Japanese should be the very bottom option. If it doesn't work, you can switch your whole computer's locale to Japanese in the Control Panel, restart, then run Danmakufu normally. It should work fine. Switching your computer to Japanese locale will change almost nothing, so don't worry about it screwing with other programs.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Alpha Werewolf on July 10, 2010, 04:46:41 AM
Probably running it under the wrong language? Japanese should be the very bottom option. If it doesn't work, you can switch your whole computer's locale to Japanese in the Control Panel, restart, then run Danmakufu normally. It should work fine. Switching your computer to Japanese locale will change almost nothing, so don't worry about it screwing with other programs.

No, I definitely ran it in japanese. I changed the computer's locale to Japanese and ran it, but it's the same as before - crashes when I go into any option on the main menu.

EDIT: Problem solved - I had to remove the EX Rumia and player Rumia files. Thanks puremrz!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Stuffman on July 11, 2010, 07:58:14 AM
Quote
EDIT: Problem solved - I had to remove the EX Rumia and player Rumia files. Thanks puremrz!
Then Applocale isn't working right, because the reason Rumia crashes it and the reason Applocale fixes it is Danmakufu doesn't like scripts with moonrunes in them when running english settings.



(http://img541.imageshack.us/img541/3959/diagram.png)

Formula? :ohdear:

EDIT:
I think the first thing that needs to be done is to locate the point on the wall where it's going to rebound. I had the idea of getting the Y distance between the enemy and player to get the amount of wall that needs to be traversed, and then getting the X distance from the wall for both and comparing them to get a ratio of how much wall would be between them on the bounce.

Code: [Select]
ydist=GetPlayerY-GetY;
// get y distance between enemy and player
yratio=(GetX-GetClipMinX)/((GetX-GetClipMinX)+(GetPlayerX-GetClipMinX));
// get ratio of distance from wall for enemy and player (assuming left wall here)
ypoint=GetY+(ydist*yratio);
// apply ratio to y distance to get how far down the wall it needs to bounce
angle=atan2(GetClipMinX-GetX,ypoint-GetY);
// get the angle to that point
pointdist=((GetX-GetClipMinX)^2)+((GetY-ypoint)^2);
pointdist=pointdist^0.5;
// gets distance from enemy to that point
pointdist=floor(pointdist/2);
// divides by two for number of frames travelled, to know when to reflect (speed 2)
CreateShotA(0,GetX,GetY,0);
SetShotDataA(0,0,2,angle,0,0,0,65);
SetShotDataA(0,pointdist,2,180-angle,0,0,0,65);
FireShot(0);

(http://img84.imageshack.us/img84/2497/testct.png)

Why not worky?

EDIT 2:
angle=atan2(GetClipMinX-GetX,ypoint-GetY);
angle=atan2(ypoint-GetY,GetClipMinX-GetX);

Not worky because y coords need to go first in atan2. Goddamnit :fail:

So there's how to do it if anyone wants to know, I guess
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on July 11, 2010, 09:37:24 AM
Code: [Select]
[quote]
let yratio2=(GetX-GetClipMaxX)/((GetX-GetClipMaxX)+(GetPlayerX-GetClipMaxX));
let ypoint2=GetY+(ydist*yratio2);
let angle2=atan2(ypoint2-GetY,GetClipMaxX-GetX);
let pointdist2=((GetX-GetClipMaxX)^2)+((GetY-ypoint2)^2);
let pointdist2=pointdist2^0.5;
let pointdist2=floor(pointdist2/2);

Stuffman's code for the right wall
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: 空SoraのNo鏡Kagami on July 14, 2010, 09:15:25 PM
Ugh...  Can anyone tell me exactly how Shot replacement works? I can't seem to find anything on it...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on July 14, 2010, 09:36:55 PM
Shot Replacement works by using #include_function "pathname of .txt" to make it easier to catorgorize shots.

when making Shot Data you give the bullets an ID, calling this ID calls that bullet's graphic with the ID of the one called, but it is possible to "replace" this ID with something easier, such as RED01, BLUE02, GREEN22 etc. etc.

Does that clear that up?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: 空SoraのNo鏡Kagami on July 14, 2010, 09:47:37 PM
I think what i was trying to say was... How would you put it into the code... It confuses me,,,
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on July 14, 2010, 09:54:20 PM
you would use

#include_function"pathname to the shot_replace.txt"

it doesn't have to be named shot_replace.txt, but thats just an example
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Zerro on July 15, 2010, 03:55:06 AM

Gargh! I'm still confused!


GetPlayerScriptName and USER_PLAYER confuse me to no end.  :(
How do you use them? How do you use them for multiple characters?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on July 15, 2010, 04:03:41 AM
GetPlayerScriptName works by getting the name of the player script that the player is currently using.
for example
if(GetPlayerScriptName == enter_name_of_player.txt){ SetStuff; DoStuff; Whatever;}
note, that you will need to know the name of the player script before hand.

USER_PLAYER, I have no idea what that does
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on July 15, 2010, 04:11:01 AM
USER_PLAYER, I have no idea what that does

USER_PLAYER is for a Player Script, for example, "Rumia.txt"
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Zerro on July 15, 2010, 04:34:58 AM
GetPlayerScriptName works by getting the name of the player script that the player is currently using.
for example
if(GetPlayerScriptName == enter_name_of_player.txt){ SetStuff; DoStuff; Whatever;}
note, that you will need to know the name of the player script before hand.

USER_PLAYER, I have no idea what that does

Thanks, it's working now ^_^
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on July 17, 2010, 12:14:13 PM
How to make screen Shake  :o ? Like when you use master spark
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on July 17, 2010, 12:18:48 PM
How to make screen Shake  :o ? Like when you use master spark
There is a command in danmakufu that does that, but I believe it screwed up replays and various other things.

So you best bet is to make every bullet an object bullet (not effect object, what was I thinking when I wrote that?!), then declare a global angular variable that gets set to a random angle each 3 frames or so and have each bullet, the player and the bullets move in the direction of that variable.

To prevent the shaking from occasionally drifting everything in one direction, I'd advise to use shakeangle+=rand(120, 240); for the shaking randomization.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Grumskiz on July 17, 2010, 05:18:30 PM
Hey,
I'm very new to Danmakufu and I have a problem with my @BackGround loop.
I started making my first boss some weeks ago with my first spellcard.
In this spellcard my background image shows up just fine.(It is a placeholder btw...I'm still looking for other bg pictures)
After I finished this spell I decided to make a non-spell like a prequel and to combine these scripts in a plural script.
I copied the whole code and delete some things like SetScore and CutIn but I didn't change any variablenames or values or code in the @DrawLoop or the @BackGround loop.
But the graphics (both bg and enemygraphics) didn't work anymore.
I was able to get the enemygraphics to work again through recoding it completely and changing some things, but I couldn't get the bg to work. (It just shows the standart bg in Danmakufu)
Is there a bug in Danmakufu, which causes the Graphicfunctions to screw up, when you use them in a single script without calling SetScore and/or CutIn or did I make a mistake?

Some code:

At first the @DrawLoop from the first, real spellcard (I left out the variables, because the values didn't change and I checked them three times):
Quote
    @DrawLoop {                     
         
         SetTexture(imgBoss);
         SetRenderState(ALPHA);
         SetAlpha(255);
         SetGraphicScale(0.6,0.6);
         if(int(GetSpeedX())==0) {
            if(f<=10)         { SetGraphicRect(0,0,35,120); }
            if(f>10 && f<=20) { SetGraphicRect(39,0,74,120); }
            if(f>20 && f<=30) {SetGraphicRect(78,0,113,120); }
            f2=0;
         
         
         }
         
         if(GetSpeedX()>0) {          
         
            if(f2<=5)         { SetGraphicRect(170,0,220,120); }
            if(f2>=5) { SetGraphicRect(222,0,279,120); }
            f2++;
         
         
         
         }
         
         if(GetSpeedX()<0) {            
            SetGraphicAngle(180,0,0);
            if(f2<=5)         { SetGraphicRect(170,0,220,120);
            DrawGraphic(GetEnemyX, GetEnemyY);
                                                            }
            if(f2>=5) { SetGraphicRect(222,0,279,120);
            DrawGraphic(GetEnemyX, GetEnemyY);
                                             }
            
            f2++;
         
         
         
         }
         
         
         
         
         
         
         
         
         
         DrawGraphic(GetX,GetY);
         
         f++;
         if(f == 30){f=0;}
   
   
   }

   
    @BackGround {                  
   
         SetTexture(bg);
         SetRenderState(ALPHA);
         SetAlpha(255);
         SetGraphicRect(0,0,500,333);
         SetGraphicScale(1,1);
         SetGraphicAngle(0,0,0);
         DrawGraphic(GetCenterX, GetCenterY);
      
   }




Now the code from the "prequel-non-spell" (How do you call it??):

Quote
  @DrawLoop {                     
         
         SetTexture(imgBoss);
         SetRenderState(ALPHA);
         SetAlpha(255);
         SetGraphicScale(0.6,0.6);
         if(int(GetSpeedX())==0) {
         SetGraphicAngle(0,0,0);
            if(f<=10)         { SetGraphicRect(0,0,35,120); }
            if(f>10 && f<=20) { SetGraphicRect(39,0,74,120); }
            if(f>20 && f<=30) {SetGraphicRect(78,0,113,120); }
            f2=0;
         
         
         }
         
         if(GetSpeedX()>0) {          
         SetGraphicAngle(0,0,0);
            if(f2<=5)         { SetGraphicRect(170,0,220,120); }
            if(f2>=5) { SetGraphicRect(222,0,279,120); }
            f2++;
         
         
         
         }
         
         if(GetSpeedX()<0) {         
            SetGraphicAngle(180,0,0);
            if(f2<=5)         { SetGraphicRect(170,0,220,120);
            DrawGraphic(GetEnemyX, GetEnemyY);
                                                            }
            if(f2>=5) { SetGraphicRect(222,0,279,120);
            DrawGraphic(GetEnemyX, GetEnemyY);
                                             }
            
            f2++;
         
         
         
         }
         
         
         DrawGraphic(GetX,GetY);
         
         f++;
         if(f == 30){f=0;}
   
   
   }

   
    @BackGround {                  
   
         SetTexture(bg);
         SetRenderState(ALPHA);
         SetAlpha(255);
         SetGraphicRect(0,0,500,333);
         SetGraphicScale(1,1);
         SetGraphicAngle(0,0,0);
         DrawGraphic(GetCenterX, GetCenterY);
      
   }

As you can see, I had to change the code in the @DrawLoop to get it work properly. How do I get the background to work?


My apologies for my bad english. I'm german and I learned it at school...

Grums
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on July 17, 2010, 05:35:28 PM
@BackGround does not work in Non-Spells, @BackGround only functions when there is SetScore. Copy Paste everything in @BackGround and put it in @DrawLoop
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on July 17, 2010, 05:39:26 PM
There is a command in danmakufu that does that,

Just for fun what's the command though  :V ?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Grumskiz on July 17, 2010, 05:46:04 PM
Thanks a lot Demonbman.
Now the background works also in non-spells.
But why do I need to change the code in the Drawloop? Also because my script has no SetScore?
Thats pretty annoying for those who want to create their own bosses in Danmakufu   :(
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on July 17, 2010, 05:54:43 PM
But why do I need to change the code in the Drawloop? Also because my script has no SetScore?
Thats pretty annoying for those who want to create their own bosses in Danmakufu   :(

Well, most people use Stage Scripts to host the background. And yes, @BackGround is IGNORED when there is no SetScore
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Grumskiz on July 17, 2010, 06:18:22 PM
Damn I knew it would happen...my english sucks -.-
My last question was intended to be like this one, but I messed it up, so you understood it wrong (I don't blame you...it was my fault):
Why did I also have to change the code for the bossgraphic (not the background) in the Drawloop?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on July 17, 2010, 07:10:19 PM
Damn I knew it would happen...my english sucks -.-
My last question was intended to be like this one, but I messed it up, so you understood it wrong (I don't blame you...it was my fault):
Why did I also have to change the code for the bossgraphic (not the background) in the Drawloop?


I have no idea why you would have to do that, unless you had two variables, or you used the same variable twice, I see no reason why you would have to do that.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: ganon2310 on July 18, 2010, 02:06:14 AM
HOW DO I MAKE A FAMILAIR FOR MY GAME CHARACTER!?
 :3
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on July 18, 2010, 02:15:54 AM
Didn't you read the sticky? Look for Stuffman's Player Tutorial, he has it explained in there
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: ganon2310 on July 18, 2010, 02:20:07 AM
i did and he assumed that we already knew how to make and option. i dont.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on July 18, 2010, 02:23:31 AM
5th Code Box from the post, look at it, it even says optionX and optionY for your convience.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: electron9186 on July 18, 2010, 03:13:39 AM
Ganon, i know you're basing your character somewhat off the tutorial's Sakuya A, so here's some hopefully relevant code. It's the option task from the script. Modify as neccessary.

Code: [Select]
task Option(position){
let objoption=Obj_Create(OBJ_EFFECT);
Obj_SetAlpha(objoption,200);
ObjEffect_SetTexture(objoption,img_sakuya);
ObjEffect_SetRenderState(objoption,ALPHA);
ObjEffect_SetPrimitiveType(objoption,PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(objoption,4);
ObjEffect_SetVertexUV(objoption,0,145,1);
ObjEffect_SetVertexUV(objoption,1,159,1);
ObjEffect_SetVertexUV(objoption,2,159,15);
ObjEffect_SetVertexUV(objoption,3,145,15);
if(position=="LEFT"){
while(!Obj_BeDeleted(objoption)){
ObjEffect_SetVertexXY(objoption,0,GetPlayerX-optionxpos-8,GetPlayerY+optionypos-7);
ObjEffect_SetVertexXY(objoption,1,GetPlayerX-optionxpos+6,GetPlayerY+optionypos-7);
ObjEffect_SetVertexXY(objoption,2,GetPlayerX-optionxpos+6,GetPlayerY+optionypos+7);
ObjEffect_SetVertexXY(objoption,3,GetPlayerX-optionxpos-8,GetPlayerY+optionypos+7);
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
if(count%6 == 3){
JackTheRipper(GetPlayerX-optionxpos-1,GetPlayerY+optionypos-8,12);
}
}else{
if(count%8 == 4){
i=-2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()-optionxpos-1, GetPlayerY()+optionypos-8, 10, 254+(i*8), 1.5, 1, 2);
i++;
}
}
}
yield;
}
}else{
while(!Obj_BeDeleted(objoption)){
ObjEffect_SetVertexXY(objoption,0,GetPlayerX+optionxpos-7,GetPlayerY+optionypos-7);
ObjEffect_SetVertexXY(objoption,1,GetPlayerX+optionxpos+7,GetPlayerY+optionypos-7);
ObjEffect_SetVertexXY(objoption,2,GetPlayerX+optionxpos+7,GetPlayerY+optionypos+7);
ObjEffect_SetVertexXY(objoption,3,GetPlayerX+optionxpos-7,GetPlayerY+optionypos+7);
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
if(count%6 == 3){
JackTheRipper(GetPlayerX+optionxpos,GetPlayerY+optionypos-8,12);
}
}else{
if(count%8 == 4){
i=-2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()+optionxpos, GetPlayerY()+optionypos-8, 10, 286+(i*8), 1.5, 1, 2);
i++;
}
}
}
yield;
}
}
}
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: ganon2310 on July 18, 2010, 03:18:50 AM
electron, how do i test if it worked?
 :3
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: electron9186 on July 18, 2010, 03:30:43 AM
 :/

Good question. I don't think we'll be able to even get your character to work until we code the rest of the nonsense for its file.

This is going to take a while...  :(
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on July 18, 2010, 12:35:09 PM
Stupid question: Does Obj_SetSpeed and Obj_SetAngle work for obj Effects?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on July 18, 2010, 01:52:26 PM
Stupid question: Does Obj_SetSpeed and Obj_SetAngle work for obj Effects?

I'm not sure about Obj_SetSpeed, but I'm sure ObjEffect_SetAngle is supposed to be used instead for effects.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on July 18, 2010, 02:19:45 PM
ObjEffect_SetAngle changes the angle of the graphic, while Obj_SetAngle changes the angle of movement. Yes, Obj_SetSpeed works with effect objects.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on July 19, 2010, 08:49:55 AM
ObjEffect_SetAngle changes the angle of the graphic, while Obj_SetAngle changes the angle of movement. Yes, Obj_SetSpeed works with effect objects.
Thanks.

Now if I want my effect object to hurt the player should I use SetCollisionB or what?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on July 19, 2010, 10:33:56 AM
Thanks.

Now if I want my effect object to hurt the player should I use SetCollisionB or what?

if( ( (GetPlayerX-Obj_GetX(obj))^2 + (GetPlayerY-Obj_GetX(obj))^2 )^0.5 < radius of the object){ CreateShot01(GetPlayerX, GetPlayerY, 0, 90, WHITE05, 0); }


Or something like that.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on July 20, 2010, 12:11:48 AM
SetCollisionB is the much easier method. The only problem is that it won't give you graze.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on July 20, 2010, 12:19:42 AM
How do you call SetCollisionB for an effect object?  ???
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on July 20, 2010, 12:34:21 AM
It has three parameters - X, Y, and size. Who says X and Y need to be centered on the boss? You can use more than one, so it won't interfere with boss-player collision.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on July 20, 2010, 09:50:07 AM
It has three parameters - X, Y, and size. Who says X and Y need to be centered on the boss? You can use more than one, so it won't interfere with boss-player collision.

God dammit!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on July 20, 2010, 10:56:46 AM
It said so on the wiki, but in Engrish. I went and fixed it, as well as clarifying some other stuff. (Side note: I also moved my post about render targets to the wiki, since it had no information at all about them, and I thought it would be helpful.)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on July 21, 2010, 09:24:48 AM
Dumb Question #234980012a
ZUNsuns
ADD render or ALPHA render? (I know there are two layers)

Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: puremrz on July 21, 2010, 10:04:17 AM
Dumb Question #234980012a
ZUNsuns
ADD render or ALPHA render? (I know there are two layers)


Both ADD. Be sure to give both files a black background if they don't have it yet.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on July 21, 2010, 01:10:24 PM

Both ADD. Be sure to give both files a black background if they don't have it yet.
Thanks
Shit I have zero photoshop skills
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Zerro on July 22, 2010, 02:22:56 AM
I know this is lolfacepalm but how do you call tasks?

And also, because I know it involves tasks, how do you make lasers move, like in Flandre's Laevetinn(or however the hell you spell it)?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Fetch()tirade on July 22, 2010, 02:29:44 AM
I know this is lolfacepalm but how do you call tasks?

And also, because I know it involves tasks, how do you make lasers move, like in Flandre's Laevetinn(or however the hell you spell it)?

It's really easy to call a task. Once you have it made, all you do is type the name in and any parameters you've set for it.

Code: [Select]
task Ha ha, old chap!{
   ShootDownPlayer;
}

task main{
   loop{
      Ha ha, old chap!;
      yield;
   }
}

And as for moving lasers, it depends on what type. CreateLaser01, CreateLaserA,B,C, or object?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on July 22, 2010, 02:32:22 AM
I know this is lolfacepalm but how do you call tasks?

Make one by typing

task NameMeAnythingAtAll{
   //shit goes here
}


Call one by typing

NameMeAnythingAtAll;

And also, because I know it involves tasks, how do you make lasers move, like in Flandre's Laevetinn(or however the hell you spell it)?

By changing their position  :ohdear:

while(!Obj_BeDeleted(obj)){
   Obj_SetPosition(obj, x, y);
   x++;
   y++;
   yield;
}




Please refer to the intermediate tutorial for tasking basics. (http://www.shrinemaiden.org/forum/index.php?topic=865.msg31779#msg31779)



And uh

task Ha ha, old chap!{
   ShootDownPlayer;
}

task main{
   loop{
      Ha ha, old chap!;
      yield;
   }
}

Commas, spaces and exclamation points are illegal in functions/tasks.

But since you're just saying el oh el, get owned by shitty wordfilters  :ohdear:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Zerro on July 22, 2010, 02:37:03 AM
Thanks, I've read the tutorial, and tasks are just something I need to get better at. :derp:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: CK Crash on July 22, 2010, 09:00:12 AM
This task will allow an object laser to move based on it's angle and speed, same as a bullet.

Code: [Select]
task AutoMoveLaser(obj)
{
while(!Obj_BeDeleted(obj))
{
Obj_SetPosition(obj,Obj_GetX(obj)+cos(Obj_GetAngle(obj))*Obj_GetSpeed(obj),Obj_GetY(obj)+sin(Obj_GetAngle(obj))*Obj_GetSpeed(obj));
yield;
}
}

There is almost bound to be a typo in there, so be warned :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Nonnie Grey on July 23, 2010, 10:24:16 AM
This is more a curiosity question than anything as it's not really an issue, but...

What dictates the background on a spellcard when SetScore is declared and nothing is specified in @BackGround or #BackGround? Sometimes, I get that watery-looking default background, but other times there isn't a background at all; just black. I can't seem to find any difference between the way the spellcards were coded, either, though whatever background they wind up with, they stay with.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on July 23, 2010, 10:43:50 AM
Afaik, if you leave @BackGround{} out completely, you will get the default wavery lines stuff. If put @Background{} in the script but put nothing inside it, you will get a black screen.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on July 23, 2010, 06:30:20 PM
I have some questions  :ohdear:

So recently I've been trying to master spark. But epic failed , How do I make my spell fade after using it? I tried (obj)

Code: [Select]
ObjShot_FadeDelete(obj);
Code: [Select]
ObjLaser_FadeDelete(obj);
Code: [Select]
Obj_FadeDelete(obj);
It's a player's spell. Obj_Delete just erase it and it looks kinda arkward.  :V
and also, the supershot only has 1 colour (white), how do I make it change colour without having to change the supershot sheet

That's not all, I have some more questions but I forogt for now ME AND MY POOR MEMORY
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Fetch()tirade on July 23, 2010, 06:46:09 PM
I have some questions  :ohdear:

So recently I've been trying to master spark. But epic failed , How do I make my spell fade after using it? I tried (obj)

Code: [Select]
ObjShot_FadeDelete(obj);
Code: [Select]
ObjLaser_FadeDelete(obj);
Code: [Select]
Obj_FadeDelete(obj);
It's a player's spell. Obj_Delete just erase it and it looks kinda arkward.  :V
and also, the supershot only has 1 colour (white), how do I make it change colour without having to change the supershot sheet


Your spell? Do you mean the laser? Then I would assume your answer would be the first one. It applies to both shots and lasers, but there's no control over it. The other two don't exist.

As for the supershot problem, there's no other solution that I know of, if you want to use it as a shot.
The only other method I know of changing bullet colors without changing the bullet is to turn it into an object. Then you can change the color using SetAlpha for ALPHA blend and SetColor for ADD blend, but you'd also have to set collision circles (which isn't that hard but don't forget them).
If there's an easier way, I'd like to know that too.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on July 23, 2010, 07:05:50 PM
Master Spark should be an effect object, not a laser object. Can get the rainbow, fading, multiple image blends, etc.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on July 24, 2010, 06:11:54 AM
SetColor for ADD blend

But how do you do SetColor for Add blend ? I did
Code: [Select]
ObjEffect_SetRenderState(obj,ADD);
SetColor(rand(0,255),rand(0,255),rand(0,255));

but Danmakufu give me a error saying something about SetColor

Master Spark should be an effect object, not a laser object. Can get the rainbow, fading, multiple image blends, etc.

Does effect object works the same ? and when I try rainbow multiple image blends, it doesn't work, it only works for ADD [I must had done something wrong  :/]
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on July 24, 2010, 06:15:40 AM
ObjEffect_SetVertexColor(id, vertex, alpha, red, blue, green);

Only functions that start with Obj work with Objects.

Here's a list of them. (http://dmf.shrinemaiden.org/wiki/index.php?title=Object_Control_Functions)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on July 24, 2010, 07:35:52 AM
This is a bit confusing  ??? but now the spell doesn't even show on the screen.

Code: [Select]
///////////////////////////////////////////////////
task Star(s,angle,l){
let obj = Obj_Create(OBJ_EFFECT);
  let counter = 0;
  let counterb = 0;
 

  Obj_SetPosition(obj,GetPlayerX,GetPlayerY);
Obj_SetSpeed(obj,s);
//ObjLaser_SetWidth(obj, 10);
//ObjLaser_SetLength(obj, l);
Obj_SetAlpha(obj,100);

ObjEffect_SetRenderState(obj,ALPHA);
//ObjEffect_SetLayer(obj,3);[color=pink] // I don't see the difference between any numbers[/color]
ObjEffect_SetTexture(obj,img_spell);
ObjEffect_CreateVertex(obj,4);
ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLEFAN);
ObjEffect_SetVertexUV(obj,0,1,514);
ObjEffect_SetVertexUV(obj,1,514,514);
ObjEffect_SetVertexUV(obj,2,514,767);
ObjEffect_SetVertexUV(obj,3,514,767);
ObjEffect_SetVertexColor(obj,0,100,rand(0,255),rand(0,255),rand(0,255));
ObjEffect_SetVertexColor(obj,1,100,rand(0,255),rand(0,255),rand(0,255));
ObjEffect_SetVertexColor(obj,2,100,rand(0,255),rand(0,255),rand(0,255));
ObjEffect_SetVertexColor(obj,3,100,rand(0,255),rand(0,255),rand(0,255));

Obj_SetAngle(obj,angle);
//ObjShot_SetGraphic(obj,254);
ObjShot_SetDamage(obj,5);
ObjShot_SetPenetration(obj,1000);
while(!Obj_BeDeleted(obj)){
Wait(1);
counter+=1;
counterb+=1;
if(counter==1){
Obj_SetPosition(obj,GetPlayerX,GetPlayerY);
//ObjLaser_SetWidth(obj, 500);

ObjEffect_SetVertexColor(obj,0,100,rand(0,255),rand(0,255),rand(0,255));
ObjEffect_SetVertexColor(obj,1,100,rand(0,255),rand(0,255),rand(0,255));
ObjEffect_SetVertexColor(obj,2,100,rand(0,255),rand(0,255),rand(0,255));
ObjEffect_SetVertexColor(obj,3,100,rand(0,255),rand(0,255),rand(0,255));
counter=0;}
if(counterb==300){ObjShot_FadeDelete(obj);}
}
 ///////////////////////////////////////////////////
I think the vertex should be correct [(0,514,122,767)]
Massive headache* seizure I'm going to die T_T
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on July 24, 2010, 09:42:23 AM
Ahem:

   ObjEffect_SetVertexUV(obj,0,1,514);
   ObjEffect_SetVertexUV(obj,1,514,514);
   ObjEffect_SetVertexUV(obj,2,514,767);
   ObjEffect_SetVertexUV(obj,3,514,767);


On another note, the shenanigans with your variable "counter" are completeley unnecessary. The way you increment it and set it back, it still happens once every frame.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on July 24, 2010, 11:01:22 AM
That's weird, it's still not showing up, vertex is still incorrect ?

   ObjEffect_SetVertexUV(obj,0,1,1);
   ObjEffect_SetVertexUV(obj,1,514,1);
   ObjEffect_SetVertexUV(obj,2,1,514);
   ObjEffect_SetVertexUV(obj,3,514,514);

(http://i477.photobucket.com/albums/rr139/namethecool/wee.png)

Edit :

   ObjEffect_SetVertexUV(obj,0,1,1);
   ObjEffect_SetVertexUV(obj,1,514,1);
   ObjEffect_SetVertexUV(obj,2,1,764);
   ObjEffect_SetVertexUV(obj,3,514,764);

still doesn't show, I'm starting to think it's not the vertex
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on July 24, 2010, 11:08:20 AM
If you were using TRIANGLESTRIP, that would be correct.

However, you are using TRIANGLEFAN. That means the vertex alignment you would want is:

0 --1
|  \
3   2

And even then, it is still possible that there is a less obvious error that prevents the image from showing properly, so...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on July 24, 2010, 03:49:50 PM
Look at the "diagram" I made. It is a triangle FAN.

0 --1
|  \
3   2

You have them in a strip:

0--1
  /
2--3


Oh, and the reason they don'T show up is because you are missing youe SetVertexXY.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: SparklingOrange on July 26, 2010, 10:34:51 PM
Hi! I've returned from a long hiatus. I finally got the bomb (from the last thread) working perfectly, but the texture I used for the bomb blocks the visibility of the field. Is there any way to change the transparency of the texture? I tried doing so with Obj_SetAlpha, but it has no effect, as seen on the code and the screen. Is there also a way to make the object appear about half a second rather than longer? I'm not sure about this one, since I don't know the total duration of the while loop in the object. I was hoping the object spell would flash for a short amount of time before the next one appears, since I've set it up to go on a <-o-> direction. The o being the center of the field.
Code: [Select]
task LightningRipple(xpos){
let objlightning=Obj_Create(OBJ_SPELL);
Obj_SetAlpha(objlightning,50);
Obj_SetAngle(objlightning,90);
ObjEffect_SetTexture(objlightning,lightning);
ObjEffect_SetRenderState(objlightning,ALPHA);
ObjEffect_SetScale(objlightning,2,2);
ObjEffect_CreateVertex(objlightning,4);
ObjEffect_SetPrimitiveType(objlightning,PRIMITIVE_TRIANGLEFAN);
ObjEffect_SetVertexUV(objlightning,0,0,0);
ObjEffect_SetVertexUV(objlightning,1,160,0);
ObjEffect_SetVertexUV(objlightning,2,160,600);
ObjEffect_SetVertexUV(objlightning,3,0,600);
while(!Obj_BeDeleted(objlightning)){
ObjEffect_SetVertexXY(objlightning,0,0+xpos,0);
ObjEffect_SetVertexXY(objlightning,1,52+xpos,0);
ObjEffect_SetVertexXY(objlightning,2,52+xpos,464);
ObjEffect_SetVertexXY(objlightning,3,0+xpos,464);
ObjSpell_SetIntersecrionLine(objlightning,0,0,52+xpos,464,464,5,true);
yield;
}
}

task run{
SetPlayerInvincibility(300);
ForbidShot(true);
loop(45){yield;}
while(spellcount<31){
if (spellcount%10==0){
LightningRipple(xpos1);
LightningRipple(xpos2);
xpos2+=25;
xpos1-=25;
PlaySE(lightningwav);
if(spellcount==31){
     Flash;
     PlaySE(crash);
}
}
       spellcount++;
       yield;
       }
ForbidShot(false);
SetSpeed(3.5,2.5);
loop(90){yield;}
End();
}
Result: (http://img228.imageshack.us/img228/2682/bombflub.jpg)

Also, I've been using Blargel's Animation Handling library, which really helps a great deal by the way...but is there away to scale the image being used to animate as well as change the alpha as well while using the custom functions? There's no parameter for them, but I'm guessing I have to use SetTexture?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on July 26, 2010, 11:00:04 PM
If you want to change the alpha value of an effect object, you need to set it for each vector seperately, like this:

Code: [Select]
ascent(i in 0..4){
ObjEffect_SetVertexColor(objlightning, i, the_alpha_you_want, 255, 255, 255);
}

If you want the object to be removed after some time, you need to create a variable at the beginning of the task, let's call it "death", and give it a value. Then you have it decrease the value of "death" by 1 during each run of the while{} part and then, if it is below 0, remove the object. Although removing it instantly usually looks back, so I'd advise you to create two variables instead: "death" and "visibility". Visibility starts out at the alpha value the object should have and decreases drastically every frame once "death" is below 0. Then you delete the object once "visibility" reaches zero.

Code: [Select]
      let death=30;
      let visibility = 100;

...
ascent(i in 0..4){
ObjEffect_SetVertexColor(objlightning, i, the_alpha_you_want, 255, 255, 255);
}

            death--;
            if(death<=0){ visibility-=10; }
            if(visibility<=0){ Obj_Delete(objlightning); }
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: SparklingOrange on July 27, 2010, 01:05:11 AM
If you want to change the alpha value of an effect object, you need to set it for each vector seperately, like this:

Code: [Select]
ascent(i in 0..4){
ObjEffect_SetVertexColor(objlightning, i, the_alpha_you_want, 255, 255, 255);
}

If you want the object to be removed after some time, you need to create a variable at the beginning of the task, let's call it "death", and give it a value. Then you have it decrease the value of "death" by 1 during each run of the while{} part and then, if it is below 0, remove the object. Although removing it instantly usually looks back, so I'd advise you to create two variables instead: "death" and "visibility". Visibility starts out at the alpha value the object should have and decreases drastically every frame once "death" is below 0. Then you delete the object once "visibility" reaches zero.

Code: [Select]
      let death=30;
      let visibility = 100;

...
ascent(i in 0..4){
ObjEffect_SetVertexColor(objlightning, i, the_alpha_you_want, 255, 255, 255);
}

            death--;
            if(death<=0){ visibility-=10; }
            if(visibility<=0){ Obj_Delete(objlightning); }

I like it! It works really well, but the only problem is that since I'm spawning instances of the object, calling Obj_Delete wipes out all of them. Does this mean I would have to make each effect object individual to get the effect I need?

Man, I know nothing about ascent and descent, much less arrays and other intermediate math functions...most of the stuff I've been doing are simply basic operations and if statements. I wish I knew more about those...

I'm still wondering about setting scale and alpha with Blargel's custom function library...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Formless God on July 27, 2010, 01:25:21 AM
Question question, can Danmakufu draw the screen flickering effect ? (like what happens behind those MoF/SA/UFO bosses)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on July 27, 2010, 02:21:02 AM
Question question, can Danmakufu draw the screen flickering effect ? (like what happens behind those MoF/SA/UFO bosses)

I'm sure it's been discussed before, but I wasn't there.
I don't think so. Do you mean the wavering background or the burning aura?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Formless God on July 27, 2010, 02:50:00 AM
Oh, it's the wavering background.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on July 27, 2010, 04:01:14 AM
Oh, it's the wavering background.

Ah.
I think this is possible, but will cause a shitload of lag.

It's been discussed on IRC some day, I forgot when, but it has.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on July 27, 2010, 11:11:30 AM
It would be possible with render targets, effect objects, and lots of math. I highly recommend you not to try it, though.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on July 27, 2010, 11:21:28 AM
It was something along the lines of...

Make a render target. Draw everything related to backgrounds onto this render target. Use the render target as the graphic for an effect object. Give the object zig vertices. Make them behave accordingly.


Yeah, it is difficult...


And @ Sparkling Orange: If you have a single task that creates, manages and removes one of your effect objects, calling this task several times should not cause any problems at atll because the variable that holds the id of the object, in your case "objlightning", is created withing the task and thus is unaffected by code outside of it, even the code of seperate other running instances of the same task.

Did you put the code I posted at the right places? Both parts should go in task LightningRipple(xpos){, the first one before the while{} brackets, the second one inside the while{} brackets just before the yield;.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: electron9186 on July 28, 2010, 08:35:00 PM
I'm trying to make a script with an object shot, but I keep getting an error message that says I need a bracket even when I'm sure my brackets are corredt. I even tried the object code in a task, but that did no good. Can somebody help?

Code:
Code: [Select]
#TouhouDanmakufu
#Title[spellcard]
#Text[blablabla]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let frame = 0;
    let angle = 0;
    let sword = "img\SwordandStuff.bmp";
    @Initialize {
        SetLife(1000);
        SetEnemyMarker(true);
        SetScore(500000);
       
    }

    @MainLoop {
        CreateShotA(1, GetX, GetY, 20);
        SetShotDataA(1, 0, 2, 90, 0, 0, 2, GREEN03);
        SetShotDataA(1, 30, NULL, NULL, 0, -0.025, 0, YELLOW03);
        SetShotDataA(1, 90, 0, 45, 0, 0.05, 2, YELLOW02);
        SetShotKillTime(1, 240);
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 24);
            if(frame==300){
let obj = Obj_Create(OBJ_SHOT));
Obj_SetPosition(obj, GetX, GetY);
Obj_SetSpeed(obj, 4);
Obj_SetAngle(obj, GetAngleToPlayer);
ObjShot_SetDelay(obj, 10);
ObjShot_SetGraphic(obj, sword);
FireShot(1);
                frame = 0;
            }
        frame++;
        }

    @DrawLoop {       
    }

    @Finalize {
    }

}
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on July 28, 2010, 08:36:40 PM
Are not.

let obj = Obj_Create(OBJ_SHOT));
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: electron9186 on July 28, 2010, 08:41:09 PM
*sees mistake*

Wow, you guys are good... :blush:

That leaves me to wonder, though... Why did the error message say I needed a bracket when the problem was having one too many parentheses?

Weird.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on July 28, 2010, 08:45:44 PM
It's Danmakufu. Most of us don't really care why things happen anymore.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: SparklingOrange on July 30, 2010, 05:24:29 PM
It was something along the lines of...

Make a render target. Draw everything related to backgrounds onto this render target. Use the render target as the graphic for an effect object. Give the object zig vertices. Make them behave accordingly.


Yeah, it is difficult...


And @ Sparkling Orange: If you have a single task that creates, manages and removes one of your effect objects, calling this task several times should not cause any problems at atll because the variable that holds the id of the object, in your case "objlightning", is created withing the task and thus is unaffected by code outside of it, even the code of seperate other running instances of the same task.

Did you put the code I posted at the right places? Both parts should go in task LightningRipple(xpos){, the first one before the while{} brackets, the second one inside the while{} brackets just before the yield;.
Oops, I placed the variables at the beginning of the spell script...didn't know it would make a difference if I put it locally in the task. It works now, but say what if I wanted the effect object to have an additive blend? That, or I'd have to shave off more of the black in the texture 'cause it still looks ugly. If only there's a site somewhere that contains good textures to use, especially scrolling scenery textures.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on July 30, 2010, 05:34:21 PM
The Danmakufu wiki is a helpful site. Utilize it. (http://dmf.shrinemaiden.org/wiki/index.php?title=Object_Control_Functions#ObjEffect_SetRenderState)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Beef Owl on August 04, 2010, 12:56:17 AM
This is probably a really stupid question, but is it possible to concatenate strings into method calls?

Like if I wanted a random generator to set a variable to a number rand(1,100) and then called a method corresponding to it, (Like "Function" + i) how (if at all) could that kind of code be written? I'd rather try not having a 100-case switch statement running every second or two if I can avoid it  :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on August 04, 2010, 01:03:27 AM
The ~ character can be used to concatenate strings. "string1"~"string2" would return "string1string2". However, function/sub/task/variable names are not strings, so if I'm understanding your question correctly, you'll have to use a switch.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Lord Phantasm Satori on August 04, 2010, 01:10:27 AM
Is it possible to make a game with Danmakufu that doesn't require the engine? I plan to eventually sell something I make and I won't make much money if all my customers had to do that "app locale" thing.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on August 04, 2010, 01:17:45 AM
No.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Beef Owl on August 04, 2010, 01:19:40 AM
The ~ character can be used to concatenate strings. "string1"~"string2" would return "string1string2". However, function/sub/task/variable names are not strings, so if I'm understanding your question correctly, you'll have to use a switch.

Oh, shoot, it's a tilde in danmakufu? I thought it was either with   pluses or ampersands  :derp: and dammit, figures as much.   Whatever, guess I'll just make a massive switch statement :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on August 04, 2010, 01:30:40 AM
Is it possible to make a game with Danmakufu that doesn't require the engine? I plan to eventually sell something I make and I won't make much money if all my customers had to do that "app locale" thing.

You can just set up everything so there's only one selectable script, then tell the user "press Z repeatedly until you get to a screen that's not blue." If you delete the default Rumia scripts and don't use any Japanese characters in yours, they won't need applocale.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Lord Phantasm Satori on August 04, 2010, 05:10:13 AM
then its not a game engine really.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Formless God on August 04, 2010, 06:05:17 AM
It's not your game engine.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on August 04, 2010, 04:18:03 PM
Question 1: Graphical issue with Dnh it self:

When I enlarge the screen (not full screen) the entire view looks pixelated/ugly but in full screen, everything is looking smooth/nice. I don't have this issue on my laptop so I am suspecting video graphical settings/drivers/options. Though I could vaguely remember if I had this issue when I installed my new pc for the first time.

Any ideas?

Question 2:  Math + Helepolis = Failure. (solved)
I want to mimic CreateShotA_XY as Object bullets to create the "fountain" effect for it (again yes). Knowing CreateShotA_XY has 9 parameters (ID, time to change, x-velocity, y-velocity, x-acc, y-acc and maximum x / y acceleration and finally the graphic.) Guessing trig is my friend, but no matter how much I fiddle, I cannot succeed anything close to it. Here is what I tried in despair. You may laugh now.

Code: [Select]
  task testShot(x,y,v,dir,xacc,yacc,maxXacc,maxYacc,kleur,delay){
    let obj = Obj_Create(OBJ_SHOT);
    Obj_SetPosition(obj,x,y);
    Obj_SetSpeed(obj,v);
    Obj_SetAngle(obj,dir);
    ObjShot_SetGraphic(obj,kleur);
    ObjShot_SetDelay(obj,delay);

    while(!Obj_BeDeleted(obj)) {
Obj_SetX(obj,Obj_GetX(obj)+v*cos(dir));
Obj_SetY(obj,Obj_GetY(obj)+v*sin(dir));
dir++;
yield;
    }
  }
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on August 04, 2010, 05:13:38 PM
For problem 2, have separate X and Y velocities.
Code: [Select]
  task testShot(x,y,xv,yv,xacc,yacc,maxXacc,maxYacc,kleur,delay){
    let obj = Obj_Create(OBJ_SHOT);
    Obj_SetPosition(obj,x,y);
    Obj_SetSpeed(obj,0);
    ObjShot_SetGraphic(obj,kleur);
    ObjShot_SetDelay(obj,delay);

    while(!Obj_BeDeleted(obj)) {
   Obj_SetX(obj,Obj_GetX(obj)+xv);
   Obj_SetY(obj,Obj_GetY(obj)+yv);

   xv+=xacc;
   yv+=yacc;

   Obj_SetAngle(obj,atan2(yv,xv));
   yield;
    }
  }

This is untested, but it should work unless I'm still too tired to think. This won't cap the numbers at the maximum, but I'm sure you can figure that out on your own. The bullet's display angle might be reversed too, but that should also be easy to fix.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Fetch()tirade on August 04, 2010, 05:24:27 PM
ignore this post, found a blatant error
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on August 04, 2010, 05:57:17 PM
For problem 2, have separate X and Y velocities.
Code: [Select]
< code >

This is untested, but it should work unless I'm still too tired to think. This won't cap the numbers at the maximum, but I'm sure you can figure that out on your own. The bullet's display angle might be reversed too, but that should also be easy to fix.

Bullet is moving regular to the given velocity direction, it is not de-accelerating to drop down again.

If I look at the code from my Afro boss (which Iryan I think solved for me back then): SetShotDataA_XY(5,0,speed*cos(rand(265,275)),speed*sin(rand(265,275)),0,0.04,0,rand(0.3,3),205);

Then I really suspect somewhere trig has to be applied, or am I plain wrong =|
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on August 04, 2010, 06:11:15 PM
X-acceleration should be 0, while Y-acceleration should be positive and Y-speed should start out negative. If you're doing that but it doesn't work, then there's something wrong with my code that I'm overlooking...
Trig COULD be used for this, but having separate x and y speed variables is the easier way in my opinion. You just need trig so the graphic rotates correctly.
Edit: note that I changed the velocity and angle parameters to be x-velocity and y-velocity instead. I should have specifically pointed it out.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on August 04, 2010, 09:34:44 PM
Question 2 issue solved on IRC after intensive Helepolis-being-idiot session. Thanks Azure and Iryan.

Question 1 isn't really dramatic, but if anybody has an idea, else I am just going to perform driver updates I guess and see if that helps.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Marco on August 04, 2010, 11:05:51 PM
Sorry, can I post here a little problem with my script? I have searched but I didn't found anything could help me. I have read rules but I don't know if this is the right section...I don't want make problems so
if(this==the right section){I post my script}else if{I cry and ask where the section is}
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on August 04, 2010, 11:09:33 PM
This is the right thread, so go ahead and ask.

Just make sure you give us as much information about your script and problem as possible so we can help you more efficiently.  BV
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Marco on August 04, 2010, 11:23:49 PM
Thanks to all now my script work! It's pretty easy for now but with two or theee get angle to player it will be fun! [Two or threee? Like when i put yield after every "}" (I have resolt  it!)] however thanks again!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Fetch()tirade on August 05, 2010, 12:17:10 AM
That code I posted earlier and then removed? I've been tinkering with it for hours now, but the problem is not solved at all.
I was attempting to make an object version of CreateShot02, and so far I have this. It's got tons of (unnecessary?) stuff inside so I'll explain.
See it here. (http://pastebin.com/KDDivW7G)

If you can make sense of the code on its own, you can skip this section. Otherwise, read on.
First things first, the user-defined variables. Pretty self-explanatory.
Under that, there are more variables.

shottimer = serves the same function as a timer variable in the MainLoop (not active here, so ignore please)
delaycount = aids in delaying the shot from moving (not the problem, so ignore also)
signfinder = using the startingspeed and minmaxspeed, becomes a positive or negative number to be used in determining plausibility of the user-defined accel value
calcspeed = non-permanent value that determines the current speed of the bullet, at start it is set to the starting speed

Now within the while loop.
The if statement is for delay. There are no problems with it.
The else statement:
- The first if statement is pretty self-explanatory. Any of the three values would do, but I just picked that one.
- The embedded else statement is for when the startingspeed is not equal to the minmaxspeed, and is most likely the source of my troubles.

[The following section is how I thought it would work.]
+ If the signfinder is less than 0, then it would mean that the acceleration value would have to be negative. However, I also have to check if the current speed is greater than the minimum speed. If it is, then I would add the current speed with the negative acceleration so it would slow down. If the current speed had equaled or exceeded the minimum value, then it would stay at that speed. I even put in a joke error message that would come up if the acceleration value given was not negative.
+ The second part is the exact same, but just working with positive acceleration.

However, this is not the case. No matter what plausible values I plug in, the bullet will only move at the startingspeed. Implausible values do trigger the error message, so that signals that the code is running, but I can't get the bullet to go any faster or slower.

Any advice?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on August 05, 2010, 03:23:12 AM
I got nothing, sorry Flashtirade.


I have been lectured at about this many, many times, but I still can't quite get it.

What is the Correct way to tab a script? So I can make it more readable to others rather than myself.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on August 05, 2010, 03:36:46 AM
Basically, every time you open a brace (curly bracket), tab everything in them once. If you open more than one, tab more than once. This way, the structure of the code is much easier to read, and it's easier to tell if you mess up a brace. Aside from that, everyone is slightly different, so use whatever you think makes it the most readable. Example:
Code: [Select]
function something(par1,par2){
DoSomething;
loop(3){
loop(10){
Bullet;
var++;
}
DoSomethingElse;
}
}
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Lord Phantasm Satori on August 05, 2010, 04:56:52 AM
You can just set up everything so there's only one selectable script, then tell the user "press Z repeatedly until you get to a screen that's not blue." If you delete the default Rumia scripts and don't use any Japanese characters in yours, they won't need applocale.

what about the fact that everything on the main menu is described in japanese?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on August 05, 2010, 10:29:36 AM
what about the fact that everything on the main menu is described in japanese?
Look, if you want to make a commercial game, maybe you should use an engine that is made for that ordeal, not an unoptimized, discontinued beta version released by people who designed everything in their mother tongue. Preferrably, use an engine that either explicitly says that you may use it for commercial purposes, or one that you programmed yourself.

Just sayin'.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Beef Owl on August 05, 2010, 01:57:12 PM
I have a big a crazy scheme here that I'm pretty sure I'm coding wrong:

Code: [Select]
//Header stuff

let factor = 1.0;
let count = 0;
let score = 0;
let lives = 4;
scorekeeperMake;

loop
{
        if (c < 10)
        {
              pickCard(factor);
        }
        else
        {
              pickBoss(factor);
              c = 0;
        }

        loop(lives == GetPlayerLives && score == scorekeeperValue)
        {}

        if (c == 10 && lives == GetPlayerLives)
                   lives++;
        else
        {
                   lives = GetPlayerLives;
                   score = scorekeeperValue;
                   factor += 0.05;
                   count++;
        }
}

Note that "scorekeeper" is a small script I made (and added with include function) to this script, the plural for my project, that holds the score, outputs it on the sidebar, with a scorekeeperMake method to initialize, a scorekeeperValue to return its value, and a method called scorekeeperCheck called in the Finalize method of each spellcard to add a point if the player didn't die during it.

The pickCard and pickBoss methods are also functions of scorekeeper, and are huge case-statements (hence my last question here) full that select a random spellcard to be next in the script.

The factor variable right now isn't working because I'm unsure about how the spellcards themselves will utilize it; basically I plan to give each card a parameter that makes it more difficult as the parameter's value increases, but right now the parameter isn't used.

Essentially, this is trying to emulate the concept of WarioWare with danmaku :3

I don't quite understand why this isn't working, I'm not even getting error messages when I try to run the script, Danmakufu just crashes. I'm not sure if what I'm trying to do is even gonna work but I'm curious; any ideas?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on August 05, 2010, 04:22:50 PM
Your second loop command has a boolean parameter where it should have a number. ==, <, >, <=, >=, &&, !=, and ! will all yield boolean values. One of your if statements is also missing it's braces, but I'm pretty sure you can still do that anyway so it probably doesn't matter.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Beef Owl on August 05, 2010, 08:08:40 PM
Your second loop command has a boolean parameter where it should have a number. ==, <, >, <=, >=, &&, !=, and ! will all yield boolean values. One of your if statements is also missing it's braces, but I'm pretty sure you can still do that anyway so it probably doesn't matter.

Um, the boolean parameter is to make it loop until either score or lives change, i.e. the current card ends; kinda like an indefinite wait loop. And also I'm kinda new to danmakufu but don't you not need braces for single line statements? Sorry if I'm completely wrong, I probably coded this like a Java program :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Nonnie Grey on August 05, 2010, 08:19:43 PM
Um, the boolean parameter is to make it loop until either score or lives change, i.e. the current card ends; kinda like an indefinite wait loop.

I'm no expert myself, but it sounds like you're after a "while" loop, not a regular one.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on August 05, 2010, 08:34:43 PM
Um, the boolean parameter is to make it loop until either score or lives change, i.e. the current card ends; kinda like an indefinite wait loop. And also I'm kinda new to danmakufu but don't you not need braces for single line statements? Sorry if I'm completely wrong, I probably coded this like a Java program :V

Like Kayorei said, you're looking for a while statement. Also, I too code in Java and know about the one line if statements, hence why I sorta said it might not matter. I'm not actually sure if it errors in Danmakufu, but I wanted to bring it up in case nothing else works.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Fetch()tirade on August 05, 2010, 09:11:45 PM
;_;
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on August 05, 2010, 09:22:02 PM
;_;
Your code is weird. I would have coded it differently, but this way works just as well if you just fix this little error:

You always set the speed to "calcspeed+acc", yet never change the value of "calcspeed". just get rid of the variable altogether and put "Obj_GetSpeed(obj)" in the places where it is referenced.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Fetch()tirade on August 05, 2010, 09:26:28 PM
You always set the speed to "calcspeed+acc", yet never change the value of "calcspeed".

Goddammit here's the problem. It should be something like calcspeed+=accel.
:colonveeplusalpha:

Thanks once again.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Marco on August 05, 2010, 10:22:59 PM
Sorry but, there are any places of this forum in that I could put some scripts of mine [some? or maybe alll...]. I rode I can make a rar archive and I should correct some but if you want to try...I'll be glad.....
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on August 05, 2010, 10:28:06 PM
Upload you script on www.bulletforge.org and then make a thread in this forum.  :derp:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Beef Owl on August 05, 2010, 10:41:38 PM
I'm no expert myself, but it sounds like you're after a "while" loop, not a regular one.

Omg, I didn't even notice I put loop instead of while, thanks, im smrt :colonveeplusalpha:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Marco on August 07, 2010, 12:46:24 AM
Sorrysorrysorry I have a small problem with variable (I know there are easy but...). Howrever how can I make somethin like:
Code: [Select]
if(forse==no){DeleteEnemyShot(ALL); Concentration02(60);no=0;si++;forse-rand(-10, 10);}no, si and forse are variables (yea I let them).
Please help me with this little problem...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on August 07, 2010, 01:18:27 AM
forse-=rand(-10, 10);
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Sejha on August 07, 2010, 01:47:49 AM
I'm new round here so bear with me.

Kay, so for a bout a year now I've been working on my own fullgame, called Eternal Twilight. I don't really neeed to say much cept this.

In stage three, I have two bosses, and I want them to fight simultaneously, so, how do I make it so they both appear as destructable enemies, yet still are under the Boss class?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Marco on August 07, 2010, 01:57:49 AM
forse-=rand(-10, 10);
thanks [I'm going to kill me....this mistake is so ⑨ (⑨=stupid;)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Fetch()tirade on August 07, 2010, 02:20:50 AM
I'm new round here so bear with me.

Kay, so for a bout a year now I've been working on my own fullgame, called Eternal Twilight. I don't really neeed to say much cept this.

In stage three, I have two bosses, and I want them to fight simultaneously, so, how do I make it so they both appear as destructable enemies, yet still are under the Boss class?

I'm pretty sure running two boss scripts simultaneously is impossible, since Danmakufu's tailored to single bosses. For example, the GetEnemyX (and GetEnemyY) value can't be two different numbers at the same time.

Of course, using some clever programming, you can make it look as if two bosses are onscreen by making one of your enemies the familiar of the other, but it's not the same thing.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on August 07, 2010, 02:23:10 AM
In stage three, I have two bosses, and I want them to fight simultaneously, so, how do I make it so they both appear as destructable enemies, yet still are under the Boss class?

You'll spawn one boss as an enemy during the boss script. So you'll spawn your boss using CreateEnemyBossFromFile, and then inside the boss script, you'll use CreateEnemyFromFile (or CreateEnemyFromScript) to spawn the other boss. To make it so they both operate under the same health bar, you'll use SetDamageRate() for the "main" boss, and SetDamageRateEx() for the "sub" boss. SetDamageRateEx allows the main boss to take the same damage as the sub boss (and since the main boss will automatically kill the sub boss when it dies, there is no reason to transfer damage the other way). If you want the sub boss to be at the same point at the start of the following attack, you'd need to set its coordinates in common data at the end of the previous attack and then respawn it in the next script at those coordinates, in @Initialize.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on August 07, 2010, 04:52:52 AM
Just spawn one boss enemy and keep track of two different sets of coordinates (instead of using GetEnemyX etc, create your own variables and movement functions). Then just SetCollisionA/SetCollisionB twice, once for each set. As a last touch, SetEnemyX/SetEnemyY to whichever of the two locations the player is closest to, so homing player scripts will work correctly.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Sejha on August 07, 2010, 12:37:17 PM
You'll spawn one boss as an enemy during the boss script. So you'll spawn your boss using CreateEnemyBossFromFile, and then inside the boss script, you'll use CreateEnemyFromFile (or CreateEnemyFromScript) to spawn the other boss. To make it so they both operate under the same health bar, you'll use SetDamageRate() for the "main" boss, and SetDamageRateEx() for the "sub" boss. SetDamageRateEx allows the main boss to take the same damage as the sub boss (and since the main boss will automatically kill the sub boss when it dies, there is no reason to transfer damage the other way). If you want the sub boss to be at the same point at the start of the following attack, you'd need to set its coordinates in common data at the end of the previous attack and then respawn it in the next script at those coordinates, in @Initialize.
Ah, I think this may be the best route to take.
Thank you for the advice!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Marco on August 09, 2010, 02:23:38 PM
Sorry...I've lots of problems.....Can someone tell me how "wait" works?
Code: [Select]
Wait(120);(http://img838.imageshack.us/img838/1185/problemr.jpg)
Please help me Eirin!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on August 09, 2010, 02:38:22 PM
Sorry...I've lots of problems.....Can someone tell me how "wait" works?
Code: [Select]
Wait(120);(http://img838.imageshack.us/img838/1185/problemr.jpg)
Please help me Eirin!

Wait does actually not exist in the regular danmakufu. It is just a function many scripters define in their scripts to make their script shorter.

You need to define it somewhere in your script, like this:

Code: [Select]
function Wait(t){ loop(t){ yield; } }

I should say here that danmakufu DOES have a Wait command, but it is a completely unrelated command that does nothing outside of Event scripts, so you still need to define Wait (or wait) if you want to use it the way most people use it: To delay tasks.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Grumskiz on August 09, 2010, 03:35:20 PM
It's me again and I still have problems with Non-Spell Scripts...
I just made a new non-spell Single script and tried to run it in Danmakufu.
It didn't work.
I got an error message which says that there would be a mistake in the highlighted part of the script.
After 2 hours of rechecking the script bazillions of times, I still didn't get it to work and I think I need help now :S

Sorry for the huge amount of code...I didn't know how to create a "spoiler" button. ???

Quote
(...)   task mainTask{
         wait(120);
         yield;
         movement;
         fire;
            }
         
         task movement{
               loop{
                 

               
               SetMovePositionRandom01(100, 80, 5, GetCenterX-120, GetCenterY-130, GetCenterX+120, GetCenterY-50);
               wait(90);
               yield;
                     }
                        }
      
   task fire{
            let y = 0;
            let dir = 0;
            
            loop{
            while(y<10){
            ?
                        CreateShotA(01,GetEnemyX+20*cos(dir),GetEnemyY+20*sin(dir),0);
                        SetShotDataA(01,0,6,dir,-0.2,-2,1,RED09);
                        FireShot(01);
                        
                        CreateShotA(02,GetEnemyX+20*cos(dir),GetEnemyY+20*sin(dir),5);
                        SetShotDataA(02,0,6,dir,0.2,-1,4.5,RED09);
                        FireShot(02);
                           wait(5);
               
                        dir+=360/36;
               
                        y++;
               }
                  y = 0;
                  dir = 0;
                  yield;
               }
               
               
            }
      

   
   function wait(w){
      loop(w){yield;}
   }
}  // This bracket is for script_enemy_main...

Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on August 09, 2010, 03:53:02 PM
<snip>

On the spot, I can't see something that would cause danmakufu to spit out an error. You may want to show us the actual error message (you can press ctrl+c if an error show up and it will be copied), as well as checking the lines before the error you got.


On a general, unrelated note, I want you to look at the wait function in your script, what it is defined as, and what it does in your script. I then want you to look at the places where you put a yield; directly after a wait(n);.  :derp:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on August 09, 2010, 04:54:36 PM
@Grumskiz, It would be wise to actually post large scripts in pastebin.org This way we can simply copy/paste the code and test ourselves as well.

This goes for everybody who is posting big chunk of code that covers the screen.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Fetch()tirade on August 09, 2010, 04:56:27 PM
Either posting the error message or the entire code is a good idea. Sometimes a missing bracket or semicolon near the top can ruin everything.
And there seems to be a random apostrophe or single quotation mark in the while loop.

Lastly, I'm just being nitpicky here, but this part
Code: [Select]
            let y = 0;
            while(y<10){
                        CreateShotA(01,GetEnemyX+20*cos(dir),GetEnemyY+20*sin(dir),0);
                        SetShotDataA(01,0,6,dir,-0.2,-2,1,RED09);
                        FireShot(01);
                       
                        CreateShotA(02,GetEnemyX+20*cos(dir),GetEnemyY+20*sin(dir),5);
                        SetShotDataA(02,0,6,dir,0.2,-1,4.5,RED09);
                        FireShot(02);
                           wait(5);
               
                        dir+=360/36;
               
                        y++;
               }
                  y = 0;

could easily be replaced by

Code: [Select]
           loop(10){
                        CreateShotA(01,GetEnemyX+20*cos(dir),GetEnemyY+20*sin(dir),0);
                        SetShotDataA(01,0,6,dir,-0.2,-2,1,RED09);
                        FireShot(01);
                       
                        CreateShotA(02,GetEnemyX+20*cos(dir),GetEnemyY+20*sin(dir),5);
                        SetShotDataA(02,0,6,dir,0.2,-1,4.5,RED09);
                        FireShot(02);
                           wait(5);
               
                        dir+=360/36;
               }
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on August 09, 2010, 05:15:56 PM
Code: [Select]
loop{
            while(y<10){
            ?    //THIS RIGHT HERE
                        CreateShotA(01,GetEnemyX+20*cos(dir),GetEnemyY+20*sin(dir),0);
                        SetShotDataA(01,0,6,dir,-0.2,-2,1,RED09);
                        FireShot(01);

Is that a random apostrophe?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Grumskiz on August 09, 2010, 06:22:36 PM
That apostrophe...I don't not know where it came from^^
But it is not in the actual script file...
@Helepolis
Yeah, after I posted I asked a friend on skype and he reminded me of pastebin   :ohdear:

@Flashtirade
I'm very new to scripting and especially to Danmakufu and I didn't even know, if my fire-task loop works.
Anyway, thanks for the advice ;3

@Iryan
I think there isn't any mistake in the part above the quoted one, but if I can't get it to work in near future, I will upload the whole script on pastebin and ask you again :S


5 Minutes later:
Thanks Iryan!
I replaced the yield; in the movement-task outside of the loop and fixed a typo mistake and...It works...kinda
I now have to adjust some parameters and change the whole movement for this script.(copy-pasted it from an earlier one^^)
You all answered really fast, so thanks to you =D

Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Formless God on August 10, 2010, 04:55:33 AM
Code: [Select]
let obj1=Obj_Create(OBJ_SHOT);
      let obj2=Obj_Create(OBJ_SHOT);

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

      while(Obj_BeDeleted(obj1)==false) {
              if(Obj_GetX(obj1)<GetClipMinX+4) {
                     Obj_Delete(obj1);

                     Obj_SetPosition(obj2,Obj_GetX(obj1),Obj_GetY(obj1));
                     Obj_SetSpeed(obj2, Obj_GetSpeed(obj1));
                     ObjShot_SetGraphic(obj2, graphic);
                     ObjShot_SetDelay(obj2,0);
                     ObjShot_SetBombResist(obj2,true);

                     Obj_SetAngle(obj2, 180 - Obj_GetAngle(obj1) );
                     Obj_SetX(obj2,  Obj_GetX(obj1) + 0.1);
              }

              if(Obj_GetX(obj1)>GetClipMaxX-4) {
                     Obj_Delete(obj1);

                     Obj_SetPosition(obj2,Obj_GetX(obj1),Obj_GetY(obj1));
                     Obj_SetSpeed(obj2, Obj_GetSpeed(obj1));
                     ObjShot_SetGraphic(obj2, graphic);
                     ObjShot_SetDelay(obj2,0);
                     ObjShot_SetBombResist(obj2,true);
                     Obj_SetAutoDelete(obj2,true);

                     Obj_SetAngle(obj2, 180 - Obj_GetAngle(obj1) );
                     Obj_SetX(obj2,  Obj_GetX(obj1) - 0.1);
              }
              yield;
       }
This creates indestructible bullets that bounce off walls only once. Is there any way to make it shorter ? Another problem is that the bullets don't get erased when they go off-screen (even with Obj_SetAutoDelete set to "true"). Can anyone check this for me as well ?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on August 10, 2010, 06:54:48 AM
The MotK Backspace Demon ate my post.


First of all, bullets autodelete when they hit 64 pixels outside of the game boundaries (by default), so passing GetClips shouldn't delete the bullet; and so you don't need the second bullet. You just change the angle, the position and switch a boolean that says to stop bouncing. So er, something like this:

Code: [Select]
      let obj1=Obj_Create(OBJ_SHOT);
      let bounced = false;

      Obj_SetPosition(obj1, x, y);
      Obj_SetAngle(obj1, angle);
      Obj_SetSpeed(obj1, v);
      ObjShot_SetGraphic(obj1, graphic);
      ObjShot_SetDelay  (obj1, 10);
      ObjShot_SetBombResist (obj1, true);
      Obj_SetAutoDelete(obj1,true);

      while(!bounced) {
              if(Obj_GetX(obj1)<GetClipMinX+4) {
                     Obj_SetAngle(obj1, 180 - Obj_GetAngle(obj1) );
                     Obj_SetX(obj1,  Obj_GetX(obj1) + 0.1);
                     bounced = true;
              }

              if(Obj_GetX(obj1)>GetClipMaxX-4) {
                     Obj_SetAngle(obj1, 180 - Obj_GetAngle(obj1) );
                     Obj_SetX(obj1,  Obj_GetX(obj1) - 0.1);
                     bounced = true;
              }
              yield;
       }

The reason I used !bounced instead of checking if the object is deleted is just because once the bullet bounces you just let it do its own thing; there aren't going to be any more triggers so checking it every frame is a waste of processing.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: sumisumi127 on August 12, 2010, 09:23:46 AM
This is a noobish question, but why can't I access spellcards from CTC in the directory?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on August 12, 2010, 09:41:10 AM
They do not have the #TouhouDanmakufu in the scripts, this line makes the script selectable
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: sumisumi127 on August 12, 2010, 11:56:31 AM
Ah, that was easy.  Thanks. (=
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on August 13, 2010, 10:43:55 AM
Hello I'm back, and I have a question

How do you remove those annoying somewhat huge lazer base ??   :V

Edit: How do I get ObjLaser_SetSource to work without using task

Edit Edit: So I've heard that you can delete a post you made in Motk, How do you do that ?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Fetch()tirade on August 13, 2010, 01:52:12 PM
Uhhh, you can't. For either one of those.
1. It's not possible in any other way for Danmakufu.
2. Only mods and admins have the power to delete posts, I think.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Kylesky on August 13, 2010, 03:01:52 PM
it IS actually possible to use objects without tasks, just painfully hard :V

for example
Code: [Select]
let laser=Obj_Create(OBJ_LASER);

...blah blah...

@MainLoop{
     frame++;
     if(frame==1){
          ObjLaser_SetSource(laser, false);
     }
...blah blah....
}
would actually work
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Marco on August 13, 2010, 04:57:27 PM
Sorry...I've another problem![Well I've many problem but... for now...]
Code: [Select]
fire(WHITE01);
if(frame==30){
SetMovePosition02(***, ***, 10);
}yield;
if(frame==60){
yield;
SetMovePosition02(**,***, 10);}yield;
if(frame==90){
yield;
SetMovePosition02(***, **, 10);}yield;
if(frame==120){
yield;
SetMovePosition02(***,***, 10);}yield;
if(frame==150){
yield;
SetMovePosition02(***,***, 10);}yield;
if(frame==180){
yield;
SetMovePosition02(***,***, 10);}yield;
if(frame==210){
yield;
SetMovePosition02(***,***, 10);
frame=0;yield;
}yield;
frame++;
(xs and ys are top secret)
then...
Code: [Select]
task fire(graphic){
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, GetEnemyX, GetEnemyY);
ObjShot_SetDelay(obj, 30);
ObjShot_SetGraphic(obj, graphic);
Obj_SetAngle(obj, -90);
Obj_SetSpeed(obj, 0);
yield;}
If I want that after 210 frames(the movement) ALL objs TOGETHER IN THE SAME TIME go up (for example) changing the velocity to 3 (about).But even with Wait(210); Some bullet will move, then others and then.... well I think you have understood. I tried with stop time and works, but I have other bullet that doesn't have to stop...Well I hope you have understand, I tried to speak English as better I can but... It's warm and I'm in holiday, I can't speak correctly any language....
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on August 13, 2010, 06:48:38 PM
(xs and ys are top secret)

Oh god jesus. If you're gonna keep them secret, why not just delete the freaking lines so we, the people who are trying to help solve your problem, won't have to do it ourselves?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on August 13, 2010, 06:51:20 PM
I'll be quite honest here, I have no clue what the heck your code means, what the heck you said, what the heck you want, or how the heck to respond.

i have been beaten
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on August 13, 2010, 06:54:49 PM
For what I see, we have a major misunderstanding of what the yield command does. Since your code is basically wrong to such a degree that it is incomprehensible what you were trying to achieve, I will simply tell you to read this (http://www.shrinemaiden.org/forum/index.php/topic,865.msg31779.html#msg31779), and possibly this (http://www.shrinemaiden.org/forum/index.php/topic,30.0.html).
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Formless God on August 13, 2010, 07:27:45 PM
I know I'm late but thanks a lot for the help Drake. That worked wonderfully :)



So I've been messing around with the Daifukkatsu player scripts, and I found a rather ... strange line.

Code: [Select]
SetAlpha([150, 255][(isHC)]);I just know that isHC is a boolean. What are the square brackets for ?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on August 13, 2010, 08:05:17 PM
Code: [Select]
SetAlpha([150, 255][isHC]);

[150, 255] is the array, and isHC picks the element of said array.
So if isHC is true (1), Danmakufu returns 255. If false (0), DMF returns 150.
Erm, I'm not too good at explaining, so I need someone to help.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on August 13, 2010, 08:16:25 PM
No, that's pretty much it. It's a nifty way to skip past if statements.

An array is notated by [entry, entry2], as you probably know. The zero'th element in that array is entry, and the first element is entry2. [entry, entry2][0] would be entry, and [entry, entry2][1] would be entry2. Some people seem to think that making an array can only be done by creating a variable for it, but that isn't right. Just the act of using [] creates a temporary array.
Secondly, simply because of machine code, false is the same thing as 0 and true is the same thing as 1.

So, SetAlpha([150, 255][isHC]) would be SetAlpha(150) if isHC were false, and SetAlpha(255) if it were true.

teletype
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Tarquinius on August 13, 2010, 11:22:49 PM
I'm trying to create a spellcard where the boss fires a bullet using CreateShotA, then using AddShot to create bullets from the original bullet, then using AddShot again to create bullets from the bullets created in the first AddShot. Currently, I have it set up like this:
Code: [Select]
task fire01{
loop{
CreateShotA(1,GetEnemyX,GetEnemyY,5);
SetShotDataA(1,0,2,45,0,0,2,BLUE12);
CreateShotA(2,0,0,5);
SetShotDataA(2,0,2,135,0,0,2,BLUE12);
CreateShotA(3,0,0,5);
SetShotDataA(3,0,2,315,0,0,2,BLUE12);
AddShot(60,1,2,0);
AddShot(60,1,3,0);
CreateShotA(4,0,0,5);
SetShotDataA(4,0,2,45,0,0,2,BLUE12);
CreateShotA(5,0,0,5);
SetShotDataA(5,0,2,225,0,0,2,BLUE12);
AddShot(60,2,4,0);
AddShot(60,2,5,0);
AddShot(60,3,4,0);
AddShot(60,3,5,0);
FireShot(1);
wait(120);
yield;
}
}
The idea is that shot 1 fires shots 2 and 3, and 2 and 3 each fire shots 4 and 5. However, while shot 1 fires shots 2 and 3 fine, shots 2 and 3 do not fire shots 4 and 5. Can anyone please explain how to change this so that it works like I want it do?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on August 13, 2010, 11:34:10 PM
Firstly, you can't add shot 4 and 5 to both 2 and 3, you need to make new shots for them.

Secondly, was your problem that only one of the child bullets fired additional childs, or did none of the child bullets fire further child bullets?
I haven't used AddShot in quite some time, but in the latter case I guess you should either add the shots 4 and 5 to 2 before adding 2 to 1,  or you need to change the time at which the bullets 4 and 5 are added to accommodate for the time it takes bullet 1 to spawn 2 and 3.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Tarquinius on August 13, 2010, 11:44:23 PM
Adding 4 and 5 to 2 before adding 2 to 1 and making the shots added to 3 different than the ones added to 2 worked, thank you.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Marco on August 14, 2010, 10:27:47 PM
Sorryyyy T_T that things it's so lunatic?No, Extra?Phatasm?No it's kefir... T_T sorrryyyy.....
However, how about make some bullet at GetAngleToPlayer but if the player move the bullet won't change angle?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on August 14, 2010, 11:20:04 PM
Holy fuck the engrishhhhh
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Marco on August 14, 2010, 11:24:00 PM
Holy fuck the engrishhhhh
YEEEESSSS!!!!
What does it mean?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: CK Crash on August 15, 2010, 02:52:13 AM
Sorryyyy T_T that things it's so lunatic?No, Extra?Phatasm?No it's kefir... T_T sorrryyyy.....
However, how about make some bullet at GetAngleToPlayer but if the player move the bullet won't change angle?
Make a variable equal GetAngleToPlayer. Shoot bullets using that variable for the angle. If you don't update the variable, it will shoot at where the player WAS.

Here's an example in task format.
Code: [Select]
task ShootLine
{
let angle = GetAngleToPlayer; //Variable "angle" equals the angle to player.
loop(10)
{
//Shoots the bullet towards "angle".
CreateShot01(GetX,GetY,4,angle,RED01,10);
loop(3){yield;}
}
}

Here's an example in @MainLoop format.
Code: [Select]
let frame = -60;
let angle;

@MainLoop
{
if(frame==0)
{
//Variable "angle" equals the angle to player.
angle = GetAngleToPlayer;
}
if(frame%3==0 && frame>=0)
{
//Shoots the bullet towards "angle".
CreateShot01(GetX,GetY,4,angle,BLUE01,10);
}
if(frame==30)
{
frame =- 30;
}
frame++;
}

Both examples shoot 10 bullets over 30 frames, all aimed at the same spot.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: arch on August 15, 2010, 12:03:56 PM
Need some help here, I have made my own sprites...

(http://img839.imageshack.us/img839/3839/90882779.png)

I have the idle, left, and right animations working I just need help getting the firing sprites to show when it's firing bullets.

This is what I have so far.

Code: [Select]
@DrawLoop{
SetTexture(spr);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);


if(int(GetSpeedX())==0){

if(f<10){ SetGraphicRect(0,0,96,96); }
if(f>=10 && f<20){ SetGraphicRect(96,0,192,96); }
if(f>=20 && f<30){ SetGraphicRect(192,0,288,96); }
if(f>=30 && f<40){ SetGraphicRect(288,0,384,96); }
f2=0;

}

if(GetSpeedX()>0){

if(f2<5){ SetGraphicRect(0,96,96,192); }
if(f2>=5 && f2<10){ SetGraphicRect(96,96,192,192); }
if(f2>=10 && f2<15){ SetGraphicRect(192,96,288,192); }
if(f2>=15){ SetGraphicRect(288,96,384,192); }
f2++;

}

if(GetSpeedX()<0){
if(f2<5){ SetGraphicRect(0,192,96,288); }
if(f2>=5 && f2<10){ SetGraphicRect(96,192,192,288); }
if(f2>=10 && f2<15){ SetGraphicRect(192,192,288,288); }
if(f2>=15){ SetGraphicRect(288,192,384,288); }
f2++;

}

DrawGraphic(GetX,GetY);

f++;
if(f==40){f=0;}

}
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on August 15, 2010, 12:31:08 PM
The mystery of danmakufu not playing music continues :V

Turns out when I play Phantasm Romance the midi music works but mp3s and wav don't like concealed the conclusion etc.
hmmmm.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on August 15, 2010, 07:13:39 PM
Need some help here, I have made my own sprites...

I have the idle, left, and right animations working I just need help getting the firing sprites to show when it's firing bullets.

Code: [Select]

let attack = 0;
. . .

if(int(GetSpeedX())==0){

// idle animation
if(attack == 0) {
if(f<10){ SetGraphicRect(0,0,96,96); }
if(f>=10 && f<20){ SetGraphicRect(96,0,192,96); }
if(f>=20 && f<30){ SetGraphicRect(192,0,288,96); }
if(f>=30 && f<40){ SetGraphicRect(288,0,384,96); }
f2=0;
}
// attack animation
if(attack == 1) {

<< Here SetGraphicRect ranges for the attack animation. >>
f2=0;
}
}

Declare for example:  "let attack = 0;" at the top and create simply a second animation range inside the idle statement (speed == 0) then call attack = 1; for example inside the task or function where the boss is firing. At the end of the attack sequence, simply call attack = 0; to return to idle statement.

Maybe bit strange method for most, but it works. Unless someone has a more efficient and easier method.


A question of my own:
I want to give my Marisa a laser like MarisaB dnh, however, I cannot seem to make it proper penetrate the familiars/bosses to deal equal damage along the laser.

Code: [Select]
    task testLaser(x,y) {
let obj = Obj_Create(OBJ_LASER);
let c = 0;

Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,22);
Obj_SetAngle(obj,270);
ObjShot_SetGraphic(obj,254);
    ObjLaser_SetSource(obj,false);
ObjLaser_SetLength(obj, 1000);
    ObjShot_SetDelay(obj,0);
ObjShot_SetDamage(obj,0.5);
ObjShot_SetPenetration(obj,25);
ObjLaser_SetWidth(obj,15);

while(!Obj_BeDeleted(obj)) {
Obj_SetPosition(obj,GetPlayerX,GetPlayerY);
c++;
if(c>=30) { Obj_Delete(obj); }
yield;
}
    }
Penetration isn't working. Somehow Danmakufu calculates the first target as a hit and the laser will keep penetrating that target continuously.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on August 15, 2010, 07:23:44 PM
What you could do is ascent through every enemy and check if their coordinates intersect a line (the laser). If so, damage them.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on August 15, 2010, 07:59:33 PM
Object lasers don't use Obj_SetSpeed or ObjShot_SetPenetration, don't include them. There's also no reason to set delay to zero.

My Remilia lasers use both lasers to damage the enemies and enemy enumeration loops to spawn explosions on their position. You can just copy either code for your laser.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Marco on August 15, 2010, 10:56:40 PM
Code: [Select]
if(frame%3==0)What does it means?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on August 15, 2010, 10:59:06 PM
Code: [Select]
if(frame%3==0)What does it means?

the % is called a Modulus, this statement says, if frame divided by 3 equals 0, then code
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Suikama on August 15, 2010, 11:08:01 PM
the % is called a Modulus, this statement says, if frame divided by 3 equals 0, then code
Not exactly. It says, if frame divided by 3 has a REMAINDER of 0, then code.

Also how can you divide something and end up with 0? :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on August 15, 2010, 11:09:41 PM
Not exactly. It says, if frame divided by 3 has a REMAINDER of 0, then code.

Also how can you divide something and end up with 0? :V
...whoops, my bad, thanks for the correction.

Dividing it by 0 of course :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Marco on August 15, 2010, 11:30:43 PM
AMAZING! it's useful for me! Well... it was useful some time ago, I'll thouth "if something like this exist I can ahhh so... yes! and then... perfectly I am a genious! (call my brother) I'm genializing!" [Yes when I talk I use say all that things...] HOWEVER I thinked it was impossible and i've resolved (I think[I don't remember{I like lasers}])

Ah my spellcard is complete, now (not now) I may (may?) create a topic for my scripts! [and play guess the spellcard!]
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Beef Owl on August 16, 2010, 02:57:36 AM
...whoops, my bad, thanks for the correction.

Dividing it by 0 of course :V

Not to criticize, but wouldn't dividing by 0 give you an undefined value? :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on August 16, 2010, 07:17:28 AM
Object lasers don't use Obj_SetSpeed or ObjShot_SetPenetration, don't include them. There's also no reason to set delay to zero.

My Remilia lasers use both lasers to damage the enemies and enemy enumeration loops to spawn explosions on their position. You can just copy either code for your laser.
Oh, thought penetration worked, because if I would put penetration to 1, the laser would hit once then immediately disappear (brrr sound also confirms this).

I'll be in your debt. I'll try to look and learn before blatantly copying =S
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on August 16, 2010, 07:33:25 AM
Dividing it by 0 of course :V
Wrong. START with 0.
I mean 0?3=0
0?219038219038109 = 0
Rite?
I'm such a jerk :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: DarkOverord on August 16, 2010, 07:39:35 PM
I love how I make a really complicated spellcard with many random variables, and etc. Yet angles and lasers? Well. THAT'S COMPLETELY DIFFERENT!
http://www.majhost.com/gallery/DarkOverord/Other/SS2/Toehoes/damnyouangles.png
Now it's nice the lasers are aiming at the player to the same point. But this isn't exactly what I wanted, hang on I'll get a shot if you hold still.
http://www.majhost.com/gallery/DarkOverord/Other/SS2/Toehoes/aimingforlikethis.png

That's kind of what I want, but basically for ANY angle. So say you're at the top right (Like in my pic and move down), I only want the laser to move towards where the player WAS. I'm sure you guys will know what to do. Here's the green laser script:
Code: [Select]
let x=0;
let ANG=270;
let z=0;
let v=1;
while(x<6){
CreateLaserC(11+x,GetX,GetY,10,80,188,0);
SetShotDirectionType(PLAYER);
SetLaserDataC(11+x,0,2+z,ANG*v,2*v,0,2);

SetLaserDataC(11+x,40,0,0,0,0,2);
SetLaserDataC(11+x,50,4,0,0,0,2);

y=y+10;
z++;
if(y>20){y=0;z=0;v=-1;}
x++;
}
FireShot(11);FireShot(12);FireShot(13);FireShot(14);FireShot(15);FireShot(16);
z and v are just arbitrary values that change :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on August 16, 2010, 07:49:09 PM
I'd do it with OBJ_SINUATE_LASER. Parse the player's position to the laser at the beginning of the task, then make it hom in on him.


Alternatively, you could do the math. Gimme some minutes...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: DarkOverord on August 16, 2010, 07:59:57 PM
I'd do it with OBJ_SINUATE_LASER. Parse the player's position to the laser at the beginning of the task, then make it hom in on him.


Alternatively, you could do the math. Gimme some minutes...
I suppose via the maths route I could set it back to Absolute and then sort it that way. It'd be a bit fun mind. Time to look up a function~ Even if I don't use it :3c
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Lord Phantasm Satori on August 16, 2010, 11:17:23 PM
what causes the plural, single, stage, etc. selections to not work? I can still use directory, but the other options crash. any ideas on what it could be?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on August 17, 2010, 12:23:11 AM
Many things cause stuff to not work. Post scripts.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on August 17, 2010, 12:38:39 AM
what causes the plural, single, stage, etc. selections to not work? I can still use directory, but the other options crash. any ideas on what it could be?
You mean you entire danmakufu main menu is crashing?

If so, first delete the "script_index.dat" file in your danmakufu folder and look if the error persists.

To prevent it from happening again, look for any script that you added or edited since the last time when you could access the other menu parts. With all of these, check if there is a typo or something in the script head (everything before script_enemy_main). If you have to narrow it down, try removing whole folders. Make sure that you always delete the new "script_index.dat" after each time you encountered this error.


Several things in the script head can make danmakufu store faulty script information in the dat file, making the program crash whenever it accesses the directory the script is inside. The plural, single etc selections in the menu will make danmakufu access all folders to check for the script type, making it crash every single time if there is a problematic script.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: DarkOverord on August 17, 2010, 12:59:02 AM
So I was looking you the Obj stuff for what I wanted, I still see a problem, every laser is going to require a different angle, unless now you're gonna tell me there's a way of getting obj lasers to home in on a specific XY point? :C

....Nevermind I just got it. I think. You're implying I get the player location, THEN push that into a task with OBJ_SINUATE_LASER, Get the end of the laser, then calculate the angle from there? :V!? Say yes/no/almost? (Also the idea of lasers homing in at an XY ordinate only without angles would be awesome!)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Formless God on August 17, 2010, 09:20:34 PM
Explanations.
Thanks a lot ! I was wondering why that wasn't mentioned anywhere in the tutorials (though I probably have overlooked it).



Is there a function to detect the collision between an effect object and a bullet (any kind of bullet except for lasers) ? (you could've guessed what I was trying to accomplish now:
is it possible to code a reflective barrier at all ?
)

And uh, what are the differences between a task, a subroutine and a function ?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on August 17, 2010, 09:47:09 PM
Is there a function to detect the collision between an effect object and a bullet (any kind of bullet except for lasers) ? (you could've guessed what I was trying to accomplish now:
is it possible to code a reflective barrier at all ?
)
You can check the collision manually, for example with the GetPointToLine function I posted in the Miscelleanous Code Snippets thread.

Quote
And uh, what are the differences between a task, a subroutine and a function ?
A subroutine is just you taking a block of code you need to use several times in a script, so you substitute a single command for this block to save time.
A function is pratically the same, only with a) several parameters to modify this code block and b) the possibility to have it give you a return value, so that they can be used in a similar fashion to GetAngleToPlayer.

A task is structurally different. It is a defined piece of code that runs alongside the MainLoop{}. If you task doesn'T include a yield; in the task, it can be used similar to a function, but it is a little more CPU intensive. If you DO include yield;, well, refer to the intermediate tutorial.  ;)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on August 17, 2010, 11:11:15 PM
Is there a function to detect the collision between an effect object and a bullet (any kind of bullet except for lasers) ? (you could've guessed what I was trying to accomplish now:
is it possible to code a reflective barrier at all ?
)
I suppose you could, but it sucks to work properly. It would be better off using math. What shape is it? Are you placing it anywhere in particular; are you moving it around?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Beef Owl on August 18, 2010, 04:22:59 PM
is it possible to code a reflective barrier at all ?

You could pretty easily adapt this code to work for a specific area instead of the screen borders (though you would have to put it in every bullet, which would suck) but I can't give you much in the ways of specifics because of how vague you're question is

Code: [Select]
while(Obj_BeDeleted(obj) == false)
{
        if(Obj_GetX(obj) < GetClipMinX)
        {
                  Obj_SetAngle(obj, 180 - Obj_GetAngle(obj));
                  Obj_SetX(obj,  Obj_GetX(obj) + 0.1);
        }

        if(Obj_GetX(obj) > GetClipMaxX)
        {
                  Obj_SetAngle(obj, 180 - Obj_GetAngle(obj));
                  Obj_SetX(obj,  Obj_GetX(obj) - 0.1);
        }
}

Not really sure if this is useful but hopefully it helps :)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Formless God on August 21, 2010, 08:59:08 PM
Ah ... no, this is different from the QED effect :<
The barrier should be a rectangle/square that is placed on the player and moves with the player (http://www.youtube.com/watch?v=Iu1n13Elvug#t=3m58).
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on August 21, 2010, 09:04:40 PM
You could do a circle if you want.

if( (Obj_GetX(obj) - GetPlayerX)^2 + (Obj_GetY(obj) - GetPlayerY)^2 < (radius)^2 ){ bounce; }

A square/rectangle would be

if( objx>plx-left && objx<plx+right && objy>ply-top && objy<ply+bottom ){ bounce; }

However because the bullets could bounce given any angle around the player (instead of a wall that you can only run into one side of), you would need to move the bullet that small amount like
objx += cos(atan2(objy-ply,objx-plx)); objy += sin(atan2(objy-ply,objx-plx)); or something like that.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Kylesky on August 22, 2010, 01:08:38 AM
Or you could use Collision_Line_Circle :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on August 22, 2010, 01:35:54 AM
I don't see how that would be better in this situation.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Tarquinius on August 22, 2010, 03:11:58 AM
I'm trying to make it so that a bullet will, when it hits the side of the screen, reflect off of it. This is the code I'm using:
Code: [Select]
task fire01{
let dir = 0;
let i = 0;
loop{
bullet01(GetEnemyX,GetEnemyY,3,dir,PURPLE12,5);
if(dir>=0 && i==0 && dir!=45){
dir++;
}
if(dir==45 && i==0){
dir--;
i = 1;
}
if(dir<=45 && i==1 && dir!=0){
dir--;
}
if(dir==0 && i==1){
dir++;
i = 0;
}
wait(2.5);
}
}

function bullet01(x,y,s,dir,g,d){
let obj01 = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj01,x,y);
Obj_SetSpeed(obj01,s);
Obj_SetAngle(obj01,dir);
ObjShot_SetGraphic(obj01,g);
ObjShot_SetDelay(obj01,d);

while(!Obj_BeDeleted(obj01)){
if(Obj_GetX(obj01)>GetClipMaxX){
Obj_SetAngle(obj01,rand(105,179));
}
yield;
}
}
However, the problem is that, once one bullet is fired, the next bullet won't be fired until the first bullet has been deleted. Is there a way to make it so that the next bullet will fire before first is deleted?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on August 22, 2010, 03:24:54 AM
function -> task
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Kylesky on August 22, 2010, 08:33:16 AM
I don't see how that would be better in this situation.

he wants a rotating square-shaped barrier on the player that reflects bullets out, right?
Code: [Select]
let barrier_angle=0;
let barrier_width=20;

...

task bullet(blah, blah){
let obj=Obj_Create(OBJ_SHOT);
blah blah blah
while(!Obj_BeDeleted(obj)){
    if(Collision_Line_Circle(GetPlayerX+barrier_width*cos(barrier_angle), GetPlayerY+barrier_width*sin(barrier_angle), GetPlayerX+barrier_width*cos(barrier_angle+180), GetPlayerY+barrier_width*sin(barrier_angle+180), barrier_width, Obj_GetX(obj), Obj_GetY(obj), object_radius)==true){
    *insert reflection code here depending on barrier_angle*
    }
    yield;
}
}
@MainLoop{
    barrier_angle++; //blah
}

This makes a rotating square shaped collision-check area on the player...

if I remember correctly, the reflection code should look something like this...
Code: [Select]
angle=atan2(Obj_GetY(obj)-GetPlayerY, Obj_GetX(obj)-GetPlayerX);
if(angle>=barrier_angle-45 && angle<barrier_angle+45){angleb=barrier_angle;}
if(angle>=barrier_angle+45 && angle<barrier_angle+135){angleb=barrier_angle+90;}
if(angle>=barrier_angle+135 && angle<barrier_angle+225){angleb=barrier_angle+180;}
if(angle>=barrier_angle+225 && angle<barrier_angle+315){angleb=barrier_angle+270;}
Obj_SetAngle(obj, angleb*2-Obj_GetAngle(obj)+180);
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chau on August 22, 2010, 12:47:13 PM
Hi everyone,
how do you "shorten" the replay? When I played Concealed the Conclusion I noticed that the replay doesn't show the menu. "IsReplay" can be used to prevent that the menu appears but I think the keys you pressed in the menu still remain saved in the replay so that the replay shows some weird movements at the beginning.
Or am I wrong?

} // end of Engrish
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on August 22, 2010, 12:53:00 PM
Hey guyz how do I nue line in DrawText?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on August 22, 2010, 05:52:33 PM
Sorry Chau I have no idea,

Hey guyz how do I nue line in DrawText?

You have to make an entirely new DrawText
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Tarquinius on August 22, 2010, 06:15:51 PM
function -> task
That worked, thank you.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on August 22, 2010, 06:59:23 PM
Hey guyz how do I nue line in DrawText?
type
 in the text

wtf u doin
wtf u doin
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on August 22, 2010, 07:35:34 PM
type
 in the text

I thought that only worked in Dialog?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on August 22, 2010, 07:58:17 PM
Oh whoops, thought that was what he meant. Might still work, but eh.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on August 22, 2010, 08:55:08 PM
Oh whoops, thought that was what he meant. Might still work, but eh.
Just tried it, didn't work.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on August 23, 2010, 04:18:40 AM
You have to make an entirely new DrawText
Shit.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on August 23, 2010, 04:27:49 AM
Shit.

DrawText("This one Here".x.y.30,alpha);
DrawText("That one Tere".x+30.y+30.30,alpha);

Perhaps "Make" was a poor word choice...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on August 23, 2010, 04:59:41 AM
DrawText("This one Here".x.y.30,alpha);
DrawText("That one Tere".x+30.y+30.30,alpha);

Perhaps "Make" was a poor word choice...
No. I was just complaining about the process being too time consuming.
Especially with multiple lines.
Object effects would be a lot easier in this case.
brb finding my DrawTextNew function that's blatantly edited version of Kylesky's Dialogue functionz
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on August 23, 2010, 05:03:04 AM
You're implying the DrawTextNew-esque functions were developed by one person and not a combined effort of ripping off various code from various people :(
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on August 23, 2010, 05:04:42 AM
SetFog

It turns my backgrounds into big blocks of whatever colour
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on August 23, 2010, 05:13:31 AM
You're implying the DrawTextNew-esque functions were developed by one person and not a combined effort of ripping off various code from various people :(
god.
I guess I haz worse choice of word.
I was just trying to say that I'll try another lazier method and scream when I fail miserably.

Maybe I'll just shut up next time.
Sheesh, my engrish made another mess again.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on August 23, 2010, 09:29:10 AM
SetFog

It turns my backgrounds into big blocks of whatever colour

SetFog has to be accompanied with a 2D sheet in your back ground. I think I am going to write a tutorial about this. To help you out:

Logically the stage background is pitch black. So when you are building a stage, you logically add stuff in like walls, floor, ceilings. Incase you don't have a background drop (like Azure has for example with her mountains/sky) it will simply show the black backdrop. Adding just SetFog isn't going to cure this. You have to create a "backdrop" which is simply a 2D sheet drawn with the 3Dfunction and placed in the back.

- Create a 1x1 white pixel in paint and save it as fogsheet.png or w/e.
- Draw this inside the stage with quite large proportions, so it covers the black parts. Set it to the desired fog colour you are using with SetFog (i.e if your SetFog has 255,16,16 then make sure the fogsheet is also same colour).
- Adjust the first two parameters of SetFog until you get your desired intensity.


Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Kylesky on August 23, 2010, 11:01:46 AM
I think he just means that SetFog's turning his graphics into big blocks of a certain color

use smaller images then just tile them or something, SetFog goes crazy with large images :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on August 23, 2010, 11:24:57 AM
I think he just means that SetFog's turning his graphics into big blocks of a certain color

use smaller images then just tile them or something, SetFog goes crazy with large images :V
Just realizing that I returned to this thread to edit my post, but you seem to have tackled it all ready. Must read more clearly in the early timers =.=

Like Kylesky said, build your stage from 1024 blocks etc.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Formless God on August 25, 2010, 06:27:18 AM
I couldn't achieve that reflective effect in the end (which needed to be part of the player script) but the various advices were very useful for my other scripts. Thanks a lot guys :3
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: arch on August 25, 2010, 09:09:28 AM
I have a quick question.  I have a Plural file working with Spellcards and Non-Spellcards, but I can't figure out how too change the background of the Non-Spellcards.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on August 25, 2010, 09:12:57 AM
You need a stage. Without a SetScore there are no backgrounds for single patterns.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Kylesky on August 25, 2010, 09:51:55 AM
alternatively, If you want, you can draw the background in @DrawLoop, but make sure it's always drawn below/before the boss and other things... also, I don't think this would allow anything 3D (I doubt that you're trying to do 3D yet though :V)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: arch on August 25, 2010, 09:59:57 AM
You need a stage. Without a SetScore there are no backgrounds for single patterns.

I made a 'stage' with the background I want that clears after 30 seconds, but I how do link the stage to the plural file?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on August 25, 2010, 10:05:52 AM
I made a 'stage' with the background I want that clears after 30 seconds, but I how do link the stage to the plural file?

During the stage when ever you want, you spawn the boss which is calling the plural file with the following command: CreateEnemyBossFromFile("path to the plural file",x pos,y pos, speed , direction ,userargument);

(Note that the path to the plural file must be between double quotes.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: arch on August 26, 2010, 02:57:38 AM
During the stage when ever you want, you spawn the boss which is calling the plural file with the following command: CreateEnemyBossFromFile("path to the plural file",x pos,y pos, speed , direction ,userargument);

Worked out great, thanks!

Is there a more proper way to make a time out spellcard rather than making the enemy health 99999?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on August 26, 2010, 03:08:54 AM
Leave out the SetCollisionA/SetCollisionB so make it so the player's bullets don't even collide with boss, or use ForbidShot(true);
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on August 26, 2010, 09:58:58 AM
SetDurableSpellCard; ?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on August 26, 2010, 06:17:35 PM
SetDurableSpellCard; ?
That too, because without it, the Bonus would decrease over time, so when time would be up the Bonus would be 0.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on August 27, 2010, 03:22:48 PM
Can someone see why this isn't working  :V I'm stuck

Code: [Select]
   if(sc== 1){
ascent(i in 0..5){
PlaySE(GetCurrentScriptDirectory~"SE\Shot4.wav");
CreateShotA(1, GetX+50*i, GetY, 10);
SetShotDataA(1, 0, 0.5-5/i, GetAngleToPlayer+wa, 0, 1, 10, 185);
FireShot(1);

CreateShotA(1, GetX-50*i, GetY, 10);
SetShotDataA(1, 0, 0.5-5/i, GetAngleToPlayer-wa, 0, 1, 10, 185);
FireShot(1);
}


sc = 0;
   }


   if(wa<= 100){
wa += 1;
}

   if(wa>= 100){
wa -= 1;
}

   if(wa== 95){
wa = 200;
}

   if(wa== 105){
wa = 0;
}
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Kylesky on August 27, 2010, 04:07:04 PM
Code: [Select]
   if(wa<= 100){
wa += 1;
}

   if(wa>= 100){
wa -= 1;
}

   if(wa== 95){
wa = 200;
}

   if(wa== 105){
wa = 0;
}

check if wa ever falls between 95 and 105... if it does, it would get stuck at 100... if it's impossible for it to go between 95 and 105, then I have no idea :V (too lazy to actually look at the code right now)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on August 27, 2010, 10:58:33 PM
I am so mad at this right now...

http://pastebin.org/791582

I am trying to recreate Sanae's OP from MoF, lunatic, and I can't get the angles right. I need help, please~ I have the bullet placement and the begging right, just when the fan out is the part I am having troubles with.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on August 27, 2010, 11:37:40 PM
I am so mad at this right now...

http://pastebin.org/791582

I am trying to recreate Sanae's OP from MoF, lunatic, and I can't get the angles right. I need help, please~ I have the bullet placement and the begging right, just when the fan out is the part I am having troubles with.

Code: [Select]
task TShitballs(x, y, v, r, as, ab, ns, nb, graph){

loop(120){ yield; }

let d=r*2/sin(72);

ascent(k in 0..nb){ ascent(i in 0..ns){ ascent(j in 0..5){

CreateShotA(1,  x+r*cos(ab+72*j)+d*cos(ab+72*j+162)*k/nb,
y+r*sin(ab+72*j)+d*sin(ab+72*j+162)*k/nb, 0);

SetShotDataA(1, 0, 0, as+360*i/ns, 0, 0, 0, graph);
SetShotDataA(1, 60+nb-k, 6, as+360*i/ns, 0, -0.2, 0, graph);
SetShotDataA(1, 180+nb-k, 0, ab+72*j+162, 0.25*k/nb, v/90, v, graph);
FireShot(1);

} } yield; }
}
Reposting here so it doesn't get lost in the pastebin limbo.

x,y = center of starsplosion
v = final bullet speed
r = star radius
as, ns = alignment and number of stars
ab, nb = alignment of bullets and number of bullets in the individual lines of the pentagrams
graph = graphic

You need to tinker around with the final SetShotData until you get the correct result. I may look at it again tomorrow, but it is kinda late over here...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Grumskiz on August 28, 2010, 05:45:12 PM
I have another problem.
I combining my standartspells and spell-cards in one Plural-script for my first real boss fight.(I mean, it is not just a bunch of attacks in a spellcard which was randomly designed according to a tutorial or something)
At the moment there are 2 spells and 2 standartspells combined in it.
While testing it, I noticed that the "Graze" counter resets itself after a VERY short time.
So you can't get a grazecount higher then 1.(Mostly it's 0)
How do I fix that?

€dit:
Forgot to tell you that it works for every other script. Also the single scripts work fine, when you don't use the Plural script.
I will upload it on pastebin and write the link in this post.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on August 29, 2010, 06:56:37 AM
I have another problem.
I combining my standartspells and spell-cards in one Plural-script for my first real boss fight.(I mean, it is not just a bunch of attacks in a spellcard which was randomly designed according to a tutorial or something)
At the moment there are 2 spells and 2 standartspells combined in it.
While testing it, I noticed that the "Graze" counter resets itself after a VERY short time.
So you can't get a grazecount higher then 1.(Mostly it's 0)
How do I fix that?

?dit:
Forgot to tell you that it works for every other script. Also the single scripts work fine, when you don't use the Plural script.
I will upload it on pastebin and write the link in this post.
Sounds like Danmakufu being a jerk again to me rather than your script's error.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Stuffman on August 30, 2010, 05:59:46 AM
I have another problem.
I combining my standartspells and spell-cards in one Plural-script for my first real boss fight.(I mean, it is not just a bunch of attacks in a spellcard which was randomly designed according to a tutorial or something)
At the moment there are 2 spells and 2 standartspells combined in it.
While testing it, I noticed that the "Graze" counter resets itself after a VERY short time.
So you can't get a grazecount higher then 1.(Mostly it's 0)
How do I fix that?

Might be a screwy player script? Not sure how a plural would cause this. Need to see code.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on August 30, 2010, 08:16:48 AM
Sounds like a player script indeed. I don't remember the graze counter resetting unless you use continue. Might want to try regular Reimu or Marisa A/B to see what happens. Also when does the graze counter reset? Immediately in the first spell/nonspell or ......... ?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Sakuya Izayoi on August 30, 2010, 11:09:24 AM
I'm trying to write this simple little script for animating boss characters, but what seems like a simple task seems impossible. I keep getting an error that I'm missing a }, but I counted and I have 22 opening and closing brackets in the entire script.

Code: [Select]
sub setGraphicMove {
if (GetSpeedX < 0){
setGraphicLeft;
}else{
if (GetSpeedX > 0){
setGraphicRight;
}
}else{
if (GetSpeedX == 0){
setGraphicStop;
}
}
}

I feel like a derp because this seems so simple. If only Danmakufu had elsif like perl...  :fail:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on August 30, 2010, 11:16:09 AM

I feel like a derp because this seems so simple. If only Danmakufu had elsif like perl...  :fail:
you don't type elseif, you do it this way:
Code: [Select]
if(somethingistrue){
doCrap;
} else if(somethingelseistrue){
doCrap2;
}

Edit: I'm such an awesome Ninja
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Kylesky on August 30, 2010, 11:17:34 AM
*cough*
Code: [Select]
sub setGraphicMove {
if (GetSpeedX < 0){
setGraphicLeft;
}else if(GetSpeedX > 0){
setGraphicRight;
}else{
setGraphicStop;
}
}

damn, beaten to the punch :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on August 30, 2010, 11:18:18 AM
      sub setGraphicMove {
         if (GetSpeedX < 0){
            setGraphicLeft;
         }else{
            if (GetSpeedX > 0){
               setGraphicRight;
            }
         }else{
            if (GetSpeedX == 0){
               setGraphicStop;
            }
         }
      }
Your second else{} is linked to the first else{} instead of what's IN the first else{}. Technically this would mean that the condition for the final case is the same as for the first case, but I can totally see danmakufu not liking you putting a "if else than else" condition into your code.

      sub setGraphicMove {
         if (GetSpeedX < 0){
            setGraphicLeft;
         }else{
            if (GetSpeedX > 0){
               setGraphicRight;
            }
         else{
            if (GetSpeedX == 0){
               setGraphicStop;
            }
         }   }
      }

If that does not fix it, then maybe the problem lies somewhere else entirely.


Edit: I hate all of you.  :derp:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Sakuya Izayoi on August 30, 2010, 11:39:43 AM
you don't type elseif, you do it this way:
Code: [Select]
if(somethingistrue){.
doCrap;
} else if(somethingelseistrue){
doCrap2;
}

I can dream can't I?  :D Thanks

Your second else{} is linked to the first else{} instead of what's IN the first else{}. Technically this would mean that the condition for the final case is the same as for the first case, but I can totally see danmakufu not liking you putting a "if else than else" condition into your code.

If that does not fix it, then maybe the problem lies somewhere else entirely.


Edit: I hate all of you.  :derp:

Thank you, too.  :P
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Nimono on September 01, 2010, 06:39:01 PM
I don't have a script problem, but I do have a question pertaining to player scripts that I'm not sure would fit in its own thread.

What would be a good power range for a player's unfocused shots when the point of that player is to be a bit of a spread type, thus having power in the option shots that wouldn't really go towards the enemy that much? This is my issue. I'm worried my unfocused spread is too weak (~80 DPS from the bottom of the screen against the DPS tester), but if you shotgun with it, you get ~200 DPS. I don't want it to be so weak from the bottom, but of course, that is with like, two option shots and every stream of main shots but two hitting the boss. I just...can't figure out if that is even good enough. It's meant to be slightly weak, since its main purpose is to tackle stage enemies, but this is just worrying.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on September 01, 2010, 06:54:21 PM
I don't have a script problem, but I do have a question pertaining to player scripts that I'm not sure would fit in its own thread.

What would be a good power range for a player's unfocused shots when the point of that player is to be a bit of a spread type, thus having power in the option shots that wouldn't really go towards the enemy that much? This is my issue. I'm worried my unfocused spread is too weak (~80 DPS from the bottom of the screen against the DPS tester), but if you shotgun with it, you get ~200 DPS. I don't want it to be so weak from the bottom, but of course, that is with like, two option shots and every stream of main shots but two hitting the boss. I just...can't figure out if that is even good enough. It's meant to be slightly weak, since its main purpose is to tackle stage enemies, but this is just worrying.
If you are at the bottom of the screen but below the boss, you should be able to deal at least 200 dps with any shottype. Anything else is just frustrating. Shotgun damage can be 300~350 as long as you can't do it for too long, no problem.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Nimono on September 01, 2010, 07:24:00 PM
If you are at the bottom of the screen but below the boss, you should be able to deal at least 200 dps with any shottype. Anything else is just frustrating. Shotgun damage can be 300~350 as long as you can't do it for too long, no problem.
Again, I said UNfocused. Sure, you shouldn't be going unfocused against a boss, but I'm still worried it will be too weak... And I don't want this shot to have ANY shotgun potential AT ALL. :/

does your response still stand?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on September 01, 2010, 07:39:03 PM
Again, I said UNfocused. Sure, you shouldn't be going unfocused against a boss, but I'm still worried it will be too weak... And I don't want this shot to have ANY shotgun potential AT ALL. :/

does your response still stand?
Well, at least the focused shot should do 200+ dps from the bottom of the screen when you are directly below the boss, if not 250.
If you do not want shotgun potential, you can make it so that the damage of each bullet that is not part of the forward main fire (which I assume your shot has) increases the longer it flies.  :derp:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Nimono on September 01, 2010, 08:29:00 PM
Well, at least the focused shot should do 200+ dps from the bottom of the screen when you are directly below the boss, if not 250.
If you do not want shotgun potential, you can make it so that the damage of each bullet that is not part of the forward main fire (which I assume your shot has) increases the longer it flies.  :derp:
*sigh* I just increased the power of the unfocused shot to where it's now over 100 DPS. You really weren't understanding me, Iryan. I said the UNFOCUSED spread. Nowhere was I even mentioning focused. :( The focused damage was fine, it hovers around 240. (I refuse to have it closer to 250 because I feel that is going into the "power type" area, since that is what the designated power shot, MarisaA, has...)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on September 02, 2010, 11:05:54 AM
Ok I'm pulling my hair out right now.
THIS SCRIPT crashes danmakufu after it finishes.
(All text replaced with anit-spoiler text) (http://pastebin.com/EqC2ci2J)
Edit: fixed it. Needed a if(OnEvent){ in mainloop :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Grumskiz on September 02, 2010, 04:01:34 PM
I'm sorry, I was busy and so I didn't answer you awesome guys :ohdear:
The graze-counter resets immediatly when you graze once.
I mean, you graze, so you get a grazecount of 1, but after one second it's already 0 again.
I tried many player scripts, including the original danmakufu REIMU ans MARISA Players (both A and B), but the error still occurs.

Seems like danamkufu hates me  :(

Tested again and now it works with Reimu, Marisa and Rumia, but not with custom player scripts.
I changed some graphics and sounds in th_dnh.dat in the near past.(like background, player sprites, bomb graphics, STG frame, shot sounds, enemy-kill sound, etc.))
Maybe I screwd up my danmakufu programm data??
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on September 03, 2010, 09:39:53 AM
Maybe I screwd up my danmakufu programm data??
If that is true, downloading another copy and moving all of the scripts into the new copy will fix all the problems (http://www.geocities.co.jp/SiliconValley-Oakland/9951/products/th_dnh.html)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on September 06, 2010, 10:59:59 AM
How would one go along making custom dialog and text functions? I know you would need a image sheet with the numbers, letters, and symbols, but thats about it. Oh, and using the case() thing, which I have no idea how to use as well.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on September 06, 2010, 07:17:19 PM
First, make an image file with all the letters in order, preferably spaced out evenly (32 pixels for each or so). Now, you have to make a function that converts each letter of a string into the position of the corresponding letter (usually with a case statement), then either make a series of objects for each one, or one object with many vertices.
Each string is stored as a series of letters, by the way. If you do
let string="something";
then string[0] will return 's' (single quotes, not double quotes - it's a character, not a string).

As for the case statement:
Code: [Select]
function ToNumber(character){
let ret=0;
alternative(character)
case('A') {ret=0;} case('B') {ret=1;} case('C') {ret=2;} case('D') {ret=3;}
//etc
return ret;
}
Might not be the most efficient way, but it works.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Kylesky on September 07, 2010, 03:57:09 PM
Well this is just completely craptastic...

I guess this fits in the Q&A thread :V

I just got a new comp (windows 7 home basic), and whenever I try to run danmakufu with applocale, it crashes even before it reaches the main menu screen... :/

damn my being problematic >_>

EDIT: nvm, got it working by running through config.exe... wooo! I can run it at 60fps window mode now!!! :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on September 10, 2010, 12:24:28 AM
How do you make a homing player script's bullets NOT home in on FOE's that don't have a hitbox? (eg: REIMU_A)

(Hitbox = SetCollisionA)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on September 10, 2010, 12:29:25 AM
You can't. You would have to set CommonData in the enemy script that tells the player not to shoot it. The default player characters probably don't even use Danmakufu code, but instead just call whatever language Danmakufu was programmed in directly, which gives them access to that kind of information, as well as makes them run faster than all custom player characters.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on September 10, 2010, 02:44:47 AM
run faster than all custom player characters.
:o what?!? I don't feel the difference. (Maybe because I suck)
Is it like a 1 or 2 frames different thing?

Thanks anyway.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on September 10, 2010, 03:04:33 AM
Er, it's not a frame rate increase. I meant that it takes your computer less time to process the default player scripts than it does all other custom player characters. So all scripts, if they lagged, would run faster using those characters instead of complete custom ones.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on September 10, 2010, 03:07:58 AM
Er, it's not a frame rate increase. I meant that it takes your computer less time to process the default player scripts than it does all other custom player characters. So all scripts, if they lagged, would run faster using those characters instead of complete custom ones.
Aaah! I see. I'm a (9)
Thanks again.
Now if you excuse me, I'll work on my shit.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on September 10, 2010, 04:27:36 AM
I have some questions  ???
-How do you make every bullet in the screen do something at the same time ?
-How do you make those youmu's bubble cutting thingy
-How do you make enemy do something when their health is low ?
-Where can I get damage tester ( :o)
-How do you make bullets follow you like those Pc-98 yellow worm thingy  :/
-I heard that you can make a background using loop video [How?]
-How do you make those eirin familiars that shoot stuff when bullets pass them?

I'll stop for now  :ohdear: my brain is dead
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on September 10, 2010, 04:35:15 AM
I have some questions  ???
-How do you make every bullet in the screen do something at the same time ?
-How do you make those youmu's bubble cutting thingy
-How do you make bullets follow you like those Pc-98 yellow worm thingy  :/
1, createshotA shenanigans or Object Bullets
2, Object Bullets
3, Object Sinulate Lazers

Whee I'm helpful
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on September 10, 2010, 04:39:31 AM
I have some questions  ???
-How do you make every bullet in the screen do something at the same time ?
-How do you make those youmu's bubble cutting thingy
-How do you make enemy do something when their health is low ?
-Where can I get damage tester ( :o)
-How do you make bullets follow you like those Pc-98 yellow worm thingy  :/
-I heard that you can make a background using loop video [How?]
-How do you make those eirin familiars that shoot stuff when bullets pass them?

I'll stop for now  :ohdear: my brain is dead

- Object bullets, if(SomeRandomVariable==true){ Obj_DoStuff(object, killthefuckingplayer); }
- Object laser collision_obj_obj, or use your own collision in the object bullets you will collide into the laser
- if(GetLife<1000){ .... }
- here (http://www.box.net/shared/khrz6x79n2)
- Object sinuate lasers are best, but you can use object bullets and spawn a trail behind them
- Ma'am?
- Object bullets, collision_obj_obj, or use enemy scripts (no fun, boo)

I think it's time you started actively dabbling with object bullets. This is just a hunch.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on September 10, 2010, 04:49:53 AM
I have some questions  ???
-How do you make enemy do something when their health is low ?
-Where can I get damage tester ( :o)
-I heard that you can make a background using loop video [How?]
-How do you make those eirin familiars that shoot stuff when bullets pass them?
- Use GetLife to make it check that a certain value is greater than GetLife
-The Player Tutorial has it I think
-Sorry, I'm not your guy
-Object Bullets and a CommonData, Set The commondata of the Object bullet and then have the familiars check the commondata to see if they are touching.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on September 10, 2010, 04:53:32 AM
Don't need CommonData, just every bullet that would activate the extra bullets has to be an object bullet.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Manservice on September 14, 2010, 01:22:41 PM
So, I've mostly played scripts on my Danmakufu, but now I tried to make my own script.

Code: [Select]
#TouhouDanmakufu
#Title[Fool's Arts [Scarlet Feast]]
#Image[.\giygas.gif]
#BackGround[User(.\bg.png, 1, 1)]
#BGM[.\radiant.mp3]
#PlayLevel[Normal]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let BossImage = "script\img\giygas.gif";
    let BossCutIn = "script\img\giygas.gif";
    @Initialize {LoadGraphic(BossImage);
        SetLife(100);
        SetDamageRate(10, 10);
        SetTimer(50);
        SetInvincibility(30);
        CutIn(YOUMU, "Fool's Arts [Scarlet Feast]", BossCutIn, 0, 0, 200, 600);
        SetScore(500000);
        SetEnemyMarker(true);
        SetDurableSpellCard;
        LastSpell;
        Concentration01(60);
        Concentration02(60);
        MagicCircle(false);
        SetEffectForZeroLife(180, 100, 1);
    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 24);
        if(frame==60){
            CreateShot01(50, Get30, 3, GetAngleToPlayer, RED21, 10);
            frame = 0;
        }
        frame++;
    }

    @DrawLoop {
    }

    @Finalize {
    }

    @BackGround {
    }
}

Well, when I start the script... It gives me the following error.

(http://i51.tinypic.com/2n1rew0.jpg)

I know, the script must have a fail-athon going... :fail:
So, any help? :3
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on September 14, 2010, 01:26:30 PM
You have to declare "frame" as a variable. Declare it after script_enemy_main {, like you did the variables BossImage and BossCutIn with

let frame = 0;
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Manservice on September 14, 2010, 01:42:03 PM
Gah, how, where and what? I totally don't know how to. I just copy-pasted from the tutorial, and totally skipped the variables part. >_>
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on September 14, 2010, 01:48:24 PM
Gah, how, where and what? I totally don't know how to. I just copy-pasted from the tutorial, and totally skipped the variables part. >_>
Why are you skipping the variables part when that is like the majority of general programming?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Manservice on September 14, 2010, 01:52:34 PM
Why are you skipping the variables part when that is like the majority of general programming?

>>... *cough* Well, I just thought I don't need it yet. And it was oh-so-long. BUT NO, it turned out to be the "majority of general programming." :(
(That's not an insult, fyi.)

Edit:
Well, now I got it to work, I don't know what magic did I do... Only thing is now, that I failed to get the boss in the... "playground." Also I failed such simple thing as the music. :)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on September 14, 2010, 04:07:35 PM
I appreciate your effort for trying to figure out things yourself.

Since you are new to the forum, a welcome first and second; please refrain from double posting. For this time, I merged your posts and deleted your second one. There is no reason to double post. Also, read the tutorials FULLY without skipping things. There is no reason to skip things when you are a learner.

Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Manservice on September 14, 2010, 05:09:43 PM
Yeah, thanks. I forgot that's not good on forums. :P Also, I now got some hang of it. :)
Now just one thing to ask. What's the width of the field? You know, where the bullets, enemy and the player is? :o
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on September 15, 2010, 02:47:25 AM
384x448 pixels.

(224, 240) is the center point of the field.
(32, 16) is the top left.
(416, 16) is the top right.
(32, 464) is the bottom left.
(416, 464) is the bottom right.

All these values can be substituted with...
(GetCenterX, GetCenterY) as the center point.
(GetClipMinX, GetClipMinY) as the top left.
(GetClipMaxX, GetClipMinY) as the top right.
(GetClipMinX, GetClipMaxY) as the bottom left.
(GetClipMaxX, GetClipMinY) as the bottom right.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Manservice on September 15, 2010, 04:27:57 AM
Whoa, thanks!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Hyouga Kazu on September 15, 2010, 06:02:16 AM
So...  :ohdear:
I guess I could use some help with this: http://pastebin.com/KwKjgNdN

I'm trying to make a player spell with lasers rotating around the player.
Danmakufu didn't really like what I did to those vertices though. This is the closest I got to making them rotate...

Can someone please tell me how to make it work?


Nevermind, I had to leave out those foolish (co)sine functions.  :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on September 15, 2010, 07:46:50 AM
Can anyone tell me how to make player bullets that are homing (My attempts result in making bullets that fly around like crazy during stages and breaks everything)
looking for something similar to Mof's Reimu A or CtC's Marisa A.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on September 15, 2010, 08:47:46 AM
This is the code I use for the homing bullets of my Suika player. They will home in on the enemy closest to them:

Code: [Select]
     task Homing(x, y, v, angle, avmax, damage, penetration){

    let tenemy=-1;
    let tenemydist=1000;
    let enemydist;
    let tangle;
    let diff;
    let n;

    let obj=Obj_Create(OBJ_SHOT);

    Obj_SetPosition(obj,x,y);
    ObjShot_SetGraphic(obj,11);
    ObjShot_SetDamage(obj,damage);
    ObjShot_SetPenetration(obj,penetration); //
    Obj_SetAngle(obj,angle);
    Obj_SetSpeed(obj,v);
    Obj_SetAlpha(obj,150);

    while(Obj_BeDeleted(obj)==false){

        angle=Obj_GetAngle(obj);
//        avmax=avmax*0.98;

        tenemydist=10000;

        ascent(i in EnumEnemyBegin..EnumEnemyEnd) { // detects the closest valid target

            n=EnumEnemyGetID(i);
            enemydist=( (Obj_GetX(obj) - GetEnemyInfo(n, ENEMY_X))^2 + (Obj_GetY(obj) - GetEnemyInfo(n, ENEMY_Y))^2 )^0.5;
            if(enemydist<tenemydist){

                tenemy=n; tenemydist=enemydist;
            }
        }
        if(tenemydist==10000){ tenemy=-1; }

        if(tenemy!=-1){

            tangle=atan2( (GetEnemyInfo(tenemy, ENEMY_Y) - Obj_GetY(obj)), (GetEnemyInfo(tenemy, ENEMY_X) - Obj_GetX(obj)));

            diff=tangle-angle;


            while(diff>180){ diff-=360; } while(diff<-180){ diff+=360; }

            if( (|diff|)<avmax){ angle=tangle; }

            else{ angle+=avmax*(diff)/(|diff|); }

            Obj_SetAngle(obj,angle);

        }

        yield;
    }
     }

The line that is commented out of the code is there for making the bullets behave more like the bullets in SA's ReimuB by reducing the amount by which the bullet is homing during each frame, but I don'T think you will need this.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on September 17, 2010, 02:29:28 PM
On the right are bullets copypasted from a shotsheet image. On the left is the way the bullets are drawn.
The bullets are shot at 90 degrees, and the copied bullets are rotated 90 degrees clockwise as well.
Shotsheet is 512x512, bullets are 15x15 and are drawn on a rounded position.

(http://img20.imageshack.us/img20/4469/etamaderp.png)

This does not please me.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on September 17, 2010, 04:58:51 PM
This does not please me.
When did Danmakufu pleased us? This is probably one of the reasons why I keep fucking around (even still) with the shot sheet.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on September 17, 2010, 05:05:18 PM
On the right are bullets copypasted from a shotsheet image. On the left is the way the bullets are drawn.
The bullets are shot at 90 degrees, and the copied bullets are rotated 90 degrees clockwise as well.
Shotsheet is 512x512, bullets are 15x15 and are drawn on a rounded position.

(http://img20.imageshack.us/img20/4469/etamaderp.png)

This does not please me.
Are the right bullets larger, or is that just my imagination?

Otherwise, I think Mokou had already noticed that there was a difference in look between Alpha effect objects and the Draw function. The same difference seems to exist between Alpha bullets and the draw function.  :derp:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on September 17, 2010, 05:12:51 PM
For the first two, your graphic rect is just off (add 1 to the right and bottom bounds). For the third one, it seems like your sheet's width and height aren't a power of 2, though you said that it is... what blending mode (alpha, add) are you using?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on September 17, 2010, 07:12:49 PM
1. It is not off, the images are all 15x15 and the rect of the first is 4, 48, 19, 63 (which is correct). If I expand it to 16 (to any direction) or 17 it shows the same. This is not a problem with specific rects; the entire shotsheet is like this aside from a few (02s, 03s, stars, knives).
2. Image is on transparent bg, alpha rendered. The add-blended bullets (not shown) are on black.

Note that when I place the graphics on a colored background, it is still distorted. Moving around where the bullet is shot in half-pixels does not really help.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Leerius on September 21, 2010, 11:14:53 AM
Edit for Drake :
Well maybe try to change your Rect like (-1,-1,+1,+1)

(http://img59.imageshack.us/img59/262/turnb.png)

It should come from the right and top.
However i've always problems with custom round in danmakufu...
So if it works i would like to know what was wrong.

---

Hem so much pages to read, I hope i'm the first for this kind of question...
This time pictures will not illustrate the problem ... look at this please ^^' (unlisted vid)
http://www.youtube.com/watch?v=MxVQIy31iek

The image is : http://img18.imageshack.us/img18/8307/shinkispcercle1.png
There's another one for the bottom.
Oh and there's no problem about rotation of the two Object i've tried without her.
Code: [Select]
let effect=0;
if(effect!=1){effect=effect+1;}
if(effect==1){
circleid=Obj_Create(OBJ_EFFECT);
Obj_SetX(circleid, GetX);
Obj_SetY(circleid, GetY);
ObjEffect_SetTexture(circleid, imagefile);
ObjEffect_SetAngle(circleid,80,0,0);
ObjEffect_SetRenderState(circleid,ALPHA);
ObjEffect_SetPrimitiveType(circleid,PRIMITIVE_TRIANGLELIST);
ObjEffect_CreateVertex(circleid,3);
ObjEffect_SetVertexXY(circleid,0,-142,-142);
ObjEffect_SetVertexXY(circleid,1,426,-142);
ObjEffect_SetVertexXY(circleid,2,-142,426);
ObjEffect_SetVertexUV(circleid,0,0,0);
ObjEffect_SetVertexUV(circleid,1,594,0);
ObjEffect_SetVertexUV(circleid,2,0,594);
ObjEffect_SetLayer(circleid,1);
circle=circle~[circleid];
circleid=Obj_Create(OBJ_EFFECT);
Obj_SetX(circleid, GetX);
Obj_SetY(circleid, GetY);
ObjEffect_SetTexture(circleid, imagefile2);
ObjEffect_SetAngle(circleid,80,0,0);
ObjEffect_SetRenderState(circleid,ALPHA);
ObjEffect_SetPrimitiveType(circleid,PRIMITIVE_TRIANGLELIST);
        ObjEffect_CreateVertex(circleid,3);
ObjEffect_SetVertexXY(circleid,0,-142,-143);
ObjEffect_SetVertexXY(circleid,1,426,-143);
ObjEffect_SetVertexXY(circleid,2,-142,427);
ObjEffect_SetVertexUV(circleid,0,0,0);
ObjEffect_SetVertexUV(circleid,1,594,0);
ObjEffect_SetVertexUV(circleid,2,0,594);
ObjEffect_SetLayer(circleid,2);
circle2=circle2~[circleid];
effect=2;}

plan=plan+1;
if(plan==72){plan=0;}
angleE=angleE+5;
angleE2=angleE2+5;

let magiccircle=0;
while (magiccircle<length(circle)){
if(Obj_BeDeleted(circle[magiccircle])){
circle=erase(circle,magiccircle);
magiccircle--;}
else{
let circleid=circle[magiccircle];
ObjEffect_SetAngle(circleid,80,NULL,angleE);

if(plan<=36){ObjEffect_SetLayer(circleid,1);}
if(plan>36){ObjEffect_SetLayer(circleid,2);}

ObjEffect_SetScale(circleid,scale/10,scale/10);
if(Obj_GetX(circleid)!=GetX){Obj_SetX(circleid,GetX);}
if(Obj_GetY(circleid)!=GetY){Obj_SetY(circleid,GetY);}}

magiccircle++;}

//2nd circle
let magiccircle2=0;
while (magiccircle2<length(circle2)){
if(Obj_BeDeleted(circle2[magiccircle2])){
circle2=erase(circle2,magiccircle2);
magiccircle2--;}
else{
let circleid=circle2[magiccircle2];
ObjEffect_SetAngle(circleid,80,NULL,angleE2);

if(plan>36){ObjEffect_SetLayer(circleid,1);}
if(plan<=36){ObjEffect_SetLayer(circleid,2);}

ObjEffect_SetScale(circleid,scale2/10,scale2/10);
if(Obj_GetX(circleid)!=GetX){Obj_SetX(circleid,GetX);}
if(Obj_GetY(circleid)!=GetY){Obj_SetY(circleid,GetY);}}

magiccircle2++;}

if(change==0&&constant==60){scale=scale+0.02;}
if(scale>=15&&change==0){scale=15;change=1;constant=0;}
if(change==1&&constant==60){scale=scale-0.02;}
if(scale<=10&&change==1){scale=10;change=0;constant=0;}
if(constant!=60){constant=constant+1;}

if(change2==0&&constant2==60){scale2=scale2+0.02;}
if(scale2>=15&&change2==0){scale2=15;change2=1;constant2=0;}
if(change2==1&&constant2==60){scale2=scale2-0.02;}
if(scale2<=10&&change2==1){scale2=10;change2=0;constant2=0;}
if(constant2!=60){constant2=constant2+1;}
}

Well the problem lies in the arrays because danmakufu is slower to perform the command of the second array, i've already seen that when i tried to do something with 2 lasers who had to disappear in the same time ( --> if(count==x){...} )

Then, are there any ways for me to only use magiccirle and keeping the second circle like that ?

Ooh if you have another way to do it i'm always ok the result is what needed after all...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on September 21, 2010, 12:04:14 PM
Code: [Select]
ObjSpell_SetIntersecrionLine The fuck do i use this?
What X and Y coordinates do I put (both sets) and what the hell does "width" do?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Leerius on September 21, 2010, 12:20:48 PM
GenericTouhouFailure >
For example if you put ObjSpell_SetIntersecrionLine(obj,0,0,384,448,2,10,true);

It's like having a diagonal laser starting at (0,0) going to (384,448) doing 2 pixel width like that :
(http://img683.imageshack.us/img683/8861/setintersecrionline.png)
I think it's used to made a shot hitbox for like written, bomb or custom lasers.

Sure of nothing, never used but it looks like to work like that.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on September 21, 2010, 12:25:30 PM
GenericTouhouFailure >
For example if you put ObjSpell_SetIntersecrionLine(obj,0,0,384,448,2,10,true);

It's like having a diagonal laser starting at (0,0) going to (384,448) doing 2 pixel width like that :
(http://img683.imageshack.us/img683/8861/setintersecrionline.png)
I think it's used to made a shot hitbox for like written, bomb or custom lasers.

Sure of nothing, never used but it looks like to work like that.
Ok. Gonna try when i'm free. (Like in two weeks time D: Examinations Shucks Bawlz)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chau on September 22, 2010, 02:20:45 PM
Hi everyone,
how do you make a looping background?

Currently I use the following method:

Code: [Select]
@DrawLoop{
SetTexture(bg);
SetGraphicRect(0,0,447,1000000);
DrawGraphic(GetCenterX,GetCenterY+scroll);
scroll=scroll+scrollspeed;
}

Are there any better ways to manage this? To me it looks really weird when I use such a big number with SetGraphicRect...

} //End of Engrish
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on September 22, 2010, 02:52:55 PM
That's pretty much it, but you don't need that big of a number. All you need is the height of the DNH field times 2, so if your image is 447x447 you would use 0,0,447,894. What is the size of your image, though?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on September 22, 2010, 03:02:50 PM
@Chau

Code: [Select]
@DrawLoop{
SetTexture(bg);
SetGraphicRect(0,0 + scroll,447, 479 + scroll);
DrawGraphic(GetCenterX,GetCenterY);
scroll=scroll+scrollspeed;
}

This would be how I approach it, anyway. I prefer to move around on the image rather than where I draw it. Don't know if it'll change anything for you though.



@Leerius

I honestly can't follow what you've coded there. Other than us ranting to you about how you could tab your code better, perhaps we could better help you if you told us what your objective is with your code. What exactly are you trying to do? We may be able to give a different method of approaching it, if nothing else.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Blargel on September 22, 2010, 04:39:16 PM
Ohai.

Seems like Leerius is trying to make a rotating magic circle that goes in front and behind the boss instead of  just rotating around the Z-axis in a flat 2D world. The way he's doing it now will never work though. What he needs is multiple images of the magic circle rotating, rather than rotating the image with Danmakufu so that half of it stays permanently in front of the Shinki and half of it permanently behind Shinki. The weird effect you're getting now is because the rotation you're giving it is causing the halves to move out of place.

In short you need to animate the rotation rather than rotate it with Danmakufu.

AND AWAY I GO TO DISAPPEAR FROM MOTK AGAIN!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Leerius on September 22, 2010, 05:12:42 PM
Ugh... ok thanks Blargel... won't be easy... i'll made a normal one.. xD
Too bad ...><
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Schezo on September 26, 2010, 06:07:24 AM
I need some help on making stages.  When I create more than one of the same enemy script, and one gets destroyed by player bullets, all the enemies on the field vanish.  Also backgrounds hate me in anything other than a spellcard so could someone show me what I'm doing wrong on drawing backgrounds in the stage?

The scripts I'm using:
Stage script (http://www.pastebin.org/1199814)
enemy script (http://www.pastebin.org/1199873)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on September 26, 2010, 07:12:40 AM
For the first problem, each graphic can only be loaded into memory once, and loaded graphics/sounds are universal - they apply to every script that's called (stages, enemies, bosses, etc). If you call LoadGraphic(image) when the image is already loaded, it's ignored. Then, since you have DeleteGraphic(image) in finalize, that image is deleted for ALL enemies, so they vanish. The solution is to call LoadGraphic and DeleteGraphic in the stage's@Initialize and @Finalize, rather than the enemy's.

For the second problem, the G in @BackGround needs to be capitalized. Standard beginner's error; don't feel bad.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on September 26, 2010, 08:08:48 AM
For the second problem, the G in @BackGround needs to be capitalized. Standard beginner's error; don't feel bad.
Actually, one of the tutorials (can't remember where) about stages had @Background without capital G if I am not wrong.
This needs to be found and corrected.

Fake Edit:http://dmf.shrinemaiden.org/wiki/index.php?title=Danmakufu_Intermediate_Tutorial (http://dmf.shrinemaiden.org/wiki/index.php?title=Danmakufu_Intermediate_Tutorial)
Too lazy to edit it though. I need to leave my house.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on September 26, 2010, 10:49:36 AM
More of a reason not to copy/paste entire scripts. 

I am also surprised people rarely perform trial & error when they get stuck. As in, removing the last coded parts, reboot scripts > check if error > repeat until error discovered.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Schezo on September 26, 2010, 04:48:39 PM
Wow, I've been trying to get that drawing enemy problem to work for like 2 weeks now.  Thanks Azure!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on September 26, 2010, 07:34:30 PM
I've been trying to get that drawing enemy problem to work for like 2 weeks now
Today at 01:07:24 am

WHAT THE HELL MAN WHY DID YOU NOT POST BEFOREHAND
IT WOULD HAVE TAKEN LIKE THREE SECONDS TO FIND
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Schezo on September 26, 2010, 09:26:25 PM
I forgot about this thread.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Fetch()tirade on September 28, 2010, 12:40:18 AM
I really hate asking this, but can anyone find where I am missing a closing parenthesis?

http://pastebin.com/pnL7LH24
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: 8lue Wizard on September 28, 2010, 12:46:08 AM
61.                Obj_SetAngle(obj, atan2(specy - Obj_GetY(obj), specx - Obj_GetX(obj) );
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on September 28, 2010, 12:50:29 AM
you can't seperate parameters with a '-' , Danmakufu reads it as parameter minus another parameter. At least I think thats it, when I do that it works until the next thing-like-this comes up.

And what Bluely Blue said as well
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Fetch()tirade on September 28, 2010, 01:06:51 AM
Goddammit, I totally forgot that. Thanks people.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on September 28, 2010, 01:13:43 AM
you can't seperate parameters with a '-' , Danmakufu reads it as parameter minus another parameter. At least I think thats it, when I do that it works until the next thing-like-this comes up.

And what Bluely Blue said as well
reread parameters for atan2 again plz
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Fetch()tirade on September 28, 2010, 01:24:22 AM
It turns out the actual problem was the names of all the variables.
The name "zero-angle" reads as "zero" - "angle."
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on September 28, 2010, 04:03:06 AM
reread parameters for atan2 again plz

atan2(y2-y1,x2-x1);

Okay, so I worded it wrong, he was dealing with Variables which were not set, my bad.
And besides, I was talking about it not being able to separate the variable, not subtracting numbers
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on September 28, 2010, 04:05:07 AM
K, we both screwed that up then :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: draganuv15 on September 29, 2010, 03:26:43 PM
how do you open danmakufu's config?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on September 29, 2010, 04:08:01 PM
doubleclick it

Some people apparently need to open it with applocale, so try that. It also apparently takes a while to boot up.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on September 29, 2010, 04:35:31 PM
And/or Right-click->Properties->Fiddle with Compatibility.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: draganuv15 on September 29, 2010, 09:12:14 PM
thanks for suggestions, i got it working  :3
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: gabrielwoj on September 30, 2010, 03:27:18 PM
Well, I want to try some "mods" and test it...
But, opens normally, if I open ANY option on the game, it crashes...
Win 7 64bits...
Already tried compatibility...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on September 30, 2010, 09:37:20 PM
Applocale (http://www.shrinemaiden.org/forum/index.php/topic,4138.0.html). Also, read stickies.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on October 01, 2010, 08:57:16 AM
Have anyone here tried to replicate Utsuho's great balls of sun-fire? I want to create something like it but with other aesthetics, but I am unsure how I should proceed with it. Here are the components, obtained from Drake's projects thread:

Purple Sun (http://i902.photobucket.com/albums/ac221/MasterSpark89/PurpleSun-1.png)
Sun Darkness (http://i902.photobucket.com/albums/ac221/MasterSpark89/SunDarkness.png)
Sun Aura (http://i902.photobucket.com/albums/ac221/MasterSpark89/SunAura.png)
Sun Frame (http://i902.photobucket.com/albums/ac221/MasterSpark89/SunFrame.png)

I imagine that the blob of actual colour can be treated like an Object Bullet, and then have the other bits drawn above and under it. Can Object Effects/drawing be applied on top of an Object Bullet's graphic?  :o

Edit: Also, if anyone happens to know in which order the above parts should be applied, that would be great too.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on October 01, 2010, 09:44:58 AM
Have anyone here tried to replicate Utsuho's great balls of sun-fire? I want to create something like it but with other aesthetics, but I am unsure how I should proceed with it. Here are the components, obtained from Drake's projects thread:

Purple Sun (http://i902.photobucket.com/albums/ac221/MasterSpark89/PurpleSun-1.png)
Sun Darkness (http://i902.photobucket.com/albums/ac221/MasterSpark89/SunDarkness.png)
Sun Aura (http://i902.photobucket.com/albums/ac221/MasterSpark89/SunAura.png)
Sun Frame (http://i902.photobucket.com/albums/ac221/MasterSpark89/SunFrame.png)

I imagine that the blob of actual colour can be treated like an Object Bullet, and then have the other bits drawn above and under it. Can Object Effects/drawing be applied on top of an Object Bullet's graphic?  :o

Edit: Also, if anyone happens to know in which order the above parts should be applied, that would be great too.
http://i902.photobucket.com/albums/ac221/MasterSpark89/PurpleSun.png (http://i902.photobucket.com/albums/ac221/MasterSpark89/PurpleSun.png)
http://i902.photobucket.com/albums/ac221/MasterSpark89/PurpleSun-1.png (http://i902.photobucket.com/albums/ac221/MasterSpark89/PurpleSun-1.png)
You edited your url :V
your "Purple sun" and "Sun Aura" is from the extra bosses shields when you bomb :V

Anyway, you could assemble your sun graphic into a single image file like this image (stolen from blagrel)
(http://img825.imageshack.us/img825/5221/utsuhoeffect1.png)
and fire the entire thing as an Obj_Effect.
Finally, call SetCollisionB(Obj_GetX(sunobject),Obj_GetY(sunobj),sunhitboxradius); every frame.
Unless I'm missing the entire point here  :ohdear:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on October 01, 2010, 09:54:29 AM
Oh, so only the "Sun Darkness" and "Sun Frame" bits are needed? But where does the red colour come from in the original work?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on October 01, 2010, 10:19:15 AM
Oh, so only the "Sun Darkness" and "Sun Frame" bits are needed? But where does the red colour come from in the original work?
you need to alter the color.
In danmakufu if you use ObjEffect_SetColor(obj,vertex,a,r,g,b);
you can tint your sun in a certain color.
But you're better off coloring your sun before shoving it into danmakufu since danmakufu's coloring sucks
here's my attempt at coloring suns in danmakufu
http://www.youtube.com/watch?v=TQidMmMmWeQ&t=5m20s (http://www.youtube.com/watch?v=TQidMmMmWeQ&t=5m20s)
Of course they're blue because (9)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on October 01, 2010, 10:56:09 AM
you need to alter the color.
In danmakufu if you use ObjEffect_SetColor(obj,vertex,a,r,g,b);
you can tint your sun in a certain color.

...I knew that.

 :V

Anyway, the point here is that I want to recreate Utsuho's suns, but have them purple and with them getting gradually darker closer to the center.

Thanks for your help, you've really given me something to go by here. :)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on October 01, 2010, 11:18:46 AM
...I knew that.

 :V

Anyway, the point here is that I want to recreate Utsuho's suns, but have them purple and with them getting gradually darker closer to the center.

Thanks for your help, you've really given me something to go by here. :)
Ugh. Its not easy to judge a person's skills by their posts :3

You should assemble them layer by layer in photoshop or something, black background.
shove in danmakufu. Effect object, add blend, etc etc.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on October 01, 2010, 03:08:45 PM
Well that took all of thirty seconds.

(http://img178.imageshack.us/img178/6909/72015616.png)

EDIT: Just so you know, you won't be able to actually make the bullet "darker" towards the center. Since it's add-blend, the center will just become increasingly transparent. If you need any further adjustments just ask.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on October 01, 2010, 03:21:10 PM
The input is appreciated, though I've already made a Purple Sun to use. I think I'll expand the dark middle area somewhat though, it kind of looks like a Purple Donut more than anything else at the moment.

Purple Sun (http://i902.photobucket.com/albums/ac221/MasterSpark89/PurpleSun-2.png)

Anyway, is there no way to escape a transparent appearance, such as by using a black colour that isn't really quite pitch black? I'd like for the Sun's sphere to remain solidly coloured.

Edit: Perhaps a solid image could be drawn underneath the Sun's graphic to preserve the integrity of its core?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on October 01, 2010, 03:25:22 PM
You'd need both an alpha image and an add image. While that's perfectly doable, you'll need a copy of the image with a transparent background and one with a black background. If you can't do the transparency thing, I can.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on October 01, 2010, 03:27:57 PM
Oh I can fix that.  :]

I should remove the glowing aura from the Alpha image though, shouldn't I? since that's the one thing that I actually want to appear transparent in the final product.

Edit: Oh and... which one of them should have the transparent background?  :blush:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: draganuv15 on October 01, 2010, 04:00:28 PM
i have another question, how do you change the skin of danmakufu ( the part of the screen holding the lives and that )
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on October 01, 2010, 04:05:13 PM
i have another question, how do you change the skin of danmakufu ( the part of the screen holding the lives and that )

Ooh, I know that one. Add a PNG image to the 'img' folder in your Danmakufu root directory - the place where you find the custom.exe and all that. Have the image at the dimensions 640x480 and name it STG_Frame, and it should work. :)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on October 01, 2010, 04:21:17 PM
Oh and... which one of them should have the transparent background?
Alpha-blended images contain an R,G, B and A value for each pixel. The A value determines transparency, and for danmakufu (0,0,0) denotes a transparent pixel as well as pixels that already have an alpha channel of 0. Because of this, an image whose pixels all have an alpha channel of 255 are perfectly fine with a black background, because all the black disappears and the rest stays without change. However, if an image had a black background and some pixels do not have an alpha of 255, the black combines with the semi-transparent pixels and produces a pixel that is not black, and as such is drawn at whatever that rgb color is, at 255 alpha, instead of having a predetermined alpha channel. Therefore, if you're going to draw an image with any semi-transparent pixels, use a transparent background.

Add-blend images are drawn with the same RGBA values, except differently. instead of drawing the image overtop of other images, it takes each R, G and B value in each pixel and adds it to the R, G and B values of the pixels below it. If an Add pixel was black, it would add 0,0,0 to the pixel below, which is nothing. If the pixel were white, it would add 255,255,255 to the pixel below, which is always 255,255,255. Due to the way DNH handles Add-blend images, it disregards the actual alpha channel of an image, and flats (see formula below) the whole thing to only RGB. Because of this, any transparent pixels are denoted as white, and semi-transparent pixels' RGB values are (value * (alpha / 255)) + (bg value * ((255-alpha) / 255)) instead. Thus, DNH adds those pixels to whatever below, making the whole thing a bright crappy white mess. This is why a black background is needed for Add-images, since when the background is black, (bg value * ((255-alpha) / 255)) = (0 * ((255-alpha) / 255)) = 0, so the RGB values are all added with proper transparency.

:D

Ooh, I know that one. Add a PNG image to the 'img' folder in your Danmakufu root directory - the place where you find the custom.exe and all that. Have the image at the dimensions 640x480 and name it STG_Frame, and it should work. :)
Actually, also due to the way DNH handles images, an image will appear blurred unless the dimensions are both powers of two. Therefore you should increase the canvas size to 1024x512 (to the right and bottom); DNH won't draw the extra.

:D
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: draganuv15 on October 01, 2010, 04:24:50 PM
cool, now does anyone know any good stg frames?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on October 01, 2010, 04:27:15 PM
no
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on October 01, 2010, 04:50:05 PM
Just as a reference, Utsuho's suns use two layers, both add-blended. One is the white center, then there's a pulsing outer red layer. You don't have to do that exactly, but multiple layers really helps add depth to it, especially if they're spinning or pulsing at different rates. Play around with it until you get something you like, and don't be afraid to use more than two effects for a single object.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on October 01, 2010, 06:07:27 PM
It's funny that you mention that, Azure, since that's just what I discovered myself as well. I followed Helepolis' tutorial on Object Effects and ended up with this.

The Purple Sun of Xereus (http://www.youtube.com/watch?v=PohqHH5bvGk)

Edit: You'll want to watch this in HD and turn it up to fullscreen. Youtube's really massacred the sharpness.

So far it consists of two Add-blended images spinning in opposite directions, and a lower-layered Alpha image to keep the centre free from transparency. I'm sure I could touch it up by adding some irregularity into the motions, but it's looking pretty spiffy already if I may say so myself.

Thanks for your help guys. :)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on October 01, 2010, 06:25:40 PM
Looks pretty awesome. The only thing I can complain about is the appearing effect. Utsuho always used giant explosions whenever a sun was spawned, so maybe you could do the same thing. You could try making one of the layers pulse slightly, since it's always a neat effect. Something like ObjEffect_SetScale(obj,1+sin(frame)*0.2,1+sin(frame)*0.2); while increaing frame. Though if you continue it, take it to the screenshot/video thread instead of here. Glad you got your problems solved!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on October 01, 2010, 06:32:32 PM
Ah yes, its entry was not on my priority list - I just wanted to get it up and running! Thanks for tipping me about how to make it pulse, I'll be sure to give that a shot.

Thanks again.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on October 01, 2010, 10:18:49 PM
Alright, so I've run into another little noodlescratcher regarding my Purple Sun. I'd like for it to start chasing the player around the screen by periodically checking the player's position and then moving itself over there. What would be the best way for achieving this effect? Something like the motion function SetMovePosition03 would be great, as it has a sense of fluidity built into it. Is it possible to "anchor" the Object Effects on top of a script enemy and have them move along with it?

I've tinkered around with the object movement functions but it just won't quite work out for some reason.

Edit: Might spawning the Sun on top of a familiar and then have it keep a track on the enemy's movement every frame and follow it work?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on October 02, 2010, 01:53:55 AM
It's funny that you mention that, Azure, since that's just what I discovered myself as well. I followed Helepolis' tutorial on Object Effects and ended up with this.

The Purple Sun of Xereus (http://www.youtube.com/watch?v=PohqHH5bvGk)

Edit: You'll want to watch this in HD and turn it up to fullscreen. Youtube's really massacred the sharpness.

So far it consists of two Add-blended images spinning in opposite directions, and a lower-layered Alpha image to keep the centre free from transparency. I'm sure I could touch it up by adding some irregularity into the motions, but it's looking pretty spiffy already if I may say so myself.

Thanks for your help guys. :)
Looks SECK SEE.
Hitbox of the sun could be smaller though.
Since you could almost stick your entire hitbox graphic into one in SA and the sun's hitbox is even smaller in 10 evil stars :P

Edit: Might spawning the Sun on top of a familiar and then have it keep a track on the enemy's movement every frame and follow it work?
Yes, that would be the easiest way to do it.
Obj_SetPosition(obj,GetX,GetY); every frame
Just a reminder  :3
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: YummyLychee on October 02, 2010, 11:17:41 PM
So ummm...

For some reason, whenever i kill an enemy on a stage script (the regular way, VanishEnemy, etc) the rest of the on-screen enemies' sprites disappear

And they don't get deleted when they fly off-screen (unless i do something like if(GetX>GetClipMaxX){ VanishEnemy; } ... but then the rest of the enemies that are onscreen turn invisible)


Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on October 02, 2010, 11:20:20 PM
So ummm...

For some reason, whenever i kill an enemy on a stage script (the regular way, VanishEnemy, etc) the rest of the on-screen enemies' sprites disappear

And they don't get deleted when they fly off-screen (unless i do something like if(GetX>GetClipMaxX){ VanishEnemy; } ... but then the rest of the enemies that are onscreen turn invisible)



For the first problem, each graphic can only be loaded into memory once, and loaded graphics/sounds are universal - they apply to every script that's called (stages, enemies, bosses, etc). If you call LoadGraphic(image) when the image is already loaded, it's ignored. Then, since you have DeleteGraphic(image) in finalize, that image is deleted for ALL enemies, so they vanish. The solution is to call LoadGraphic and DeleteGraphic in the stage's@Initialize and @Finalize, rather than the enemy's.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: KrackoCloud on October 03, 2010, 11:02:50 PM
How would I insert music into a Plural script? Do I have to use a Stage script or something?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on October 03, 2010, 11:05:26 PM
Just play it at the beginning and don't delete/stop the music on Finalize?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: KrackoCloud on October 03, 2010, 11:12:35 PM
So, load and play it from the first nonspell? It doesn't seem to be working.

EDIT: Maybe something's wrong with the music file itself. I tried making a Stage script and used LoadMusic and PlayMusic, but it's still no good.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on October 03, 2010, 11:52:31 PM
Protip: If music isn't working, it's either
-You didn't load it
-Typo
-It's the music file
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on October 04, 2010, 04:00:55 AM
Protip: If music isn't working, it's either
-You didn't load it
-Typo
-It's the music file
-It's danmakufu and your computer not agreeing (My Vista doesn't play MP3's or WAV's but sound effects work fine)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: KrackoCloud on October 04, 2010, 04:14:24 AM
Yeah, I just converted the .mp3 into a .wav and now it works fine.  :/
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on October 04, 2010, 04:43:24 AM
Sometimes the way the mp3 file is coded, danmakufu might not be able to read it, so usually you should open Audacity or some other music editing program and re-code it. Meaning just save it again using the Music Editing Program
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on October 04, 2010, 04:15:17 PM
I almost feel ashamed for coming to you with a question like this, but I really can't seem to figure out why it is behaving in this way. It's probably going to be something stupid.

Anyway, I'm simply trying to spawn a bunch of ShotA's randomly across the screen, and have them travel towards the position of the script enemy (not the boss itself). Here's how this simple deal looks like so far...

I hope that it is alright if I post a snippet of my code in here, since it doesn't take up nearly as much room as the entire file would.

Code: [Select]
            CreateShotA(0,rand(GetClipMinX,GetClipMinX+100),rand(GetClipMinY,GetClipMaxY),20);
            wait(1);
            CreateShotA(1,rand(GetClipMaxX-100,GetClipMaxX),rand(GetClipMinY,GetClipMaxY),20);
            wait(1);
            CreateShotA(2,rand(GetClipMinX,GetClipMaxX),rand(GetClipMaxY-100,GetClipMaxY),20);
            wait(1);

            SetShotDataA(0,20,0,GetAngle,0,0.01,1,36);
            SetShotDataA(1,20,0,GetAngle,0,0.01,1,36);
            SetShotDataA(2,20,0,GetAngle,0,0.01,1,36);

            FireShot(0);
            FireShot(1);
            FireShot(2);

The Wiki tells me that the GetAngle function should return the angle towards the script enemy if it is used in the correct script, which it is. But all that's happening is that the bullets travels in a straight line to the right of the screen, regardless of where the script enemy actually is. And to make matters even more weird, if I try GetAngleToPlayer instead, they all just drop directly down as if the angular value was 90, regardless of where I am on the screen.

There must be something else behind this malfunctioning, right?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on October 04, 2010, 04:21:24 PM
GetAngle returns the angular direction of the enemie's movement. What you want is to have a variable each for x and y, set these to random values, and then create a shot with these variables as their positions and the atan2 angle from these coordinates to the position of the enemy.

GetAngleToPlayer returns the angle from the enemy to the player, so that one is right out.  :derp:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on October 04, 2010, 04:24:11 PM
GetAngle is the angle that *whatever script you're calling it on* is moving at.

You'll want atan2(bullety-GetY,bulletx-GetX); as long as you're firing these bullets from the enemy script and not the boss. to communicate from boss to enemy I'm pretty sure you need commondata.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on October 04, 2010, 04:45:54 PM
Using Atan2 is certainly not what I was expecting, but I tried it and it seems to be working just as intended. Thanks for that. :)

And Iryan, of course I already knew in advance that GetAngleToPlayer wouldn't work the way I wanted it to, I was merely testing it to see if it would behave like I expected it to - which it didn't. I was under the assumption that using the angle functions with the bullets would yield the enemy/player angles for the bullets themselves to use, but that's apparently not the case. Something new every day, huh?  :]
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chau on October 04, 2010, 08:27:15 PM
Hi.
I wanted to try animated custom bullets. The normal animation works fine, but when the player is hit and the bullets are deleted you can see white lines around the bullets.

 http://img201.imageshack.us/img201/5647/danmakufu.png (http://img201.imageshack.us/img201/5647/danmakufu.png)
Er, is this okay when I put the image here as a hyperlink?

I used transparency around the bullets to make sure that there are no spots where the RGB is not 00 00 00.

How do I fix this problem? Or is there something like a "typical newbie mistake"?  ???
 
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on October 04, 2010, 09:02:14 PM
It looks like the bullet next to it in the shot sheet may be too close, and it's showing up slightly in the graphic rect. You can try condensing the graphic rect by one pixel to avoid that (but it may cut into your image), or move the image next to that bullet in the shot sheet over a bit.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on October 06, 2010, 02:42:50 AM
How would one revert player death in stage scripts
Eg: if implementing a custom border system like PCB's
When a player gets hit, how do you revive the player without the player pressing x?
SetPlayerInvincibility?
or save the player's x and y and when OnPlayerMissed is called, ShootDownPlayer; <-prevents deathbombing ExtendPlayer(1); and then once the player revives resume the player's x and y?
What is the best way to do this?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: 8lue Wizard on October 06, 2010, 04:01:33 AM
How would one revert player death in stage scripts
Eg: if implementing a custom border system like PCB's
When a player gets hit, how do you revive the player without the player pressing x?
SetPlayerInvincibility?
or save the player's x and y and when OnPlayerMissed is called, ShootDownPlayer; <-prevents deathbombing ExtendPlayer(1); and then once the player revives resume the player's x and y?
What is the best way to do this?

There's a built-in Border funtction; SuperNaturalBorder() to set, and GetTimeOf~ to see the status. If you want custom behavior, you can be sniffing for the three different methods of ending a border (gettime==1 for timing out, bomb key for manual cancel, gettime==0 for collision) each frame. If you want to prevent bullets from clearing on a broken border, you could do something with bomb resistance (though it might get a bit complicated if you don't want them to actually be bomb resistant).

Probably. I haven't used this function myself, so these are just rough ideas.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on October 06, 2010, 04:46:37 AM
There's a built-in Border funtction; SuperNaturalBorder() to set, and GetTimeOf~ to see the status. If you want custom behavior, you can be sniffing for the three different methods of ending a border (gettime==1 for timing out, bomb key for manual cancel, gettime==0 for collision) each frame. If you want to prevent bullets from clearing on a broken border, you could do something with bomb resistance (though it might get a bit complicated if you don't want them to actually be bomb resistant).

Probably. I haven't used this function myself, so these are just rough ideas.
Actually I used SuperNaturalBorder before but it kinda sucks so :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Schezo on October 06, 2010, 10:05:06 PM
What would be the best way to:
*Make an enemy shoot revenge bullets when destroyed.
*Transition the background at certain points like midboss, boss, etc. in stages.   I don't know how to go about doing that.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on October 06, 2010, 11:28:26 PM
*Make an enemy shoot revenge bullets when destroyed.

This. You just shoot the bullets in @Finalize...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Schezo on October 07, 2010, 12:37:44 AM
This. You just shoot the bullets in @Finalize...
Oh crap, I thought it was some special function or something that had to do with If EnemyBeDeleted or something weird. Thanks.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Suikama on October 08, 2010, 11:45:36 PM
How do you delete the default sound effects again? :derp:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on October 09, 2010, 02:50:53 AM
How do you delete the default sound effects again? :derp:
Uh. DeleteSE("seFapfapfap.wav"); ?
Replace fapfapfap (obvious)
with
Code: [Select]
seSuperNaturalBorder1.wav //activation of SNB
seScore.wav
sePlayerSpellCard.wav //SFX when player uses a SC
sePlayerShot01.wav //SFX for player shot
sePlayerCollision.wav //SFX when player dies
seGraze.wav //SFX for grazing
seGetSpellCardBonus.wav //...
seExplode01.wav
seEnemyExplode01.wav //when you defeat a yosei
seBomb_ReimuB.wav // i think this is obvious
seBomb_ReimuA.wav //so is this
se1UP.wav //Extend! lives
seUseSpellCard.wav //I think it's the one when you call SetScore(score);...
seSuperNaturalBorder2.wav //Maybe when you crush a SNB.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Suikama on October 09, 2010, 02:58:00 AM
oh I missed the se part. thanks
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on October 09, 2010, 04:03:12 AM
Code: [Select]
snip

Wait a sec... Is that from MY reply to the unraveling th_dnh.dat topic? :3
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on October 09, 2010, 06:27:47 AM
Wait a sec... Is that from MY reply to the unraveling th_dnh.dat topic? :3
Yes officer. Are you gonna charge me for copyright?  :smug:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Sejha on October 10, 2010, 01:32:57 AM
Sooo~ How do I make a Menu a la CtC?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on October 10, 2010, 01:40:07 AM
Sooo~ How do I make a Menu a la CtC?
OBJ_EFFECT SPAM ??? PROFIT

Here's the raw menu code from my abandoned game (http://pastebin.com/7FFgHMk0)

Here's the tutorial on the wiki.
That's how I learnt menus (http://dmf.shrinemaiden.org/wiki/index.php?title=Wonderful%E2%98%86Life%27s_Introduction_to_Menus)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on October 10, 2010, 04:44:36 AM
Yes officer. Are you gonna charge me for copyright?  :smug:

[sarcasm]Yes.[/sarcasm]
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Sejha on October 10, 2010, 02:18:42 PM
OBJ_EFFECT SPAM ??? PROFIT

Here's the raw menu code from my abandoned game (http://pastebin.com/7FFgHMk0)

Here's the tutorial on the wiki.
That's how I learnt menus (http://dmf.shrinemaiden.org/wiki/index.php?title=Wonderful%E2%98%86Life%27s_Introduction_to_Menus)
:derp:

Thanks~
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Zerro on October 10, 2010, 05:38:38 PM
I have question.

I wanna shoot a stream of bullets at where the player is but not have it move if the player does.
Like, I guess, get the player's location one frame and shoot the stream to that location.

I dunno if I worded that right...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on October 10, 2010, 05:43:54 PM
I have question.

I wanna shoot a stream of bullets at where the player is but not have it move if the player does.
Like, I guess, get the player's location one frame and shoot the stream to that location.

I dunno if I worded that right...
Code: [Select]
task ShootLine(x, y, tx, ty, v, graph, n, t){
    let tang = atan2(ty-y, tx-x);
    loop(n){
        CreateShot01(x, y, v, tang, graph, 0);
        loop(t){ yield; }
    }
}

Should be self explanatory.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Formless God on October 10, 2010, 10:53:44 PM
Not sure if I missed the function for it but .... how do I hide the default health bar ?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on October 10, 2010, 11:11:46 PM
Create the boss as a normal enemy, not as a boss. You'll have to make custom functions for a lot of other things if you do that, though.
Alternatively, just cover it up with your own health bar.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on October 10, 2010, 11:13:07 PM
Not sure if I missed the function for it but .... how do I hide the default health bar ?
Not possible.
you can mask it by drawing effect objects over it which is what most people do.
If not you may want to spawn the boss as a regular enemy and then use CreateEnemyFromFile to go to the next file
Code: [Select]
task SPFinalize{
CreateEnemyFromFile(CSD~"spell1.txt",GetX,GetY,0,0,0);

loop(30){
let a = rand(0,360);
let x = rand(30,60)*sin(a);
let y = rand(30,60)*cos(a);
CreateMOFItem("POINT",GetX+x,GetY+y);

}
}
Replace SPFinalize with @Finalize or something
SPFinalize was just a finalize function that spawns the next enemy 60 frames before vanishing current enemy
Quote
Warning - while you were typing a new reply has been posted. You may wish to review your post.
Dammit I hate you
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Sejha on October 11, 2010, 01:44:13 AM
Just anothr quick question.

Say I wanted to make it so that upon reaching X value of Graze, Point value increases by a value of Y. How would I go about doing this exactly? I understand the ideas behind it very easily, but I lack the knowledge of DNH's more complex functions and commands.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on October 11, 2010, 01:51:48 AM
Code: [Select]
let lastgraze=0;
@MainLoop{
  if(GetGraze>=x&&lastgraze<x){
    AddPoint(1000);
  }
  lastgraze=GetGraze;
}
This will run the AddPoint code a single time once your graze counter reaches x. It checks if your graze counter is greater than or equal to x, but your graze counter last frame wasn't.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Sejha on October 11, 2010, 02:29:32 AM
Code: [Select]
let lastgraze=0;
@MainLoop{
  if(GetGraze>=x&&lastgraze<x){
    AddPoint(1000);
  }
  lastgraze=GetGraze;
}
This will run the AddPoint code a single time once your graze counter reaches x. It checks if your graze counter is greater than or equal to x, but your graze counter last frame wasn't.
Awesome. Thanks.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Formless God on October 13, 2010, 12:34:15 AM
Yes, thanks to you both. I got it working now :3



I'm using this code from Mitori's script to draw the right-hand display, but there are a few parts I don't understand. What happens if a yield; is placed at the top ? And why doesn't the infinite loop freeze DMF ?
Code: [Select]
SetDefaultStatusVisible(false);

task PlayerOther{
        let sys=csd~"img\SystemA.png";
LoadGraphic(sys);
yield;

        let oLife0 = []; let oLife = [];

        loop{
                 ascent(let p in 0..8){
                        oLife0 = oLife0 ~ [p];
                        oLife0[p] = Obj_Create(OBJ_EFFECT);
ObjEffect_SetPrimitiveType(oLife0[p], PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(oLife0[p], 4);
ObjEffect_SetTexture(oLife0[p],sys);
ObjEffect_SetLayer(oLife0[p],8);

ObjEffect_SetVertexXY(oLife0[p], 0, -8, -8);
ObjEffect_SetVertexXY(oLife0[p], 1, -8,  8);
ObjEffect_SetVertexXY(oLife0[p], 2,  8, -8);
ObjEffect_SetVertexXY(oLife0[p], 3,  8,  8);

ObjEffect_SetVertexUV(oLife0[p], 0,  80, 2);
ObjEffect_SetVertexUV(oLife0[p], 1,  80, 18);
ObjEffect_SetVertexUV(oLife0[p], 2,  96,2);
ObjEffect_SetVertexUV(oLife0[p], 3,  96,18);

Obj_SetPosition(oLife0[p],x + p * 16,y);
                }
                ascent(let q in 0..GetPlayerLife){
                        oLife = oLife ~ [q];
                }
                ascent(let p in 0..length(oLife)-1) {
                        oLife[p] = Obj_Create(OBJ_EFFECT);
ObjEffect_SetPrimitiveType(oLife[p], PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(oLife[p], 4);
ObjEffect_SetTexture(oLife[p],sys);
ObjEffect_SetLayer(oLife[p],8);

ObjEffect_SetVertexXY(oLife[p], 0, -8, -8);
ObjEffect_SetVertexXY(oLife[p], 1, -8,  8);
ObjEffect_SetVertexXY(oLife[p], 2,  8, -8);
ObjEffect_SetVertexXY(oLife[p], 3,  8,  8);

ObjEffect_SetVertexUV(oLife[p], 0,  0, 2);
ObjEffect_SetVertexUV(oLife[p], 1,  0, 18);
ObjEffect_SetVertexUV(oLife[p], 2,  16,2);
ObjEffect_SetVertexUV(oLife[p], 3,  16,18);

Obj_SetPosition(oLife[p],x + p * 16,y);
                }

                yield;

                if (OnPlayerMissed) { Obj_Delete(oLife[length(oLife)-1]); }

                ascent(let p in 0..length(oLife0)){
Obj_Delete(oLife0[p]);
}
                ascent(let p in 0..length(oLife)){
Obj_Delete(oLife[p]);
}
       }
}
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on October 13, 2010, 12:37:18 AM
I'm using this code from Mitori's script to draw the right-hand display, but there are a few parts I don't understand. What happens if a yield; is placed at the top ? And why doesn't the infinite loop freeze DMF ?
[codez]

The yield at the top prevents the effect objects from being made during the first frame, which is the cause of some bugs. There is no infinite loop, the yield near the bottom allows the loop to escape and resume every frame.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Formless God on October 13, 2010, 12:50:13 AM
So the yield; there does the same thing as a break; ?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on October 13, 2010, 02:15:23 AM
Break would exit the loop completely, never to return. Yield will resume the loop the next frame. Yield is covered in the intermediate tutorial.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on October 13, 2010, 02:41:56 AM
Yield means "go do other shit and come back when you're done". Code hits yield, does other stuff, resumes where yield is, hits loop and goes over again.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Formless God on October 13, 2010, 07:11:53 AM
Oh ... I get it now. (yield has always been bugging me because people seem to just throw it all over the place and their codes would still work >_>)



I'm trying to use a render target to re-draw my background. I've been following Azure's tutorial but the result was pretty messed up. Did I do it wrong somewhere ?
Code: [Select]
@Initialize {
    LoadImages;

    CreateRenderTarget("bg",384,448);
    SetRenderTarget("bg");

    //SetTexture and stuff, which I assume is just copying stuff from @BackGround ?
    SetGraphicAngle(0,0,0);
    SetGraphicScale(1,1);
    SetTexture(bgb);
    SetGraphicRect(bgscr,-bgscr,512-bgscr,512-bgscr);
    DrawGraphic(GetCenterX,GetCenterY);
    SetTexture(bgt);
    SetAlpha(224);
    SetGraphicRect(0,0,256,256);
    SetGraphicScale(1.5,1.76);
    SetGraphicAngle(0,0,0);
    bgscr-=3;
    DrawGraphic(GetCenterX,GetCenterY);

    SetRenderTarget("DEFAULT");
(by the way, the bgscr variable is used to scroll the image and changes every frame, but AFAIK @Initialize only runs each line once. Do I need to move the bgscr-=3; line into a loop ?)

Code: [Select]
@DrawLoop {
        SetTexture("bg");
        SetGraphicRect(0,0,384,448);
        DrawGraphic(GetCenterX,GetCenterY);
}

Code: [Select]
@Finalize {
        DeleteImages;
        ClearRenderTarget("bg");
    }
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on October 13, 2010, 12:57:32 PM
Oh ... I get it now. (yield has always been bugging me because people seem to just throw it all over the place and their codes would still work >_>)



I'm trying to use a render target to re-draw my background. I've been following Azure's tutorial but the result was pretty messed up. Did I do it wrong somewhere ?
Code: [Select]
@Initialize {
    LoadImages;

    CreateRenderTarget("bg",384,448);
    SetRenderTarget("bg");

    //SetTexture and stuff, which I assume is just copying stuff from @BackGround ?
    SetGraphicAngle(0,0,0);
    SetGraphicScale(1,1);
    SetTexture(bgb);
    SetGraphicRect(bgscr,-bgscr,512-bgscr,512-bgscr);
    DrawGraphic(GetCenterX,GetCenterY);
    SetTexture(bgt);
    SetAlpha(224);
    SetGraphicRect(0,0,256,256);
    SetGraphicScale(1.5,1.76);
    SetGraphicAngle(0,0,0);
    bgscr-=3;
    DrawGraphic(GetCenterX,GetCenterY);

    SetRenderTarget("DEFAULT");
(by the way, the bgscr variable is used to scroll the image and changes every frame, but AFAIK @Initialize only runs each line once. Do I need to move the bgscr-=3; line into a loop ?)

Code: [Select]
@DrawLoop {
        SetTexture("bg");
        SetGraphicRect(0,0,384,448);
        DrawGraphic(GetCenterX,GetCenterY);
}

Code: [Select]
@Finalize {
        DeleteImages;
        ClearRenderTarget("bg");
    }
I didn't check the code but.
Code: [Select]
3 Parameters
    1) The name of the render-target texture you want to create
    2) The width of the render target to be created, must be a power of 2 (2, 4, 8, 16, 32, 64, 128, 256, ...)
    3) The height of the render target to be created, must be a power of 2
and i'm pretty damn sure that 384 and 448 are not powers of 2 unless my math fails really hard.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on October 13, 2010, 01:01:31 PM
and i'm pretty damn sure that 384 and 448 are not powers of 2 unless my math fails really hard.

256 + 128 = 384.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on October 13, 2010, 02:45:26 PM
That isn't the problem, render targets just need to be explained a bit 'better'.

First of all, think of a render target as two things:
-A render target has the same use as any other image you load into DNH. However, instead of loading an image from a directory, you create it within the script and build it bottom-up.
-A render target is also the same as an entirely new DrawLoop or BackGround. You pile images on it it drawing order to make a picture, then the next frame you redo it. The exception, is that if you don't change it or reset it per frame, it will stay the same.

The example Azure used created the target in Initialize simply for demonstration. You don't need to create it in Initialize, but if you're using said target right away, you obviously need to create the target before you use it, so if you're using the exact same image the whole time in a single spell script, go right ahead. Otherwise, you can easily write a task to reupdate the target every frame. Backgrounds in particular easy to do this with, although you could really just use BackGround for it and considering you aren't doing any huge modifying to the target, there isn't much use for it. Good for practice though.

task RENDER_background{
   let bgscr = 0;
   CreateRenderTarget("bg",384,448);   //Only need to do this once.
   loop{
      ClearRenderTarget("bg");   //This resets the render target every frame. Otherwise, you'd be drawing more stuff on the stuff already there.
      SetRenderTarget("bg");

      SetTexture(bgb);
      SetGraphicRect(bgscr, -bgscr, bgscr+512, -bgscr+512);   //Diagonal up-right.
            //Clearly label this stuff and I suggest writing it like this instead. Ambiguous value first, then add the unchanging rect values.
      SetGraphicAngle(0,0,0);
      SetGraphicScale(1,1);
      DrawGraphic(GetCenterX,GetCenterY);

      SetTexture(bgt);
      SetAlpha(224);
      SetGraphicRect(0, 0, 256, 256);
      SetGraphicAngle(0,0,0);
      SetGraphicScale(1.5,1.76);
      DrawGraphic(GetCenterX,GetCenterY);

      bgscr-=3;
      SetRenderTarget("DEFAULT");      //Done drawing the image, switch back to normal drawing.
      yield;   //Do other stuff.
   }
}


Call this in Initialize or at some other significant point and it should do what you want.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on October 14, 2010, 08:14:12 AM
How do i use danmakufu's 3d drawing functions?
(I suck terrible balls at making backgrounds)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on October 14, 2010, 07:40:10 PM
NC's drawing tutorial covers 3D drawing. As for making backgrounds, it's pretty similar to 2D but the best way to learn is by trial and error.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chau on October 17, 2010, 10:34:10 AM
Is it better to use CreateEnemyFromFile instead of CreateEnemyFromScript? Are there any advantages or disadvantages?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on October 17, 2010, 10:41:05 AM
With CreateEnemyFromFile, you don't have to put everything into the same script file. That way the code becomes easier to read. On the other hand, if you already have a lot of files in the parent script folder, you may want to keep the number of files low, so in that case it would be helpful to use CreateEnemyFromScript instead.

It is a matter of organisation, mostly.

Although, if you use CreateEnemyFromScript, danmakufu has a little problem that can get annoying:
You can use #include_function for any specific function only once per script. This means if you want to include a certain universal script block in both the parent and the child enemies, you can't include it with #include_function in both script parts when they are in the same file. In that case, you would have to use CreateEnemyFromFile.

Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: 8lue Wizard on October 18, 2010, 01:30:09 AM
This just in: Danmakufu's 3d coordinate system makes absolutely no logical sense whatsoever. And why the hell is my fog changing when I'm not even moving the camera?

After some slightly more level-headed experimentation (not to mention a couple face-palms), the system is proving at least sensible, if not intuitive internally consistent. However, fog  remains opaque as ever (literally). Can someone explain to me why this is causing my bg to completely fade out within ~200 frames?
Code: [Select]
    @BackGround{
        SetViewTo(0, 0, 0);
        SetViewFrom(-200, 0, 0);
        SetFog(0,500,0,0,0);
        SetGraphicAngle(90, 0, 0);
        SetTexture(bg_floor);
        SetGraphicRect(0, 0, 2400, 450);
        DrawGraphic3D(600-(frame%1280)/2,-50,0);
    }

Commenting out SetFog fixes it btw.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Formless God on October 18, 2010, 02:55:45 AM
With CreateEnemyFromFile, you don't have to put everything into the same script file. That way the code becomes easier to read. On the other hand, if you already have a lot of files in the parent script folder, you may want to keep the number of files low, so in that case it would be helpful to use CreateEnemyFromScript instead.
So to create a child enemy in the same script, I just put another script_enemy_main name {} after the first @Finalize ?

Although, if you use CreateEnemyFromScript, danmakufu has a little problem that can get annoying:
You can use #include_function for any specific function only once per script. This means if you want to include a certain universal script block in both the parent and the child enemies, you can't include it with #include_function in both script parts when they are in the same file. In that case, you would have to use CreateEnemyFromFile.
Uh, if they are both already in the same file, you would only need to call #include_function once at the top, wouldn't you ? :/

And while we're talking about CreateXFromScript, when is CreateShotFromScript actually needed ? (it doesn't seem to be any better than normal object shots)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: CK Crash on October 18, 2010, 03:13:34 AM
And while we're talking about CreateXFromScript, when is CreateShotFromScript actually needed ? (it doesn't seem to be any better than normal object shots)
It's the same type of thing as object familiars and enemy familiars. They each have different advantages, and different amounts of "connection" to the boss script. Shot objects just happen to be able to do things more efficiently most of the time, because shots don't need their own hitboxes/health/etc like familiars sometimes need.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on October 18, 2010, 03:43:41 AM
I have the basic stuff drawn for my script, but I want to know how to make 3D trees, I had trouble placing the simple stuff, this kind of stuff is gonna give me a headache X_X
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on October 18, 2010, 10:53:30 AM
So to create a child enemy in the same script, I just put another script_enemy_main name {} after the first @Finalize ?
Uh, if they are both already in the same file, you would only need to call #include_function once at the top, wouldn't you ? :/
You have to put the script_enemy ENEMY_NAME{} of the child enemy after the closing bracket of the script_enemy_main{} of the script. That also means that the #include_function won't be included in the child script. But since it is still the same file, a clause probably meant to prevent infinite loops during the script loading prevents the same #include_function from working more than once.

Quote
And while we're talking about CreateXFromScript, when is CreateShotFromScript actually needed ? (it doesn't seem to be any better than normal object shots)
I have no idea.  :derp:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on October 18, 2010, 11:33:14 AM
And while we're talking about CreateXFromScript, when is CreateShotFromScript actually needed ? (it doesn't seem to be any better than normal object shots)

It was made obsolete some time ago by tasks and object shots. I personally like the idea of being able to set your own collision and whatnot with bullet scripts, but each bullet is like spawning another enemy, and 2000 enemies floating around the screen is :(
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chau on October 21, 2010, 05:47:12 PM
Code: [Select]
@BackGround{
SetViewTo(0,0,0);
}

The error message shows that there is something wrong with SetViewTo. Is there really a mistake or is that because I try to draw 3D stuff in Single scripts? I've already used SetScore in @Initialize so that I can use @BackGround.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on October 21, 2010, 06:20:10 PM
Code: [Select]
@BackGround{
SetViewTo(0,0,0);
}

The error message shows that there is something wrong with SetViewTo. Is there really a mistake or is that because I try to draw 3D stuff in Single scripts? I've already used SetScore in @Initialize so that I can use @BackGround.

Correct me if I am wrong, but that is a stage function right? My question: Is that a stage script you are trying to make?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on October 21, 2010, 07:13:56 PM
is that because I try to draw 3D stuff in Single scripts? I've already used SetScore in @Initialize so that I can use @BackGround.

SetViewTo and other 3D drawing functions can only be used in Stage scripts. I think you might wanna put your code in a stage script so it would work.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chau on October 21, 2010, 07:47:05 PM
Quote
Is that a stage script you are trying to make?

I'm trying to make an enemy script. Looks like I'll have to implement the drawing into the stage script   :ohdear:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on October 22, 2010, 03:12:57 AM
Fucking what? (http://idiocy.pastebin.com/FaWM2TLb)
Don't effect objects allow texture changing or whatever?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on October 22, 2010, 03:19:36 AM
There's a problem right now in that you aren't giving a texture, and then calling UVs on a nonexistent texture.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on October 22, 2010, 06:01:09 PM
Does that mean I have to change the initial texture to a transparent pixel?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on October 22, 2010, 06:03:23 PM
You need to re-set the SetVertexUV's after you change the texture, I believe.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on October 23, 2010, 12:07:25 AM
It turns out I had to put a loop(2){yield;} before TsuchiEvent; was called.
What the hell, Danmakufu?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Fujiwara no Mokou on October 23, 2010, 07:15:02 AM
It turns out I had to put a loop(2){yield;} before TsuchiEvent; was called.
What the hell, Danmakufu?


This is why I'm making my own game engine for this kind of work.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on October 23, 2010, 05:25:25 PM
Hmm I have a question, how do you make things appear off screen, something like Koishi's hell  :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Paper Conan on October 23, 2010, 05:32:43 PM
Maybe you can spawn them offscreen but also put a SetShotKillTime.... I'm still learning how to use danmakufu so please don't hurt me  :ohdear:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Luna on October 23, 2010, 06:35:03 PM
Hmm I have a question, how do you make things appear off screen, something like Koishi's hell  :V
If you by "off screen" you mean outside the "game area," the first thing that comes into my mind is using effect objects. I'm just a newbie to this kind of stuff though.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on October 23, 2010, 06:52:52 PM
Do you mean spawning a bullet off-screen which then moves inward (becoming visible once it's in the game area), or do you mean creating a graphic over the "frame" where your score, lives, etc. are stored, rather than the screen?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on October 23, 2010, 07:16:02 PM
where your score, lives, etc. are stored, rather than the screen?

Yah hmmm
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on October 23, 2010, 07:19:04 PM
Make an effect object, and put it on layer 8. If you don't know how to do either of those, check here (http://dmf.shrinemaiden.org/wiki/index.php?title=Nuclear_Cheese%27s_Effect_Object_Tutorial) or here (http://dmf.shrinemaiden.org/wiki/index.php?title=Object_Control_Functions#ObjEffect_SetLayer), respectively.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Grumskiz on October 24, 2010, 01:47:08 AM
hey guys, I got two (minor...or maybe major...ok medium) problems at the same time and I really hope you can give my some advice for solving these.
First you need two know, that I got several familiars in my Spellcard.
Now the two problems:
1. You prbably know player scripts that automatically hit the boss in the script with some kind of lower level shot when you shoot (like ReimuA). Is there a way to fix that, so that the automatic shots go to the nearest enemy, so that the familiars get shot too? Do I have to change things in the player script to make it hapen or in the single script of my spellcard?(I ask that, 'cause I wanted to use the implemented ReimuA...)

2.I wanted to have an enemy marker on the bottom for the boss and every familiar. I tried to put SetEnemyMarker(true); in @Initialize of my familiars, but I still only have one  for the boss.
Is there a way to get multiple of these?

And a final question for both problems:
Do I have to create my own functions for this or is there some easy way around?(I'm actually pretty sure that I have to make it myself, so I already started to look at that ReimuA player script, but I'm not very familiar(lol) with player scripts, yet...)


€dit:
Wow, another problem and I think I have to tell you by know:
The boss and the familiars look EXACTLY the same!
It's like Flandre making copies of herself, you know.
But Danmakufu ruins everyhting, because the actual boss has these white squares floating around his midpoint.
Is there a way to prevent these from appearing?(They actually anoy me for quite a long time already...)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on October 24, 2010, 11:24:59 AM
@ 1) Danmakufu ReimuA is "hardcoded" in the old version. You will need to make your own Reimu for this.

@ 2)  Marker is boss only function. You need to use Effect Objects on Layer 8 at the bottom of the screen. Manually create your own function that spawns a marker for each familiar.

@ your Edit) Think in the System.png you could blanc out the spinning ugly things and then put it in your Danmakufu root/img folder. Check this  (http://www.shrinemaiden.org/forum/index.php/topic,3167.0.html)thread for more info.

Didn't quite get your final question =|
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Luna on October 24, 2010, 11:56:20 AM
@Grumskiz
To "erase" the white squares, put "MagicCircle(false);" somewhere inside your @initialize.
(Note: This also removes the "magic circle," that round thing that gets smaller and smaller as the timer counts down.)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Grumskiz on October 24, 2010, 02:00:27 PM
Thanks a lot Helepolis and Luna!
I got an alternative ReimuA and ReimuB here made by some japanese guy with nicer graphics and smoother bombs and so on, so I think I will probably use these as base for my new one...
The Enemymarker-thing is not sooo necessary yet, but I would really like to make that later for my script, because it just looks better.(Maybe I also make a playr marker....mhhh)
I think it is better to deactivate that magic circle in the script instead of deleting it from th_dnh.dat, because it is easier to transfer the script.
@Helepolis
Forget about the final question, you answered it already, eventhough you didn't get it^^
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Micro on November 07, 2010, 02:03:33 AM
Sorry if this has already been posted, if so, please direct me to that post.
Anyways, does any one know how to make a continuous laser. Kind of like non-directional laser from IN. Thanks!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Kylesky on November 07, 2010, 02:08:57 AM
Use Object Lasers (http://dmf.shrinemaiden.org/wiki/index.php?title=Object_Control_Functions)

and next time... please post in the Q&A thread (http://www.shrinemaiden.org/forum/index.php/topic,6424.0.html) :D
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Micro on November 07, 2010, 02:12:31 AM
Sorry, didn't see it.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: KrackoCloud on November 11, 2010, 06:20:38 PM
How would I get bullets to never spawn on top of the player?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on November 11, 2010, 06:43:53 PM
How would I get bullets to never spawn on top of the player?
Code: [Select]
function Checkbullet(rcheck, _regular_bullet_parameters_){
   if(  ((x-GetPlayerX)^2 + (y-GetPlayerY)^2 )^0.5 > rcheck){
        _bullet_spawning_code_;
   }
}
If you want to have bullet delay smoke before, you need this instead:

Code: [Select]
task Checkbullet(rcheck, _regular_bullet_parameters_, delay){

   CreateShotA(1, x, y, delay);
   SetShotDataA(1, 0, 0, angle, 0, 0, 0, graphic);
   SetShotKillTime(1, 0);

   loop(delay){ yield; }

   if(  ((x-GetPlayerX)^2 + (y-GetPlayerY)^2 )^0.5 > rcheck){
        _bullet_spawning_code_without_the_bullet_delay;
   }
}
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Sejha on November 11, 2010, 11:59:55 PM
Okay, say I want DNH to automatically load my script, upon launching, could I do that?

Also, can I package my music in a .dat but still call each separate file in the code? If so, how would I go about doing that?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GenericTouhouFailure on November 12, 2010, 12:41:28 AM
Okay, say I want DNH to automatically load my script, upon launching, could I do that?
no.

you could decompile the th_dnh.dat and fuck around with stage0.txt (this code executes when running a plural or single file) but i doubt you'd get far.
Also, can I package my music in a .dat but still call each separate file in the code? If so, how would I go about doing that?
dat packing is very glitchy. Tried it and gives you a tonne of weird problems, so i'm not sure on this part.


Edit: Now for my question: What the fuck makes a good stage. I can't make a decent one without spaming rand() or GetAngleToPlayer
is there something I could reference or learn from?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on November 12, 2010, 07:02:05 AM
Edit: Now for my question: What the fuck makes a good stage. I can't make a decent one without spaming rand() or GetAngleToPlayer
is there something I could reference or learn from?
See one post from PoSR thread (http://www.shrinemaiden.org/forum/index.php/topic,897.msg258576.html#msg258576), brb getting link
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on November 12, 2010, 07:12:56 AM
Yeah, I was trying to find that earlier. Why the fuck isn't it in the info thread yet.

*cough cough*
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Grumskiz on November 12, 2010, 07:17:26 PM


you could decompile the th_dnh.dat and fuck around with stage0.txt (this code executes when running a plural or single file) but i doubt you'd get far.dat packing is very glitchy. Tried it and gives you a tonne of weird problems, so i'm not sure on this part.

/sign
I tried both things several times this summer and I completely ruined Danmakufu and it didn't work properly.
I think the only thing you can change in th_dnh.dat without encountering many problems are graphics.(even sounds make problems, depending on the length of what you put in)
You probably know this already, but if you really want to give it a try, this programm is helpful:
http://www.shrinemaiden.org/forum/index.php/topic,4731.0.html

Btw, if you get it to work PLEASE tell us how you did it! It would be a really great opportunity for people who want to create their very own game (with their own menu and stuff)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on November 12, 2010, 07:21:09 PM
Even if you did make it automatically launch, what about the pause menu? And the "return to menu" key? And what about when the script ends, or you get an error, or want to save a replay?
Really, it's not going to be possible. Just pack everything into a single zip/rar file, including Danmakufu, then include a readme saying "run th_dnh.exe and mash Z until you get to a menu screen that's not blue." Most people should be able to understand it.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Grumskiz on November 12, 2010, 07:30:47 PM
Even if you did make it automatically launch, what about the pause menu? And the "return to menu" key? And what about when the script ends, or you get an error, or want to save a replay?
Really, it's not going to be possible. Just pack everything into a single zip/rar file, including Danmakufu, then include a readme saying "run th_dnh.exe and mash Z until you get to a menu screen that's not blue." Most people should be able to understand it.
Well, that's true. Let's just say, that it is probably possible, but not really needed and a LOT of work ;3
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Ianator on November 12, 2010, 08:38:41 PM
Afternoon folks. Just got DMF today and I'm having some crashing troubles - specifically, if I make it to the end of a spell in Single mode. So far I've only tried the included EX-Rumia spells, and I personally can't beat the Plural-mode.

In addition, when going down the list of spells in Single mode it doesn't show the preview screenshots. I tried it without AppLocale and they show fine (but it crashes if I try to play it). I feel like I'm missing something obvious here, but I don't know what.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Octopus on November 12, 2010, 10:56:27 PM
I'm having a problem with applocale, I've followed the instructions on running danmakufu and such, and it worked the 1st time. However, when I try to run it again, it doesn't work and my computer tells me there is an error and danamakufu needs to close down. I'm using the 4th language from the bottom. Also, I'm using the 'launch an application' option. Help?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Schezo on November 13, 2010, 02:13:51 AM
Octopus: you should be using the language at the very bottom.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Sejha on November 13, 2010, 02:41:05 AM
Afternoon folks. Just got DMF today and I'm having some crashing troubles - specifically, if I make it to the end of a spell in Single mode. So far I've only tried the included EX-Rumia spells, and I personally can't beat the Plural-mode.

In addition, when going down the list of spells in Single mode it doesn't show the preview screenshots. I tried it without AppLocale and they show fine (but it crashes if I try to play it). I feel like I'm missing something obvious here, but I don't know what.
Some copies of DNH are quite frankly broken beyond belief.

My copy for example is only able to use the directory command without crashing.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Kylesky on November 13, 2010, 02:44:56 AM
Let's get this straight

Code: [Select]
let array=[0, 0, 0];
array[2]=180-array[2];
bad allocation
Code: [Select]
let array[0, 0, 0];
let tempval=array[2];
tempval=180-tempval;
array[2]=tempval;
works


wut, why?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on November 13, 2010, 03:11:07 AM
http://en.wikipedia.org/wiki/Malloc

read up
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Kylesky on November 13, 2010, 03:50:56 AM
dammit... malloc :|
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on November 13, 2010, 05:55:09 AM
Malloc is a good thing. Odd coding is not.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Furienify on November 15, 2010, 09:44:24 AM
Some copies of DNH are quite frankly broken beyond belief.

My copy for example is only able to use the directory command without crashing.

Delete script_index.dat, restart Danmakufu and try again. Usually fixes the problem.

If it doesn't, one of your scripts is has its opening parameters (#TouhouDanamakufu etc) bracketed wrong.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Grumskiz on November 16, 2010, 12:53:31 AM
Since I really don't like the built-in Enemymarker of Danmakufu I decided to make my own Effect Object for it.
Some of my goals are:
-Better graphic than the bad loking built-in one (done)
-Making it look smooth and bright(graphics: yes / coding:...no... :derp:)
-Making it move on the same X-Position as the boss(done)
-Making it useable with ALL kinds of enemies and not only bosses( I didn't try that, but it should work...)
-Making it glow brighter when you move away from the boss and making it more transparent when you move towards it (there is one of my problems)
-Making it flash rapidly when the lifebar of the boss is nearly empty(I got another problem here)

Well, you already notice, it shall look like the one ZUN made for his games, just with my own graphics, because it makes it more unique  :V
Anyway, my problems a little better explained:

First:
How can I get the opacity stuff in my script. To be a little more precise: I want a smoothly decreasing opacity when your X-Position gets nearer to the one of the boss.
I could do it with a counter that counts the difference and sets new values in Obj_SetAlpha every now and then, but that wouldn't be very smooth, except if I make bazillions of if-statements and you know, I'm too lazy for that and I'm pretty sure there are more ways and I just don't have the imagination  :V

Now the flashing stuff:
The easiest , most efficient, but not best  looking way I can think of  is to create two parameters for my function.
One for the 1. life-value where it starts to flash slowly and the second one for the life-value where it starts to flash twice as fast.
This method is, like it said earlier, not sooo smooth and you know it is one of my goals to make it look good, eventhough some people might say that this is not necessary.

If you want to take a look at the script, feel free to do so:
http://pastebin.com/M83sz7F4

Thanks for taking yur time :3
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on November 16, 2010, 01:11:28 AM
First problem (more opaque when you're closer to the boss), here's one way to handle it. X is the position of the marker, while k and alpha should be declared beforehand.

Code: [Select]
alpha=absolute(x-GetPlayerX)*2+100;  //the 2 sets how far you have to be away for it to be maximum opacity (opacity units per 1 pixel of difference), and the 100 sets the minimum opacity
if(alpha>255){alpha=255;}

k=0;
loop(4){
ObjEffect_SetColor(obj,k,alpha,255,255,255);
k++;
}

For the flashing code, you can use (maxlife-GetEnemyLife)/maxlife to get the percentage of life the boss has left, as long as you set maxlife to be the maximum life value of the enemy (obviously). You can then use that value as a multiplier for how fast it's flashing (possibly using a sine wave). If anyone else wants to elaborate on this, go ahead. (I'm a bit pressed for time at the moment, and I figured the theory should be enough to get you started.)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Grumskiz on November 16, 2010, 01:22:06 AM
Code: [Select]
k=0;
loop(4){
ObjEffect_SetColor(obj,k,alpha,255,255,255);
k++;
}
Thanks!
Looks like something I can figure out...
But I think you mean this function, don't you?
Code: [Select]
ObjEffect_SetVertexColor(obj,k,alpha,255,255,255);
As far as I know yours doesn't exist, does it?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on November 16, 2010, 01:32:54 AM
as long as it's defined it's good lolol

function EffectSetAlpha(n,a){    ascent(i in 0..n){    ObjEffect_SetVertexColor(obj,i,a,255,255,255);    }    }
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Grumskiz on November 16, 2010, 01:36:41 AM
as long as it's defined it's good lolol

function EffectSetAlpha(n,a){    ascent(i in 0..n){    ObjEffect_SetVertexColor(obj,i,a,255,255,255);    }    }
Well...yeah  :V

Anyway, I used Azure's version with my little fix and I set the minimum opacity to 50 and it works great =D
Thanks a lot!

€dit:
Ok, changed the minimum again to 80 and the range to reach the minimum to 1. Looks pretty smooth now and I'm very happy with it.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on November 16, 2010, 04:15:24 AM
Yeah, sorry for the typo there. I use a custom function like what Drake posted instead of looping through them, and like I said, I was in a bit of a hurry. As long as you understood it, it's fine though, right?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Octopus on November 17, 2010, 06:13:48 AM
Octopus: you should be using the language at the very bottom.

I tried the four bottom languages, and none of them worked. Maybe I'm using Applocale incorrectly?!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Grumskiz on November 17, 2010, 11:09:03 AM
Did you install all languages from your Windows CD?
Can you actually see japanese letters at the alst language or only 3 squares?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Sejha on November 17, 2010, 03:27:52 PM
Wow... I sure got questions.

Y'know the very loud sound that plays on enemy death? How do I change it?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on November 17, 2010, 03:32:03 PM
dnhfolderseseEnemyExplode01.wav

and 02
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Grumskiz on November 17, 2010, 08:23:02 PM
Drake's method is easier and safer, but you could also disassemble your th_dnh.dat and replace the sounds in it.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Paper Conan on November 17, 2010, 11:29:51 PM
Um, I have a simple question... How do you install the unofficial CtC spellcard practice on danmakufu?  :blush:
\edit:
nvm, I got it to work. lol
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on November 18, 2010, 01:09:22 AM
Or just stick DeleteSE("se\seEnemyExplode01.wav"); into @Initialize and it's gone for the entirety of the script! No need to mess around with switching files or disassembling a dat. I forgot who discovered this, but it wasn't me.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on November 18, 2010, 02:51:06 AM
Uh what? Sound files are loaded when they play as well, so wouldn't they just reload again? I just stick DeleteSE("se\seEnemyExplode01.wav"); in @Finalize of every enemy I use.

Oh hey, look at that. Deleting any of the default sound effects makes them unplayable unless you reload them or restart dnh. Interesting.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on November 18, 2010, 03:07:45 AM
In that case couldn't you just edit that into stage0 instead of in the script?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Grumskiz on November 18, 2010, 03:42:15 AM
In that case couldn't you just edit that into stage0 instead of in the script?
Gave it a try. The exact code doesn't seem to work, but I try out some other things...
Actually this requires to disassemble your th_dnh.dat again, so actually that step is only useful for lazy people with weird ideas.(like me)

Little report:
DeleteSE("se\seEnemyExplode01.wav");  --doesn't change anything
DeleteSE(".\seEnemyExplode01.wav"); --crashes Danmakufu when you try to load a script
DeleteSE("GetCurrentScriptDirectory ~ \seEnemyExplode01.wav"); --doesn't change anything

Has anyone more ideas, what to try? Or has anyone any experience with script0.txt?


€dit:
dnhfolder\se\seEnemyExplode01.wav

and 02

As far as I know there is no seEnemyExplode02.wav oO
At least I couldn't find it in my th_dnh.dat, but maybe that's just me at 23:57 -.-
Must.go.to.bed.and...sleeeeeep
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Octopus on November 18, 2010, 06:41:12 AM
Did you install all languages from your Windows CD?
Can you actually see japanese letters at the alst language or only 3 squares?

I can see the kanji on the last one, and the characters on the last three. (That's on my mother's laptop, but on my normal computer I can't. Does it matter, if so don't worry I'll work it out. Hopefully.)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Grumskiz on November 18, 2010, 11:07:50 AM
I can see the kanji on the last one, and the characters on the last three. (That's on my mother's laptop, but on my normal computer I can't. Does it matter, if so don't worry I'll work it out. Hopefully.)
Yeah, you need to install all eastern asian language files from your Windows CD first, before you can use Applocal correctly.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on November 19, 2010, 05:10:38 PM
Sorry to shift the course of the current discussion, but is there a way to make a user defined player spellcard NOT nullify bullets and stuff and suck them into it like point items? I was hoping that skipping the CollectItems(); that Stuffman placed in the MainLoop of his tutorial would do the trick, but I was wrong. Is there any way at all to disable this annoying behaviour?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on November 19, 2010, 05:58:07 PM
Sorry to shift the course of the current discussion, but is there a way to make a user defined player spellcard NOT nullify bullets and stuff and suck them into it like point items? I was hoping that skipping the CollectItems(); that Stuffman placed in the MainLoop of his tutorial would do the trick, but I was wrong. Is there any way at all to disable this annoying behaviour?
Don't use the ObjSpell_SetIntersecrionCircle and ObjSpell_SetIntersecrionLine commands on the spell objects..?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on November 19, 2010, 06:09:19 PM
Don't use the ObjSpell_SetIntersecrionCircle and ObjSpell_SetIntersecrionLine commands on the spell objects..?

I'm not actually using any Spell Objects in my bombs though. I'm trying a new approach to bombing where a push on the 'X' button will release a different kind of regular attack, one that won't make you go invincible or help you out of a tight spot without careful use. So far I've only tried doing it with regular Object Shots. Should I remake it with Spell Objects instead? Can the projectiles still cause damage to the enemy even if the intersecrion commands are missing?

Edit: I also tried skipping the whole @SpellCard deal in the player script and include if-statements in the MainLoop that checks if the bomb button is being pushed or held down, but that seems to strain the processing in some weird ways, resulting in a drop of framerate.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on November 19, 2010, 08:50:47 PM
Make the bullets into spell objects instead, then when you call the intersecrion functions, just set them to not destroy bullets. The only problem is that they'll be forced to penetrate enemies rather than being destroyed in one hit.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Sejha on November 21, 2010, 03:21:10 AM
Yeah, you need to install all eastern asian language files from your Windows CD first, before you can use Applocal correctly.

If you don't have the disc, you can download the folder needed online. It's called I386. If you can't find it, I do still have my copy.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Grumskiz on November 21, 2010, 04:13:18 AM
If you don't have the disc, you can download the folder needed online. It's called I386. If you can't find it, I do still have my copy.
He is right, you can borrow any CD you want. In this case, Windows suprisingly doesn't look at the serial codes or something and lets you use anything, as long as you got all the data...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on November 21, 2010, 02:46:00 PM
Make the bullets into spell objects instead, then when you call the intersecrion functions, just set them to not destroy bullets. The only problem is that they'll be forced to penetrate enemies rather than being destroyed in one hit.

Alright, I will try that on my next outing with Danmakufu. Thanks for the suggestion.

As a follow-up question, can spell objects be made to produce decent graphics for lasers? Or could I in some way combine a spell object with a laser object to work together to achieve a bomb-laser that does not eat enemy projectiles?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on November 21, 2010, 08:58:54 PM
A spell object is basically an effect object, just with collision functions. So yes, you can just stretch it out to look like a laser if you want, and use the line collision rather than the circle collision. There's a tutorial about effect objects... somewhere. I don't have the link with me right now.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on November 21, 2010, 09:26:22 PM
I am looking at Nuclear Cheese's Effect Object tutorial right now. I assume that's the one you're speaking of? I've actuallly used it before to create effect objects, but I only just now noticed the section where he shows how to stretch the image on both the width and length. I'll definately give this a go at some point. Thanks!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on November 22, 2010, 01:18:31 AM
DNH upscale-stretching by XYs and setscale both look extremely bad. Make a large graphic, then shrink it by default instead and build up to normal size.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on November 22, 2010, 06:34:51 AM
I once tried making an object laser but the SetLength and SetWidth functions ended up giving it a very jagged appearance, so I can only guess that the SetScale would do the same. How would I go about making a larger graphic to use? Draw it myself outside of Danmakufu and place it in a sheet? That's outside anything I've ever done before, although I suppose there's a necessary first time for everything...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on November 22, 2010, 06:43:14 AM
If you mean "sheet" as in "image", then yes. You don't make a shotsheet for object effects. Just use a larger graphic.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on November 23, 2010, 07:03:26 PM
Alright, I got it all done and running in good shape after I did some mucking about. Now that I've gotten more used to working with effect objects, there really are a lot of things that are possible to do with them. Thanks for the help.

But I wonder, is it possible to remove that annoying Rate data display in the lower left of the playing field? It's kind of clashing with my charge attack bar.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on November 23, 2010, 07:04:40 PM
At the beginning of your script:

SetRateScoreSystemEnable(false);
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on November 23, 2010, 07:12:50 PM
Thanks man. It looks a lot better this way.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Mr. Sacchi on November 23, 2010, 09:04:27 PM
OK, so I want to make a pattern like this:

a circular pattern of 18 blue bullets stops after around a second, turn into aqua bullets and then resume movement, but on random directions(for each bullet)

This is a Cirno Boss btw  :derp:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on November 23, 2010, 09:10:33 PM
OK, so I want to make a pattern like this:

a circular pattern of 18 blue bullets stops after around a second, turn into aqua bullets and then resume movement, but on random directions(for each bullet)

This is a Cirno Boss btw  :derp:
Board.

Code: [Select]
function wave(x, y, v1, t, v2){
let ang=rand(0,360);
ascent(i in 0..18){

CreateShotA(1, x, y, 0);
SetShotDataA(1, 0, v1, ang+360*i/18, 0, 0, 0, RED01);
SetShotDataA(1, t, 0, ang+360*i/18, 0, 0, 0,AQUA01);
SetShotDataA(1, t+60, v2, rand(0, 360), 0, 0, 0,AQUA01);

}
}
Something like that.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on November 23, 2010, 09:13:52 PM
ascent(i in 0..18){
createshota
setshotdata(0 frames, angle=i*360/18, negative acceleration)
setshotdata(60 frames, 0 speed)
setshotdata(x frames, more speed, angle=rand(etc), AQUAxx)
fireshot
}

EDIT: iryan you weren't supposed to do it for him
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on November 23, 2010, 09:19:23 PM
EDIT: iryan you weren't supposed to do it for him
sorry  :ohdear:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Mr. Sacchi on November 23, 2010, 09:36:02 PM
Danmakufu is raising retarded error, what do I do? (http://img203.imageshack.us/f/errorbe.png/)

Also, I took a look at the codes you both gave me, and I must say I'm confused, what is de "i" and the "t"? and I'm assuming "v1" and "v2" stands for velocity 1&2
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on November 23, 2010, 09:44:45 PM
Danmakufu is raising retarded error, what do I do? (http://img203.imageshack.us/f/errorbe.png/)

Also, I took a look at the codes you both gave me, and I must say I'm confused, what is de "i" and the "t"? and I'm assuming "v1" and "v2" stands for velocity 1&2
You should be able to figure it out from looking at it.

"t" stands for "time", as in "frames", meaning the "delay" after which the bullets freeze.

And "i" is just the most commonly used variable when using the ascent function, of which I hope you know how it works, because it great.


As for your error, the line where you define GCD is missing the ending ";"
This makes danmakufu interpret the lines after that as still being a part of the definition of GCD, which causes an error.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Mr. Sacchi on November 23, 2010, 09:55:40 PM
Oh, really that I missed that ;?  :colonveeplusalpha: :colonveeplusalpha:

And, no, I never even heard of such function, how does it work?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on November 23, 2010, 10:02:20 PM
Code: [Select]
ascent(i in a..b){

    DoStuff;

}
This code block would create an integer variable "i" with a value of "a", repeat the DoStuff; command several times, but for each repetition, the value of the variable "i" is increased by 1. This is repeated until "i" assumes the value of ("b"-1).
Thus you can shorthand repetitive code that has the same alteration between each iteration very efficiently, like for example when you want to make a circle of bullets.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on November 24, 2010, 08:47:28 PM
How do I set the user-defined part of VK_USER? I tried doing it with (letter) afterwards but it wouldn't have any of that.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on November 24, 2010, 08:49:06 PM
VK_USER just means the C key. The user-defined part is what it does, not what key it is.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on November 24, 2010, 08:52:48 PM
But is there no way to change it from being assigned to the C key? The wiki mentions that C is merely the default value.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Micro on November 24, 2010, 09:07:33 PM
For some reason, the bullets in the "bullet5" if statement are spawned to the right of Cirno. Keep in mind that I've been busy, and this spell card has spanned quite some time, so some ways of doing stuff, might not be as good as if I were to redo it now.
Code: [Select]
      if (circle5==600)
      {
         PlaySE(shotsound03);
         loop(36)
         {
            CreateShotA(5,GetX+40*cos(angle),GetY+40*sin(angle),0);
            SetShotDataA(5,0,3,angle2,0.2,0,1,AQUA23);
            FireShot(5);

            CreateShotA(6,GetX+40*cos(angle),GetY+40*sin(angle),0);
            SetShotDataA(6,0,3,angle2,-0.2,0,1,AQUA23);
            FireShot(6);

            CreateShotA(6,GetX+30*cos(angle),GetY+30*sin(angle),0);
            SetShotDataA(6,0,3,angle2,0.2,0,1,AQUA23);
            FireShot(6);
                       
            CreateShotA(7,GetX+30*cos(angle),GetY+30*sin(angle),0);
            SetShotDataA(7,0,3,angle2,-0.2,0,1,AQUA23);
            FireShot(7);
           
            angle2+= 360/36;
            circle5 = 0;
         }

      }   
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Blargel on November 24, 2010, 09:14:20 PM
If you're trying to make a circle of bullets appear around Cirno, you need to make the angle variable increment. The 40*sin(angle) and 40*cos(angle) makes the bullet spawn a distance of 40 away from Cirno at the angle the angle variable is set at. It sounds like you just set it to 0 without changing it which is to the right.

But is there no way to change it from being assigned to the C key? The wiki mentions that C is merely the default value.
My guess would be the config.exe. But I don't know where because I don't read Japanese.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Micro on November 24, 2010, 10:45:40 PM
First of all: Wow, that was fast.
Second: Either I'm not understanding you, or you're incorrect (probably the former). Do you mean increment angle2 with angle2++ ? That doesn't work. Do you wan't me too get rid of the whole "cos" and "sin"? That doesn't work either.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on November 24, 2010, 10:51:12 PM
It would be much easier to help you if you actually said what pattern you were trying to create. The way it is now, not only do we have to spot where the error is, but before that we have to understand what you are trying to do, which is difficult if the code is not doing what it is supposed to do.  :derp:

Please elaborate.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on November 24, 2010, 11:48:08 PM
First of all: Wow, that was fast.
Second: Either I'm not understanding you, or you're incorrect (probably the former). Do you mean increment angle2 with angle2++ ? That doesn't work. Do you wan't me too get rid of the whole "cos" and "sin"? That doesn't work either.
No, you need to increment "angle".

GetX = Cirno
cos(0) = 1
40*cos(0) = 40
GetX+40*cos(0) = Cirno+40

GetY = Cirno
sin(0) = 0
40*sin(0) = 0
GetY+40*sin(0) = Cirno

So every bullet spawns 40 pixels to the right of Cirno. If I'm guessing right, you probably want the bullets to spawn in a circle around Cirno with a radius of 40 pixels. All you have to do is change all the "angle"s to "angle2".
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Micro on November 25, 2010, 01:41:43 AM
Thanks! It works!. Leave it to me to make a stupid mistake like leaving out a "2".
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chau on November 27, 2010, 09:54:55 PM
Hi, I've got a couple of questions regarding the making of a whole game:

1.How would you connect the stages to the menu? Is there actually a function like "CreateStageFromFile" or something?
2.Do you actually use a menu at all or do you just let the player choose via the Script Menu in Danmakufu?
3.When you use the replay function the menu is also shown (if you want to include one, of course). How do you cope with this problem?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on November 27, 2010, 09:57:38 PM
1) Have everything on one stage script, blocking out the view of the character with the menu, and having one task per stage.
2) Your choice. Using Danmakufu menus is ten times easier, but custom menus are more visually appealing and give you more room to work with (unlockable stages and such).
3) If you're wondering how to make a menu with stages work in the first place, don't worry about the small details like that. It's more of a pain than it's worth.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: ふねん1 on November 29, 2010, 01:38:28 AM
I apologize if no one wants to see a "can't start Danmakufu" post here, but I am at a complete loss here. I'm running Windows 7, and I'm starting up the program through AppLocale, but the computer keeps giving me the "th_dnh.exe has stopped working" message. I followed Helepolis' instructions for installing both Danmakafu and AppLocale to the letter. I tried changing my computer settings to Japanese. I tried deleting the Rumia scripts. I double-checked that I had the most up-to-date graphics card. Nothing seems to work, and Danmakufu doesn't get past that first gray window that pops up before crashing. Even the people I talked to on the chat have no idea what's messing this up. So to the others in here, is there anything else I might be missing somewhere that's preventing the game from starting up?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on November 29, 2010, 02:38:16 AM
-Try opening the game through config.exe. The left-most button starts it. Applocale, etc.
-Try a different th_dnh.exe.
-Restart computer.
-Post screenshot of folder and error details if possible.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: ふねん1 on November 29, 2010, 02:49:32 AM
Tried your config.exe suggestion, and it got to the main menu! Never knew I could open the program like that, especially since the button was written with all question marks and I couldn't read it. Thanks for the help.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on December 01, 2010, 07:33:12 PM
Has anyone noticed some strange stuff with bullet deletion for CreateShotAs ?

Normally danmakufu handles the fieldboundaries + some pixels as the auto-delete area for any bullet travelling beyond it right? (excluding obj bullets which cannot be destroyed)

When I test my spell card solo, the bullets that leave the screen disappear. How ever if I test the same card during my stage the bullets return back into my screen, stacking up each time. I don't remember putting any code altering the bullet deletion in my stage script. I simply made a curving CreateShotA pattern where bullets being spawned, travel forward while curving and surely leave the screen enough to be actually deleted. Guess what, they return after like 4-5 seconds of travelling.

Don't ask me to post code because it has no use to post 2000 lines of code. So what is going on?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Blargel on December 01, 2010, 08:23:37 PM
Has anyone noticed some strange stuff with bullet deletion for CreateShotAs ?

Normally danmakufu handles the fieldboundaries + some pixels as the auto-delete area for any bullet travelling beyond it right? (excluding obj bullets which cannot be destroyed)

When I test my spell card solo, the bullets that leave the screen disappear. How ever if I test the same card during my stage the bullets return back into my screen, stacking up each time. I don't remember putting any code altering the bullet deletion in my stage script. I simply made a curving CreateShotA pattern where bullets being spawned, travel forward while curving and surely leave the screen enough to be actually deleted. Guess what, they return after like 4-5 seconds of travelling.

Don't ask me to post code because it has no use to post 2000 lines of code. So what is going on?

It's just Danmakufu being Danmakufu, I guess. For a simple fix, you can try manually setting the auto delete clip with SetShotAutoDeleteClip (http://dmf.shrinemaiden.org/wiki/index.php?title=Bullet_Control_Functions#SetShotAutoDeleteClip) in the spellcard itself, or in the stage. It seems to default to 64 for all 4 sides according to the wiki, but perhaps that's only in some cases. Maybe mkm screwed up and didn't make the defaults the same in all cases.

(Also, shot objects DO get auto-deleted unless specifically told not to with Obj_SetAutoDelete(obj, false).)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on December 01, 2010, 09:30:31 PM
I see you got Jazz Flandre as avatar.

Also that indeed fixed the problem. I didn't knew SetShot(ry was saved in Danmakufu memory. If you call it only once in a previous boss/spellcard it will affect the entire game. My afro boss increased the boundaries of SetShot(ry by 300 pixels. orz

Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Serena on December 03, 2010, 07:43:30 PM
So I've been looking through the basics and the first  little bit of the intermediate tutorials, and I'm used to the general CreateShot commands and all that stuff.
And I'm wondering why this isn't working:
Code: [Select]
#TouhouDanmakufu
#Title[Attack Name]
#Text[Attack Description]
#BGM[.\bgm.mp3]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let frame = 0;
    @Initialize {
        SetLife(1000);
        SetEnemyMarker(true);
SetTimer(60);
MagicCircle(true);
SetMovePosition02(GetCenterX, GetCenterY - 100, 120);
    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 24);
        if(frame==5){
            CreateShot12(46, 40, 10, 2, -0.5, 1, -20, 10, RED01, 10);
    CreateShot12(400, 40, -10, 2, 0.5, 1, 20, 10, RED01, 10);
    frame = 0;
frame++;
}
if(frame==20){
    CreateShot01(GetX, GetY, 3, GetAngleToPlayer, GREEN01, 10);
            frame = 0;
frame++;
        }
    }

    @DrawLoop {       
    }

    @Finalize {
    }
}

I'm trying to get the RED01's to fire on different frames than the GREEN01's, but niether of them spawn when the script runs, no errors though...
I thought I might have to use alternative/case, but the same nothing happens (though I don't know if I've done this one right...).

Code: [Select]
@MainLoop {
        SetCollisionA(GetX, GetY, 32);
   SetCollisionB(GetX, GetY, 24);
        alternative(frame)
   case(5){
            CreateShot12(46, 40, 10, 2, -0.5, 1, -20, 10, RED22, 10);
       CreateShot12(400, 40, -10, 2, 0.5, 1, 20, 10, RED22, 10);
       frame = 0;
   frame++;
   }
   case(20){
       CreateShot01(GetX, GetY, 3, GetAngleToPlayer, GREEN22, 10);
            frame = 0;
   frame++;
        }
    }

The two separate shots work fine on their own, but I don't know how I'm supposed to get them to work together.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: ChiyuriKitashirakawa on December 03, 2010, 08:07:23 PM
This is sorta silly.
Is there a way to make familiars have more complex movement than shooting them like bullets? I mean, I have some movement scripts on the familiar enemy script,  but they do nothing.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on December 03, 2010, 08:24:00 PM
So I've been looking through the basics and the first  little bit of the intermediate tutorials, and I'm used to the general CreateShot commands and all that stuff.
And I'm wondering why this isn't working:
Code: [Select]
snip

Of course it doesn't work.
The variable "frame" doesn't increment until it has a value of either 5 or 20. Which you never actually make happen.
Fix: put one of the frame++; just after @MainLoop { and delete the other one.

Like so: (i also fixed some teensy "errors")
Code: [Select]
    @MainLoop {
frame++;
        SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 24);
        if(frame%5==0){
            CreateShot12(46, 40, 10, 2, -0.5, 1, -20, 10, RED01, 10);
    CreateShot12(400, 40, -10, 2, 0.5, 1, 20, 10, RED01, 10);
}
if(frame==20){
    CreateShot01(GetX, GetY, 3, GetAngleToPlayer, GREEN01, 10);
            frame = 0;
        }
    }
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on December 03, 2010, 08:34:28 PM
This is sorta silly.
Is there a way to make familiars have more complex movement than shooting them like bullets? I mean, I have some movement scripts on the familiar enemy script,  but they do nothing.
SetX/SetY? Obj_SetX/Obj_SetY?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: ChiyuriKitashirakawa on December 03, 2010, 08:35:25 PM
SetX/SetY? Obj_SetX/Obj_SetY?
I thought of those, but I'm not sure if they can create smooth movement.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on December 03, 2010, 08:46:36 PM
task moveshit(angle,speed){
    loop{
        SetX(GetX+cos(angle)*speed);
        SetY(GetX+sin(angle)*speed);
        //change angle maybe
        //change speed maybe
        yield;
    }
}

Something like that.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Serena on December 03, 2010, 09:29:16 PM
Of course it doesn't work.
The variable "frame" doesn't increment until it has a value of either 5 or 20. Which you never actually make happen.
Fix: put one of the frame++; just after @MainLoop { and delete the other one.

Like so: (i also fixed some teensy "errors")
Code: [Select]
fixed code stuff

Thanks for fixing that. Just one question about the fixed one though, what does the "%5==0" in "if(frame%5==0){}" mean? I noticed it doesn't work at (frame==5), which I originally thought would work...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on December 03, 2010, 10:19:06 PM
x%n is the denotation of "x modulus n", where the value is the remainder of x/n (or rather r in the equation x=y*n+r). For example.

3%10 = 3
6%10 = 6
9%10 = 9
10%10 = 0
11%10 = 1
12%10 = 2
40%10 = 0
129641%10 = 1
5%3 = 2
72%3 = 0
6001%3 = 1
80%7 = 3

So when you say if(frame%5==0), you mean you want to execute that code every time frame is a multiple of 5. Since MainLoop runs every frame and you increment frame by 1, every 5 frames that code will execute.
If you just say if(frame==5), the code will execute after 5 frames and then never again unless you reset frame to 0 or somewhere below 5.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on December 03, 2010, 10:58:48 PM
About the familiars as well: You can use Drake's code for smoother movement or just use SetMoveSpeed03. Many flavours available ze.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Serena on December 03, 2010, 11:25:21 PM
x%n is the denotation of "x modulus n", where the value is the remainder of x/n (or rather r in the equation x=y*n+r). For example.

3%10 = 3
6%10 = 6
9%10 = 9
10%10 = 0
11%10 = 1
12%10 = 2
40%10 = 0
129641%10 = 1
5%3 = 2
72%3 = 0
6001%3 = 1
80%7 = 3

So when you say if(frame%5==0), you mean you want to execute that code every time frame is a multiple of 5. Since MainLoop runs every frame and you increment frame by 1, every 5 frames that code will execute.
If you just say if(frame==5), the code will execute after 5 frames and then never again unless you reset frame to 0 or somewhere below 5.

Ok, that makes more sense.
Thanks  :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: PurpleMagus on December 05, 2010, 02:50:25 AM
Hi,I wondered how to shake the camera in the script version 2,because i can't seem to get it to work well... Also, a friend of mine gave me this:http://www.mediafire.com/?ve8r1y22kpykdny  It has pretty nice things though where could I find the necessary resources?Because they look awesome,thanks already~
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Blargel on December 06, 2010, 04:55:18 AM
Hi,I wondered how to shake the camera in the script version 2,because i can't seem to get it to work well... Also, a friend of mine gave me this:http://www.mediafire.com/?ve8r1y22kpykdny  It has pretty nice things though where could I find the necessary resources?Because they look awesome,thanks already~

Shaking the camera is technically impossible with script version 2. The best thing you can do is shake the enemy graphics, the background, the player, and all the bullets (which will have to be shot objects) at the same time with some special set up. I actually wrote something like this before but I lost it. If you are new to Danmakufu, I highly advise to just forget about shaking the camera. It's just an aesthetic thing anyway.

For your second question, I"m not entirely sure what you're asking. If you're asking where to find graphics for your own projects, you'll just have to ask someone to create them for you. However, very rarely will anyone actually help out unless you show them a nearly finished product that just needs graphics. You can always use placeholder images or even steal ZUN's images to use. Of course, the Japanese community doesn't really approve of using ZUN's graphics, but over here we don't really give a damn.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: BrawlerGamma on December 07, 2010, 11:14:53 PM
So, like, it opens, it runs, then when I press "Single," "All," do to Direction and try to load a script... try to change the script type... it always crashes no matter what I do.  Does anyone know what might cause this and how/if it can be fixed?  Thank You.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Mr. Sacchi on December 07, 2010, 11:30:13 PM
Applocale, pretty much.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: BrawlerGamma on December 07, 2010, 11:47:08 PM
That's all? I tried to get that and it failed to install... 5 times... and I ran it, and it ran (sort of), so I assumed it was fine without.... Guess not, eh?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Mr. Sacchi on December 07, 2010, 11:51:31 PM
When trying to do anything with japanese things, touhou fangames and danmakufu included, run with applocale, it's pretty much the "ultimate fixer", and I say that from experience *Glares at Genius Of Sappheiros*
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: BrawlerGamma on December 08, 2010, 12:07:57 AM
There we go. Thanks for the help, took a minute figurin' out why the stupid thing wouldn't install right, but it's workin now. Thanks for the help.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: MarielSaen on December 08, 2010, 07:00:15 PM
Can somebody help me on Danmakufu? I don't know where to get picture files for the characters compatible with Danmakufu, and I don't know what every bit of the code to make the game represents.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Stuffman on December 08, 2010, 08:07:55 PM
Oy.

Quote
I don't know where to get picture files for the characters compatible with Danmakufu
DMF uses regular GIFs and PNGs (and possibly BMPs but there's no reason to use those).

Quote
I don't know what every bit of the code to make the game represents.
Read the tutorials.

If you don't even tell us what you're trying to do then how are we supposed to help? At least TRY to write some code so we can tell you why it's not working. This is the laziest help post ever.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on December 08, 2010, 08:09:54 PM
Not to mention there is an actual Q&A thread...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Romantique Tp on December 09, 2010, 02:55:20 PM
Does danmakufu have some standard for spritesheets ? Note that I don't know shit about danmakufu, but I'm thinking about making some "free" spritesheets for practice. (I haven't sprited in a while...)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on December 09, 2010, 04:53:56 PM
png
transparent background is transparent for alpha blend, pure black (0,0,0) is as well, do not use black background for alpha blend if the image is not perfectly opaque
black bg is transparent for add blend as should be obvious, transparency draws as white so don't do that
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Serina on December 09, 2010, 07:28:31 PM
(http://i56.tinypic.com/14y3f3r.png)

Well, i don't get it. I checked and all the { and }'s are okay. I tried just to add a { in the DrawLoop and it asks me to add a }. I tried also adding some random {{{ and the script ran, but there was only a hitbox, i was invincible (that's okay because my Missed loop is empty there's only the yield;) and i couldn't shot.
What can I do?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on December 09, 2010, 07:55:41 PM
(http://i56.tinypic.com/14y3f3r.png)

Well, i don't get it. I checked and all the { and }'s are okay. I tried just to add a { in the DrawLoop and it asks me to add a }. I tried also adding some random {{{ and the script ran, but there was only a hitbox, i was invincible (that's okay because my Missed loop is empty there's only the yield;) and i couldn't shot.
What can I do?

Visible in the error raise:

you have a ; between the closing ) of your if condition and the opening { of the statement.

 :derp:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Serina on December 09, 2010, 08:05:36 PM
Visible in the error raise:

you have a ; between the closing ) of your if condition and the opening { of the statement.

 :derp:

So that's it! Thank you, it should be "if blahblahblah) {" right? Anyway i still getting the same error, but with "(". I'm not very good in english, so maybe i misunderstood what you said hehe~
But thank you very much and sorry if i'm being a idiot.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on December 09, 2010, 08:11:53 PM
To help you, it would be a good idea if you actually posted the code you are working on, or at least the block of code where danmakufu is finding the error.

Make sure to include the lines before the one where the error is. If you are missing a ), a ; or something similar at the end of a statement, danmakufu does not realize that the statement is supposed to be over, so it goes to the next line of code where the error is then raised.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Serina on December 09, 2010, 08:22:38 PM
http://pastebin.com/5kW1dxCV

Well, here's the "important" part. Also i removed the ; of the if's. Ignore this :V

And thank you very much again!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on December 09, 2010, 08:33:20 PM
In line 30 and line 39, you are missing a ) in the internal if conditions.

For all of your SetGraphicRect() commands, you are missing the ; at the end.  :derp:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Serina on December 10, 2010, 01:57:51 PM
Thank you very much! But the error stills... anyway, i'll check again it must be some newbie error i commited.
Thank you very much!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Octopus on December 13, 2010, 06:25:32 AM
If you don't have the disc, you can download the folder needed online. It's called I386. If you can't find it, I do still have my copy.

I downloaded language support off the internet and it worked perfectly! Thanks!

I know this is going to sound even stupider than my last problem, but I can't open the script I've downloaded, (Skies of Insanity) so only the default ones work. They're in my script folder. though. Same deal with the player scripts.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Blargel on December 13, 2010, 07:55:09 AM
Try navigating through the the Directory menu in Danmakufu to the folder where you unpacked the files. Only thing I can think of...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: PurpleMagus on December 14, 2010, 01:03:20 AM
I think...you should get the ;  after KEY_HOLD) off? Anyway,now I would like to know how can we get the screen dark but around the player or some places,like Mystia's 3 last spells,thanks alredy ^^
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Octopus on December 14, 2010, 01:06:57 AM
Try navigating through the the Directory menu in Danmakufu to the folder where you unpacked the files. Only thing I can think of...

That worked, thankyou!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Micro on December 14, 2010, 01:11:52 AM
Does any one know why this code raises an error?

http://pastebin.com/upKWaju6

Block of code = no. Pastebin it. -Hele
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on December 14, 2010, 01:57:09 AM
   task fire
   {
      loop
      {
         flame(GetEnemyX,GetEnemyY,5,90,RED01,30);
         dir+=180/36;
         x++;
         wait(90);
      }

      //Only yield loops!
      //yield;
      }////////////////////////////////////////////////////////////////////////this
   }
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Micro on December 14, 2010, 11:50:38 PM
Thank you very much! I should really remember to use Notepad++ more often. After that I got a few more errors, but I handled them my self.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on December 15, 2010, 12:11:52 AM
Notepad++'s bracket checker isn't all that great for DNH syntax, and actually screws up highlighting too. The best thing you can do is keep consistently tabbing and spacing like you have been. I was actually surprised when I saw a new person use nice tabbing and spacing, gj lol
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Micro on December 15, 2010, 12:41:36 AM
Thank you! Actually, that's why the way Helepolis (and others) does there code bothers me. He does this:
Code: [Select]
thing{
}
Whereas I (and many others) do this:
Code: [Select]
thing
{
}
I think that way makes it easer to read, even if it is a little bigger. Anyone here agree? Also, I've been Danmakufu scripting longer than I've been on, or even heard of, (said, I know) this forum.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on December 15, 2010, 01:04:56 AM
Oh, ok.

Either one is fine. Most professors will tell you to make a new line and it does look more neat, but many people including myself don't bother; it's actually harder for me to read the latter. It isn't for any huge overlying reason or anything, it's just how we do it. It feels weird to do otherwise just as you probably feel weird doing it our way. There are a lot of programming conventions that are ambiguous enough for people to do them multiple ways, don't worry about it.

EDIT: A related thing, take this example.
Code: [Select]
thing{
    stuff;
    }
vs
Code: [Select]
thing{
    stuff;
}
It doesn't actually change anything; it's just how people read things differently.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Blargel on December 15, 2010, 05:10:52 AM
I actually thought the first example was more common than the second. Maybe it's just this community.... and in which case it's probably my fault for making the first ever basics tutorial and everyone learning from my bad habits.  :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on December 15, 2010, 05:37:37 AM
blargel is obv western danmakufu grandpa
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Micro on December 15, 2010, 09:51:47 PM
Notice how everyone is commenting on the first thing I said (or rather, typed), instead of the second where I said:
"... Also, I've been Danmakufu scripting longer than I've been on, or even heard of, (said, I know) this forum."

I wonder what would have happened if I had typed those two things in reverse order...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on December 18, 2010, 08:57:59 PM
Hello,

I must really be missing something here. I'm having some trouble altering the Alpha value of an object effect that I'm drawing. Consider this little piece of code..
Code: [Select]
task Hitbox
{
let obj=Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(obj,img_hitbox);
ObjEffect_SetRenderState(obj,ALPHA);
Obj_SetAlpha(obj,255);
ObjEffect_SetLayer(obj,4);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(obj,4);
ObjEffect_SetVertexXY(obj,0,-50,-75);
ObjEffect_SetVertexXY(obj,1,50,-75);
ObjEffect_SetVertexXY(obj,2,-50,75);
ObjEffect_SetVertexXY(obj,3,50,75);
ObjEffect_SetVertexUV(obj,0,0,0);
ObjEffect_SetVertexUV(obj,1,100,0);
ObjEffect_SetVertexUV(obj,2,0,150);
ObjEffect_SetVertexUV(obj,3,100,150);
while(!Obj_BeDeleted(obj))
{
Obj_SetPosition(obj,GetEnemyX,GetEnemyY);
yield;
}
}
It's a big, ugly yellow rectangle that I want to use for hitbox purposes on large things. However, it won't respond properly to the Obj_SetAlpha part. Even if I set it to 0 it will still be shown fully opaque.

What am I missing here?  ???
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on December 18, 2010, 09:09:14 PM
You have to use ObjEffect_SetVertexColor(obj, vertexnumber, alpha, red, green, blue); for every single vertex instead.

Because danmakufu is stupid.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on December 19, 2010, 01:00:16 PM
Alright, thanks for that. That'll teach me to actually read up on the functions instead of just scrolling through the list trying to find a relevant name. :)

Another thing,

Is it not possible to perform an AddShot on a bullet that was spawned with AddShot? Let's say that I fire bullet (1) like a regular shot, and bullet (2) is then AddShotted from it - can't I then spawn bullet (3) from bullet (2) using the same mechanics as with the first AddShot? I'm trying to get some results with it, but it's all blank at the moment.

There is no reason for double posting =.=  -Hele
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on December 19, 2010, 04:36:31 PM
Another thing,

Is it not possible to perform an AddShot on a bullet that was spawned with AddShot? Let's say that I fire bullet (1) like a regular shot, and bullet (2) is then AddShotted from it - can't I then spawn bullet (3) from bullet (2) using the same mechanics as with the first AddShot? I'm trying to get some results with it, but it's all blank at the moment.
You need to call the AddShot before the bullet you are adding to is fired. I am not 100% sure, but that may mean that you also have to add the tertiary bullet to the secondary bullet before you add the secondary to the primary.

I know for sure that it works if you do it that way, though.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on December 19, 2010, 04:43:44 PM
That worked!

I changed it from
Code: [Select]
AddShot(120,1,2,0);
AddShot(60,2,3,0);
to
Code: [Select]
AddShot(60,2,3,0);
AddShot(120,1,2,0);
and now it behaves exactly like I wanted it to.

Thanks.   :)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Laplace on December 19, 2010, 07:03:16 PM
Hi~
I made an account just to get help :D
Be part of this wonderful community
Anyway, I'm working on a Rumia character using the default Rumia Danmakufu stuff
As usual being the smartass that I am I thought copying a snippet of a code (to make a hitbox) from another character (In this case a Byakuren made by someone on here, I think)
And the results are as expected   :derp:

(http://i55.tinypic.com/11kzjb5.jpg)

And the code

http://pastebin.com/s6PrEiDr

Anyway apologies to the dude/ette for stealing a snippet of code ;c
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on December 19, 2010, 07:20:03 PM
I am going to say that "img" is a string variable that was defined in the original player script you copied the hitbox code snippet from to make refering to the paths of the images easier.

You need to change that line so that you give the command the actual full (relative, please) pathname of the image you would want to use for your hitbox.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Laplace on December 19, 2010, 07:33:14 PM
I am going to say that "img" is a string variable that was defined in the original player script you copied the hitbox code snippet from to make refering to the paths of the images easier.

You need to change that line so that you give the command the actual full (relative, please) pathname of the image you would want to use for your hitbox.

Can you give me an example of how the path should be, please?
I'm sorta confused
Sorry ;;;
I should go back to study Danmakufu scripting
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on December 19, 2010, 07:49:07 PM
Can you give me an example of how the path should be, please?
I'm sorta confused
Sorry ;;;
I should go back to study Danmakufu scripting
Welllllll, have you read the avialable danmakufu tutorials here? There is one on player creation as well, so you may want to take a look if you plan to make one.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Laplace on December 19, 2010, 08:09:35 PM
Welllllll, have you read the avialable danmakufu tutorials here? There is one on player creation as well, so you may want to take a look if you plan to make one.
Not many as of yet.
And that's what I'm doing
I'm taking the Rumia stuff in Danmakufu and making it better
I thought it have been easier to use an already existing character script to learn a few things
But yeah, can you give me an example  :ohdear:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Zengar Zombolt on December 19, 2010, 11:46:05 PM
I'd say that you should learn some boss scripting before player scripting, as it uses some more complex knowledge (Like say, objects.)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Schezo on December 20, 2010, 06:00:00 AM
I can't seem to figure out why this code is doing this with ascent.

Code: [Select]
task fire{
loop{
ascent(i in -29..30){
ascent(j in -14..15){
CreateShot01(GetX, GetY, 3, 90+(i*4), 54, 5);
CreateShot01(GetX, GetY, 1.5, 90+(j*9), 225, 5);
} }
wait(120);
}
}

So, when this task runs, it slows down the framerate and each 1 bullet that I graze gives me 50+ grazes so I assume there a really hundreds of bullets on top of each other but I can't figure out how to make them only one bullet/ spread out.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on December 20, 2010, 06:05:48 AM
The outer ascent runs 58 times, and the inner ascent (called once for every loop through the outer one) runs 28 times. This means it's creating 58x28 = 1624 bullets every 120 frames. A lot of them are stacked on top of each other.
I don't know what you're trying to do, so I can't give you the fixed code, but that explains the slowdown.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Schezo on December 20, 2010, 06:09:58 AM
Hmm, if I'm trying to just fire some spreads of bullets, what would be the correct way to run that without running the loop more than once so the bullets don't stack on each other?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on December 20, 2010, 06:24:53 AM
(Note in advance: When I say "loop," I mean all of loop{}, while(){}, or ascent(){} as a general term, not just loop{}.)
For a simple spread, you'd just need one loop, not two. I think you're just uncertain about how exactly ascent loops work. What they do is create the variable that you specify and set its value to the first number, then loop through the code inside while incrementing that variable by one every time until it hits the second number. If you're just going to be changing one variable - in this case, the angle - you only need one loop. If there's a loop inside a loop, the inner loop will fully execute once for every time the outer loop runs, which isn't what you want. You probably want the stuff involving j to be a separate loop entirely.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Schezo on December 20, 2010, 06:31:39 AM
Ah ok, thank you so much!  It works how I want it to now, so I should stop combining loops from now on as they usually just make unwanted problems.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Zengar Zombolt on December 21, 2010, 11:26:45 PM
Buncha questions here!
1) In which layer is the life bar drawn? As in, what layers are ok to draw Effect Objects over it.
2) Does GetTimer give out anything if there's no SetTimer?
3) Does GetTimer deliver the correct time if there's over 99 seconds left?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Schezo on December 22, 2010, 01:15:40 AM
For 2 and 3, I think this is what you mean.

2. From my testing (it was brief) when I didn't specify SetTimer it gave me a value of 15.
3. Yes, like in the normal Touhous if you specify 120 sec it will just show 99 until the value is <99 then it will count regularly.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Blargel on December 22, 2010, 04:48:56 AM
Those questions aren't exactly hard to test on your own... :3
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Zengar Zombolt on December 22, 2010, 11:38:03 PM
Well I don't have enough time to test at all so yeah. :P
Anyways thanks for the third answer, but I already had a good idea to cover that. Thanks again anyways!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on December 25, 2010, 03:30:24 PM
Hello I have a question.

Code: [Select]
http://pastebin.com/xXUZkxKZcode by : Supreme Gamesmaster

I can't make the task to work  :( and I don't know what's wrong.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on December 25, 2010, 07:28:28 PM
I'm assuming you call the task once and then it should run forever. Otherwise you'd be instantiating the thresholds over and over every time you call it.
In which case, your loop(1){ should be loop{ . The former runs once, the latter runs forever. As it stands, the checking code only runs once.



Also, not saying this wouldn't work, since it should, but what would be a more efficient code is if you kept only one threshold counter variable and an array of possible points. You can also just have it run only until you max out points. Like this:

let pointThreshold = [1,400,600,800,1000,etc];
let thresholdCount = 0;

while( thresholdCount<8 ){ //At least, according to your code it's 8.
         if(GetPoint >= pointThreshold[thresholdCount]) {
            ExtendPlayer(1);
            thresholdCount++;
         }
}
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on December 26, 2010, 08:37:10 AM
Quote from Drake

Yay it's working :D thanks
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on December 26, 2010, 03:46:54 PM
I'm having some more troubles with the AddShot function. How do I get an AddShotted bullet to recognise the angle of the parent shot, and continue in that same direction?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on December 26, 2010, 09:06:31 PM
(http://img402.imageshack.us/img402/4384/addshot.gif)

Think of AddShot like some upside-down tree.

You script the bullets from trunk to branches to smaller branches, then compile the smaller branches into the larger branches, then the larger branches into the trunk. The bullets are fired then from trunk and up.

You can't make the child recognize the angle of the parent, but if you're ascenting through the bullets (as you probably should be doing), then you just use the same counting variable. How exactly are you building your pattern?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Blargel on December 26, 2010, 09:49:48 PM
If you know the starting angle and angular rotation of the bullet, and the time elapsed, you can get the current angle with some calculations and apply it from there. This sort of thing is much more easily handled with shot objects though since you can just create a new shot at the position of the shot object with Obj_GetX and Obj_GetY as well as get the current angle of the shot object with Obj_GetAngle.

It's worth looking into if you're comfortable with AddShot and the like already as that's the next step in Danmakufu scripting anyway.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on December 27, 2010, 05:05:27 PM
Yes, I nailed it after some more tinkering about, thanks. I was actually planning on remaking the pattern I'm building and use object bullets instead of AddShots, but I've run into another snag. I want the bullet spawn to move in a smooth clockwise circle around the boss, starting at GetEnemyX,GetEnemyY-25. I know it involves the use of sin and cos, but I don't fully understand how they work and my random changing of the variables isn't doing much for me either.

Is there a tutorial or something for tricky x and y coordination understanding?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on December 27, 2010, 08:30:54 PM
This was covered in the intermed tutorial. SIMPLE TRIGONOMETRYYYYYY

(http://i46.photobucket.com/albums/f128/Alleo/Circle2.png)

The middle point is your point of origin. If you want to spawn a bullet at (x,y) away from your origin (ox,oy), you spawn your bullet at
ox+cos(A)*L
oy+sin(A)*L

But really just read the intermed tutorial. The above image really has all you need, but the tutorial goes through examples that make it easy to understand.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on December 27, 2010, 09:12:04 PM
Ah, now that was just what I needed! Thanks a lot.  :)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Zengar Zombolt on December 27, 2010, 09:46:35 PM
Quick question!
Is it possible to use AnimationData (Animated bullets) on a Player's Shot Data?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on December 28, 2010, 06:53:25 AM
Quick question!
Is it possible to use AnimationData (Animated bullets) on a Player's Shot Data?
And this is another question that can be simply tested out yourself with minimum effort you know. Afaik, it doesn't work because player shots are different than regular shots, even though the shot sheets are scripted similar.

And even if it is not possible, you can work your way around using effect objects or object bullets with swapping texture.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on December 28, 2010, 08:44:32 AM
It's possible.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chester-low on December 28, 2010, 06:50:52 PM
hi
I have a little problem about sprite animation, I connot animate the boss when he create bullets
the animation of the sprite holds four thumbnail
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Blargel on December 28, 2010, 07:31:10 PM
hi
I have a little problem about sprite animation, I connot animate the boss when he create bullets
the animation of the sprite holds four thumbnail

We're gonna have to see your code. Not to be rude or anything, but since Danmakufu does not inherently have anything that handles animation for you, that means you had to write the code that does the animation so there's probably something wrong with it.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on December 28, 2010, 07:50:09 PM
blargel-sama is so patient
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Marco on December 28, 2010, 09:39:15 PM
Hi!
I've a problem with bouncing bullets.
My script is here: http://pastebin.com/4EYRvMQA (http://pastebin.com/4EYRvMQA)
I used the tutorial-like-script that I found around in this forum to try BUT IT WON'T WORK BWAAAA!!!!
Can you help me please?
PS: I havn't used default bullets... My bullets are named 01,02,03,04,05,06,07,08.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: CK Crash on December 28, 2010, 09:56:50 PM
You need a yield; in @MainLoop. Otherwise, when the task yields to @MainLoop, it will never resume (specifically, the part of the bullet task that checks if it should be bouncing).
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Marco on December 28, 2010, 10:04:56 PM
Oh my *die*
That's right I forgot the yield huahua thanks Lucas!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: KrackoCloud on December 28, 2010, 11:45:09 PM
How can I turn all the bullets into point / star items without ending the spell card?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on December 28, 2010, 11:46:27 PM
How can I turn all the bullets into point / star items without ending the spell card?
http://dmf.shrinemaiden.org/wiki/index.php?title=Bullet_Control_Functions#DeleteEnemyShotToItem (http://dmf.shrinemaiden.org/wiki/index.php?title=Bullet_Control_Functions#DeleteEnemyShotToItem)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on December 29, 2010, 05:10:27 AM
How can I turn all the bullets into point / star items without ending the spell card?

Now the real question is:
How can I end the spell card without turning all the bullets into point/star items?
I try checking if the boss has a low enough life (I used 10 HP of 1000 Max), delete all the bullets, then AddLife(-GetLife);
But the bullets still convert into star items. Do I need to use all object bullets (ObjShot_ToItem)? :ohdear:

Oh, the star items are so ugly, no matter what~
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on December 29, 2010, 08:42:25 AM
If you want to do that, then you'll have to spawn it as a normal enemy, not a boss, and make your own functions for clearing bullets and creating the next attack in @Finalize.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Schezo on December 30, 2010, 04:20:45 AM
These seem to be really silly questions, but

how do you create custom spell circles to get rid of the annoying white stuff flying around bosses and
how do you make a custom boss explosion for when the boss is destroyed?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Blargel on December 30, 2010, 06:56:40 AM
These seem to be really silly questions, but

how do you create custom spell circles to get rid of the annoying white stuff flying around bosses and
how do you make a custom boss explosion for when the boss is destroyed?

To make a custom spell circle, you just need to make an effect object and attach it to the boss and set MagicCircle(false);. To get rid of the white stuff flying around you can replace the effect by putting an transparent png int the th_dnh/img/ folder. I forget what you have to call it though, so maybe someone else can shed some light on that. As for custom boss explosions, there's no good way of doing this, but what I do is make an extra "attack" for the boss that has 1 life and no hitbox. I use this "attack" to make whatever effects I want and play whatever sound I want. Then, when all the effects are finished, I use VanishEnemy; to remove the boss instead of killing it which causes it to skip the default explosion.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on December 30, 2010, 06:58:16 AM
To make a custom spell circle, you just need to make an effect object and attach it to the boss and set MagicCircle(false);. To get rid of the white stuff flying around you can replace the effect by putting an transparent png int the th_dnh/img/ folder.
MagicCircle(false) also removes the floating stuff. No need to mess around with the images.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Schezo on December 30, 2010, 10:57:57 PM
Thanks a lot for your answers.

Now I'm having trouble making all the bullets on the screen move towards the center at the same time.
Is there an easier way of doing this than just setting the individual angle of each bullet?  I have a feeling it is a object bullet of some kind but I need a little guidance on where to start.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on December 30, 2010, 11:00:15 PM
atan2(endY-startY,endX-startX) gets the angle between (startX,startY) and (endX,endY). For example, if x and y are the bullet's current position, set their angle to atan2(GetCenterY-y,GetCenterX-x).
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Channy on January 01, 2011, 08:10:12 AM
Mmm would you like to explain about object lasers? Are they the same as object bullets?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on January 01, 2011, 08:31:42 AM
Object Lasers follow the same rules as Shots, but you just need to set a length and width as well. That's... pretty much it. Please take any further questions to the Q&A thread. (http://www.shrinemaiden.org/forum/index.php/topic,6424.0.html)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Captain Murasa on January 02, 2011, 08:16:35 AM
I've recently discovered Danmakufu, and, being a computer guy, naturally got attracted by the programming stuff. However, while crafting up a script, I couldn't get the anchor bullets to work. And what's Murasa without her anchors (if you haven't gotten hint yet, I'm big on Murasa)? I don't know if it's appropriate to ask here, but I'll try. >_>

Code: [Select]
task superbullet(x,y,v,dir,graphic,delay){
let anchorbullet=0;
let anchorangle=0;
let anchorspawn=0;
PlaySE(CSD ~ "sfx\tan02.wav");
let anchortoss = Obj_Create(OBJ_EFFECT);
Obj_SetPosition(anchortoss,GetEnemyX,GetEnemyY);
ObjEffect_SetLayer(anchortoss,7);
ObjEffect_SetTexture(anchortoss,Anchor);
ObjEffect_SetPrimitiveType(anchortoss,PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(anchortoss,4);
ObjEffect_SetScale(anchortoss,1,1);
ObjEffect_SetVertexXY(anchortoss,0,-64,-64);
ObjEffect_SetVertexUV(anchortoss,0,0,0);
ObjEffect_SetVertexXY(anchortoss,1,64,-64);
ObjEffect_SetVertexUV(anchortoss,1,128,0);
ObjEffect_SetVertexXY(anchortoss,2,-64,64);
ObjEffect_SetVertexUV(anchortoss,2,0,128);
ObjEffect_SetVertexXY(anchortoss,3,64,64);
ObjEffect_SetVertexUV(anchortoss,3,128,128);
ObjEffect_SetAngle(anchortoss,0,0,90);
Obj_SetSpeed(anchortoss,4);

let anchorbullet = Obj_Create(OBJ_SHOT);
Obj_SetPosition(anchorbullet,GetEnemyX,GetEnemyY);
Obj_SetSpeed(anchorbullet,4);
Obj_SetAngle(anchorbullet,GetAngleToPlayer);
ObjShot_SetBombResist(anchorbullet,true);
ObjShot_SetGraphic(anchorbullet,graphic);

while(!Obj_BeDeleted(anchortoss)){

CreateShot01(GetEnemyX,GetEnemyY,4,90,Anchor,0);

wait(60);
yield;
}
}

Now I've gotten the anchor bullet to load nice and well, but the problem is... the bullet sprite keeps on flying to the immediate right of the boss. However, the hitbox of the anchors continue flying towards me as usual. Which parameter do I switch up to cause the anchors to work properly?

First comment by the way. ;)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on January 02, 2011, 08:29:56 AM
Effect object's angle is set using ObjEffect_SetAngle(obj,x,y,z); 

And next time, please post inside the Q&A thread all your questions. There is like obvious STICKY out there with guidelines on how to post =|
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Captain Murasa on January 02, 2011, 08:36:31 AM
I'm sorry, I just really want to get done with this script. >_> Desperation means I don't have much time to read. And thanks!

EDIT:

ObjEffect_SetAngle(obj,x,y,z); 

What do the parameters x, y and z stand for? If I leave both x and y as 0 and z as GetAngleToPlayer, the anchor comes out perfectly but it only flies to the right side of the boss. However, the tip of the anchor IS pointing towards the player.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on January 02, 2011, 11:02:59 AM
I'm sorry, I just really want to get done with this script. >_> Desperation means I don't have much time to read. And thanks!
That isn't the correct attitude to have though. Mainly because this thread is read and answered very fast, hence it has already 4 threads in history and lots of pages. There is no such thing as "I am in a hurry so I bluntly post a thread because it will help me faster" in this forum section. Now for your question.

ObjEffect_SetAngle(obj,x,y,z); 

What do the parameters x, y and z stand for? If I leave both x and y as 0 and z as GetAngleToPlayer, the anchor comes out perfectly but it only flies to the right side of the boss. However, the tip of the anchor IS pointing towards the player.
x y z are the parameters for flipping or tilting the image. X parameter flips the image around the x-axis, y around the y-axis and z makes it rotate. If it is flying to the right of the boss, it means it has a movement angle of 0.

Take a look at your own code. You are saying  "let anchorangle = 0;"  but doing nothing with it. And defining   ObjEffect_SetAngle(anchortoss,0,0,90); but you are nowhere defining WHERE the object bullet should move. You need to also define Obj_SetAngle(obj,angle);  Remember that these are two different angle functions. The ObjEffect one is only for the graphics and the Obj_Angle is for the actual angle of the object bullet.

To fix your issue:
- Remove let anchorangle = 0; because you are doing nothing with it.
- Add  Obj_SetAngle(obj,dir);   <-- because you are using the parameter dir in your task.
- Change the effect angle to ObjEffect_SetAngle(obj,0,0,dir);
- Call the bullet in your script with superbullet(x,y,v,dir,graphic,delay);  where dir = GetAngleToPlayer.

The parameter will automatically pass down the direction angle for both the Object it self and the effect angle.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Captain Murasa on January 02, 2011, 11:30:02 AM
Very much thanks, and sorry again. That's just how I am, unfortunately.

Now that the anchor movement issue is fixed... The only other problem is the anchor hitbox. It's unusually small, which appears to be around 25 pixels in diameter. How do I go about changing that?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TBox on January 04, 2011, 09:50:15 PM
Like Patchouli's Green Storm or Sylphae Horn (even though that's supposed to be leaves) or Moedan Spell Card 29?  I want to see how it's done and I'm drawing a blank on how to search for it.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Blargel on January 04, 2011, 11:00:29 PM
I don't see what's so difficult to imitate about Patchouli's leaf attacks and I don't remember spellcard 29 in Moedan. You should probably be more specific on what part of the attack you don't understand.

Also, use this thread instead of making your own thread to ask simple questions from now on.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TBox on January 04, 2011, 11:03:55 PM
I've never done anything danmakufu before and I was hoping to skip that tedious "learning" stage and modify something close to my goal.  Oh well, I'll start from the beginning like a good boy.

PS:  Is there a faq I missed about posting in this thread?  I feel guilty having to be moved.  Oh, nm, there it is.  ( -.-)  I'm sorry I missed it.  Could you maybe make that rules part of the faq a different color?  My eyes were drawn to the shiny blue FAQ link and I glossed right over it.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Blargel on January 05, 2011, 07:38:28 AM
Making the Rules heading larger and coloring it would probably be a good idea. We've been getting quite a few stray "help me" threads that have been merged in here lately. Maybe sticky the Q&A thread too so it's harder to miss?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on January 05, 2011, 03:36:13 PM
Maybe sticky the Q&A thread too so it's harder to miss?

People read stickies?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TBox on January 05, 2011, 03:42:48 PM
This one reads stickies.  Mostly.

Is there an index of Danmakufu statements?  The wiki has a nice list of functions, but not statements.  I had a heck of a time finding a reference to "ascent"
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Kylesky on January 05, 2011, 04:00:11 PM
This one reads stickies.  Mostly.

Is there an index of Danmakufu statements?  The wiki has a nice list of functions, but not statements.  I had a heck of a time finding a reference to "ascent"

Well... we have the great information thread (that's STICKIED). :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TBox on January 05, 2011, 04:13:22 PM
I did read that.  It has several tutorials, but no indices.  There's a link to the wiki, which has a function index on the front page, but the wiki does not have a statement index.  I finally had the bright idea to search the wiki (I dunno I always forget about search functions) and found the ascent statement in the beginner's tutorial.  In retrospect that makes sense, but I stopped reading the beginner's tutorial when it started talking about how if statements worked.  I have a bit more comp sci behind me than that.

The function index gives the impression that all danmaku built-ins start with a capital letter, so when I was browsing code and saw "ascent" with a lower case letter, I made a lot of bad assumptions.  You have to admit it's not a statement found in common languages. 

The beginner tutorial shows a lot of neat statements now that I slog through all of it, but how do I know that's all of them?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on January 05, 2011, 05:24:08 PM
The old touhouwiki used to have arbitrary syntax rules somewhere, but they haven't yet been added to the DNH wiki.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on January 05, 2011, 05:47:20 PM
Tagging along the talk about functions and stuff, what exactly are the functional differences between a Task and a Function? A common custom function is Wait(w), but how would a Task built in the same way be different?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on January 05, 2011, 06:32:20 PM
Tagging along the talk about functions and stuff, what exactly are the functional differences between a Task and a Function? A common custom function is Wait(w), but how would a Task built in the same way be different?
A function is just a shorthand for a piece of code.

A task, on the other hand, is a whole new code thread that runs alongside @MainLoop{} once you call it. Since it is seperate from the code thread that called it, you can suspend it with the yield; command without suspending the original code.

This means:
1. tasks called in the MainLoop{} can last for more than one frame while functions cannot.
2. tasks cannot be used to return information with the return(); command.
3. tasks take more processing power than a function that would accomplish the same.

There are many things tasks can do which functions can't, some things functions can that tasks can't, and in pretty much all other cases you will want a function rather than a task to keep the performance up.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on January 05, 2011, 07:48:58 PM
Ah, that's a significant fundamental difference to keep in mind. Now that you mention it, my attempts to stall the MainLoop with loop(){yield;} have never been successful - now I know why!

Thanks.  :derp:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on January 05, 2011, 08:53:15 PM
It should be noted that both tasks and functions can include parameters, while a sub cannot. A sub is basically a function that doesn't have parameters, and it runs much faster than a function as a result, so if you don't want your block of code to have parameters (or more accurately, don't need it to have them), then it's wise to use subs instead of functions.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on January 05, 2011, 10:42:12 PM
subs also cannot return values and are usually quite tasty
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on January 06, 2011, 08:07:27 AM
The old touhouwiki used to have arbitrary syntax rules somewhere, but they haven't yet been added to the DNH wiki.

Most time I use this http://en.touhouwiki.net/wiki/Category:Touhou_Danmakufu

I will see what I can do about increasing font in the FAQ
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TBox on January 06, 2011, 05:28:56 PM
When you're using CreateShotWhatever with a non-default bullet, what determines the hitbox?  Can you specify that in the shot data file?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on January 06, 2011, 05:33:33 PM
The size of a bullet's hitbox is proportional to the size of its graphic rect. This means you can increase the hitbox size of a bullet by adding more empty space around the bullet inside the shotsheet and then encompassing it with the grapic rect.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TBox on January 06, 2011, 07:10:23 PM
What I hear you saying is that the hitbox is a (rectangle?  square?  circle?) centered on the image but the size of the hitbox is not the size of the image.  Is that correct?  Do we know the proportion?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on January 06, 2011, 07:14:33 PM
It's a circle, with a radius of about half the smallest two parallel sides. ScriptVersion[3] allows hitbox size declaration in shot files, but mkm still hasn't released it :(
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Zengar Zombolt on January 06, 2011, 07:16:36 PM
ScriptVersion[3] allows hitbox size declaration in shot files, but mkm still hasn't released it :(
METAL FATIGUE BULLETS will be so fun. Oh so fun.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on January 06, 2011, 07:22:31 PM
METAL FATIGUE BULLETS will be so fun. Oh so fun.
Pffft, pushover. Mima's final form bullets, now THOSE will be fun.  >:D
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TBox on January 06, 2011, 07:39:24 PM
I'm glad I asked.  My card would've been hateful.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Zengar Zombolt on January 06, 2011, 08:48:23 PM
Object oddities galore!
http://pastebin.com/RSFaJvMn
This code is supposed to create a beam from the player, aimed at the angle the task was called with (Only supposed to be used with the angles inside the if statements at the top). After that, the angle changes so it eventually reaches the main laser of the bomb (Aimed at 270 degrees, AKA straight up). However, I'm getting some rare behaviors on the lasers. Help a bro?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TBox on January 07, 2011, 01:09:19 AM
Can you get rid of the shiny glow at the base of a CreateLaserA?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on January 07, 2011, 01:46:44 AM
Can you get rid of the shiny glow at the base of a CreateLaserA?
ObjLaser_SetSource(false);

No, you can't.

Zengar I'm going to have to draw your stuff out to be able to understand it :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Laplace on January 07, 2011, 06:53:11 PM
I'm probably living proof that stickies aren't to be read
How do you get a coordinate in an image?
For example, I made a sprite sheet and in that sprite sheet, there's well a sprite
that I want to use as a life image.
Is this trial and error or is there something I'm missing to find said coordinates?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on January 07, 2011, 06:56:31 PM
I'm probably living proof that stickies aren't to be read
How do you get a coordinate in an image?
For example, I made a sprite sheet and in that sprite sheet, there's well a sprite
that I want to use as a life image.
Is this trial and error or is there something I'm missing to find said coordinates?
1. Open the image in MS Paint or a similar program.
2. Zoom in as much as neccessary
3. Move your mouse to the location you want the coordinate of. It should be displayed at the bottom of the window, iirc.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Laplace on January 07, 2011, 07:05:25 PM
1. Open the image in MS Paint or a similar program.
2. Zoom in as much as neccessary
3. Move your mouse to the location you want the coordinate of. It should be displayed at the bottom of the window, iirc.

Oh my
So simple
Thanks Iryan, you are the best or something similar.
:V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on January 07, 2011, 07:33:31 PM
You can also enable it in Photoshop with F8 or Window->Info.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TBox on January 07, 2011, 10:21:49 PM
Object oddities galore!
http://pastebin.com/RSFaJvMn
This code is supposed to create a beam from the player, aimed at the angle the task was called with (Only supposed to be used with the angles inside the if statements at the top). After that, the angle changes so it eventually reaches the main laser of the bomb (Aimed at 270 degrees, AKA straight up). However, I'm getting some rare behaviors on the lasers. Help a bro?

DMF chokes on ObjEffect_SetAlphaGreen and I can't find it in either the wiki or the Japanese manual.  Where does it come from?  Also, what's your BeamImage?  I know how it feels when you don't want to release a project before it's done, but maybe you should mock up a full player script that we can test with?  Or maybe describe better what the lasers are doing for you.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Laplace on January 08, 2011, 12:09:43 PM
You can also enable it in Photoshop with F8 or Window->Info.

So that's what that tiny window above Swatches is.
Thanks.

Edit2;

Been working on something basic, with DoubleVia's tutorials on Youtube
This time I wrote the code directly on a Notepad file as I watched the videos instead of writing down stuff in my sketchbook.


http://pastebin.com/5nfdYFqA

What am I doing wrong in that script, now?  :ohdear:
When I run it this error pops up, now.

http://i51.tinypic.com/vsjg60.jpg

Did you guys had the same issues when you first started basic scripting? v__v

Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Luna on January 08, 2011, 03:32:42 PM
"SetMovePosition" isn't a function. <.<

The (simplest?) functions to move the enemy to coordinates "X, Y" are

SetMovePosition01(x, y, speed);
SetMovePosition02(x, y, frames);
SetMovePosition03(x, y, weight, max speed);

So if you want to move the boss to the center, with a speed of 6, the correct function is
SetMovePosition01(GetCenterX, GetCenterY, 6);
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Zengar Zombolt on January 08, 2011, 04:58:19 PM
DMF chokes on ObjEffect_SetAlphaGreen and I can't find it in either the wiki or the Japanese manual.  Where does it come from?  Also, what's your BeamImage?  I know how it feels when you don't want to release a project before it's done, but maybe you should mock up a full player script that we can test with?  Or maybe describe better what the lasers are doing for you.
This ain't a problem. SetAlphaGreen is a function made by myself to set all the Vertices' color to green (And set their Alpha value).
http://www.mediafire.com/?7e93f7gt12kgq0c
This is it complete. I'm having problems mostly with the trig stuff however, all the rest of the functions and whatnot are already tested.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: RemiFlan on January 08, 2011, 08:03:10 PM
Can I ask a question since it's about questions and answers? Umm ok so I was wondering if danmakufu could be runed without applocale just by going to control panel->language and region->administrative->japanese (japan) Or do I Have to download applocale cause I'd rather not. :)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Laplace on January 08, 2011, 08:06:56 PM
Can I ask a question since it's about questions and answers? Umm ok so I was wondering if danmakufu could be runed without applocale just by going to control panel->language and region->administrative->japanese (japan) Or do I Have to download applocale cause I'd rather not. :)
Well I did that once and the programs that needed to be run with Applocale didn't need Applocale anymore.
Try it out for yourself and good luck.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Zengar Zombolt on January 08, 2011, 08:14:13 PM
It works, but many things that do not need Applocale may start to misfunction.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TBox on January 08, 2011, 10:08:37 PM
The biggest pain is how it replaces most backslashes with yen signs.  And some of the more portably written programs will auto-reskin to japanese.  Apple Update will, for example.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on January 08, 2011, 10:53:18 PM
Setting Windows Locale to Japanese is definitely the easiest way, but honestly installing Applocale and the right-click extension is the most flexible option out there. The only more flexible one would be a command-line parameter.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TBox on January 09, 2011, 02:59:27 AM
This ain't a problem. SetAlphaGreen is a function made by myself to set all the Vertices' color to green (And set their Alpha value).
http://www.mediafire.com/?7e93f7gt12kgq0c
This is it complete. I'm having problems mostly with the trig stuff however, all the rest of the functions and whatnot are already tested.

I'll be honest, I suck at trig.  I started from scratch.  Works.

http://www.mediafire.com/?gixuq8gd48p54zd

Got the GetPointInDirection function from the helpful code snippets thread, even.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: KuraiShoka on January 09, 2011, 04:25:47 AM
I should've come here a while ago  :V
I have a script I'm working on that requires lasers to bounce on the screen. But for some reason they delay when bouncing off the top, and don't change position when bouncing off the side.

http://pastebin.com/UdbsSgxU

Can someone help me with this?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: RemiFlan on January 09, 2011, 02:17:17 PM
Well I did that once and the programs that needed to be run with Applocale didn't need Applocale anymore.
Try it out for yourself and good luck.
Ok thanks! :)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TBox on January 09, 2011, 04:30:50 PM
I should've come here a while ago  :V
I have a script I'm working on that requires lasers to bounce on the screen. But for some reason they delay when bouncing off the top, and don't change position when bouncing off the side.

http://pastebin.com/UdbsSgxU

Can someone help me with this?

I'm not at home and can't test but you may want to compare yours to this reflection function:
http://www.shrinemaiden.org/forum/index.php/topic,5164.msg339908.html#msg339908
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Zengar Zombolt on January 09, 2011, 04:57:28 PM
GetPointInDirection
arghagh how did I didn't notice this
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: KuraiShoka on January 09, 2011, 05:09:10 PM
I'm not at home and can't test but you may want to compare yours to this reflection function:
http://www.shrinemaiden.org/forum/index.php/topic,5164.msg339908.html#msg339908

Worked like a charm, thanks!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TBox on January 09, 2011, 05:33:43 PM
arghagh how did I didn't notice this

I know you're just kidding around but I have a serious answer for you.  In the snippets thread a lot of people post big colored headers for their functions, which trains you to look for that while cruising it.  When someone posts something plain like this:

http://www.shrinemaiden.org/forum/index.php/topic,5164.msg494187.html#msg494187

You just skip over it.  It's the same reason I missed the line about "Post questions in this thread."  I found a comic strip once that preyed on this, big balloon in the last panel that says "I bet you read this one first!" and a smaller one in the first panel that said, "It's too late now to come back here."

I'm only saying this so I can add:  I *really* want to do some psychology of vision tests with danmakufu and see how people react.  Unfortunately a lot of them probably fall under "tricking the player" so... I'm hesitant.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Zengar Zombolt on January 09, 2011, 05:51:03 PM
http://www.shrinemaiden.org/forum/index.php/topic,5164.msg494187.html#msg494187
Now that I see it, GetPointInDirectionFromPlayer would also be rather useful for hitbox declaration. Thanks!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: KuraiShoka on January 10, 2011, 12:22:12 AM
Sorry for bothering again :V

I'm trying to get my object laser to bounce off the screen using this method:
http://www.shrinemaiden.org/forum/index.php/topic,5164.msg339908.html#msg339908

I'm trying to modify it so that my laser can bounce off the bottom as well, but I can't get it to work.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on January 10, 2011, 12:28:31 AM
It would be great if you actually posted your script instead of us having to guess what your mistake is.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: KuraiShoka on January 10, 2011, 12:33:36 AM
It would be great if you actually posted your script instead of us having to guess what your mistake is.

whoops, forgot to do that :V
http://pastebin.com/vCYQ69j4
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on January 10, 2011, 01:55:18 PM
whoops, forgot to do that :V
http://pastebin.com/vCYQ69j4

I can't say how kosher and/or efficient this solution really is, but adding the following if-statement between the ceiling and wall detections did it for me.

Code: [Select]
else if(angle>0&&y>GetClipMaxY&&x>GetClipMinX&&x<GetClipMaxX)
{
if(count>0){TReflectionLaser(x, y, v, -angle, maxLen, width, graphic, 0, count-1);}
break;
}

Basically reversing the check on 'angle' and 'y' while using the ClipMax instead of ClipMin.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TBox on January 10, 2011, 06:00:21 PM
What's the secret to a pretty bullet?  Mine look like a kindergartner playing with construction paper, only without the charm.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on January 10, 2011, 09:21:24 PM
What's the secret to a pretty bullet?  Mine look like a kindergartner playing with construction paper, only without the charm.

You'll have to define "pretty bullet" a bit more for me. If you're talking about bullet patterns and arrangements I'll suggest that you practice by replicating your favourites of ZUN's patterns. If you're going for the real thing you'll have to pay attention to and find solutions for all of the minute detailing that the man puts into his work, things that are easily overlooked otherwise. That's what I'm doing at the moment, anyway. Hopefully it'll start to rub off on me enough that I'll be composing pretty things myself at one point or another.  :derp:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TBox on January 10, 2011, 09:33:21 PM
I'm talking about the sprites.  Looking at the existing bullets I think my biggest problem might be using the alpha channel more creatively and somehow getting that glowy aura going.  How do you get a glowy aura on your bullet sprite?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on January 10, 2011, 09:38:41 PM
Oh. That's currently out of my field, but you could try to use DMF's ADD blending instead of Alpha. I've heard and/or read that it's the one to use for transparent (ie glowy) bits and doo-dahs.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on January 10, 2011, 09:39:22 PM
I'm talking about the sprites.  Looking at the existing bullets I think my biggest problem might be using the alpha channel more creatively and somehow getting that glowy aura going.  How do you get a glowy aura on your bullet sprite?
I don't know much, but what I do know is this:

If you want alpha-blended bullets, you need to modify the transparency values of the image and surround the bullets with 100% transparent pixels.
If you want glowy add-blended bullets, you need to cause the differences in brightness and transparency through color darkness and the bullets have to be surrounded by 0/0/0 color.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on January 10, 2011, 10:31:20 PM
You're basically just asking "how do I draw well," which nobody can answer. Just keep practicing.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TBox on January 10, 2011, 10:46:48 PM
I suppose you're right.  But all the bullet sheets (the defaults and the replacements in the threads) have a sort of familial similarity that I can't put my finger on.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Channy on January 11, 2011, 09:53:50 AM
What kind of shot(s) make(s) Shou's non-spell lasers? They all seem to have two colors.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on January 11, 2011, 01:31:29 PM
What kind of shot(s) make(s) Shou's non-spell lasers? They all seem to have two colors.

You mean, CURVING LASER ? omg get in the car

Quote
CreateLaserC
These lasers are usually seen only in Perfect Cherry Blossom, namely against Letty Whiterock or Merlin Prismriver. I'm talking about those annoying curving lasers... or at least they're annoying when Merlin uses them. These lasers are very heavy on the processor so use them sparingly (i.e. don't have fifty of them out at once). However, if you've mastered controlling ShotAs and LaserAs, this will be really easy for you to use. The parameters for CreateLaserC are exactly the same as those of CreateLaserA and the parameters for SetLaserDataC are exactly the same as those of SetShotDataA. In other words, LaserCs are pretty much ShotAs with a tail following them.

read more here

http://www.shrinemaiden.org/forum/index.php/topic,30.0.html

and there's something about Sinuate laser

http://dmf.shrinemaiden.org/wiki/index.php?title=Object_Control_Functions#Sinuate_Laser_Object_Functions
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on January 11, 2011, 05:09:28 PM
One thing to know about curvy lasers in danmakufu, both LaserCs and Sinuate laser objects:

In their case, the "length" value you give them is not actual length in pixels.
The end of the laser moves by its speed value every frame, and the rest of the laser, its "tail", so to speak, consists of many singular points, all of which take the position that the piece in front of them had last frame every frame. Danmakufu then calculates the graphic and hitbox of the laser based on these singular points. This is also why they are so expensive on the processing power and should be used sparingly.

The "length" parameter of a curvy laser in danmakufu is actually the number of the singular points the laser is made of. This means that the actual length is dependant on the speed of the laser, since that is the distance between two points on the laser. It also means that if you increase the speed of the laser it will become longer, as well as the other way round.

Also, please only use bullet graphics for curvy lasers (actually, for lasers in general, but here it is even more important) which have a clearly visible outline when add-blended. The bubble bullets work quite well for this, but most bullet graphics don't.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TBox on January 12, 2011, 12:20:45 AM
Is the hate for curving lasers because they're hard to predict, because they're hard on the processor, both, or neither?  Any other patterns/components that should be avoided?  Besides the brofist script.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Blargel on January 12, 2011, 05:55:57 AM
Is the hate for curving lasers because they're hard to predict, because they're hard on the processor, both, or neither?  Any other patterns/components that should be avoided?  Besides the brofist script.

The hate is for the unpredictability and unreadability of a lot of them -- especially Shou's.

As for bad ideas in attack design, a lot of it is opinion, but here's what I think you should avoid:
 - Too many add blended bullets. Additively blended images layered on top of each other get brighter and brighter so with a lot of bullets, it just becomes a blob of unreadable whiteness.
 - Puzzle/pathfinding gimmicks. Unless it's a game like StB or a Last Word or something. Attacks that you have to figure out by dying repeatedly in order to dodge correctly is just a cheap shot in a full multi-stage game.
 - Curvy bullet spam. Curvy bullets are just as bad as curvy lasers. Maybe even worse because you cant see the trail as easily to help identify the trajectory. I would straighten out the bullets before they reach the bottom 1/3 of the screen
 - Super fast bullets. Common sense, I'd think.

In general, I like to believe that attacks should be able to be beaten the first time they're played if the player is skilled enough. Attacks that cannot be beaten unless you've played them before aren't fun to me. Of course, what "skilled enough" means is entirely up to you.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on January 12, 2011, 06:59:56 AM
- Too many add blended bullets.
Just to note, the main problem is that overlapping bullets make it more difficult to process in the brain since there are no edges between the bullets. You can do as GFW did, and have bullets that are both add-blend AND alpha. Another factor is that it is more difficult to track trajectories with low-contrast areas (talking bullet-to-background), so the bullets should be fairly visible on your BG.

- Puzzle/pathfinding gimmicks.
A few, especially in an Extra stage-ish setting, are okay. A very good exception I can name off is Green Eyed Monster, Parsee's midboss card.

- Curvy bullet spam.
Going to add that slow curvy bullets can be good, and curvy bullets that you don't have to actively dodge are also fine. It's when you have to constantly process the bullet's trajectories (especially at fast speeds, incl. curvy lasers) that it gets confusing. Worth mentioning in this case are pretty much all off Yuyuko's cards. PCB as a whole has many good cards with curving bullets.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Channy on January 12, 2011, 11:54:30 AM
Okay thanks :)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TBox on January 13, 2011, 07:20:48 PM
For Obj_IsIntersected, what counts as an "Attackable target"?  That is, what makes it return true?

EDIT:  Actually, let me just state the problem:  How do I act on two objects intersecting each other, given that neither object is a player or an enemy?  Do I really need to write my own collision detection from scratch?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on January 13, 2011, 07:36:59 PM
For Obj_IsIntersected, what counts as an "Attackable target"?  That is, what makes it return true?

EDIT:  Actually, let me just state the problem:  How do I act on two objects intersecting each other, given that neither object is a player or an enemy?  Do I really need to write my own collision detection from scratch?
Are they bullets/lasers? If so, you can call Obj_SetCollisionToObject(obj, true); after the creation of the object to enagle collision detection against other objects. You then can check for their collision using Collision_Obj_Obj(obj1, obj2). However, this will require that the IDs of the objects you want to collide be stored in a way that they can be accessed by the other bullets, usually meaning: You need to create an array at the beginning of script_enemy_main{ } in which you store the IDs of the objects, and you need to insert code in each object that removes its ID from the array. Then you can check for collision between any of those objects by refering to the places their ID have in the array.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TBox on January 13, 2011, 08:21:51 PM
I can do what I need to with that, thank you.  However, I have to ask... does it only work with bullets/lasers?  Is there a way to do it with an effect object?  And what does IsIntersected do then?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on January 13, 2011, 08:40:11 PM
However, I have to ask... does it only work with bullets/lasers?  Is there a way to do it with an effect object?  And what does IsIntersected do then?
I don't have a clue.


Oh, and I just noticed that one sentence in my post is missing important information: The code that removes the object ID from the array is supposed to be at the point where the object is destroyed, not before then.  :derp:
I usually do that by putting it in the object task behind the while(Obj_BeDeleted(obj)==false){ } brackets, so it runs automatically when the object ceases to exist before the task completely expires.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on January 13, 2011, 09:24:18 PM
Don't be so intimidated by "writing your own collision function from scratch." It's really easy if you know the math. Assuming you want circle-to-circle collision, Pythagorean Theorem is your friend:
Code: [Select]
if( (x1-x2)^2 + (y1-y2)^2 < (radius1+radius2)^2 ){theobjectscollided;}(x1,y1) is the position of the first object and (x2,y2) is the position of the second. Radius is obvious.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TBox on January 14, 2011, 01:19:02 AM
Plan A failed.  Plan B requires a way to get the player's hitbox.  Is this possible?  I'm not seeing an easy way on the list of misc functions.  Otherwise I'm just going to take a callous attitude towards "thin" characters like Reimu.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on January 14, 2011, 01:27:04 AM
The default Reimu and Marisa players have the same size hitbox, which is 0. Most custom player characters follow this example.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TBox on January 14, 2011, 04:58:55 PM
Is there a page for sprites like there is for shotreplace?  I want to steal a fairy sprite.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on January 14, 2011, 05:17:37 PM
Lots of sources here (http://www.shrinemaiden.org/forum/index.php/topic,197.0.html). Keep in mind that making your own sprites is grossly prefered to stealing somebody elses, so if you publish your work or whatever try to make your own or commission somebody to make some for you.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TBox on January 14, 2011, 05:20:16 PM
I'm commissioning, but he can only draw so fast (and only in his free time).  And I can only afford so much.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: capt. h on January 14, 2011, 08:07:25 PM
I installed app local, I'm using the right language pack, and danmakufu is still crashing whenever I try to run it. I also can't find the shortcut I created to run danmakufu. Is there something I'm missing? I'm running Windows 7, and I followed the guide here: http://www.shrinemaiden.org/forum/index.php/topic,4138.0.html

EDIT: I think the problem is that I'm running the program straight, instead of in compatibility mode. I'm not sure how to run it differently though.

EDIT: Sorry. figured it out. Is there an english patch? I'm having some trouble navigating the program. I cannot get this thing running without crashing. I need to do compatibility mode while running it with apploc. I have no idea how to do that.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: RavenEngie on January 14, 2011, 08:19:17 PM
It goes:
> All (All scripts)
> Single (Single Spellcards)
> Plural (Bosses)
> Stage
> Random
> Directory (Opens up your "script" folder in the program, so you can navigate to the file you want)
> Exit

... Also, does 'Directory' seem to load faster for anyone else than the other options?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on January 14, 2011, 08:24:13 PM
Of course Directory loads faster, it doesn't load every script at once.

Also.

http://alcahest.perso.sfr.fr/perso/apploc/applocpatched.zip

Download that, replace the applocale exe in C:\Windows\AppPatch.

http://alcahest.perso.sfr.fr/perso/apploc/localejaptoexecontext.zip

Download that, run the install reg file.

Right click th_dnh.exe, Properties. Compatibility Mode, change stuff.

Restart comp, right-click th_dnh.exe, Locale Japanese.

All problems solved.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: capt. h on January 14, 2011, 08:40:33 PM
Of course Directory loads faster, it doesn't load every script at once.

Also.

http://alcahest.perso.sfr.fr/perso/apploc/applocpatched.zip

Download that, replace the applocale exe in C:\Windows\AppPatch.

http://alcahest.perso.sfr.fr/perso/apploc/localejaptoexecontext.zip

Download that, run the install reg file.

Right click th_dnh.exe, Properties. Compatibility Mode, change stuff.

Restart comp, right-click th_dnh.exe, Locale Japanese.

All problems solved.

Using this, I was able to get inside the program's title screen without crashing. I try to run a script (Hit anything other than directory) and it stops working immediately. I'm running danmakufu in 2000 compatibility mode, but only the main program and the config program; I don't think I can put an entire file into compatibility mode like that.

Thanks, I am able to get much farther than last time, but I'm still crashing before I pass the title screen. Is there anything else I could do?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Romantique Tp on January 14, 2011, 10:13:53 PM
It might be a problem with the script (or how you extracted it), since danmakufu runs fine without compatibility mode on both vista and win7.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TBox on January 14, 2011, 11:32:11 PM
I'm taking a wild guess here and will be embarrassed if I'm wrong, but if you haven't yet, move everything to your documents folder, executables and all.  Windows Vista and 7 do not play well with older programs installed into Program Files.  You can make them work if you try hard enough, or you can just ship off elsewhere.  Also, even though AppLocale is supposed to solve the problem, try renaming folders so they don't contain japanese characters.

I'm just going over random stuff that has fixed other Jap programs for me before...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: capt. h on January 14, 2011, 11:42:48 PM
It might be a problem with the script (or how you extracted it), since danmakufu runs fine without compatibility mode on both vista and win7.

Oddly, deleting and reinstalling danmakufu got it up and running perfectly. Thanks!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on January 14, 2011, 11:48:43 PM
The problem was your script index file. You could have deleted that and it would have started working again.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TBox on January 15, 2011, 01:54:02 AM
Can you move enemies during an event script?  Like on PCB stage 4, when Lunasa pops out in the middle.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on January 15, 2011, 01:58:50 AM
An event script doesn't just randomly halt the main script, it'll keep going unless you tell it to yield while OnEvent. When you get to the part that you want to do something, just throw in a omgflag=true; and have the main script act accordingly. Or even, just yield until omgflag is true. Or something of the sort.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on January 15, 2011, 01:59:16 AM
Can you move enemies during an event script?  Like on PCB stage 4, when Lunasa pops out in the middle.

SetStep and GetEventStep.
Combine them with a task in the enemy script that calls the event = KABLAM. Moving!!

I'll type up an example later.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: LostCelesti on January 15, 2011, 10:54:59 AM
Does anybody know how to imitate this spellcard for Danmakufu?
http://www.youtube.com/watch?v=UwUtw_kzTBM
I really want to make that one.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on January 15, 2011, 11:10:13 AM
Code: [Select]
function SuperHuman(tx, ty, v, ang, n, t, delay){
  let px=GetX; let py=GetY;
  ascent(i in 0..n){
    CreateShotA(1, px+ (tx-px)*i/(n-1), py+ (ty-py)*i/(n-1), t);
    SetShotDataA(1, 0, 0, ang+720*i/(n-1), 0, 0, 0, BLUE01);
    SetShotDataA(1, delay, 0, ang+720*i/(n-1), 0, 0.1, v, BLUE01);
  }
  SetMovePosition02(tx, ty, t);
}
Not tested, but this should give you one of Byakuren's dashes in a customizable way. If it works, calibrate, then abuse.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: LostCelesti on January 15, 2011, 01:38:21 PM
Code: [Select]
function SuperHuman(tx, ty, v, ang, n, t, delay){
  let px=GetX; let py=GetY;
  ascent(i in 0..n){
    CreateShotA(1, px+ (tx-px)*i/(n-1), py+ (ty-py)*i/(n-1), t);
    SetShotDataA(1, 0, 0, ang+720*i/(n-1), 0, 0, 0, BLUE01);
    SetShotDataA(1, delay, 0, ang+720*i/(n-1), 0, 0.1, v, BLUE01);
  }
  SetMovePosition02(tx, ty, t);
}
Not tested, but this should give you one of Byakuren's dashes in a customizable way. If it works, calibrate, then abuse.
It worked, but the shots appear from the top of the screen and not from Byakuren's trails. Here's the code if there are any problems:
Code: [Select]
task dash{
let px=GetX;
let py=GetY;
let tx=GetCenterX-125;
let ty=GetCenterY-155;
wait(60);
ascent(i in 0..30){
CreateShotA(i,px+(tx-px)*i/(20-1),py+(ty-py)*i/(20-1),1);
SetShotDataA(i,0,0,GetX+720*i/(60-1),0,0,0,246);
SetShotDataA(i,180,0,GetX+720*i/(60-1),0,0.03,2,246);
FireShot(i);
}
SetMovePosition03(GetCenterX-125,GetCenterY-155,10,20);
}
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on January 15, 2011, 01:57:15 PM
Heh, I totally forgot the FireShot(1);  :derp:

First off:

Quote
   ascent(i in 0..30){
      CreateShotA(i,px+(tx-px)*i/(20-1),py+(ty-py)*i/(20-1),1);
      SetShotDataA(i,0,0,GetX+720*i/(60-1),0,0,0,246);
      SetShotDataA(i,180,0,GetX+720*i/(60-1),0,0.03,2,246);
      FireShot(i);
      }

These numbers should all be the same. If the orange numbers don't match the green one, the bullets will get misplaced because the line will overshoot. If the blue ones don't match, the angle of the bullets will be a little off. If you want to change the angle range, change 720 to another number, but try keeping it to a multiple of 180 so that it still looks symmetrical.

Second,
Quote
wait(60);
will cause the bullet trail to be dislocated if the boss moves in these 60 frames.

There are other things I would change, but that would depend on what pattern exactly you were trying to make, so I am not going to talk about that.  :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: LostCelesti on January 15, 2011, 02:34:45 PM
 ???
I'm sorry for being such a beginner, but nothing really changes...
I made some changes so that it looks harder.
Here's the whole script if I did something wrong:

http://pastebin.com/0EKaWbcK

Never mind the variables below the include function blabla.  :V
Oh, and the wait(60) in the task trail? If you meant for it as the time for it to appear, then I did that on purpose. ;D
Sorry, still a beginner. ;_;
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on January 15, 2011, 03:00:39 PM
Quote
CreateShotA(b,px+(tx-px)*b/(150-3),py+(ty-py)*b/(150-2),5);
[...]
CreateShotA(c,px+(tx-px)*c/(150-5),py+(ty-py)*c/(150-3),5);
Why are these not 1?

The original code I posted (which, if you add FireShot(1);, works perfectly fine) was coded like that for a reason.
You want to place n bullets on a line between two points. The length difference between these points is tx-px on the x-axis and ty-py on the y-axis. since you will have one bullet on the starting and end point of the line, the distance on one axis between each individual bullet is equal to the total axial distance divided by (n-1). If you change this number, you will shorten or lengthen the distance between any two bullets and thus the line on which the bullets are actually placed. If you change it to two different values for x and y positions, you will alter the angle of the line as well.

I probably should have explained that from the start. ^^'



Also, when you want to post a long excerpt of code, please don't post it directly in the thread, it stretches the topic out and makes it harder to read.
Use pastebin instead. (http://pastebin.com/)
 ;)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: LostCelesti on January 15, 2011, 03:22:31 PM
OH! It seems I found out what was wrong. xD
Thanks a lot! I owe you billions!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on January 19, 2011, 08:45:33 PM
I'm trying to recreate Utsuho's sun bullets from Subterranean Animism as Object Effects (with vertices, in other words), but I am completely unable to make it come out right with the colouring and transparency. Have anyone pieced together the correct recipe for them?

Edit: I am using the standard sun components (http://i902.photobucket.com/albums/ac221/MasterSpark89/suntemplate.png?t=1295469841), axed from Drake's thread.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Blargel on January 22, 2011, 07:42:22 PM
I'm trying to recreate Utsuho's sun bullets from Subterranean Animism as Object Effects (with vertices, in other words), but I am completely unable to make it come out right with the colouring and transparency. Have anyone pieced together the correct recipe for them?

Edit: I am using the standard sun components (http://i902.photobucket.com/albums/ac221/MasterSpark89/suntemplate.png?t=1295469841), axed from Drake's thread.

If I remember correctly it's left part alpha blended with rgb(255, 255, 255) on the bottom and the right part add blended with rgb(255, 0, 0) on top. I believe in SA, one or both the parts are rotating and pulsing too so you'll have to experiment with that.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Fujiwara no Mokou on January 23, 2011, 06:57:06 AM
I'm trying to recreate Utsuho's sun bullets from Subterranean Animism as Object Effects (with vertices, in other words), but I am completely unable to make it come out right with the colouring and transparency. Have anyone pieced together the correct recipe for them?

Edit: I am using the standard sun components (http://i902.photobucket.com/albums/ac221/MasterSpark89/suntemplate.png?t=1295469841), axed from Drake's thread.


From what I remember, the object showed its true colors in the center, and became more "pure" red toward the edges. Your best bet would be making an object effect as TRIANGLEFAN. Make a circle with your first vertex at the center with, as blargel said, RGB 255,255,255, and each vertices on the outside or outer edge RGB 255,0,0.
This should give it that glow you want.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GuardianTempest on January 23, 2011, 07:23:00 AM
Code: [Select]
script_enemy_main {
    let frame = 0;
    let BossImage = "script\GuardianTempest\img\DemoTrap.jpg";
    let BossCutIn = "script\GuardianTempest\img\GeneralJuhziz.jpg";
    let angle1 = 0;
    @Initialize {
    [Juhziz Stuff]
    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 69);
        if(frame==60){
            CreateShot01(GetX, GetY, 3, angle1, WHITE11, 10);
            angle = angle + 10;
            frame = 0;
        }
        frame++;
        if(frame==10){
            CreateShot01(GetX, GetY, 5, GetAngleToPlayer, BLUE21, 0);
            frame = 0;
        }
        frame++;
        if(frame==120){
            SetMovePosition03(GetCenterX, GetCenterY, 10, 3);
        }
    }

    [stuff]
}

Can't get it to work...
What I was trying to do was tweak the White stream of bullets to act like a water sprinkler where there is a 50/50 chance of grazing it or die before the GLA. There is also a blue stream that shoots at you so you have to dodge two things at once. But before all those the enemy will move to the center of the screen.


I know I lost the values on the 50-50 sweep but I'll nail it again later...

EDIT: I finally found the edit button.....Hooray!!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on January 23, 2011, 08:49:27 AM
Can't get it to work...

I see a couple of continuity errors in your code. I'll list them below, for clarity:


If you make these rectifications the script should work, leaving you to experiment to get it just right - and that's the best part.  :3
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on January 23, 2011, 09:12:19 AM
If I remember correctly it's left part alpha blended with rgb(255, 255, 255) on the bottom and the right part add blended with rgb(255, 0, 0) on top. I believe in SA, one or both the parts are rotating and pulsing too so you'll have to experiment with that.
Using that RGB setup looks right, but what's giving me the real trouble is the way that SetVertexColor forces me to apply an Alpha value to each vertex. A lower value for the top part brings transparency, but it also dulls the colour. What I end up with is a solid white core with a drab pink tinting the edges. If I crank the top layer's Alpha up to max it overpowers the rest of it. Can the parameter in SetVertexColor be overridden to assume the original value found in the image?

From what I remember, the object showed its true colors in the center, and became more "pure" red toward the edges. Your best bet would be making an object effect as TRIANGLEFAN. Make a circle with your first vertex at the center with, as blargel said, RGB 255,255,255, and each vertices on the outside or outer edge RGB 255,0,0.
This should give it that glow you want.
I've never used a TRIANGLEFAN primitive type before, do you have an example somewhere of how the vertices are connected? I'm currently using TRIANGLESTRIP for this object effect (4 vertices) with these as the drawing coordinates.

Code: [Select]
ObjEffect_SetVertexXY(bottom,0,-128,-128);
ObjEffect_SetVertexXY(bottom,1,128,-128);
ObjEffect_SetVertexXY(bottom,2,-128,128);
ObjEffect_SetVertexXY(bottom,3,128,128);
ObjEffect_SetVertexUV(bottom,0,0,0);
ObjEffect_SetVertexUV(bottom,1,256,0);
ObjEffect_SetVertexUV(bottom,2,0,256);
ObjEffect_SetVertexUV(bottom,3,256,256);
The object in the image is 256x256. The drawing looks the same for the top part as well, aside from some different UV coordinates as they're in the same image file.

Thanks for the input.  :moogy:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chester-low on January 23, 2011, 12:43:41 PM
Ok  I have a problem with Animation lib.
My script is:

#TouhouDanmakufu
#Title[MurasaNS1]
#Text[]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{
function wait(w){loop(w){yield;}}
#include_function "script\Murasa\lib\AnimationLib\AnimationLib.dnh";
let Murasa=GetCurrentScriptDirectory ~ ("\murasa.png");
@Initialize
{
            LoadGraphic(Murasa);
            SetLife(4000);
            SetTimer(100);
            SetInvincibility(30);
            SetMovePosition02(GetCenterX, GetCenterY - 100, 120);
    CreateAnimation("murasa", "idle", 4);
    SetAnimationFrame("murasa", "idle", 0,Murasa, 0, 0, 0, 64, 64);
    SetAnimationFrame("murasa", "idle", 1,Murasa, 0, 64, 0, 128, 64);
    SetAnimationFrame("murasa", "idle", 2,Murasa, 0, 128, 0, 196, 64);
    SetAnimationFrame("murasa", "idle", 3,Murasa, 0, 196, 0, 256, 64);
    Animate("murasa", "idle", true);

}
   
@MainLoop
{
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,16);
yield;
}
@DrawLoop{
   SetGraphicScale(1,1);
   SetTexture(Murasa);
   SetGraphicAngle(0,0,0);
   SetColor(255,255,255);
   SetRenderState(ALPHA);
   

}
@Finalize{

   DeleteGraphic(Murasa);

}

}


And I have: (http://free0.hiboox.com/images/0311/b8bb22b75c5ca6a925874dc292549766.bmp) (http://www.hiboox.fr/go/images/dessin/error2,b8bb22b75c5ca6a925874dc292549766.bmp.html)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Kyaksa on January 23, 2011, 01:55:47 PM
I have a problem with creating patterns... My Cirno freezes and then the script just dies.

*Edit*FIX
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Luna on January 23, 2011, 04:10:01 PM
In your "fire" task you have a "while 0 is smaller than 36, do stuff," and since 0<36 is pretty much true always, DMF attempts to do infinite amounts of stuff in one frame.
(Or something like that, I forgot :c)

But change the "while(0<36){" to "while(x<36){" or something and then it should work.
(Also might as well note that DMF questions should go to the Q/A thread.)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Kyaksa on January 23, 2011, 06:06:34 PM
Thank you. It works...

 :ohdear: I'm sorry for posting in the wrong place... But I wasn't sure since people (or from the videos I've watched) Task and Loops are very different things ^^; Since I was watching his videos I thought I should ask here. Meh, sorry again
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on January 23, 2011, 07:41:07 PM
Uh, you'd think the answer is pretty obvious? You've set all the frames to animate for 0 frames. Which is impossible. Did you just try coding it all at once then when it didn't work immediately, you showed it to us? You gotta test this stuff, man.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: 8lue Wizard on January 24, 2011, 02:51:04 AM
So I've been experimenting with lasers recently, intending to finally get around to making a Nazrin B player in the near future, and dnh is giving me an error which, according to the troubleshooting thread, says the CreateLaserX functions don't exist. Yes, I double, triple, quadruple checked my spelling and capitalization. The hell?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on January 24, 2011, 03:03:45 AM
create anything functions don't exist in player scripts

besides createplayershot but it might as well be nothing
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: 8lue Wizard on January 24, 2011, 03:16:34 AM
Huh. 'd be nice if the player tut mentioned that. In that case, is there any way to get object lasers to move automatically? Obj_SetSpeed doesn't appear to be doing anything.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on January 24, 2011, 03:34:49 AM
create anything functions don't exist in player scripts

besides createplayershot but it might as well be nothing
Huh. 'd be nice if the player tut mentioned that.
CreatePlayerShot01 is the only bullet function for players; anything else will need to be an object shot. Anyway, it's pretty similar to the enemy version, CreateShot01. The difference is the addition of two arguments, which is the two next-to-last. The first (2.5) is the damage the bullet will do. The second (1) is the penetration, or the number of hits the bullet can score, once per frame. If you set the penetration to some huge number the bullet will be able to shoot through every enemy it hits, but be sure to set the damage low if you do something like that! The final argument is the bullet graphic, in this case the blue knives we defined earlier. Player shots cannot have delay.

Hmm.

In that case, is there any way to get object lasers to move automatically? Obj_SetSpeed doesn't appear to be doing anything.

Object lasers do not use Obj_SetSpeed. You will have to set their position every frame using Obj_SetPosition (or Obj_SetX and Obj_SetY).
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: 8lue Wizard on January 24, 2011, 03:56:25 AM
Quote from: Stuffman
CreatePlayerShot01 is the only bullet function for players; anything else will need to be an object shot. Anyway, it's pretty similar to the enemy version, CreateShot01. The difference is the addition of two arguments, which is the two next-to-last. The first (2.5) is the damage the bullet will do. The second (1) is the penetration, or the number of hits the bullet can score, once per frame. If you set the penetration to some huge number the bullet will be able to shoot through every enemy it hits, but be sure to set the damage low if you do something like that! The final argument is the bullet graphic, in this case the blue knives we defined earlier. Player shots cannot have delay.
Huh. Must've skipped that part. Besides, it only specifies bullet functions; it doesn't say anything about lasers.

Object lasers do not use Obj_SetSpeed. You will have to set their position every frame using Obj_SetPosition (or Obj_SetX and Obj_SetY).

I figured as much. Oh well.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GuardianTempest on January 24, 2011, 10:08:54 AM
Code: [Select]
    @MainLoop {
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 32);
        if(frame==10){
            CreateShot01(GetX, GetY, 5, angle1, WHITE11, 0);
          angle1 = angle1 + 10;
        }
        if(frame==10){
            CreateShot01(GetX, GetY, 5, GetAngleToPlayer, BLUE21, 0);
        }

        if(frame==120){
            SetMovePosition03(GetCenterX, GetCenterY, 10, 3);
            frame = 0;
        }
        frame++;
        yield;
    }
New Problem, yes it moves, it fires though it doesn't fire at the way I want it to.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on January 24, 2011, 10:20:55 AM
New Problem, yes it moves, it fires though it doesn't fire at the way I want it to.

Let me guess - you want it to fire once every 10 frames, right? As it stands, the CreateShot01's will happen when 'frame' equals 10, but then 'frame' will keep increasing until it reaches 120, where it resets to zero.

Instead of
"if(frame==10)"
try
"if(frame%10==0)"
which basically tells the script to fire the shots whenever 'frame' is divideable with 10 (at least that's what I think it does). This means that the shots will be fired when 'frame' equals 0, 10, 20, 30, 40 and so on. This will also mean that the shots will be fired just as the script starts, since 'frame' start out as 0. To negate this you can place your frame++ at the top of your main loop instead. That way 'frame' will equal 1 when the script reaches the if-statements for the first time.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GuardianTempest on January 24, 2011, 10:27:52 AM
Let me guess - you want it to fire once every 10 frames, right? As it stands, the CreateShot01's will happen when 'frame' equals 10, but then 'frame' will keep increasing until it reaches 120, where it resets to zero.

Instead of
"if(frame==10)"
try
"if(frame%10==0)"
which basically tells the script to fire the shots whenever 'frame' is divideable with 10 (at least that's what I think it does). This means that the shots will be fired when 'frame' equals 0, 10, 20, 30, 40 and so on. This will also mean that the shots will be fired just as the script starts, since 'frame' start out as 0. To negate this you can place your frame++ at the top of your main loop instead. That way 'frame' will equal 1 when the script reaches the if-statements for the first time.

HAh!! Brilliant!! Thanks alot! Once I'm done tweaking my 50-50 sweep....

EDIT: Oh great...Step 2 problem.
Code: [Select]
        if(frame%1==0){
            CreateShot01(GetX, GetY, 6, angle1, WHITE11, 0);
          angle1 = angle1 + 2;
        }
//        if(frame%1==0){
//            CreateShot01(GetX, GetY, 6, angle2, WHITE11, 0);
//          angle1 = angle2 + 2;
//        }
//        if(frame%1==0){
//            CreateShot01(GetX, GetY, 6, angle3, WHITE11, 0);
//          angle1 = angle3 + 2;
//        }
//        if(frame%1==0){
//            CreateShot01(GetX, GetY, 6, angle4, WHITE11, 0);
//          angle1 = angle4 + 2;
//        }

The spinning motion works fine but when I uncomment the three parts, then the fountain just freezes in place for UBER-graze points.
Then once this is fixed I'm done.

Clumping them together didn't work either.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on January 24, 2011, 11:32:12 AM
The spinning motion works fine but when I uncomment the three parts, then the fountain just freezes in place for UBER-graze points.
Then once this is fixed I'm done.

Clumping them together didn't work either.

Of all your angle variables, you're only ever increasing the value of 'angle1'.  The other bullet streams will remain static.

It should be
angle2 = angle2 + 2
angle3 = angle3 + 2
angle4 = angle4 +2

Edit:
You could give this method a shot, too. Put the variables in your @Initialize an the if-statement in your @MainLoop (after removing all other if-statements. This new one fires four bullets per frame on its own).
Code: [Select]
let angle = 2;
let dir = 0;

if(frame%1==0)
{
     loop(4)
     {
          CreateShot01(GetX,GetY,6,dir,WHITE11,0);
          dir+=360/4;
     }
    dir+=angle;
}
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: GuardianTempest on January 24, 2011, 11:44:58 AM
*facepalm*

Wish I was more aware of this....man this behavior of mine is exhibited in all of the roleplays I've been to, both IC and OOC.

Anyway it worked, seems I need to be more aware now.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: KuraiShoka on January 30, 2011, 03:30:00 AM
I swear, I need to favorite this thread, I fail so bad :V
Anyways, I tried making a stage for the first time, and I decided to animate the enemies using Helepolis's tutorial  so it wouldn't be so boring.
BAD IDEA
So many errors: All enemies dissapear and reapear when just one dies. Some animate correctly, some don't. Etc.

http://www.mediafire.com/?ozcwda17f45zx4l

I'd use pastebin, but I had to include the enemy image I used to replicate the error as close as possible.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on January 30, 2011, 04:51:58 AM
So many errors: All enemies dissapear and reapear when just one dies. Some animate correctly, some don't. Etc.
All enemies disappear when one dies, eh?
Obviously, you're: 1) deleting the fairy graphic in the enemy file's @Finalize; then 2) loading the fairy graphic again in the same enemy file's @Initialize.
That's a big no-no.
Instead, you should load and delete every graphic you're gonna use, in the stage itself, rather than in every enemy file.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: KuraiShoka on January 30, 2011, 05:35:33 AM
All enemies disappear when one dies, eh?
Obviously, you're: 1) deleting the fairy graphic in the enemy file's @Finalize; then 2) loading the fairy graphic again in the same enemy file's @Initialize.
That's a big no-no.
Instead, you should load and delete every graphic you're gonna use, in the stage itself, rather than in every enemy file.

Oh my- *facepalm*
That makes so much sense, thanks  :]
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: pacman2278111 on February 01, 2011, 01:40:58 AM
I tried to load up a danmakufu  script  (Thaws snow V3 Attack phase 1-L ) and it crashed the Game.
any help? :/
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: KuraiShoka on February 01, 2011, 02:09:56 AM
I tried to load up a danmakufu  script  (Thaws snow V3 Attack phase 1-L ) and it crashed the Game.
any help? :/

Are you running Danmakufu through Applocal or with a computer set to japanese system local? If not, you need to do that or Danmakufu will keep crashing.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Schezo on February 06, 2011, 04:38:31 AM
Ok so these Event scripts that do the dialogue are just stumping me and I've hit a rough point that I can't make them do what I want.

So I've created an object effect for when the boss dies and I'm making it go in this order:
Code: [Select]
task mainTask{
startexplode;
wait(180);
VanishEnemy;
}

So now, I'm trying to get an event script to go off after all that, since it is just programmed in a separate attack at the end of the plural file.  But I also want it to be able to choose various event scripts depending on how the script was played (ie. say something different if a continue was used) but all the different ways I've tried it didn't even create an event script at the end.  I'm guessing that I should place the events in if statements like:

if(Continued==true){
   CreateEventFromScript("lol");
   }
if(Continued==false){
   CreateEventFromScript("Winnerwhatwhat");
   }

Or I could be totally wrong.  The problem is, I don't know where to place this or if I'm missing something important to make the event go off before the script ends or if I should be using a different method to make the boss sprite disappear when it explodes.

If it matters the plural is in a stage file and using that as a method is possible (?).
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheTeff007 on February 10, 2011, 01:30:00 PM
Hello, I am trying to make the familiars spawn, but they don't. Whenever I run the script it tells me that there is an error with the Function and closes.

http://pastebin.com/YvDPTfR0

There is the whole code, Danmakufu throws me an error on Line 65. Thanks.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on February 10, 2011, 02:11:48 PM
The problem is actually in line 117:

Code: [Select]
script_enemy_starFam {should be
Code: [Select]
script_enemy starFam {
Because you have worded it the way you did, danmakufu does not recognize "starFam" as the name of the enemy, so the CreateEnemyFromScript function doesn't recognize it and throws up an error.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheTeff007 on February 10, 2011, 09:13:53 PM
Well, now aparrently the problem is on line 161.

http://pastebin.com/Xqt0ajdF
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Zengar Zombolt on February 10, 2011, 10:14:58 PM
I don't see an error, prolly because I'm not that experienced, but I do see that since rad = 0 you're not moving the boss anywhere.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on February 10, 2011, 10:15:53 PM
Well, now aparrently the problem is on line 161.

http://pastebin.com/Xqt0ajdF
You have not defined "dir".

This was an error that you could have figured out by yourself pretty easily, though.  :derp:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on February 10, 2011, 10:23:43 PM
Come on people. At least try read your goddamn errors and figure your problems out for yourself. We may be bored here, but not bored enough to answer every little tidbit that you complain about when you try to make a whole script without testing then go "oops it doesn't work better go ask motk".

seriously jesus



EDIT: To demonstrate slightly more thoroughly, take the above question. Since Iryan identified the (or one of the) problem(s) to be an undefined variable, there likely would have been ERROR: LINE X: "dir" HAMITEIGINOSHIKIBETSUSHI. You see the variable name, and you should be able to understand that there's something wrong with the variable on line X. If you know how these errors work and look, then you should be able to pick up automatically that it's an undefined variable. Otherwise, you can look around to see why it errors, and quickly figure out that it's undefined simply because well you didn't define it.

It's the same thing with more complicated errors, and it's the reason we have a small error database (http://www.shrinemaiden.org/forum/index.php/topic,4155.0.html). You should have a japanese locale method enabled or at least available; there are few excuses for not knowing the actual error before asking a question. Some people (lol hi) can even tell the error in non-localed DNH, where it just spews garbage and identifier names everywhere. Your error messages are key to solving your problems and you need to learn or at least reference this shit.

If you seriously cannot figure out why it's giving you a certain error or the error makes no sense or whatever and you can't deduce the problem yourself after going over your script a few times, THEN PLEASE ask why it isn't working (run-on sentence woo). In addition, although it only really matters for more advanced shit, if you can't figure out the problem after all this, don't mess up your whole goddamn script before coming to ask a question.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on February 13, 2011, 02:36:45 PM
Neh Neh, I have a question.

I don't really understand how to use || [The or thing]
So let's say you want a bullet to either go at 0 or 90 degree how would you use this ?
[No other angle only 0 and 90]
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Iryan on February 13, 2011, 02:44:12 PM
You mean, randomized?

That you do by using let coin=rand_int(0, 1); if(coin==0){ ... } else{ ... }.

|| is a logic operator that you can use inside the if( ) brackets so that the conditions are fulfilled if at least one of two conditions is met.

if(coin==0||coin==1){ stuff }  would mean the stuff happens if at least one of the conditions is true, and if coin is always either 0 or 1, that would be everytime.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on February 13, 2011, 03:02:29 PM
You mean, randomized?

That you do by using let coin=rand_int(0, 1); if(coin==0){ ... } else{ ... }.

|| is a logic operator that you can use inside the if( ) brackets so that the conditions are fulfilled if at least one of two conditions is met.
if(coin==0||coin==1){ stuff }  would mean the stuff happens if at least one of the conditions is true, and if coin is always either 0 or 1, that would be everytime.

Thanks Iryan, this is what I was trying to do

(http://i477.photobucket.com/albums/rr139/namethecool/explain.png)

I took the easy way but Thanks for the idea  :]

http://pastebin.com/7tThNVF6
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on February 14, 2011, 05:20:51 AM
Neh Neh, I have a question.

I don't really understand how to use || [The or thing]
So let's say you want a bullet to either go at 0 or 90 degree how would you use this ?
[No other angle only 0 and 90]

[0,90][rand_int(0,1)]
or
90*rand_int(0,1)

... What.
Remember, sometimes the answer is right in front of you. It's just invisible to you.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Uzumaki_tenma on February 15, 2011, 04:58:25 AM
Hello, I have a question:
In the event script you can use as default MARISA and REIMU scripts...
Quote
   if(GetPlayerScriptName=="REIMU"){
      CreateEventFromScript("Reimu");
   
   }else if(GetPlayerScriptName=="MARISA"){
      CreateEventFromScript("Marisa");}
But, if you have another player script, how can I do to make the event only for this script?

Quote
   
OPTION 1

}else if(GetPlayerScriptName=="player\Sanae\SanaeA.txt"){
      CreateEventFromScript("Sanae");}

OPTION 2

   }else if(GetPlayerScriptName=="Sanae A"){
      CreateEventFromScript("Sanae");}

No one worked
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on February 15, 2011, 05:23:04 AM
Hello, I have a question:
In the event script you can use as default MARISA and REIMU scripts...But, if you have another player script, how can I do to make the event only for this script?
No one worked
For SanaeA, use "SanaeA.txt".

Seriously, test it with the given Rumia script - it would return "Rumia.txt" (I think).
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Blargel on February 15, 2011, 11:56:17 AM
If you're not sure what a function is outputting, you can always use the DrawText or RaiseError functions to see what it's giving you.

In your case, you can try RaiseError(GetPlayerScriptName, "player script name"); in @Initialize and select the Sanae player you want to check. This will cause Danmakufu to spit out an error message with the name of the player.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Uzumaki_tenma on February 15, 2011, 05:38:22 PM
Uhm.... uh? sry, im a little slow...

mmmm well, check this image please
http://i580.photobucket.com/albums/ss249/Uzumaki_Tenma/test_desktop_1.jpg
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Zengar Zombolt on February 15, 2011, 06:39:03 PM
That's because GetPlayerScriptName gives SanaeA, not SanaeA.txt.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on February 15, 2011, 07:41:24 PM
YOU MESSED UP YOUR BRACKETS. THE ERROR SAYS IT CAN'T FIND THE END OF THE LINE.

ALWAYS CHECK YOUR BRACKETS.

if(reimubla){
    reimuthing;
}else if(marisabla){
    marisathing;}
}else if(sanaebla){
    sanaething;}

It would have really helped if you just tabbed and enclosed things properly. Move the bracket at the end of sanaething one line down, and get rid of the bracket after marisathing.
But also realize that the problem wasn't the player name, so change that back to "Sanae A".
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Uzumaki_tenma on February 16, 2011, 04:10:37 PM
whops
hehehe... sorry ^^U, fixed
well, thank you very much
***EDIT***
new problem: the program closed when I tried, trying "with player\Sanae\SanaeA.txt"

and...

Quote
@Initialize{
   SetLife(1);
   SetDamageRate(1,1);
   LoadGraphic(Boss);
   SetGraphicRect(0,0,63,93);
   SetX(GetClipMaxX-50);
   SetY(-110);
   CollectItems;
   RaiseError(GetPlayerScriptName, "Sanae A");
   SetEnemyMarker(true);
   SetMovePositionHermite(cx,120,-90,290,0,0,100);

   if(GetPlayerScriptName=="REIMU"){
      CreateEventFromScript("Reimu");
   
   }else if(GetPlayerScriptName=="MARISA"){
      CreateEventFromScript("Marisa");

   }else if(GetPlayerScriptName=="Sanae A"){
      CreateEventFromScript("Sanae");
   }   

}

http://i580.photobucket.com/albums/ss249/Uzumaki_Tenma/test_desktop_3.jpg

What the hell happened??!!??
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Zengar Zombolt on February 16, 2011, 04:39:20 PM
That's the effect of RaiseError. So yeah, comment it out / Delete it.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Uzumaki_tenma on February 16, 2011, 05:40:09 PM
That's the effect of RaiseError. So yeah, comment it out / Delete it.
And in doing so, the programcloses putting it found a problem (i'm such a pain, right?), now what happens!?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on February 17, 2011, 11:14:58 AM
Quote
@Initialize{
   SetLife(1);
   SetDamageRate(1,1);
   LoadGraphic(Boss);
   SetGraphicRect(0,0,63,93);
   SetX(GetClipMaxX-50);
   SetY(-110);
   CollectItems;
   RaiseError(GetPlayerScriptName, "Sanae A");
   SetEnemyMarker(true);
   SetMovePositionHermite(cx,120,-90,290,0,0,100);

   if(GetPlayerScriptName=="REIMU"){
      CreateEventFromScript("Reimu");
   
   }else if(GetPlayerScriptName=="MARISA"){
      CreateEventFromScript("Marisa");

   }else if(GetPlayerScriptName=="Sanae A"){
      CreateEventFromScript("Sanae");
   }   

}

now what happens!?

Whoa you can do that ?!  :3
What is going to happen ?

anyways, I saw this on
http://dmf.shrinemaiden.org/wiki/index.php?title=Object_Control_Functions#Collision_Obj_Obj
Quote
Obj_SetCollisionToObject

2 Parameters
    1) object ID
    2) collision detection setting
        true : performed
        false: not performed

Set whether or not collision detection with other objects is performed. The collision detection can be performed by Collision_Obj_Obj.

(Youmu's bubble cutting blade comes to mind)
How do I use this  :3 Collision_Obj_Obj. I use to saw a sample script somewhere but I deleted it  :/
I don't think I recognize this in the tutorials either. Or did I misread ?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on February 17, 2011, 07:56:15 PM
Youmu's blade takes a giant rectangle of bullets if(object bullet is inside this fucking rectangle){explode;} ; it doesn't even bother with object collision. In this case, neither should you :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheTeff007 on February 18, 2011, 02:05:10 AM
How do I call and shot a bullet from an external shot data?  (In my Case, Expanded ShotData ny Helepolis)

Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on February 18, 2011, 03:53:57 AM
How do I call and shot a bullet from an external shot data?  (In my Case, Expanded ShotData ny Helepolis)

Do you mean you want to know how to create a shot replace script, or do you want to know how to create a bullet from said shot script?
If the latter, you just use the ID number of said bullet in whatever CreateShot function.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheTeff007 on February 18, 2011, 05:00:24 AM
Hmmm... but what about the SetShotData? In the Graphic argument, it seems that overrides the shot loaded...

I've loaded the Shot Data in Initialize, and Danmakufu shows no signs of crash, as if it ingores the information (and I check and I didn't ignore the line using the //)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Schezo on February 18, 2011, 05:12:12 AM
You aren't supposed to load the shot sheet in the initialize, you should be calling it like a variable.

Code: [Select]
script_enemy_main {

LoadUserShotData(GetCurrentScriptDirectory ~ "andsoon");

@Initialize {

Then you should be able to call the numbers in the create whatevers.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on February 18, 2011, 10:07:11 AM
Youmu's blade takes a giant rectangle of bullets if(object bullet is inside this fucking rectangle){explode;} ; it doesn't even bother with object collision. In this case, neither should you :V

Hnnnggggg  :getdown:

EDIT :
I'm stuck again, how do you do that  :( ^^^^
Also , how do you make things respond when it is being attacked by player ?

Quote
How do I call and shot a bullet from an external shot data?  (In my Case, Expanded ShotData ny Helepolis)

Maybe I can try to help too  :3
Let's say I'm using Supershot (an external shot data), and so there will be the shot data place thingy and the picture of the Shotdata.
(http://i477.photobucket.com/albums/rr139/namethecool/supershot-1.png)

Then I make a variable like that v

Code: [Select]
let SupaShot = GetCurrentScriptDirectory~".\Supershot.txt";
and then I load the supershot in @Initialize

Code: [Select]
   @Initialize{
LoadUserShotData(SupaShot);
}

That's all to it, don't forget to look at the numbers inside the shot data that should tell you what number will give you what graphic. And also, you can put the external shot data into your lib (library) so you can call it even if the external shot isn't in your folder, but your script path would be (in this case) like this instead.

Code: [Select]
let SupaShot = Some path that connects to your lib folder ~".\Supershot.txt";
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: KuraiShoka on February 20, 2011, 03:39:39 AM
Hnnnggggg  :getdown:

EDIT :
I'm stuck again, how do you do that  :( ^^^^

Possible Solution.  (http://www.shrinemaiden.org/forum/index.php/topic,5164.msg262470.html#msg262470)
I haven't checked if this works, so no promises :V

Also, Naut found some sort of weird error (http://www.shrinemaiden.org/forum/index.php/topic,5164.msg265972.html#msg265972), so you may have to change the GetPointToLine inside the GetPointInRectangle function to GetPointToLineSegment (http://www.shrinemaiden.org/forum/index.php/topic,5164.msg266034.html#msg266034)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on February 20, 2011, 03:59:50 AM
I'm stuck again, how do you do that  :( ^^^^
Also , how do you make things respond when it is being attacked by player ?
1. Make task that shoots bullets and increases counter variable
2. Make global "explodebullets" variable
3. When counter variable gets to x, explodebullets = true
4. In the bullet object code, check every frame if explodebullets is true. If so,
5. Check if(obj.x>left && obj.x<right && obj.y>top && obj.y<bottom). If so, explode bullet.

Second, if GetEnemyLife is less then it was last frame. Or some other similar function.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on February 20, 2011, 04:16:51 AM
Second, if GetEnemyLife is less then it was last frame. Or some other similar function.

GetHitCount.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Captain Murasa on February 20, 2011, 10:16:49 AM
How do I make it so that the boss shoots two bullets at opposite angles around her body? Like Orin's zombie fairy spellcard at Lunatic. For now I only know how to make them shoot at a particular angle or in a circle around them.

Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Luna on February 20, 2011, 11:13:28 AM
How do I make it so that the boss shoots two bullets at opposite angles around her body? Like Orin's zombie fairy spellcard at Lunatic. For now I only know how to make them shoot at a particular angle or in a circle around them.

Code: [Select]
CreateShot01(GetX, GetY,2, GetAngleToPlayer, RED01, 7);
CreateShot01(GetX, GetY,2, GetAngleToPlayer-180, RED01, 7);

Fires two streams of bullets, one aimed towards the player, other aimed to the opposite. Was this something like what you were looking for?
(tl;dr angle-180 points at the opposite of "angle")
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Captain Murasa on February 20, 2011, 01:13:38 PM
No, I mean the boss shoots bullets around her.

B = Boss
o = Bullet
x = Previously shot bullet

o
B
o

then

...x
.....o
..B
o
..x

then

....x
.......x
o  B  o
...x
.......x

And so on, continuing in a loop.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Luna on February 20, 2011, 02:02:48 PM
If you mean something like this (http://img703.imageshack.us/img703/9784/aaaala.jpg), use trigonometry.

e.g.
Add "let a=0;" before @Initialize and put this into @MainLoop:
Code: [Select]
CreateShot01(GetX+50*cos(a), GetY+50*sin(a),2, a, RED01, 7);
CreateShot01(GetX+50*cos(a-180), GetY+50*sin(a-180),2, a-180, RED01, 7);
a+=2.5;
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Captain Murasa on February 20, 2011, 02:16:35 PM
Thanks, that's it. What parameter do I change to make it spin faster?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Luna on February 20, 2011, 02:25:48 PM
Thanks, that's it. What parameter do I change to make it spin faster?
"a+=n"

Where "n" is how much the angle increments each frame.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Laplace on February 20, 2011, 03:52:43 PM
Quote
---------------------------
ScriptError?C:Documents and SettingsBrazAmbiente de trabalho   h_dnhscriptSayaNoUtaSayaScript.txt?
---------------------------
mainTask??????????(72??)
?
       mainTask{

         yield;

         fire;

         movement;       

       

         task movement{

            loop{



         
~~~

What is this error about?
 :ohdear:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Blargel on February 20, 2011, 05:28:40 PM
mainTask??????????(72??)
?
        task mainTask{

         yield;

         fire;

         movement;       


Seriously now, pay attention while typing. Or even better, learn to figure out what's wrong on silly problems like this. The error message is pointing straight at the problem.  :wat:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on February 20, 2011, 06:58:18 PM
i hate you all
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Suikama on February 20, 2011, 07:01:06 PM
i hate you all
ilu too drakeypoo
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Laplace on February 20, 2011, 09:45:40 PM
Whoops
Sorry for making Drake hate all of humanity
 :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on February 21, 2011, 01:29:46 AM
Whoops
Sorry for making Drake hate all of humanity
 :V
/me stabs Laplace
/me uses Spell Card: [Error-finding Skill "Double Checking -Hard-"]
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheTeff007 on February 21, 2011, 07:48:31 AM
How can I make a entire code to loop?

Say, I want to make fall a wall of bullets but having one of them missing, so the player can slip in that gap.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on February 21, 2011, 08:20:02 AM
http://www.shrinemaiden.org/forum/index.php/topic,6181.msg345023.html#msg345023
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Laplace on February 21, 2011, 02:56:46 PM
/me stabs Laplace
/me uses Spell Card: [Error-finding Skill "Double Checking -Hard-"]
Kinky~
 :3

Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheTeff007 on February 21, 2011, 05:44:16 PM
I tI explained myself wrong, I want that the bullet that is missing changes to a random place everytime the code is looped.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Schezo on February 21, 2011, 06:08:09 PM
Then when you increment your variable with

X +=;

You add a

rand(1, 7) ; or whatever Numbers float your boat after the =.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheTeff007 on February 22, 2011, 09:32:52 PM
I was wondering after reading some threads in here. And it says that some scripts requiere the CtC Shotreplace pack...

I already have it... but I don't know how to install it... and the readme doesn't help.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Schezo on February 22, 2011, 11:38:39 PM
It's because people are being lazy, and not pathing correctly if their script doesn't come with it already in the file they want you to play and they aren't following this thread (http://www.shrinemaiden.org/forum/index.php/topic,4752.0.html).  Some people have this crazy idea everyone has it installed (when they don't and it only serves to make people frustrated) but if you do want it there like they want, this is what you do:

*In your th_dnh folder where your th_dnh game executor is, create a folder called lib
*Put the SHOT_REPLACE or whatever it's called folder in that.
*Scripts which require it should work now, if not, you can go back to my earlier annoyance that they should have pathed it correctly.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Zengar Zombolt on February 23, 2011, 04:49:36 AM
I think someone should update the tutorials saying that Shotsheet scripts are that much better.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Schezo on February 23, 2011, 05:00:11 AM
Disregard
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on February 25, 2011, 09:24:09 AM
People shouldn't be lazy and just include the shotsheet they used a long with the download. Even if it is the CtC or w/e. As if 100kb extra is going to be a problem. But yea, lazy people =[
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on February 25, 2011, 02:58:01 PM
I has some un-danmakufu related questions  :V

1.) What happen to all the pictures  :wat:

(http://i477.photobucket.com/albums/rr139/namethecool/whathappe.png)

2.) Why Can't I join "You wah Ban" group Anymore  :3
(There's no group to join)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Schezo on February 25, 2011, 03:58:06 PM
Those aren't really danmakufu questions. :P


The first on is some silliness about having to be registered at imageshack to upload the images or something. They know in CPMC it's a rage issue.

The second one is more of a letters to the editor question. It was answered here. (http://www.shrinemaiden.org/forum/index.php/topic,46.msg562356.html#msg562356)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: WriggleNightbug on March 01, 2011, 10:18:10 PM
So I'm making a more efficient, convenient version of my custom frame from my old project, and I'm currently at making the custom numbers, and it works pretty well but I want a way to control when I update the text, so here's what I need to do:

delete a group of effect objects, and immediately replace them, only when the number changes.

So I'd need to get all the number's effect objects, and delete them, so I have two ideas but I don't think it's possible in Danmakufu.

1. Call all effect objects somehow, like a global effect object caller, and if they have a certain variable that shows that each character belongs to the set of numbers (for example the 11 characters that compose "200,000,000"), whether its for Score or Graze, etc.

2. plan ahead and put each object in an array belonging to the represented variable, but I need to make it so I can add to the array as it goes along, like HighScoreChars.push...but I don't think Danmakufu has lists with Push and Exclude and stuff does it?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on March 02, 2011, 01:30:13 AM
If you want to make an array-based stack or something, you can, somewhat.

However, you can compare the array of characters from your current score to an array of characters from a string that keeps your last score string. If a character is different you can update the string and the associated objects, etc.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: WriggleNightbug on March 02, 2011, 01:39:33 AM
If you want to make an array-based stack or something, you can, somewhat.

However, you can compare the array of characters from your current score to an array of characters from a string that keeps your last score string. If a character is different you can update the string and the associated objects, etc.

yeah thats what I want to do ^^ but its just that they way its set up now, once theyre drawn once theres no removing them, I can draw new ones on top just fine but that would be a mess because theyd stack, and eventualy the game would lag from way too many effects, but I think I maybe have an idea, im gonna try it out and see ^^
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: WriggleNightbug on March 02, 2011, 02:09:19 AM
yeah thats what I want to do ^^ but its just that they way its set up now, once theyre drawn once theres no removing them, I can draw new ones on top just fine but that would be a mess because theyd stack, and eventualy the game would lag from way too many effects, but I think I maybe have an idea, im gonna try it out and see ^^

Okay so all I did was pretty much ruin the script...whoops, I rewrote it so that every letter was stored in an array, so the effect object for the first letter, the one at the very end, is ObjectArray[0], etc. and there didnt seem to be any problems there, but then I try to update the textures of the array of objects much similarly to the first time they were created and given the right number image files, the program crashes, and when I tried the method of deleting them every frame to create new ones, they didnt delete and just piled up constantly droping the framerate instantly, basically its as if they were never put in an array at all, now the whole thing is a mess.

I should probably start a new task for this from scratch after I learn what went wrong...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: WriggleNightbug on March 02, 2011, 02:12:41 AM
Okay so all I did was pretty much ruin the script...whoops, I rewrote it so that every letter was stored in an array, so the effect object for the first letter, the one at the very end, is ObjectArray[0], etc. and there didnt seem to be any problems there, but then I try to update the textures of the array of objects much similarly to the first time they were created and given the right number image files, the program crashes, and when I tried the method of deleting them every frame to create new ones, they didnt delete and just piled up constantly droping the framerate instantly, basically its as if they were never put in an array at all, now the whole thing is a mess.

I should probably start a new task for this from scratch after I learn what went wrong...

And I figured I should probably paste what the whole thing looks like but after all the tweaking (and the last part of the DrawNumber command is unfinished, and most variables dont do anything anymore, it really is incomprehensible, but im just trying to show what I was trying to accomplish with it:

EDIT:  Super sorry about the huge block of code, I didn't even know about Pastebin until just recently, I'd upload a Pastebin'd version but the code is kinda outdated since a lot was rewritten. ^^
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on March 02, 2011, 06:48:11 AM
pastebin go go go
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: WriggleNightbug on March 02, 2011, 03:35:44 PM
Okay so I restarted and this time I got something a little more promising, although now its suffering from extreme slowdown, like at first it's fine and it runs perfectly, but after awhile it gradually slows down more and more to the point where it takes about a whole minute for it to retry the level, and I don't see why, It usually lags when the number exceeds the 3rd digit, but all 11 characters of the score are displayed all the time anyways, cuz the rest of the numbers after the variable are shown as 0's.

Basically I create new effects every frame, and the effects are made to delete themselves after one frame...but if theyre deleted they shouldnt build up right? I'm guessing the gradual increasing lag is caused by a build up somewhere
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on March 02, 2011, 04:03:41 PM
Well obviously something isn't being deleted. Pastebin please.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: WriggleNightbug on March 02, 2011, 04:11:03 PM
Well obviously something isn't being deleted. Pastebin please.
 

Oh okay now I know what pastebin is XD
Like this?
http://pastebin.com/qt31uELC
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on March 02, 2011, 05:16:29 PM
Alright, well the build up became obvious once I discovered you're double creating objects (first creating empty objects in your array, then seeing that you're also creating them in StaticFrameSetup 7 times as it runs in @DrawLoop every frame), which don't get deleted. Going by your current code, I can't see any easy way to fix this. Instead I'll show you how I would've approached it, from a conceptual standpoint anyway.

Instead of creating an array filled with empty objects, just create and empty array (God bless dynamic array sizes) and fill it with objects as you create them. So everytime you call a function that creates a digit in your number, you can say

sub CreateDigit{
   let obj = Obj_Create(OBJ_EFFECT);
   objArray = objArray ~ [obj];
   //... etc
}

//then after you've drawn all the letters, you can delete them with

loop(length(objArray)){
   objArray = erase(objArray, 0);
}

//though I'd try to find a way to just change their graphic as opposed to deleting and recreating them every frame, something like

sub RunEveryFrame{
   score = GetScore; //whatever
   //insert code to delete decimals from numbers here
   if(length(ToString(score))>length(objArray)){
      //if there are more digits in score than there are objects, create another object and add it to the array
      loop(length(ToString(score))-length(objArray)){
         CreateDigit;
      }
   }else if(length(ToString(score))<length(objArray)){
      //similarly, delete objects if there are too many
      loop(length(objArray)-length(ToString(score))){
         let spot = length(objArray)-1;
         Obj_Delete(objArray[spot]);
         objArray = erase(objArray, spot);
      }
   }
   
   //loop # = length of objArray, or however many digits are in the score
   descent(j in 0..length(objArray)){
      let var = ToString(score)[j];
      Obj_SetTexture(objArray[j], GetCurrentScriptDirectory~"Image\" ~ var ~ ".png");
      //remember you need to redefine the vertices after setting a new texture to an obj effect, so do that
      //ObjEffect_SetVertexUV(objArray[j], 0, 0, 16);
      //etc.
      //Also set position
      Obj_SetPosition(ObjArray[j], x + j*16, y);
      //insert your own coordinates for x and y, just remember to displace each digit by j*(however wide the image is), I used 16 as an example
   }
}

EDIT: corrected a few things, logic was still the same, however
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: WriggleNightbug on March 02, 2011, 06:06:18 PM


Okay so I'm super excited that you can add to an array instead of intense copy pasting.

But now I'm back to an old problem, for example here's a tiny bit of code:

Code: [Select]
task DrawHighScore {
yield;
let Array = [];
ascent(i in 0..11) {
let Obj = Obj_Create(OBJ_EFFECT);
Array = Array ~ [Obj];
SimpleEffect(Array[i], 300-(14*i), 100, Image_0, 17, 24, 1, 8)
}
EffectUpdate(Array[3], Image_Comma, 17, 24, 1);
}

This isn't really drawing the high score, it basically sets up a bunch of 0's and then for testing purposes I went and re-updated the 4th character into a comma, to see if it works, but it still remains a 0, and its not the function I think because doing it the old fashioned way isn't changing the texture either, and that function pretty much covers everything from rescaling to getting the new picture and setting up the vertices, etc.

So yeah, back to the old problem of the array never seeming to return anything
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: WriggleNightbug on March 02, 2011, 06:31:46 PM
Oh wait I just clued in what you guys meant by double-creating! Whoops whoops whoops...Sometimes I wonder how I'm even able to get this far sometimes XD
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: WriggleNightbug on March 02, 2011, 11:19:19 PM
So here's another issue I've encountered while making the Stats frame, It isn't a huge problem but since I'm very picky with graphics when I'm the one making them, I can't get over the constant distortions in all my imported sprites, Danmakufu tends to do this alot with my custom bullets and graphics, and I'm wondering what im doing wrong...

Here's a picture of the distortions, there's also a bit of it noticeable on the numbers too.

(http://i786.photobucket.com/albums/yy145/FurryGoatSammy/Game/FrameProgress.png)

And here's the vertices setup:

Code: [Select]
                ObjEffect_SetPrimitiveType(Variable, PRIMITIVE_TRIANGLESTRIP);
 
          ObjEffect_CreateVertex(Variable, 4);

ObjEffect_SetScale(Variable, Scale, Scale);
ObjEffect_SetLayer(Variable, Layer);
 
          ObjEffect_SetVertexXY(Variable, 0, -Image_X/2, -Image_Y/2);
          ObjEffect_SetVertexUV(Variable, 0, 0, 0);

          ObjEffect_SetVertexXY(Variable, 1, Image_X/2, -Image_Y/2);
          ObjEffect_SetVertexUV(Variable, 1, Image_X, 0);

          ObjEffect_SetVertexXY(Variable, 2, -Image_X/2, Image_Y/2);
          ObjEffect_SetVertexUV(Variable, 2, 0, Image_Y);

ObjEffect_SetVertexXY(Variable, 3, Image_X/2, Image_Y/2);
          ObjEffect_SetVertexUV(Variable, 3, Image_X, Image_Y);
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on March 03, 2011, 05:38:54 AM
Separate your graphics by at least one pixel on the image, dnh tends to bleed pixels at the fringe of the graphic rects. What you're seeing is the edge of whatever is next to those characters on your graphic. I really don't know why it does this, it just does.

To answer the other question that you for some reason didn't ask in this thread:

let string = "" ~ ToString(variable);
let n = 0;
let res = "";
while (n < length(string) && string[n] != '.')
{
   res = res ~ ToString(string[n]);
   n++;
}

res is the string with the decimal and all zeros after it removed after the code runs. variable is the original number, before being converted to a String.

Even after two years of dnh I'm still abusing Nuclear Cheese code :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: WriggleNightbug on March 03, 2011, 07:54:41 AM
Separate your graphics by at least one pixel on the image, dnh tends to bleed pixels at the fringe of the graphic rects. What you're seeing is the edge of whatever is next to those characters on your graphic. I really don't know why it does this, it just does.

To answer the other question that you for some reason didn't ask in this thread:

let string = "" ~ ToString(variable);
let n = 0;
let res = "";
while (n < length(string) && string[n] != '.')
{
   res = res ~ ToString(string[n]);
   n++;
}

res is the string with the decimal and all zeros after it removed after the code runs. variable is the original number, before being converted to a String.

Even after two years of dnh I'm still abusing Nuclear Cheese code :V

Thanks ^^ I managed to make a pretty good system for drawing numbers using effect objects, something that concerns me a little is that there's a slight slowdown after all the effect processes, its minor, but I wonder if it'l become too much after backgrounds and danmaku and such.

Oh and that could be the problem, it happened a few times before when I was making shot graphics, but the problem is that each yellow text is their own graphic, so they arent connected, what seems to happen on every graphic is that the very bottom pixels are put on top, no matter what modifications I make to the vertice setup, It's so odd...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on March 03, 2011, 04:17:51 PM
Oh and that could be the problem, it happened a few times before when I was making shot graphics, but the problem is that each yellow text is their own graphic, so they arent connected, what seems to happen on every graphic is that the very bottom pixels are put on top, no matter what modifications I make to the vertice setup, It's so odd...

All textures are infinitely tiled, so you're seeing the wrap around on the same graphic. The solution is still the same, add at least 1 pixel of blank space around the graphic.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: WriggleNightbug on March 03, 2011, 11:46:12 PM
All textures are infinitely tiled, so you're seeing the wrap around on the same graphic. The solution is still the same, add at least 1 pixel of blank space around the graphic.

I cant believe I didn't think about that! it's a simple fix, there's gonna be a lot of to do though, all numbers and static words, etc.

Anyways here's my screen so far, once the cutout is gone, it should work well, and I made it so textures are only updated if their assigned variable changes, this made it run smoother since effects arent updated every frame, so it plays pretty much at the same FPS as it does without the stats table:

http://i786.photobucket.com/albums/yy145/FurryGoatSammy/Frame.png

(By the way, 57 or so is as high as frames will go on my parent's comp, the one I used to take this snapshot, it runs at the same ammount either way)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: WriggleNightbug on March 05, 2011, 05:21:37 PM
I have question involving a formula I used to use, but I cant seem to remember how it went.

Basically it was used for circle collisions, like if a bullet gets close enough to a player's circle shaped radius, it might bounce in another direction, or if the item effect is close to the player's sprite enough to be collected, it dissapears and does it's work.
I need it again since I'm making items that home in on you if you get close and become collected once really close.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on March 05, 2011, 06:20:01 PM
Distance formula: ((x1-x2)^2 + (y1-y2)^2)^0.5

Also, if you have small questions like this you might as well stop by the IRC channel for danmakufu, you'll get a much faster response. #danmakufu @ irc.ppirc.net (http://webchat.ppirc.net/?channels=danmakufu)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Mr. Sacchi on March 05, 2011, 09:43:26 PM
Alright, I dunno if this is the RIGHT place to put this but.

http://www.mediafire.com/?qrxbp7p65df2d53 (http://www.mediafire.com/?qrxbp7p65df2d53)

This is a Cirno Boss I'm working on, for now only 2 spellcards are made, I wanted to know if they are ok for a normal difficulty level (Also, I should note that the second one has a Timeout phase and a "move" phase right before that, there's more than enough time to win but...)

Yeah, the first one was shamelessly stolen from ruro's tutorial, sue me.

And, the health/timer for the second one are right, the health/timer for the first one are not, too lazy to go and fix them.

Also, any special reason why the default background is on the second card? I'm pretty sure I put the custom one there.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on March 05, 2011, 11:43:58 PM
You accidentally put another } after the closing bracket for @DrawLoop {, apparently. That removes everything after.
Also, you didn't define the variable "lay".

http://pastebin.com/RhCP73hQ
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: WriggleNightbug on March 07, 2011, 08:51:40 PM
Iv'e started doing something other than the frame today, Iv'e begun a background for stage 2 and something Iv'e noticed is that theres a lot of lines being cut trough all the graphics, its a little odd and distracting, especialy on the top of the cubic flower garden things.

http://i786.photobucket.com/albums/yy145/FurryGoatSammy/Clipping.png  (screenshot is > 150kb -Hele)

This seems to be a common thing in most of the backgrounds I make, I'm thinking theres something wrong with the way I draw or save my files, also Iv'e already tried adding more transparent space, but it only made it worst. ^^;

Note: the tops of those boxes are supposed to be flat, the lines arent a design choice XD the reason their there is that the wall graphics are also drawn with the same sizes inwards to give the walls of the inside of the box
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on March 08, 2011, 12:13:26 PM
Did you try setting your graphicrect 1 pixel shorter to find out whether it is dnh issue or image issue. I didn't had this issue with my 3D stage. You need to give more information about your files.

- Are you using powers of 2 for the images?
- PNG or BPM ?
- Graphicrects?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Blargel on March 08, 2011, 01:43:44 PM
It looks like the side of the walls are poking through the top part of the walls. Maybe try putting the top a tiny bit higher? Or make the sides a bit shorter?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: WriggleNightbug on March 08, 2011, 05:27:47 PM
Did you try setting your graphicrect 1 pixel shorter to find out whether it is dnh issue or image issue. I didn't had this issue with my 3D stage. You need to give more information about your files.

- Are you using powers of 2 for the images?
- PNG or BPM ?
- Graphicrects?

the verticle sides of the boxes have twice the scales of the horizontal sides, so their stretched,
theyre all png images,
and their rect is the exact same size of the image, so I assumed that they would be exact size, but i'll try recuding by one pixel
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: WriggleNightbug on March 08, 2011, 05:39:32 PM
It looks like the side of the walls are poking through the top part of the walls. Maybe try putting the top a tiny bit higher? Or make the sides a bit shorter?

Doing that only seemed to make the box too short for the top, and then you could see an opening, I tried atleast XD

Here's what the box drawing function looks like:

Code: [Select]
function DrawFlowerBlock(X, Y, Z) {
SetTexture(img2);
SetGraphicRect(0, 0, 50, 25);

SetGraphicScale(2, 1);
SetGraphicAngle(0, 0, 180);
DrawGraphic3D(X, Y, Z-12.5);
DrawGraphic3D(X, Y, Z+12.5);
DrawGraphic3D(X, Y, Z-7.5);
DrawGraphic3D(X, Y, Z+7.5);

SetGraphicScale(0.5, 1);
SetGraphicAngle(0, 90, 180);
DrawGraphic3D(X-50, Y, Z);
DrawGraphic3D(X+50, Y, Z);
DrawGraphic3D(X-45, Y, Z);
DrawGraphic3D(X+45, Y, Z);

SetTexture(img3);
SetGraphicRect(0, 0, 100, 25);

SetGraphicScale(1, 1);
SetGraphicAngle(90, 0, 180);
DrawGraphic3D(X, Y+11, Z);

SetTexture(img4);
SetGraphicRect(0, 0, 90, 15);

SetGraphicScale(1, 1);
SetGraphicAngle(90, 0, 180);
DrawGraphic3D(X, Y+5, Z);
}
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: WriggleNightbug on March 08, 2011, 08:09:29 PM
I also noticed that all transparent parts (like the very tips of the flower patches* cut trough pillars and such, the same thing would happen were I to add floor fog, etc. It seems to be a trait with using ZBuffer, but ZBuffer itself is pretty important, turning it off will draw the objects in order rather than how the camera sees them, if I use it though, then all transperacy hides objects underneath, either method seems to do some negative effect on my background so I'm kinda at a loss...the lines arent a problem without ZBuffer by the way, but is there a way to use it without low alpha values hiding objects?

Example:

http://i786.photobucket.com/albums/yy145/FurryGoatSammy/Example.png
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Nuclear Cheese on March 08, 2011, 10:43:47 PM
I also noticed that all transparent parts (like the very tips of the flower patches* cut trough pillars and such, the same thing would happen were I to add floor fog, etc. It seems to be a trait with using ZBuffer, but ZBuffer itself is pretty important, turning it off will draw the objects in order rather than how the camera sees them, if I use it though, then all transperacy hides objects underneath, either method seems to do some negative effect on my background so I'm kinda at a loss...the lines arent a problem without ZBuffer by the way, but is there a way to use it without low alpha values hiding objects?

Example:

http://i786.photobucket.com/albums/yy145/FurryGoatSammy/Example.png

I can't get your image to load, but I think I know what's going wrong.  In short, Z-buffer and transparency don't play well together.

First, some explaination:
The Z-buffer works by, when drawing a shape to the screen, updating each pixel with the depth (that is - how far away from the camera) of that pixel.  When it goes to write a new pixel on that same pixel, it will only do so if the new depth is closer to the camera than the previous one (thus, hiding farther objects behind newer ones).

However, when doing transparent pixels, the depth buffer is still updated even if the pixel is partially transparent, meaning if you go to draw something below it, it won't be seen because it doesn't get past the depth test.


Unfortunately, if you want to combine these two technologies together without the artifacts you're seeing (assuming my understanding is correct), you will need to draw any transparent objects in reverse-depth order (from farthest to closest), and ensure that you either
1) draw all solid (non-transparent) objects first, or
2) draw all solid objects in the same order at the same time.


It's a bit of a pain, I know, but it's the only way to get it looking right.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Captain Murasa on March 09, 2011, 12:26:12 PM
What function do I use to make bullets move in a random direction? Or having a boss shoot in a random direction?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on March 09, 2011, 01:29:14 PM
It's impossible. Just give up all hope now.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on March 09, 2011, 04:14:33 PM
What function do I use to make bullets move in a random direction? Or having a boss shoot in a random direction?

ascent(i in 0..100){
CreateShotA(1, GetX, GetY, 0);
SetShotDataA(1, 0+10*i, 2, rand(1,360), 0, 0, 0, CAKE);
FireShot(1);
}

CreateShot01(GetX, GetY, 2, rand(1,360), YAKISOBA, 0);

 :]
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheTeff007 on March 12, 2011, 11:12:25 PM
This might look as a question extremely noobish, but how do I edit the Frame? I haven't found any tutorial about it.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on March 12, 2011, 11:34:20 PM
As far as the graphic goes, make a 640x480 frame (with appropriate transparent gap), extend the boundaries to 1024x512, name it STG_frame.png and slap it in danmakufu\img. If the folder isn't there, create it.

As far as everything else, draw effect objects on layer 8. You can use SetRateScoreSystemEnable(false); and SetDefaultStatusVisible(false); to get rid of the rate scoring system and the score/etc info respectively.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on March 13, 2011, 02:28:18 PM
Hey I have a question, it's been bothering me for a while now. But every game that I open with AppLocale doesn't have music (or at least can't play mp3 files). It can still play .wav musics but not .mp3 I knew this because I just played Irisu Syndrome and it has music but it doesn't play the music in game.

How do I fix this ?  :ohdear:
I'm tired of converting .mp3 to .wav files

Edit : Also, when something is completely black, Danmakufu makes it transparent, does this happen to other people ? Is there a way to fix it ?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Luna on March 13, 2011, 04:13:30 PM
For your second question, it happens to me as well, and the (probably) only solution is using RGB 1, 1, 1 instead of 0, 0, 0.

:c
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on March 13, 2011, 07:33:42 PM
Except having an RGB value default to a transparency is done on purpose and doesn't really need to be fixed since it isn't a problem.

Not sure why the music isn't working though. Does it happen for all mp3s? Are the tags maybe messed up in some way?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Foremoster on March 14, 2011, 02:05:22 AM
Not sure why the music isn't working though. Does it happen for all mp3s? Are the tags maybe messed up in some way?

Yah, all .mp3 happens to become silent

PlayMusic(GetCurrentScriptDirectory ~ "\boat3.wav");
Work

PlayMusic(GetCurrentScriptDirectory ~ "\CresentEdge.mp3");
Silence
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Hyouga Kazu on March 14, 2011, 06:55:32 AM
Could someone explain to me how to use Common Data?
I tried using it before but it had zero result.

I'm probably doing something wrong, but I can't find out what it is.
I was trying to make a spellcard captured/played counter for my game.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: puremrz on March 23, 2011, 09:47:36 PM
So I have an enemy script, and I want to make a custom healthbar and timer and such appear. How would I do this without copy-pasting it in every script?
I've looked around #include_function, which apparently lets me paste a file's contents in my enemy script.
So I did it like this:

Code: [Select]
#TouhouDanmakufu
//*etc*

#include_function("script\Functions\SpellcardName.txt");

script_enemy_main{

@Initialize{
let nameofspellcard="transfer_this_string_to_the_SpellcardName_function_plz";
}

@MainLoop{
}

@BackGround{
}

@DrawLoop{
}

}

Code: [Select]
SpellcardName{ // Is this right?

@Initialize{
//Where's that data I asked for?
}

@MainLoop{
}

@Finalize{
}

}

I'm missing that bit of info, does anyone know how to send that string over to the included script?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on March 23, 2011, 10:18:24 PM
Just by looking, it seems you're looking to put a script_spell in a file.
You'd use #include_script in that case, instead of #include_function.

Also, for spell scripts, you would use script_spell cardname { } instead of just SpellCardName { }.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on March 23, 2011, 10:32:39 PM
He uses script spells instead of functions because he doesn't know how functions work. However, he's trying to learn, which is why he posted here.
...and honestly, it's all wrong. Functions don't have #initialize or anything you put there. Instead of us trying to teach you from scratch, be like a normal person and read this (http://dmf.shrinemaiden.org/wiki/index.php?title=Danmakufu_Intermediate_Tutorial) to learn how to use tasks, which are a type of function. The tutorial uses it to control bullets, but you can use it to control an effect object instead, which you can use for your text.
(Apologies for sounding harsh, but I told you this before and it seems like you didn't even attempt to search for a tutorial... you just kept asking "how do I do this?" and made no real attempt to figure it out yourself.)

For now, put everything in the same script. Once you finish that and get it working in a task, then worry about #include_function. Otherwise it's like asking how to run when you don't even know what walking is.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on March 23, 2011, 10:44:32 PM
You are slightly wrong Azure. It is not that he doesn't wants to read tutorials, it is because Puremrz is a person who tries to script everything in mainloop style without tasks and very minimum of functions. And there are no tutorials for mainloop style scripting for such things. Because nobody makes his life harder with scripting, except Puremrz.

He has some fetish or something it seems.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on March 23, 2011, 11:03:51 PM
No wonder nobody fuckin' scripts anymore



Could someone explain to me how to use Common Data?
I tried using it before but it had zero result.

I'm probably doing something wrong, but I can't find out what it is.
I was trying to make a spellcard captured/played counter for my game.

CommonData is, in short, a global variable that you can pass along between scripts, and even between play sessions. You declare a variable name and then give it a value, and that value can be accessed from any script you've made. For example, normally you would declare a variable within a script like

let variable = 4;

And that variable can be accessed by anything within the braces (scope) it was declared in. To initialize common data with the same name and value, you would say

SetCommonData("variable", 4);

And this value can be got from anywhere using GetCommonData("variable"); For example, number = GetCommonData("variable") + 6; would set the value of a variable called number to 10. However, sometimes you may run into points where you want to get some common data but you haven't initialized it anywhere first. This is where you would use GetCommonDataDefault("variable", 2); which would attempt to retrieve common data named "variable," but if it can't find any, it will return the value 2. All common data is deleted when you stop running the script, however, you can also save common data to be used when the player starts up the script at some other time, using the SaveCommonData function, which writes all the current common data and it's values to a .dat file, which can be retrieved in a later play of the script using LoadCommonData. There are many other useful common data functions, like saving values in groups using common data areas and stuff like that, feel free to experiment with all the functions you find here (http://dmf.shrinemaiden.org/wiki/index.php?title=Miscellaneous_Functions#Common_Data_Functions).



So I have an enemy script, and I want to make a custom healthbar and timer and such appear. How would I do this without copy-pasting it in every script?
I've looked around #include_function, which apparently lets me paste a file's contents in my enemy script.
So I did it like this:

*c0d3z*

I'm missing that bit of info, does anyone know how to send that string over to the included script?

The #include_function "script/path/name/here.txt"; command takes all the information from the text file here.txt and pastes it in the script you declared #include_function in, as if it was actually in that script. You'll even notice that when an error message pops up for something after the #include_function command, it includes the lines from the included text file in the line count of the current file as if the included text was actually written in it. The text you put in this included file can be absolutely anything legal in danmakufu terms, that is, you can make a text file here.txt and in it write only...

let variable = 2;

...then say in some other file...

script_enemy_main{
   let coordinate = 5;
   #include_function "here.txt";

   @Initialize{
      //...etc


And danmakufu will read it as:


script_enemy_main{
   let coordinate = 5;
   let variable = 2;

   @Initialize{
      //...etc


So as you can see, putting something like a seperate enemy script in the included function would probably yield an error. To go about doing your custom healthbar, script it up so that it works in one enemy script, then begin to transfer all the necessary code into a text file that may be included in other enemy scripts. Unfortunately, the easiest way to do this would be to make your healthbar thing a task which can be called from the enemy script and then run along side it using the enemy's yield command. If you really want to use the "MainLoop" method, you'll still probably have to seperate the healthbar from your MainLoop, but instead make it a sub (or function) instead of a task. Something like:

"here.txt"

sub Healthbar{
   let obj = Obj_Create(OBJ_EFFECT);
   //...etc
   //insert your healthbar code here, exactly as if it was written in the @MainLoop of your enemy script.
}


"hostscript.txt"

script_enemy_main{

   #include_function "here.txt";

   @Initialize{
      //...
   }

   @MainLoop{
      Healthbar;
   }

   //etc
}
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Blargel on March 24, 2011, 05:17:20 AM
So I heard Mr. Z actually doesn't understand how to use subs, functions, and tasks. I remember I wrote something about this in one of the old ass Q&A threads...
*looks for a while*
Here we go (http://www.shrinemaiden.org/forum/index.php/topic,3218.msg162097.html#msg162097).

To add on top of that bit of reading, when you are writing a sub, function, or task, you will generally be putting in the same place as global variables... i.e. right after script_enemy_main{ and before @Initialize{

Also, another example that might help you understand this more:
Code: [Select]
function AnotherCreateShot01(x, y, speed, angle, graphic, delay) {
    let obj = Obj_Create(OBJ_SHOT);
    Obj_SetPosition(obj, x, y);
    Obj_SetSpeed(obj, speed);
    Obj_SetAngle(obj, angle);
    ObjShot_SetGraphic(obj, graphic);
    ObjShot_SetDelay(obj, delay);
}
This bit of code makes a function called AnotherCreateShot01 that behaves EXACTLY like the built in CreateShot01 function. Basically if you were to put this in an enemy script and replace all instances of CreateShot01; with AnotherCreateShot01;, it would work exactly the same. What I'm trying to demonstrate here is that you can write your own shot creation functions for types of shots you find yourself using really often. By extension, once you're able to write functions for controlling shots, you should be able to start working on writing functions to handle other things like drawing. Eventually you should even be able to start working with tasks.

One last example:
Code: [Select]
function GetDistance(x1, y1, x2, y2){
    return ((x1-x2)+(y1-y2))^0.5
}
Another great use for functions is to do calculations. Would you rather see GetDistance or a giant long string of calculations? Making a function like this makes it more apparent what you're trying to accomplish instead of just what looks like a  random calculation. The return keyword makes the function spit out a value that can be used at wherever the function was called. This means you can do something like let variable = GetDistance(GetPlayerX, GetPlayerY, GetX, GetY); to store the current distance from the boss to the player in the variable, similar to how you would use let variable = Obj_GetSpeed(obj); to store the current speed of an object in a variable.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on March 24, 2011, 05:52:18 AM
Just adding a little tidbit I realized and then forgot about and then rediscovered later.

Code: [Select]
function CreateShot01T(x, y, s, a, g, d) {
    let obj = Obj_Create(OBJ_SHOT);
    Obj_SetPosition(obj, x, y);
    Obj_SetSpeed(obj, s);
    Obj_SetAngle(obj, a);
    ObjShot_SetGraphic(obj, g);
    ObjShot_SetDelay(obj, d);
}
Code: [Select]
function CreateShot01S(x, y, s, a, g, d) {
    let obj = Obj_Create(OBJ_SHOT);
    Obj_SetPosition(obj, x, y);
    Obj_SetSpeed(obj, 0);
    Obj_SetAngle(obj, 0);
    ObjShot_SetGraphic(obj, g);
    ObjShot_SetDelay(obj, d);
    while(!Obj_BeDeleted(obj)){
        Obj_SetX(obj,Obj_GetX(obj)+cos(a)*s);
        Obj_SetY(obj,Obj_GetY(obj)+sin(a)*s);
    }
}

The S and T stand for Still and Turn. They are both CreateShot01 with objects; but T will changes the graphic angle of the bullet as it turns (such as for rice bullets and arrows), whereas S will keep the graphic angle of the bullet still at all times. This is very handy for everyday circular bullets.
Or I should say, the whole premise is that making bullets that move through trigonometry and not Danmakufu movement attributes will keep their graphic still.
In addition, bullets with an even width/height will not have a pixel-perfect drawing center. These should be spawned at (floor(x)+0.5, floor(y)+0.5).
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on March 24, 2011, 06:10:44 AM
You have a while loop without a yield there, and the second function will make the bullets move even while they're delaying. Minor, but they're worth pointing out.

Maybe all of this should be combined into a "functions and tasks" tutorial on the wiki? It needs more stuff anyway.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on March 24, 2011, 06:17:58 AM
Sorry, was typed from memory. The movement-while-delayed thing is on purpose though, the Touhou games actually use this method rather than DNH's stop-while-delay thingy.
Another small problem is that if an enemy dies while a bullet is still on-screen it'll just stop due to no yielding. So, it requires a controller method, or for the enemy to not die. There are multiple solutions for that though so yeah.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Hyouga Kazu on March 24, 2011, 07:44:24 AM
No wonder nobody fuckin' scripts anymore
RaNGE is too quiet these days. Someone should stir it up a little. A new game perhaps?
Yes yes, I'll get onto it, I have to finish some things that deal with Common Data and then I'll make a thread.  :V

CommonData is, in short, a global variable that you can pass along between scripts, and even between play sessions. You declare a variable name and then give it a value, and that value can be accessed from any script you've made. For example, normally you would declare a variable within a script like

(Wall of text and code)
Hmm, that might've been a little too basic. Okay, I formulated my question a little poorly, didn't I?
So what was the problem in the end? The lack of proper Common Data saving by me.
I solved it by having the CtC script open next to mine, and man, they use too many included scripts.   :derp:

Sorry for the misunderstanding, Naut.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: puremrz on March 24, 2011, 08:00:09 AM
He has some fetish or something it seems.

Not really, I just do things this way because I learned to script from the Ex Rumia example files that came with Danmakufu.
It's just different, and really not inefficient or anything. It may seem strange to people who don't do things that way, but the same goes for me.
Anyway, that wasn't so nice, Azure. I really did look at the tutorials, and I only post here as a last resort when I really can't figure things out. I'm not good with danmakufu terminology, so what I want can be hard to explain, I guess.
But I guess I'll just find a loophole to it. If Mewkyuu's clear and simple solution won't do that job, that is. (can't try it out yet because I'm at work)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on March 24, 2011, 08:04:58 AM
That was obviously a joke puremrz :V

Anyway, RikaNitori seems indeed quiet lately. Wonder what happened to all major games being made. So far only drake/naut, azure and stuffman seem to be active.

As for me, :V i am lacking inspiration momentarily. orz
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: puremrz on March 24, 2011, 08:17:44 AM
That was obviously a joke puremrz :V

Anyway, RikaNitori seems indeed quiet lately. Wonder what happened to all major games being made. So far only drake/naut, azure and stuffman seem to be active.

As for me, :V i am lacking inspiration momentarily. orz

:V
Oh, I'm working really hard on something, since September 2009 actually. The main game is practically done (aside from the custom spellcard names and spellcard practise, which I'm now asking tough questions about), and the 2 extra stages only need the enemy parts and a few spellcards. I'm just not announcing anything big yet because I want to get it done before I start raising people's hope.

But am I really the only one who learned from Ex Rumia? I mean, it came from the creator of danmakufu as an example, so it has to be good, right? O_O

That reminds me, what I'm trying to do now is the same as how you call a player's spellcard. If you need an example out of my player script, in which it works, I'll post it when I get back to my computer.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on March 24, 2011, 08:32:51 AM
I actually never learned from ex-rumia script. Most of the info I got from wiki and existing tutorials here on this forum. But back in the days, those tutorials were small so i had to ask often on forum and try out myself with task-style scripting.

This was also one of the reasons i started the video tutorials.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: puremrz on March 24, 2011, 11:30:35 AM
After combining Naut and Blargel's explanations, I now know how to get what I was looking for. Namingly:

Code: [Select]
//enemy script - unimportant data was left out
@MainLoop{
  if(time%10==0){ AnotherCreateShot01(GetX,GetY,3,GetAngleToPlayer,ORANGE02,0); }
  time++;
}
#include_function "script/Shot.txt";

+

Code: [Select]
//Shot.txt
function AnotherCreateShot01(x, y, speed, angle, graphic, delay) {
    let obj = Obj_Create(OBJ_SHOT);
    Obj_SetPosition(obj, x, y);
    Obj_SetSpeed(obj, speed);
    Obj_SetAngle(obj, angle);
    ObjShot_SetGraphic(obj, graphic);
    ObjShot_SetDelay(obj, delay);
}
(This is just a simple test, but it works)

Now that I got this working, I know how to do better things with it as well.
And this will certainly tidy up the main file, now that I can put backgrounds and enemy spawn data in sepperate files.
Thanks fellas.  :3
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Kylesky on March 25, 2011, 01:02:30 AM
Remember me? I see everyone's saying Rika Nitori's getting quiet lately...

Well yeah, I admit I haven't been doing anything, or even posting here for a long time... I'm either really busy or getting really lazy lately... all my projects have been sitting here with no progress at all... (ESD, RPG, IMI, etc)

Anyone wanna try getting me to start working again? :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on March 25, 2011, 01:17:08 AM
Anyone wanna try getting me to start working again? :V

I dare you to make a script that is actually possible to beat.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Kylesky on March 25, 2011, 01:42:37 AM
I dare you to make a script that is actually possible to beat.

I have... play my scripts on normal, instead of lunatic :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on March 25, 2011, 02:19:31 AM
I have... play my scripts on normal, instead of lunatic :V

Fine. Make one of my scripts into Mewkyuu/Kylesky difficulty. (They're the same thing... right?)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: puremrz on March 26, 2011, 10:57:55 AM
Simple one: Can danmakufu put a variable in a string? And if so,  how?
Example:

Code: [Select]
let difficulty="Hard";
SpellcardName("Shoot Bullets To Kill The Player (difficulty)");

If that won't do, can I succesfully merge two strings into one?
Code: [Select]
["Shoot Bullets "]~["(Hard)"];The above has no success unfortunately.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Zengar Zombolt on March 26, 2011, 11:53:31 AM
To merge strings, I think you can just add them. What you're trying to do is to combine two arrays that aren't saved, so it doesn't work because there's nothing happening to it.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on March 26, 2011, 02:10:26 PM
"Shoot Bullets (" ~ difficulty ~ ")"
Strings themselves are basically arrays, so the brackets are unnecessary.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: puremrz on March 26, 2011, 05:16:07 PM
Thanks, that worked.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: JmLyan on April 02, 2011, 12:15:26 PM
I'm trying to make a stage script, but when I use this script, the boss doesn't appear but the music plays normally. I have checked that the path is correct and WaitForFrames is correctly defined in StageFunctions.dnh. Also, if I use CreateEnemyFromFile in the script, danmakufu crashes. Any idea what could be wrong?

Code: [Select]
#TouhouDanmakufu[Stage]
#Title[Patchouli Knowledge EX Stage]
#Text[Extra Stage]
#Player[FREE]
#ScriptVersion[2]

script_stage_main{
let StageMusic = "script\Stage BGM\BGM_6-4";
task stage{
PlayMusic(StageMusic);
CreateEnemyBossFromFile("script\Patchouli Knowledge\PatchouliBoss.dnh", GetCenterX, -20, 0, 0, 0);
WaitForFrames(240);
Clear;
}
#include_function "\lib\StageFunctions.dnh";
@Initialize{
LoadMusic(StageMusic);
stage;
}
@MainLoop{
yield;
}
@BackGround{
SetAlpha(255);
SetGraphicScale(1, 1);
SetGraphicAngle(0, 0, 0);
SetViewTo(0, 0, 0);
SetViewFrom(100, 90, 45);
SetFog(100, 300, 0, 0, 0);
}
@Finalize{
DeleteMusic(StageMusic);
}
}
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Atfyntify on April 02, 2011, 04:52:03 PM
For some what reason my danmakufu does not respond when I go to: All,Single,Plural,Stage,Random. I can only enter directory, What is wrong? I've used applocale many times!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on April 02, 2011, 05:23:13 PM
I'm trying to make a stage script, but when I use this script, the boss doesn't appear but the music plays normally. I have checked that the path is correct and WaitForFrames is correctly defined in StageFunctions.dnh. Also, if I use CreateEnemyFromFile in the script, danmakufu crashes. Any idea what could be wrong?

Code: [Select]
snip
Apparently CreateEnemyFromFile and FromScript does not work on the first frame of running a script. Put a WaitForFrames(1); just before calling CreateEnemyFromFile.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Luna on April 02, 2011, 05:36:04 PM
For some what reason my danmakufu does not respond when I go to: All,Single,Plural,Stage,Random. I can only enter directory, What is wrong? I've used applocale many times!

Wait for a while, it may be loading the list of scripts.

If it doesn't work, try deleting script_index.dat.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: JmLyan on April 02, 2011, 05:56:46 PM
Apparently CreateEnemyFromFile and FromScript does not work on the first frame of running a script. Put a WaitForFrames(1); just before calling CreateEnemyFromFile.

Thanks a lot. It worked.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Yuyuko Yakumo on April 03, 2011, 06:39:38 AM
How can you decelerate object bullets? The method I'm using doesn't seem to work. It'll make the 16 bullets that move at the appropriate speed, but they won't slow down like how I want them to.
Code: [Select]
function PrimaryShot () {
ascent (i in 1..16) {
PrimaryShotDefine(i)

}
}

task PrimaryShotDefine(v) {
let obj=Obj_Create(OBJ_SHOT); //Make an object with the properties of a shot.
Obj_SetPosition(obj, GetX, GetY);
Obj_SetAngle(obj, 90);
Obj_SetSpeed(obj, 0.25* v);
ObjShot_SetGraphic(obj, 210); //Shot ID 210. See custom supershot script.
ObjShot_SetDelay  (obj, 20);
ObjShot_SetBombResist (obj, false);

while(Obj_BeDeleted(obj)==false) {
descent (j in 100..1) { //Deceleration of bullets. (not working)
Obj_SetSpeed(obj, j* v* 0.02);

}
yield;
}
}
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on April 03, 2011, 06:52:16 AM
Quote
while(Obj_BeDeleted(obj)==false) {
   descent (j in 100..1) { //Deceleration of bullets. (not working)
      Obj_SetSpeed(obj, j* v* 0.02);
   }
   yield;
}
This will set the speed 100 times, then yield. Not only will you not see anything happen, it's a waste of processing and probably wouldn't give the right result anyways.

What you want is simply
while(Obj_BeDeleted(obj)==false) {
   Obj_SetSpeed(obj, Obj_GetSpeed(obj) - something);
   yield;
}
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Atfyntify on April 03, 2011, 06:55:49 AM
Wait for a while, it may be loading the list of scripts.

If it doesn't work, try deleting script_index.dat.
ah ok. thanks.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Yuyuko Yakumo on April 03, 2011, 07:22:42 AM
Ah, t
This will set the speed 100 times, then yield. Not only will you not see anything happen, it's a waste of processing and probably wouldn't give the right result anyways.

What you want is simply
while(Obj_BeDeleted(obj)==false) {
   Obj_SetSpeed(obj, Obj_GetSpeed(obj) - something);
   yield;
}

Ah, that worked perfectly. Thanks for the help.

I guess I tend to overthink things...

EDIT: Another question. Can the argument for an angle of a bullet be <0 or >360?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Kylesky on April 04, 2011, 02:16:38 AM
EDIT: Another question. Can the argument for an angle of a bullet be <0 or >360?

Yes... you can even make it 92371590275182934 :V (though that might cause problems)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on April 04, 2011, 02:31:12 AM
However due to DNH screwing up with sufficiently high or low values, you're going to want to modulo it most of the time.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Atfyntify on April 04, 2011, 02:35:33 PM
Quote
Player Scripts:
- Yuka Kazami (Mystic Square) <12/15/09 UPDATE>
- Mima (Mystic Square)

- The Shot Replace Script. - Requiered to play the old Cirno and Tenshi scripts

Err........for some what reason the mima error always appears and it says that the "mima.txt" has a problem. What's wrong? also I've tried all of johnny walker's scripts and there seems to be a BGcontrol error. I'd love the grimoire of alice script. http://www.shrinemaiden.org/forum/index.php?topic=476.0
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: ふとくていなねこじょおう on April 10, 2011, 02:07:48 PM
So, I'm starting on Danmakufu today.

I downloaded Applocale and started to install it.

Everything's fine and dandy until...it stops and says that it couldn't open some program needed and it canceled the install.

FFFFUUUUUUUUUU-  :colonveeplusalpha:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on April 10, 2011, 02:17:40 PM
So, I'm starting on Danmakufu today.

I downloaded Applocale and started to install it.

Everything's fine and dandy until...it stops and says that it couldn't open some program needed and it canceled the install.

FFFFUUUUUUUUUU-  :colonveeplusalpha:

Oh? Hey there. What program does it "need"? Did it just suddenly close the install?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: ふとくていなねこじょおう on April 10, 2011, 02:51:24 PM
It just stopped, showed me that message, and then closed the install once I pressed ok.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Kylesky on April 10, 2011, 03:27:52 PM
It just stopped, showed me that message, and then closed the install once I pressed ok.

Care to show us the error? either a print screen image or just copy pasting it would work...
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: ふとくていなねこじょおう on April 10, 2011, 03:51:51 PM
http://i232.photobucket.com/albums/ee28/gaara_panda_luff/Problem.png

Would that do?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Luna on April 10, 2011, 04:07:53 PM
IIRC the error is caused by UAC being a jerk. Either turn it off or do this:

Move apploc.msi somewhere where you can reach it easily from the command prompt.
Run the command prompt with admin rights.
Run apploc.msi from the command prompt.

hooray, vague explanations
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on April 10, 2011, 04:13:19 PM
That's the same thing I had to go through when I tried to install Applocale on Windows 7 as well. They're basically what Luna just wrote, but here's the steps I used to set things straight.

Here?s how to install AppLocale on Windows 7:
1. Place the AppLocale installer (apploc.msi) in your C: drive.
2. Go to your start menu, type cmd in the search box.
3. Hold down crtl+shift and click on cmd.exe.
4. Select Yes when a dialog asks if you want the program to make chances to your computer.
5. The command prompt should show C:\Windows\System32.
6. Type cd\ and press enter to navigate to the C: drive.
7. Type apploc.msi and press enter, the installer will appear.
8. Install the application.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: ふとくていなねこじょおう on April 10, 2011, 04:19:15 PM
Thank you so much! It finally worked!  :]
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Darkness1 on April 11, 2011, 05:06:13 PM
Is it just me not getting puremrz?s shotsheet to work? When i load the bullets they all look like the graphicrect is off.

EDIT: Nevermind, fixed. I apparently had an old version of the shotsheet.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Atfyntify on April 12, 2011, 01:14:41 PM
That's the same thing I had to go through when I tried to install Applocale on Windows 7 as well. They're basically what Luna just wrote, but here's the steps I used to set things straight.

Here’s how to install AppLocale on Windows 7:
1. Place the AppLocale installer (apploc.msi) in your C: drive.
2. Go to your start menu, type cmd in the search box.
3. Hold down crtl+shift and click on cmd.exe.
4. Select Yes when a dialog asks if you want the program to make chances to your computer.
5. The command prompt should show C:\Windows\System32.
6. Type cd\ and press enter to navigate to the C: drive.
7. Type apploc.msi and press enter, the installer will appear.
8. Install the application.

(http://img33.imageshack.us/img33/1521/errorep.png)

how come I can't open the installation?

I already have danmakufu but I want to install it on my OTHER computer.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on April 12, 2011, 05:14:33 PM
Still Windows 7?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Atfyntify on April 12, 2011, 05:24:37 PM
Still Windows 7?
what? my error? no. its XP.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on April 12, 2011, 06:07:24 PM
You're following instructions on how to install it on Windows 7. Just double click apploc.msi to install it on Windows XP, don't bother moving it around or anything like that.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on April 12, 2011, 06:55:14 PM
Do people even read the FAQ thread I wonder. As Applocal thing is like extremely frequently asked.

Like Naut said, stop fooling around with the msi and just install it. XP does not have any UAC-like protection. Unless you are on a computer with administrator restrictions, but I highly doubt that.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: touhouplayer on April 13, 2011, 12:24:32 AM
I made a very simple danmakufu script using CreateLaser01 and CreateShot01.
Was wondering how to manage "SetText" and "#BGM"
Here is my script.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#TouhouDanmakufu
#Title [Christmas Sign "The Tree and the Ornament"]
#Text [Test Script]
#ScriptVersion [2]

script_enemy_main {
    let imgBoss = "script\img\ExRumia.png";
    let angle = 90;
    let frame = 0;
    @Initialize {
        SetX(GetCenterX);
        SetY(GetClipMinY + 120);
        SetLife(5000);

        LoadGraphic(imgBoss);
        SetTexture(imgBoss);
        SetGraphicRect(0, 0, 63, 63);
    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 24);
        SetCollisionB(GetX, GetY, 24);

        frame++;
        if (frame == 5) {
            CreateLaser01(GetX, GetY, 2, GetAngleToPlayer, 200, 16, GREEN01, 20);
            CreateShot01(GetX, GetY, 1, angle, RED04, 0);
            angle += 2;
            frame = 0;
        }
    }

    @DrawLoop {
        DrawGraphic(GetX, GetY);
    }

    @Finalize {
        DeleteGraphic(imgBoss);
    }
}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Pls help
(I would Appriciate those who would try to help)
 :P
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Naut on April 13, 2011, 12:40:51 AM
Was wondering how to manage "SetText" and "#BGM"

#BGM goes in the top of your script along with all the other lines that begin with #, in it's bracket you specify the path directory of your background music. If your background music is in the same directory as your script and is called bgm.mp3, it would look like this:

#BGM[.\bgm.mp3]



What do you mean by SetText? DrawText?

DrawText("text goes here", x, y, size, alpha); draws a text string at the x and y coordinates you specify, with the size and transparency you give it (12 is a nice average size for text, and 255 alpha means the text is completely solid, 0 alpha means it's completely invisible). DrawText must be put in @DrawLoop.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: touhouplayer on April 13, 2011, 12:53:36 AM
@Naut:
The #BGM dosen't work.
and forget what i said about SetText...

The Title of the danmaku is what im talking about...(e.g. Impossible Request "Rainbow Danmaku")
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on April 13, 2011, 01:08:19 AM
PASTEBIN

What is it about the #BGM? Is the music not playing? There a big pause before the script starts?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Kylesky on April 13, 2011, 01:13:41 AM
I'm not so sure, but you might have to add quotation marks to the bgm path...

also, for the spell card title, just use the CutIn function:

CutIn(*insert KOUMA or YOUMU*, *insert spell card name as a string*, *insert path to cutin image, leave as 0 if no image*, *insert left, top, right, bottom coordinates of cutin image, leave as 0 if none*);
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: touhouplayer on April 13, 2011, 05:30:12 AM
@Mewkyuu:
There isn't a big stop...
It's just that when i play the script, there are no sounds...

@Kylesky
I tried to put
 CutIn(YOUMU,"Christmas Sign"\""Tree and Ornament"\",0,0,200,600);
all i get when i play it is a window saying:
-----------------------------------------------------------------------------------------------------|
Error                                                                                                                              |
CutIn,(17s-U)                                                                                                              |
                                                                                                                                       |
       CutIn(YOUMU,"Christmas Sign"\""Tree and Ornament"\",0,0,200,600);  |
-----------------------------------------------------------------------------------------------------|

Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on April 13, 2011, 05:36:59 AM
@Mewkyuu:
It's just that when i play the script, there are no sounds...
Check the names and file extensions of your files. They should also be in the right folder.

@Kylesky
-----------------------------------------------------------------------------------------------------|
Error                                                                                                                              |
CutIn,(17s-U)                                                                                                              |
                                                                                                                                       |
       CutIn(YOUMU,"Christmas Sign"\""Tree and Ornament"\",0,0,200,600);  |
-----------------------------------------------------------------------------------------------------|
That shouldn't happen.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: touhouplayer on April 13, 2011, 05:58:47 AM
Here is a picture to the  one where i failed in putting the title of spellcard.
(I Tried again, and slightly different but still error.)

http://a3.sphotos.ak.fbcdn.net/hphotos-ak-snc6/205564_1993664846373_1385971258_32372512_2556099_n.jpg
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on April 13, 2011, 06:43:53 AM
Yes it should happen, you're missing a parameter.

CutIn(TYPE,"name","image",L,T,R,B);
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Atfyntify on April 13, 2011, 06:57:33 AM
Do people even read the FAQ thread I wonder. As Applocal thing is like extremely frequently asked.

Like Naut said, stop fooling around with the msi and just install it. XP does not have any UAC-like protection. Unless you are on a computer with administrator restrictions, but I highly doubt that.
I actually did read it but I didn't find the FAQ on what happens when I can't open the installer and was interrupt. it says that the error code is 2755.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: touhouplayer on April 13, 2011, 08:52:39 AM
Yes it should happen, you're missing a parameter.

CutIn(TYPE,"name","image",L,T,R,B);

Thanks. It Worked!
And now, i got the bgm working!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: JmLyan on April 13, 2011, 06:04:06 PM
For some reason, danmakufu crashes after the dialogue when I run this script. There is no trouble with the event itself because if I comment it out then it just crashes instantly instead. What could be wrong?

Code: [Select]
script_enemy_main {
//General Variables
    let BossImage = GetCurrentScriptDirectory~"Remilia Scarlet Sprite.png";
let BossStill = [0, 0, 64, 64];
let BossMove = [64, 64, 128, 128];
let BossMusic = GetCurrentScriptDirectory~"BGM_Remilia";

    @Initialize {
        LoadGraphic(BossImage);
LoadMusic(BossMusic);
        SetLife(1);
        SetDamageRate(0, 0);
        MagicCircle(false);
        SetEnemyMarker(true);
CreateEventFromScript("Talk");
    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 24);
if(GetEventStep==1){
PlayMusic(BossMusic);
}
if(OnEvent==false){
SetLife(0);
}
yield;
    }

    @DrawLoop {
DrawText("Boss Name", 36, 30, 12, 225);
if(GetSpeedX>=1){
SetTexture(BossImage);
SetGraphicAngle(0, 0, 0);
SetGraphicRect(BossMove[0], BossMove[1], BossMove[2], BossMove[3]);
DrawGraphic(GetX, GetY);
}else if(GetSpeedX<=-1){
SetTexture(BossImage);
SetGraphicAngle(180, 0, 0);
SetGraphicRect(BossMove[0], BossMove[1], BossMove[2], BossMove[3]);
DrawGraphic(GetX, GetY);
}else{
SetTexture(BossImage);
SetGraphicAngle(0, 0, 0);
SetGraphicRect(BossStill[0], BossStill[1], BossStill[2], BossStill[3]);
DrawGraphic(GetX, GetY);
}
    }

    @Finalize {
       DeleteGraphic(BossImage);
    }
}

script_event Talk{
//General Variables
let CharGraphic = GetCurrentScriptDirectory~"0.png";
let BossGraphic = GetCurrentScriptDirectory~"Remilia Scarlet.png";

@Initialize{
LoadGraphic(CharGraphic);
LoadGraphic(BossGraphic);
}

@MainLoop{
SetChar(LEFT, CharGraphic);
SetGraphicRect(LEFT, 0, 0, 256, 512);
MoveChar(LEFT, BACK);
SetChar(RIGHT, BossGraphic);
SetGraphicRect(RIGHT, 0, 0, 256, 512);
MoveChar(RIGHT, BACK);
TextOutA("You won!");
SetStep(1);
End;
}

@Finalize{
DeleteGraphic(CharGraphic);
DeleteGraphic(BossGraphic);
}
}

PS. Never mind the dialogue, it's just a test.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Atfyntify on April 13, 2011, 08:18:15 PM
hey err....guys  recently started my own script and I don't know stuff so I just made a test on the background and I FAIL :fail:. all my projects are easy and FAIL with errors. I have 2 projects too but they're also with errors so here's my test:

Code: [Select]
#TouhouDanmakufu
#Title[BG test]
#Text[testing the background abilitie in danmakufu]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{

        let CSD =  GetCurrentScriptDirctory;

        let bg = CSD ~ "bg\hakureishrine.png";

        @Initialize{
              SetLife(1000)
              SetMovePosition01(GetCenterX,GetCenterY,5);

              mainTask;

        }

        @MainLoop{

        }

        @DrawLoop{

        }

        @Background{
               SetTexture(bg);
               SetRenderState(ALPHA);
               SetAlpha(255);
               SetGraphicRect(0,0,832,539);
               SetGraphicScale(1,1);
               SetGraphicAngle(0,0,0)
               DrawGraphic(GetCenterX,GetCenterY);

        }

        @Finalize{

        }

}

And I kept getting this error:
(http://img200.imageshack.us/img200/1253/error5u.jpg)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: JmLyan on April 13, 2011, 08:44:42 PM
You misspelled directory. Fix that and it will probably work.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Atfyntify on April 14, 2011, 09:58:59 AM
You misspelled directory. Fix that and it will probably work.
I did correct directory but for some what reason hakureishrine.png keeps getting errors.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on April 14, 2011, 10:17:47 AM
I did correct directory but for some what reason hakureishrine.png keeps getting errors.

Does it generate an actual error message or does it just not show up at all? You seem to have left out your LoadGraphic(bg), which means that your background image won't ever exist in DNF's memory. Add it in your @Initialize to set things right.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Stuffman on April 14, 2011, 10:36:39 AM
JmLyan - This has me completely stumped, it won't stop crashing no matter what I comment out ???

Anyone else want to take a look at this?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Atfyntify on April 14, 2011, 10:52:31 AM
Does it generate an actual error message or does it just not show up at all? You seem to have left out your LoadGraphic(bg), which means that your background image won't ever exist in DNF's memory. Add it in your @Initialize to set things right.
(http://img17.imageshack.us/img17/9634/error6r.jpg)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: JmLyan on April 14, 2011, 10:54:59 AM
You have forgotten a semicolon after SetLife(1000).
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Atfyntify on April 14, 2011, 11:02:58 AM
You have forgotten a semicolon after SetLife(1000).
OH! darn it. I always forget semicolons. *_*

Also: (http://img233.imageshack.us/img233/9067/error7t.jpg)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on April 14, 2011, 11:08:42 AM
Is there actually a task named mainTask? Please use Pastebin (http://pastebin.com/) to show us your entire code.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Atfyntify on April 14, 2011, 11:34:56 AM
Is there actually a task named mainTask? Please use Pastebin (http://pastebin.com/) to show us your entire code.
like this? http://pastebin.com/bEMCWKQ6
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Atfyntify on April 14, 2011, 11:41:22 AM
Is there actually a task named mainTask? Please use Pastebin (http://pastebin.com/) to show us your entire code.
(http://img713.imageshack.us/img713/5943/error8.jpg)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: JmLyan on April 14, 2011, 11:42:59 AM
Now you forgot the semicolon on SetGraphicAngle.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on April 14, 2011, 11:46:50 AM
like this? http://pastebin.com/bEMCWKQ6

Yup, just like that. You're calling for the task mainTask to start in your @Initialize, but there's actually nothing named mainTask in your script.

That's an error, mate.  :3
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Atfyntify on April 14, 2011, 12:14:16 PM
Yup, just like that. You're calling for the task mainTask to start in your @Initialize, but there's actually nothing named mainTask in your script.

That's an error, mate.  :3
thanks. but anyway the hakureishrine.png isn't appearing at all! also I didn't put SetTimer(60) you can download my epic FAIL script at: http://bulletforge.org/u/atfyntify/p/one-epic-bg-fail-test/v/1
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: JmLyan on April 14, 2011, 12:21:55 PM
@BackGround only functions in either stage scripts or spellcards.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheMasterSpark on April 14, 2011, 12:23:57 PM
Two things:

First, you need to make the G capital in @BackGround. Second, you must put a SetScore(*some number here*) statement in your @Initialize. Like Jm said just now, what you draw in @BackGround doesn't work in non-spellcard attacks - SetScore turns your script into a spellcard attack.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Atfyntify on April 14, 2011, 12:49:17 PM
Two things:

First, you need to make the G capital in @BackGround. Second, you must put a SetScore(*some number here*) statement in your @Initialize. Like Jm said just now, what you draw in @BackGround doesn't work in non-spellcard attacks - SetScore turns your script into a spellcard attack.
GUYS IT WORKED!!!!!!!!!!!!!
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Darkness1 on April 15, 2011, 01:12:35 PM
Can someone explain to me how you make a global variable? Cause always when i define a variable in a task, and want to call it outside of the task, danmakufu says that the variable obj2 is undefined ( because of me not getting Collision_Obj_Obj to work :().
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Azure Lazuline on April 15, 2011, 03:58:26 PM
Just define the variable outside everything else - the common place is right above @Initialize or @MainLoop.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Darkness1 on April 15, 2011, 06:12:14 PM
Okay... Now i actually got it to work by experimenting a little, with what you said (thanks Azure!). It works good, except for on thing. In my script the boss is shooting three bullets but only one bullet is affected. I can?t figure out what?s wrong ??? . Heres the script btw ~ http://pastebin.com/g0JMR2MA (http://pastebin.com/g0JMR2MA).
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: CK Crash on April 18, 2011, 02:01:18 PM
When you create the third object, it's ID overwrites where one of the other IDs was stored. You only have 2 variables, so you'll only be able to do correct collision for 2 bullets a time. I recommend you instead use an array, and ascent through it for the collision. The lazy way to do this would look something like this:
Code: [Select]
let objarr = []; //Init empty array

task objTask
{
let obj = Obj_Create(OBJ_SHOT);
objarr = objarr~[obj]; //Add the object to the global array

blahblah;

while(!Obj_BeDeleted(obj)){
ascent(i in 0..length(objarr)){ //Go through all objects
if(objarr[i] != obj && Collision_Obj_Obj(obj,objarr[i])){
dostuff;
}
}
yield;
}

ascent(i in 0..length(objarr)){ //Go through all objects and remove self
if(objarr[i] == obj){
objarr = erase(objarr,i);
break;
}
}
}
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: ふとくていなねこじょおう on April 19, 2011, 02:54:12 AM
So I'm following Helopolis's video tutorials on Danmakufu, and I got to the object Bullet lesson. I do everything he says to do, I make sure I wrote the script down correctly, but when I try to run it it comes up with an error.

Code: [Select]
task fire{
let x=0;
let dir=0;

loop{
bakabullet(GetEnemyX,GetEnemyY,3,GetAngleToPlayer,AQUA01,30);
bakabullet(GetEnemyX,GetEnemyY,3,GetAngleToPlayer-20,AQUA01,30);
bakabullet(GetEnemyX,GetEnemyY,3,GetAngleToPlayer+20,AQUA01,30);
wait(30);
yield;
}
}

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

Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,v);
Obj_SetAngle(obj,dir);
ObjShot_SetGraphic(obj,graphic);
ObjShot_SetDelay(obj,delay);
ObjShot_BombResist(obj,true);

}
           
function wait (w){
loop (w){yield,}
}

}

Could someone please look over it and see what's wrong?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on April 19, 2011, 03:03:52 AM
That was kind of funny, I looked through the whole thing and was like "this should work perfectly wtf" and then I saw the last line.

function wait (w){
   loop (w){yield,}
}


When you get an error, please check the specified line for mistakes. If you can't solve it, copy the error down (ctrl+c).
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: ふとくていなねこじょおう on April 19, 2011, 12:27:31 PM
Oh. *facepalm*

It's the second time I make a stupid mistake like that. Thanks.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Luna on April 19, 2011, 02:00:09 PM
Code: [Select]
let a = 0;
descent(i in -180..180) {
a++;
i = i*8;
CreateShot02(GetX+50*cos(a),GetY+50*sin(a), 0, i-180, 0.01, 3, GREEN22, 30);
}
a=0;

This is a silly question regarding the snippet above: What in this thing causes the pattern?
(I need to lrn2math)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: JmLyan on April 19, 2011, 06:29:34 PM
I'm making a boss where you face two characters at once, but I can't figure out how I can make them share the same life bar. Anyone knows an effective way of doing this?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on April 19, 2011, 10:19:34 PM
I'm making a boss where you face two characters at once, but I can't figure out how I can make them share the same life bar. Anyone knows an effective way of doing this?
Spawn one boss as a familiar of the boss. So if the "actual" boss is to be defeated, both bosses will be spawned in the next lifebar. Also if the "familiar" is to be defeated, make it so that the "master" boss kills itself (AddLife(-GetEnemyLife);), so both bosses will go into their next lifebar.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on April 19, 2011, 10:49:39 PM
Familiar of the boss is the most common, yes. The life should be tracked by common data that both bosses contribute towards.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Zengar Zombolt on April 20, 2011, 12:50:05 AM
Or maybe using SetDamageRateEx? It transfers a Familiar's damage to the parent enemy anyways.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Phonibologna on April 20, 2011, 01:07:34 AM
Can someone help me with my script? it seems to hate my wait command, since it gives me an error about it.

(just a heads up, i'm new at this, so this code might be very ugly)

http://pastebin.com/cMMdkBR4

<Naut> Please use pastebin when posting large walls of code.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Demonbman on April 20, 2011, 01:17:32 AM

Code: [Select]

task fire{
loop(36){
if(bleh==60) { //<-----Need this
CreateShot01(GetX,GetY,3,angle,RED12,0);
angle += 360/36;
yield:
}
angle = 0;
bleh = 0;


You are missing a { at the end of your if(bleh==60)
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on April 20, 2011, 01:18:03 AM
pastebinplzedit

Ahahah what. ninjd (by a weeaboo no less)

By the way, the problem isn't in the wait function - look at the line number that Danmakufu gives in the error and look around there! There's a reason behind those error messages that Danmakufu gives.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Phonibologna on April 20, 2011, 01:29:24 AM
thank you for the help, adding the bracket fixed the error, although i had to remove my task fire and two variables to make it work again.
(sorry about the massive block, i just saw the pastebin thing.)

one more thing, it says im missing a bracket at this area, but every one of my brackets match up.

Code: [Select]
task fire{

let x = 0;
let dir = 0;
loop{
while(x<36){
CreateShotA(9,GetEnemyX,GetEnemyY,30);
SetShotDataA(9,60,2,dir,2,0,2,RED12);
FireShot(1)

dir+=360/36;
x++;
}
x = 0;
dir = 0;
                        wait(60);
yield;
}
}
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Chronojet ⚙ Dragon on April 20, 2011, 02:05:34 AM
            FireShot(1)

Missing semicolon. Also, why are you always "wait"ing for one frame more than you think you are / you want to?

By the way, the problem isn't in the wait function - look at the line number that Danmakufu gives in the error and look around there! There's a reason behind those error messages that Danmakufu gives.
And again, this. RaNGE is not your personal Eirin.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Phonibologna on April 20, 2011, 02:39:00 AM
i'm not sure, ill get around to taking out all of those extra yields eventually, and thank you for the help

oh, and is there a way to give custom bullets custom hit boxes? its annoying to see large bullets with tiny hit boxes
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: AlchemyFan101 on April 20, 2011, 05:50:25 AM
this is the script for the first tutorial in the advanced section  :V
I got an error in the task fire section D:

http://pastebin.com/ADv5m4U7

<Naut> Please use pastebin when posting large walls of code.

so what did I totaly screw up this time?  :colonveeplusalpha:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on April 20, 2011, 06:29:09 AM
Your second SetShotDataA has an extra parameter. SetShotDataA(id, frame, speed, angle, turn, acc, minmaxspd, graphic);
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Yuyuko Yakumo on April 20, 2011, 08:30:12 AM
What's the best way to animate a sprite so that it's facing the right way when it's moving, especially if it's a random movement? Like, if it moves right, I want the "move right" animation to show.

I tried a couple of ways, but they won't work if the movement is randomly in a box. Meaning it could move left OR right.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on April 20, 2011, 08:39:38 AM
What's the best way to animate a sprite so that it's facing the right way when it's moving, especially if it's a random movement? Like, if it moves right, I want the "move right" animation to show.

I tried a couple of ways, but they won't work if the movement is randomly in a box. Meaning it could move left OR right.
Well, no matter if it is a random movement or box, an enemy gains an X variable speed for moving left or right and Y variable speed when moving up or down, so you need to tackle those two variables:
Code: [Select]
if(GetSpeedX()>0){ // if(GetSpeedX()<0){
So what are you trying atm?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Yuyuko Yakumo on April 20, 2011, 08:50:23 AM
The way I'm getting which direction is more or less indirectly. In the following, I have the enemy move to the x-cord of where the player is standing. So I use whatever angle the enemy has to the player to determine which direction it's moving.

Code: [Select]
SetMovePosition03(GetPlayerX, GetClipMinY +35, 10, 8.5); //Move towards the player right before shooting.
if (GetAngleToPlayer> 0 && GetAngleToPlayer< 89) { //Player is to the right of the enemy
BossMove= 1;
}
if (GetAngleToPlayer> 89 && GetAngleToPlayer< 91) { //Player is more or less directly below
BossMove= 0;
}
if (GetAngleToPlayer> 91 && GetAngleToPlayer< 180) { //Player is on the left
BossMove= -1;
}
//later
if (BossMove== 0) { //Right on top of the player
SetTexture(BossSprite);
SetGraphicRect(0, 0, 51, 81);
}
if (BossMove== -1) { //When she moves left.
SetTexture(BossSprite);
SetGraphicRect(94, 0, 145, 81);
}
if (BossMove== 1) { //When she moves right.
SetTexture(BossSprite);
SetGraphicRect(207, 0, 258, 81);
So I just have it draw whatever sprite it needs each time it needs to check.
But of course, I get a simple solution to a simple problem.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Helepolis on April 20, 2011, 09:12:03 AM
Eh, either I am getting it wrong but the way I see it now: You want to make the enemy face the correct direction when it is moving in a direction on the X-axis (aka to the left == face left).

If that is the case, your coding is extremely awkward. As I said, you need to define the sprite animation using the GetSpeedX > and < using the @DrawLoop. The code you are showing looks more like the direction the enemy sprite is facing based on player location, that is something totally different than movement of the enemy itself.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Yuyuko Yakumo on April 20, 2011, 03:51:39 PM
Yeah, that's why I asked for help. I tend to really overthink things with Danmakufu.  :ohdear:
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: JmLyan on April 20, 2011, 09:10:12 PM
I ran into another problem while making my double character script. After the first attack, once of the characters is supposed to leave the screen. I set the coordinates of that character as common data in the attack script, and then accesses it in the spellcard that comes after. But for some reason, the enemy I create to leave the screen appears at different coordinates than where the other enemy died, also always somewhere at the top left.

Here's the normal enemy in the attack: http://pastebin.com/cMmfGbxu

And here's the spellcard where the enemy that leaves the screen is created: http://pastebin.com/VHdFmk1r
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Blargel on April 23, 2011, 12:35:02 AM
I ran into another problem while making my double character script. After the first attack, once of the characters is supposed to leave the screen. I set the coordinates of that character as common data in the attack script, and then accesses it in the spellcard that comes after. But for some reason, the enemy I create to leave the screen appears at different coordinates than where the other enemy died, also always somewhere at the top left.

Here's the normal enemy in the attack: http://pastebin.com/cMmfGbxu

And here's the spellcard where the enemy that leaves the screen is created: http://pastebin.com/VHdFmk1r

There's only one obvious answer I can think of and it's that you're RMSpell01Leave.dnh enemy is using SetX and SetY in the @Initialize (or maybe elsewhere) by accident. Otherwise, it might be a silly quirk of Danmakufu, though I'm pretty sure I've gotten something like this working myself. Perhaps if you set the common data every frame instead of in @Finalize with a task that loops infinitely with a single yield between each loop, it'll work? If all else fails, you can try using the debug window (look up CreateDebugWindow and OutputDebugString in the function list on the wiki) and make it output stuff like GetX, GetY, and GetCommonData to see if they're matching up correctly.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: JmLyan on April 23, 2011, 10:47:39 AM
I used DrawText to check it in one of the scripts I used where the main boss was supposed to aim for the sub boss. In the sub boss, GetCommonData returned the exact X and Y coordinates, but in the main boss, it returned the shared life of the bosses instead for some reason, so I gave up with the nice leaving effect and found another solutin for the aiming.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: puremrz on April 24, 2011, 08:28:28 AM
Greetings, I'm now trying to make a caterpillar effect where a bunch of familiars chase after an enemy, like in this picture:

(http://i32.photobucket.com/albums/d49/puremrz/caterpillar.jpg)
(The red bullets are placeholders for the familiars)

It's all going well and stuff, but only when I use 1 enemy.
That's because I'm using common data, and don't know how to expand common data arrays.

Normally expanding arrays would go like:
Code: [Select]
bullet=bullet~[shot];
But since this is common data I'm working with, that trick won't work:
Code: [Select]
GetCommonDataDefault("EnemyX",0)=GetCommonDataDefault("EnemyX",0)~[GetX];== error

Does anyone know what the right way is to add more values to a common data array?
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Blargel on April 24, 2011, 09:54:41 AM
Greetings, I'm now trying to make a caterpillar effect where a bunch of familiars chase after an enemy, like in this picture:

(http://i32.photobucket.com/albums/d49/puremrz/caterpillar.jpg)
(The red bullets are placeholders for the familiars)

It's all going well and stuff, but only when I use 1 enemy.
That's because I'm using common data, and don't know how to expand common data arrays.

Normally expanding arrays would go like:
Code: [Select]
bullet=bullet~[shot];
But since this is common data I'm working with, that trick won't work:
Code: [Select]
GetCommonDataDefault("EnemyX",0)=GetCommonDataDefault("EnemyX",0)~[GetX];== error

Does anyone know what the right way is to add more values to a common data array?

You're supposed to use SetCommonData in order to change stuff in common data remember? As such, it would be like this:
Code: [Select]
SetCommonData("EnemyX", GetCommonDataDefault("EnemyX", 0)~[GetX]);
To make more sense of this, here's an expanded version with a variable for clarity:
Code: [Select]
let arrayX = GetCommonDataDefault("EnemyX", 0);
arrayX = arrayX ~ [GetX];
SetCommonData("EnemyX", arrayX);
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: puremrz on April 24, 2011, 09:58:29 AM
You're supposed to use SetCommonData in order to change stuff in common data remember? As such, it would be like this:
Code: [Select]
SetCommonData("EnemyX", GetCommonDataDefault("EnemyX", 0)~[GetX]);
To make more sense of this, here's an expanded version with a variable for clarity:
Code: [Select]
let arrayX = GetCommonDataDefault("EnemyX", 0);
arrayX = arrayX ~ [GetX];
SetCommonData("EnemyX", arrayX);

Thanks, I'll try it out. ^_^
I already found a way around using common data by making the familiars into objects, but I'm sure I'll still need to know this for later.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: JmLyan on April 25, 2011, 11:07:14 AM
I'm trying to create a spellcard where lasers comes from two sides and then alternates between having collision and not colision (delayed). But no matter what I try it always ends up in an infinite loop somewhere. Any idea of how to spawn the lasers where the old laser was deleted that doesn't freeze danmakufu?

EDIT: Nevermind, fixed it.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Thaws on April 25, 2011, 11:37:52 AM
I'm trying to create a spellcard where lasers comes from two sides and then alternates between having collision and not colision (delayed). But no matter what I try it always ends up in an infinite loop somewhere. Any idea of how to spawn the lasers where the old laser was deleted that doesn't freeze danmakufu?

Here's the code: http://pastebin.com/5bjC7Jnt
The reason why it's freezing is probably because you're trying to get the coordinates of a deleted object. To solve this, store the coordinates of the old laser first before deleting.
Like
Code: [Select]

                        if(deathTime==0){
                                let tempx = Obj_GetX(obj);
                                Obj_Delete(obj);
                                break;
                        }

Using the Call*horizontal/vertical* functions are not necessary, you can simply call the task inside itself.

Have you considered using Obj_SetCollisionToPlayer (http://dmf.shrinemaiden.org/wiki/index.php?title=Object_Control_Functions#Obj_SetCollisionToPlayer)?

Hope this helps.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: TheTeff007 on April 25, 2011, 10:46:30 PM
How can I make a Bullet to Chase The player?  Currently, I'm trying to use CreateShotA and GetAngleToPlayer function, but it doesn't work and the bullet doesn't chase the player
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on April 25, 2011, 11:08:53 PM
Gotta learn how to object bullets, dude. Intermediate tutorial (http://www.shrinemaiden.org/forum/index.php/topic,865.0.html) goes over object bullets nicely and it should be easy to get something to follow the player once you get how it works.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Stuffman on April 26, 2011, 09:17:36 AM
[attach=1]

Code: [Select]
task ArcBullet(targetx,targety,arcdist,speed){
  math???
  CreateShotA(0,GetX,GetY,0);
  SetShotDataA(0,0,speed,???,???,0,0,WHITE05);
  FireShot(0);
}

math is what
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: JmLyan on April 26, 2011, 11:10:49 AM
The reason why it's freezing is probably because you're trying to get the coordinates of a deleted object. To solve this, store the coordinates of the old laser first before deleting.
Like
Code: [Select]

                        if(deathTime==0){
                                let tempx = Obj_GetX(obj);
                                Obj_Delete(obj);
                                break;
                        }

Using the Call*horizontal/vertical* functions are not necessary, you can simply call the task inside itself.

Have you considered using Obj_SetCollisionToPlayer (http://dmf.shrinemaiden.org/wiki/index.php?title=Object_Control_Functions#Obj_SetCollisionToPlayer)?

Hope this helps.

Actually, I fixed it by making the VerticalCall and HorizontalCall into tasks instead and putting a yield at the top of the task.
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Blargel on April 26, 2011, 04:08:04 PM
[attach=1]

Code: [Select]
task ArcBullet(targetx,targety,arcdist,speed){
  math???
  CreateShotA(0,GetX,GetY,0);
  SetShotDataA(0,0,speed,???,???,0,0,WHITE05);
  FireShot(0);
}

math is what

First find cx and cy, where (cx, cy) is the center point of the circle. Unfortunately, I don't know off the top of my head what the math for this is but it is possible with the given information.

The initial angle of the bullet would be atan2(GetY-cy, GetX-cx)+90.

For the angular velocity, you will first need to find the radius of the circle. Radius is easily determined with distance formula from the center to either point: let radius = ((GetX-cx) + (GetY-cy))^0.5. After you have the radius, you can find the circumference of the circle with let circumference = radius * 2 * 3.141592. Now that we have the circumference, we can easily determine how long it would take for the bullet to travel the whole circumference of a circle at the given speed. let time = circumference/speed. With that time, we now know how long it should take for the bullet to turn 360 degrees as well, so angular velocity can be found with let angVelocity = 360/time.

So to fill in some of the missing info for your code:
Code: [Select]
task ArcBullet(targetx,targety,arcdist,speed){
  let initialAngle = atan2(GetY-cy, GetX-cx)+90;
  let cx = ???;
  let cy = ???;
  let radius = ((GetX-cx) + (GetY-cy))^0.5;
  let circumference = radius * 2 * 3.141592;
  let time = circumference/speed;
  let angularVelocity = 360/time;

  CreateShotA(0,GetX,GetY,0);
  SetShotDataA(0,0,speed,initialAngle,angularVelocity,0,0,WHITE05);
  FireShot(0);
}

So now, all you're missing is how to get cx and cy. Maybe someone else knows the math for that, but I can't think of anything right now. As a side note, whoever decides to figure out how to get the center of the circle, make sure that what you write works with a negative arcdist as well because it is perfectly possible for arcdist to go to the other side of the line between (GetX, GetY) and (targetx, targety). Also, if you want the bullet to go counterclockwise instead of clockwise around that circle, you just need to flip the sign of angularVelocity and initialAngle would be atan2(GetY-cy, GetX-cx)-90 instead.

EDIT: Few fixes.
EDIT2: Got bored and googled some info. I think this works with negative arcdist as well, but it's untested in Danmakufu. Setting arcdist to 0 will give you a divide by 0 error, but any other value should work. I also added a parameter to choose whether the bullet should travel clockwise ("cw") or counterclockwise ("ccw"). Here's the full code:

Code: [Select]
task ArcBullet(targetx,targety,arcdist,speed,direction){
  let chordDist = ((GetX-targetx)^2 + (GetY-targety)^2)^0.5; //Finding distance between enemy and target
  let chordAngle = atan2(targety-GetY, targetx-GetX); //Finding angle from enemy to target
  let radius = (arcdist^2 + (chordDist/2)^2)/arcdist/2; //Finding length of radius
  let mx = GetX+cos(chordAngle)*chordDist/2 //Finding x-coord of midpoint of the chord
  let my = GetY+sin(chordAngle)*chordDist/2 // Finding y-coord of midpoint of the chord
  let cx = mx+cos(chordAngle+90)*(radius-arcdist); //Finding x-coord of center of circle
  let cy = my+sin(chordAngle+90)*(radius-arcdist); //Finding y-coord of center of circle
  let circumference = absolute(radius * 2 * 3.141592); //Finding the circumference of the circle
  let time = circumference/speed; //Finding the time it takes to travel the length of the circumference with given speed
  let angularVelocity = 360/time; //Finding the angular velocity to turn 360 degrees in that time
  let initialAngle = atan2(GetY-cy, GetX-cx)+90; //Finding the initial angle to fire bullet

  alternative(direction)
  case("cw"){
    //Do nothing, lol bad code.
  }
  case("ccw"){
    angularVelocity *= -1; //reverse the angular velocity
    initialAngle -=180; //turn the initial angle around 180 degrees
  }
  others {
    RaiseError("ArcBullet expected "cw" or "ccw" for direction parameter but got " + ToString(direction));
  }

  CreateShotA(0,GetX,GetY,0);
  SetShotDataA(0,0,speed,initialAngle,angularVelocity,0,0,WHITE05);
  FireShot(0);
}
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Stuffman on April 26, 2011, 10:46:03 PM
Whoops, I had forgotten that I would need to specify clockwise or counterclockwise movement.

Looks like it works, thanks Blargs! Time to make some gimmicky streaming attacks :V
Title: Re: Danmakufu Q&A/Problem thread number 4
Post by: Drake on April 26, 2011, 11:22:54 PM
lololololol 1000 get lolololollooloooololol new thread