Maidens of the Kaleidoscope

~Hakurei Shrine~ => Rika and Nitori's Garage Experiments => Topic started by: Helepolis on April 05, 2012, 06:48:39 AM

Title: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on April 05, 2012, 06:48:39 AM
Previous topic (5) here: http://www.shrinemaiden.org/forum/index.php/topic,9281.990.html

Ask all Danmakufu 0.12m related questions in here. Please use pastebin.com for large blocks of code.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: puremrz on April 05, 2012, 08:00:49 AM
As a reply to the bugged replays from the old topic:

I'm sure there was a discussion somewhere about CommonData causing a mess in replays. And it was because CommonData doesn't get saved/loaded properly in replays. Something about the Save/LoadCommonDataImReplay functions.

This needs some investigation, because I also had that problem with my own replays.

Edit:
So I did some investigating, and here's what I found out about common data messing up the replay's gameplay:

Code: [Select]
#TouhouDanmakufu[Enemy]
#Title[Common Data In Replays]
#ScriptVersion[2]

script_enemy_main{

SetCommonData("Test",rand(0,360)); // Sets a random angle
if(IsReplay==false){ LoadCommonData; } // This will keep the angle the same every time you play it, remove it if you want it to be random every time
if(IsReplay==true){ LoadCommonDataFromReplayFile; } // Correctly loads common data during replays

let time=0; // MainLoop style lol

@Initialize{
SetScore(300000);
SetLife(50);
SetTimer(10);
SetInvincibility(60);
SetDamageRate(10,10);
SetEnemyMarker(true);
MagicCircle(true);
SetEffectForZeroLife(60,100,1);

SetMovePosition02(GetCenterX,GetClipMinY+100,50);
}

@MainLoop{

SetCollisionA(GetX,GetY,16);
SetCollisionB(GetX,GetY,16);
SetShotAutoDeleteClip(32,32,32,32);

if(time==60){ CreateShot01(GetX,GetY,2,GetCommonDataDefault("Test",90),RED01,0); } // A visual test

time++;

}

@BackGround{
}

@DrawLoop{
}

@Finalize{
if(IsReplay==false){ SaveCommonData; SaveCommonDataInReplayFile; } //Save common data only when not in a replay, just putting this condition here as a safety measure.
}

}

Not using Save/LoadCommonDataInReplayFile will give you the wrong random seed during replays, causing Subterranean Animism moments.

In short, so many types of CommonData are really unnecessarily confusing.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on April 05, 2012, 04:00:07 PM
Just as a side note, even with correctly saved common data, you may still encounter desynced replays at a far higher rate than would normally be tolerable. Another good example I remember is the Sasupoika's entry in the second Halloween scripting contest. I had tried to make a replay of me unlocking the secret boss, but every time, the boss would kill me in the replay when I'd been perfectly fine otherwise. I made 3 successful unlocks of the secret boss (never did beat the damn boss though) and all 3 times, the replay would desync. And then I gave up.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: puremrz on April 09, 2012, 06:19:52 PM
Question!
I want a 2nd task to tell what should happen in the 1st task without using CommonData.
How to do that?

Example:

Code: [Select]
let i=1;
loop(12){
BossSprites(i); // Creates 12 different boss sprites
i++;
}

//====== skip =======


MoveBossSprites(GetClipMinX+100,GetClipMinY+100); // A task from the same script that tells the task "BossSprites" where it should move next

//====== skip =======


task BossSprites(id){
let xsize=128;
let ysize=128;

let obj=Obj_Create(OBJ_EFFECT);
Obj_SetPosition(obj,cx,cy);
ObjEffect_SetTexture(obj,GRbosssprites);
ObjEffect_CreateVertex(obj,4);
ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLESTRIP);
ObjEffect_SetScale(obj,1,1);
ObjEffect_SetLayer(obj,5);
ObjEffect_SetRenderState(obj,ALPHA);
ObjEffect_SetAngle(obj,0,0,0);
ObjEffect_SetVertexXY(obj,0,-(xsize/2),-(ysize/2));
ObjEffect_SetVertexXY(obj,1,xsize/2,-(ysize/2));
ObjEffect_SetVertexXY(obj,2,-(xsize/2),ysize/2);
ObjEffect_SetVertexXY(obj,3,xsize/2,ysize/2);
ObjEffect_SetVertexUV(obj,0,0,0);
ObjEffect_SetVertexUV(obj,1,xsize,0);
ObjEffect_SetVertexUV(obj,2,0,ysize);
ObjEffect_SetVertexUV(obj,3,xsize,ysize);
ObjEffect_SetVertexColor(obj,0,255,255,255,255);
ObjEffect_SetVertexColor(obj,1,255,255,255,255);
ObjEffect_SetVertexColor(obj,2,255,255,255,255);
ObjEffect_SetVertexColor(obj,3,255,255,255,255);

while(Obj_BeDeleted(obj)==false){

// How to get the data from MoveBossSprites in here?
// Writing task MoveBossSprites{  }  won't work, so how do I do it instead?
// Don't say with common data, it'll become really messy if I have to resort to that. :(

wait(1);
}
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: MMX on April 09, 2012, 06:42:15 PM
Why do you need that speceific task that tells those sprites what to do? Implement it in the same task that creates them.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: puremrz on April 09, 2012, 06:53:37 PM
Why do you need that speceific task that tells those sprites what to do? Implement it in the same task that creates them.

The first task is called at the beginning of the game, it's for making and moving fake boss sprites.
They won't move until I tell them to, so I need something that I can call at any moment to move the sprites. For example, to have the fake boss sprites fly around during a stage.
Reason it's a task and not an enemy script is because this won't vanish during/after boss battles.

But what I tried won't work (see example), and I can't figure out what I should do instead.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: MMX on April 09, 2012, 07:32:28 PM
The first task is called at the beginning of the game, it's for making and moving fake boss sprites.
They won't move until I tell them to, so I need something that I can call at any moment to move the sprites. For example, to have the fake boss sprites fly around during a stage.
Reason it's a task and not an enemy script is because this won't vanish during/after boss battles.

But what I tried won't work (see example), and I can't figure out what I should do instead.
Wait a minute? Is it a task from stage script you wanna control from enemy script? Then only common data is the solution.

Anyway, if you want some task to perform "commands" from outside this task, just make an additional script-level variable so every instance of that task can track it's state. If you just want a bunch of objects to do the same thing at the same time - just track frame counter like for example...
Code: [Select]
script_stage_main{
let fcount=0;

@MainLoop{
fcount++;
yield;
}

task SomeObject{
//create and initialize
while(object lives){
//do regular stuff
if(!(fcount%60)){
//do speceific stuff
}
yield;
}
}
}
This will make all objects do some speceific stuff every second simultaneously. You can check for more advanced conditions or like track multiple global variables (using a special task to control them).
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: puremrz on April 09, 2012, 08:00:05 PM
Wait a minute? Is it a task from stage script you wanna control from enemy script? Then only common data is the solution.

They're still in the same script.
Actually I meant to do the opposite thing of what you posted. I'll edit things to show what I mean.

...And while modifying your script, I think I found the solution. Not sure if this will work though, I'll have to test it first.
At the very least, this won't cost me extra variables or CommonData.

Code: [Select]
script_stage_main{

@MainLoop{

       if(at a random moment){ moveboss=["yesplease",oldx,oldy,newx,newy,speed,character]; }

yield;
}

task SomeObject{
//create and initialize
while(object lives){
//do regular stuff
if(moveboss[0]=="yesplease"){
//set new location and speed etc
}
yield;
}
}
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: MMX on April 09, 2012, 09:58:29 PM
...And while modifying your script, I think I found the solution. Not sure if this will work though, I'll have to test it first.
At the very least, this won't cost me extra variables or CommonData.
Yeah. That's the way to do this if you wanna "pass" multiple data to a task running. I always try to aware of using arrays, but in this case it makes code handling much easier. Just dont forget to reset flag after stuff's done.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: TheTeff007 on April 18, 2012, 01:40:41 AM
Pastebin doesn't work right now, so I'll be usign an alternate method.

I'm trying to make a Simple Main Menu, this is what I have now:

http://bin.smwcentral.net/u/7443/MenuFunction.txt

I haven't tested it, but I wanna know if I'm doing good or what. Thanks in Advance.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on April 18, 2012, 02:59:19 PM
Looks on track to me but I haven't tested it in Danmakufu either. You might need to do some modifications if you intend to expand how the menu works, but this should be fine for a basic one.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Amulet_Clover on April 18, 2012, 07:14:03 PM
I'm confused with including functions.  More specifically, I'm confused with how to use Helepolis's custom cut-in script.  I know there's a readme, but even though I follow all the rules, I keep getting an error message saying that the identifiers for the three different types of cut-ins (KANAKO, NAZRIN, and BYAKUREN) are all undefined.  I usually list the #include_function thing first under script_enemy_main.  What should I do?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on April 18, 2012, 08:50:38 PM
I actually don't remember the order of the parameters, but it sounds like you're doing something like

Code: [Select]
cutin(KANAKO, blah, blah, blah);
Try putting it in quotes instead because Hele's functions are not checking for a constant, but a string.

Code: [Select]
cutin("KANAKO", blah, blah, blah);
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Amulet_Clover on April 19, 2012, 03:29:26 AM
Thanks!  The Cutins work now!  I also need help figuring out this error message (posted here to avoid necroposting elsewhere (http://www.shrinemaiden.org/forum/index.php/topic,4155.0.html))

(http://img26.imageshack.us/img26/3153/errorlj.png)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: TheTeff007 on April 19, 2012, 04:43:10 AM
If you could please post the message? Press Ctrl + C to copy the contents of the Message Box.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on April 19, 2012, 05:13:54 AM
It just says the special character used is odd, maybe you forgot quotation marks.
Of course, it's pointing at a curly brace so there's no way of telling what it means without more code.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on April 19, 2012, 06:42:31 AM
I've been having some 3D background problems lately. I'm still new to them, so I probably don't fully understand the entirety of my code. Nevertheless, I managed to get one working pretty well until I realized that it blocked out the text that I had displaying bomb and life piece information (done with DrawText in the full game's @BackGround since @DrawLoop doesnt seem to work for stages). I managed to fix the issue with this:

http://pastebin.com/KymuSwJe (this is all in @BackGround)

Unfortunately, now the text appears but is blackened by the SetFog. I tried moving the DrawText to before the fog, but it only repeated the same problem as before: the DrawText was behind the background again. I also tried changing the start and end points of the fog, but no matter where it was, it always seemed to make the text black. Is there some way I can fix this? Or do I need to resort to using effect objects or something to display the data with 3D backgrounds?

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on April 19, 2012, 09:30:09 AM
I've been having some 3D background problems lately. I'm still new to them, so I probably don't fully understand the entirety of my code. Nevertheless, I managed to get one working pretty well until I realized that it blocked out the text that I had displaying bomb and life piece information (done with DrawText in the full game's @BackGround since @DrawLoop doesnt seem to work for stages). I managed to fix the issue with this:

http://pastebin.com/KymuSwJe (this is all in @BackGround)

Unfortunately, now the text appears but is blackened by the SetFog. I tried moving the DrawText to before the fog, but it only repeated the same problem as before: the DrawText was behind the background again. I also tried changing the start and end points of the fog, but no matter where it was, it always seemed to make the text black. Is there some way I can fix this? Or do I need to resort to using effect objects or something to display the data with 3D backgrounds?
Have you tried to set ZBuffer to true? I remember I bumped into the same problem when I wanted to track variables during my stage. If this doesn't work out I'll get back to it when I am at home so  I can view my code.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: puremrz on April 19, 2012, 10:21:59 AM
I'm trying to make a caterpillar with object bullets chasing after each other.
I'm this close to finishing it, but there's something wrong in the ChainDelay task:

Code: [Select]
script_enemy_main{

let chainx=[0,0,0,0,0];
let chainy=[0,0,0,0,0];
//Making a sample chain of 5 bullets long
//etc

Code: [Select]
chainx[0]=cx+100*cos(time);
chainy[0]=cy+100*sin(time);
//Just spinning the boss bullet around as a test.


let i=0;
while(i<length(chainx)-1){
ChainDelay(10*i,i); //10*i means it takes 10 frames for the next bullet in line to arrive at the previous bullet's location.
i++;
}


if(time==0){
let i=0;
loop(5){
Chain(i);
i++;
}
}
//Creating the "chain" of bullets at the beginning of the script, nothing wrong here.

Code: [Select]
task Chain(id){
let frame=0;
let angle=0;

let obj=(Obj_Create(OBJ_SHOT));
Obj_SetPosition(obj,chainx[id],chainy[id]);
Obj_SetAngle(obj,0);
Obj_SetSpeed(obj,0);
Obj_SetAutoDelete(obj,false);
ObjShot_SetBombResist(obj,true);
ObjShot_SetGraphic(obj,RED01);
ObjShot_SetDelay(obj,0);

while(Obj_BeDeleted(obj)==false){

Obj_SetPosition(obj,chainx[id],chainy[id]);

frame++;

Delay(1);
}
}


task ChainDelay(time,i){
loop(time){ yield; } //this should delay things, but no matter what I give "time" as input, the bullets are only 1 frame away from each other. Even though I wrote ChainDelay(10*i,i); before
chainx[i+1]=chainx[i];
chainy[i+1]=chainy[i];
}


function Delay(time){
loop(time){ yield; }
}


It does make a caterpillar of bullets, but they're only 1 frame away from each other, no matter what I write in ChainDelay(*here*,i).
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on April 19, 2012, 04:24:43 PM
Why don't you just shoot the same bullet 10 frames later?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: MMX on April 19, 2012, 06:54:30 PM
Do the bullets you use for that caterpillar pattern follow some non-static path? Cause if it's predefined once before caterpillar launch, you may just repeat calling the same bullet's task like Blargel said.
But if the direction of leading bullet may change on some random behaviour, why not just to use a chasing algorythm? You don't need to store an array of bullets, just pass an id of a chased bullet to the task when shooting the new one (use 0 to point it as a leader).
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on April 19, 2012, 09:24:18 PM
Have you tried to set ZBuffer to true? I remember I bumped into the same problem when I wanted to track variables during my stage. If this doesn't work out I'll get back to it when I am at home so  I can view my code.

Currently I have WriteZBuffer and UseZBuffer set to true before the 3D background code and then have them set to false after it. The code for the DrawText information comes after it's set back to false. Doing this allowed the DrawText to be drawn over the 3D background. This was the only way that I found that allowed the text to be drawn on top of the background. However, doing it this way causes the SetFog to make the text look black.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on April 19, 2012, 10:49:08 PM
@Ozzy

http://www.mediafire.com/download.php?ymyy5zmtem1

Code: [Select]
#include_function "./path/to/text.txt"
let imgFont = GetCurrentScriptDirectory ~ "path/to/font.png";

@MainLoop {
    // Make sure you're doing this in @MainLoop because it's making an effect object, not drawing in @DrawLoop or @BackGround.
    // Fill in the string, x, y, and layer yourself. I'd advise you to leave the rest of the parameters alone but you can fool with them if you're curious.
    // This version lets your draw on top of the frame itself if you want.
    DrawTextNew(string, imgFont, x, y, 0, 1, 1, layer, 1, 255, );

    // There's also a SetFontColorNew function that works exactly like SetFontColor. Stick it before DrawTextNew.
}

Take a look at ObjEffect_SetLayer (http://dmf.shrinemaiden.org/wiki/index.php?title=Object_Control_Functions#ObjEffect_SetLayer) to figure out which layer you want your text to be on.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on April 20, 2012, 03:53:45 AM
@Ozzy

http://www.mediafire.com/download.php?ymyy5zmtem1

Code: [Select]
#include_function "./path/to/text.txt"
let imgFont = GetCurrentScriptDirectory ~ "path/to/font.png";

@MainLoop {
    // Make sure you're doing this in @MainLoop because it's making an effect object, not drawing in @DrawLoop or @BackGround.
    // Fill in the string, x, y, and layer yourself. I'd advise you to leave the rest of the parameters alone but you can fool with them if you're curious.
    // This version lets your draw on top of the frame itself if you want.
    DrawTextNew(string, imgFont, x, y, 0, 1, 1, layer, 1, 255, );

    // There's also a SetFontColorNew function that works exactly like SetFontColor. Stick it before DrawTextNew.
}

Take a look at ObjEffect_SetLayer (http://dmf.shrinemaiden.org/wiki/index.php?title=Object_Control_Functions#ObjEffect_SetLayer) to figure out which layer you want your text to be on.
You forgot to mention that I had to load the graphic in the script, though I suppose that was implied. Thanks a lot, this works nicely. However, are there characters missing? The file seems to contain code for / and \ but there aren't any images of them.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on April 20, 2012, 07:05:40 AM
You forgot to mention that I had to load the graphic in the script, though I suppose that was implied. Thanks a lot, this works nicely. However, are there characters missing? The file seems to contain code for / and \ but there aren't any images of them.

I would've included the loading if I remembered but I don't even have danmakufu on my computer anymore. The script is based off Azure's (all I did was make it not fixed width) and she had \ and / correspond to single and double quotes. Probably so that you didn't have to escape the " character in that weird way. If you need those characters, you can try adding them yourself, lol.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on April 20, 2012, 07:52:36 AM
I would've included the loading if I remembered but I don't even have danmakufu on my computer anymore. The script is based off Azure's (all I did was make it not fixed width) and she had \ and / correspond to single and double quotes. Probably so that you didn't have to escape the " character in that weird way.
Ah, that makes sense.

If you need those characters, you can try adding them yourself, lol.
I would, but I don't know what generated the text in the image, so I wouldn't be able to simply add characters unfortunately. Unless some one happens to know where I could.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Kingault on April 23, 2012, 02:51:42 AM
Huh, when I try installing it on my Windows 7 laptop, I get this error:
(http://i44.tinypic.com/21mzyp2.png)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Yao-Kun on April 23, 2012, 04:20:25 AM
Huh, when I try installing it on my Windows 7 laptop, I get this error:
(http://i44.tinypic.com/21mzyp2.png)

I search and found this, maybe this help.

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.
(source : http://www.elitepvpers.com/forum/foreign-sro-discussions-questions/407422-csro-applocale-windows-7-useful.html)

Anyway I'm using win7 and didn't encounter that problem, so I hope that work.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on April 27, 2012, 12:49:12 PM
I was wondering, what should i write to shoot bullets in a spiral pattern?

Also, i have a problem:

SetShotDataA(1,1,3,dir,0.5,0,0,GREEN05);

SetShotDataA(3,1,3,dir,-0.5,0,0,GREEN05);

This creates a nice circular pattern that go fast out of the screen. But...why if i set "1" or "-1" instead of "0.5" or "-0.5" the bullets go in a circular pattern to the and of the screen...and then they come back to the boss??!
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: JmLyan on April 27, 2012, 07:38:02 PM
The value that makes them turn (angular velocity) is how many angles it will turn each frame. So when you write 0.5, it means it takes 360 frames = 6 seconds to turn around 180 degrees and head back the way it came, then another 360 frames to return to it's starting angle. If the angular velocity is 1 however, it will turn twice as fast  and head back for the boss after only 3 seconds. The reason the bullets with lower turn speed doesn't head back is because they manage to leave the screen before turning back, and since they are deleted off-screen they will never head back.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on April 27, 2012, 07:56:57 PM
Thanks! So to make spiral patterns like a vortex i could use this

Btw, i tryed task metod and @mainloop metod to make scripts in danmakufu, but i prefer the tasks.

So, my question is: with task how can i create 2 streams of bullets, 1 stream in a task1 and the 2nd stream in a task2 and make the engine loop...
for example:

boss appears, wait 120 frames
task1 start, so the 1st stream is shot
wait 60 frames
task2 starts, so the second stream is shot
wait 60 frames
task3 starts, so the 3rd stream is shot

and at the end make it repeat, like in old pc-98 games where the bosses had for example betwheen 1000-2000 lifepoints 3-4 different attacks that kept repeating one after the other
(attack1 -> 2 -> 3 -> 4 -> 1 again ...) but not all in the same time.


Second question:

 I would like to understand how to set that for example if the spellcard is 60 seconds, i create 3 attack tasks called fire1, fire2 and fire3. fire1 work only for the first 20 seconds, than it "deleted" and start fire2-only for 20 seconds, than it deleted too and start fire3 till the end of the script.

So...
how to (using task metod!)

1- make stream of bullets
2- make different attacks that happens one after the other considering the lifepoints of the enemy or that simply loops not at the same time
3- make different attacks that don't loops and happear when the spellcard time reaches a certain value.

Sorry if that is confusing.

Oh, and last thing, so i can start scripting a bit more advanced, how to make a stream of bullet with gaps betwheen a bullet and another like the one in lotus land story where yuuka shoot a stream of bullets that after about 3-4 seconds go right or left (a stream that moves like a snake...)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: JmLyan on April 28, 2012, 09:58:22 AM
First question:

Since you are using a task instead of @mainloop, you can put the following code, to halt the task:

Code: [Select]
loop(x){yield;}
Where x would be the ammount of frames to wait. So what you wanted would be like:

Boss appears.
loop(120){yield;}
1st stream
loop(60){yield;}
2nd stream
loop(60){yield;}
3rd stream

Also, if you want it to loop, just put it inside a loop like this:

loop{
Boss appears.
loop(120){yield;}
1st stream
loop(60){yield;}
2nd stream
loop(60){yield;}
3rd stream
}

As for the second question, you can use a variable to keep track of how many frames have passed. Then you can ensure that the 1st task is only used if the frame count is less than 1200, use the 2nd task while it's between 1200 and 2400 and the 3rd task while it's over 2400.

I'm not quite sure which of yuuka's attacks you mean. Could you describe it in a little more detail or show a picture?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on April 28, 2012, 12:10:12 PM
ok thanks! But how to write the "if frame betwheen 2000 and 4000"?

The attack i'm talking about...well i can't find a picture or a video so let's make a similar and more simple example: lotus land story, the very first attack of boss Reimu in which she shoots a stream of white and yellow bullets. White bullets behave like in fantasy seal-concentrate, but what i want to lear is to reproduce the patterns of the white bullets

mmm... could i see a script with the tasks?

i undestand that i have to create task fire1 fire2 fire3 and then i have to do something like

if time<1000
fire1;
if time betwheen 1000<x<2000
fire2;
if time over 2000
fire3;

but i keep doing errors (danmakufu freeze). Probably or:

1- I write the 3 fire tasks wrong so that when i need to execute them the program crashes

2- I write wrong the chain
"if time<1000
fire1;
if time betwheen 1000<x<2000
fire2;
if time over 2000
fire3;"

3- write wrong the "if" strings...well, if someone has a script to show me that works and that is similar i would be glad.
 
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on April 28, 2012, 02:14:33 PM
Code: [Select]
task fire{               
               let timer=1;
               angle = 360/36;
               angle += 20;
               while(timer>0) {
CreateShot01(GetX, GetY, 3, angle, BLUE12, 0);
                        angle ++;
                        timer++;
                        yield;       
}
                timer=0;
                angle += 5;
}

A big wonder... i wanted to make a circle of bullets that spin increasing angle of 5 each time.
Instead i have a SPIRAL with angle that increase too much...1 per frame!
So...
1- how to make the spiral or circle, and making bot increase their angle of 5 to make a spinning circle/spiral?
2- how to increase the angle?
3- and also, why i made a spiral and not a circle?

Obviously i messed big this time!
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on April 28, 2012, 09:31:48 PM
stuff
You don't use if statements at all. You would have to if you were using @MainLoop to run the bulk, but tasks are entirely thread-driven so it's all measured in frames. Say you have tasks main, fire1, fire2, and fire3, then you just have something like

Code: [Select]
@Initialize{
main; //main task starts when the script begins
}

task main{
loop{ //this loop runs infinitely
fire1; //starts at frame 0
loop(1000){yield;} //waits 1000 frames, or almost 17 seconds
fire2; //starts at frame 1000
loop(1000){yield;} //waits 1000 frames
fire3; //starts at frame 2000
loop(1000){yield;} //waits 1000 frames
} //once you're done, go back to the loop beginning
}

But then you have to make sure that each "fire" task only lasts that much time, or else you'll get some overlap, or the pattern will end prematurely.
Another thing you could do is have them link to each other, which is more effective but looks a bit messier:

Code: [Select]
@Initialize{
fire1; //start off running the first pattern
}

task fire1{
//the rest of your code bla bla bla
//once you're done or time is up or whatever
fire2;
}

task fire2{
//same deal
fire3;
}

task fire3{
//again
fire1; //go back to fire1
}



Honestly I'm not sure how I can explain the other question though. Here's a breakdown of your function.

Code: [Select]
task fire{               
let timer=1; //You set timer to 1.
angle = 360/36; //You set angle to 10.
angle += 20; //You increase angle by 20, so angle is now 30.
while(timer>0) { //When you first start this loop, timer is 1, so the condition is true and it runs.
CreateShot01(GetX, GetY, 3, angle, BLUE12, 0);
//Fire a bullet of speed 3 that goes straight in the "angle" direction. There is no turning.
angle ++; //Angle increases by 1. It will take 360 of these to make a full circle.
timer++; //Timer increases by 1.
yield; //This yield tells the task to wait a frame. Because of this, all of your bullets are separated by one frame.
}
//Loop back to the while condition. Note that since the timer is just increasing, the condition will always be true. This is an infinite loop.
//Also, if you get rid of the yield, you will then have an infinite loop without breaks, and DNH will crash.
//The next few statements will never happen.
timer=0;
angle += 5;
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on April 29, 2012, 06:27:26 AM
Drake, i really really thank you for your help and kindness, but i still don't understand this and don't know what i do wrong...so:
THIS is my script (with errors):

http://pastebin.com/ShtJDgxu

What, where and why (mostly why, because if i understand not only i improve but also won't bother you anymore with these things) did i mess?

Angleacc also is maybe wrong...don't know what it did. I tryed to recreate in my way Blargel metod (but he uses mainloop instead of tasks)
 Now i will quote Blargel metod so you can see from my link of pastebin.com that i tryed to do a similar script, but i think that i messed with:

1- tasks
2- yield (i put it evrywhere, i read before what it does but still don't grasp the concept)

Oh, and i don't want to learn mainloop style because i don't really like it...i aim at learning tasks and, if it happens, combine them with a few actions in mainloop, but mostly is task metod the one i'm trying to master



Any help would be really appreciated!
My gift of gratitude will be a nice spellcard once i understand how to do this  :)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on April 29, 2012, 07:02:59 AM
Firstly, you must have a yield; in your MainLoop, otherwise nothing will work properly.
Second, you have a stray closing bracket after mainTask. That will close the script_enemy_main section and everything afterwards will error.

That should fix up your problems, and you should be able to play around with your values. Also, if you could edit out Blargel's code in your post that would be great, since it's a bit long and doesn't really need to be on the page.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on April 29, 2012, 07:39:16 AM
Thanks Drake but... now i have mima standing around doing nothing, no matter what i do in the script  ???
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on April 29, 2012, 08:12:43 AM
Wait crap sorry, that bracket was supposed to be there. It just has the same tabulation as the previous bracket and the loop has the same tabulation as the lines after it, so I didn't see the connection. Not sure if it was pastebin that did that or not, but please organize your brackets and tabbing properly. After every opening bracket {, if you're going onto a new line then tab the line forward once. Every closing bracket should also be tabbed back once to match its opening bracket.

The yield in MainLoop thing still holds, if you don't put one in there your tasks will never run more than one frame.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on April 29, 2012, 09:26:15 AM
Ok thanks Drake! Now that i praticed a bit in making cirles and spirals, i was interested in a thing about mainloop.

Let's say for example that i want to do:

wait 120
fire a bullets
fire b different bullets
wait 120
fire c bullets
wait 120
fire d bullets
STOP SCRIPT ( enemy stand still doing nothing even if spellcard time left is more than 0)

or instead of stopping the script, a nice loop that will bring me at the beginning (fire a ...)

You understand, a sequence of shots with pauses betwheen them

All of that using the Mainloop and not task?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: puremrz on April 29, 2012, 06:02:55 PM
Danmakufu doesn't seem to like variables that are longer than 8 digits.
By using DrawText I noticed that a variable whose value I gave "123456789" displays as "123456792", It increases in steps of 8.
If I increase the value by 1 each frame, it will stay as "123456792" for 7 frames and then suddenly skip to "123456800" on the 8th.

Does anyone know a way to get around this limit? I'm using that variable for score and high score, so it needs to be bigger than 8 digits.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: MMX on April 29, 2012, 09:50:22 PM
Danmakufu doesn't seem to like variables that are longer than 8 digits.
By using DrawText I noticed that a variable whose value I gave "123456789" displays as "123456792", It increases in steps of 8.
If I increase the value by 1 each frame, it will stay as "123456792" for 7 frames and then suddenly skip to "123456800" on the 8th.

Does anyone know a way to get around this limit? I'm using that variable for score and high score, so it needs to be bigger than 8 digits.
Split it into two variables (one for higher digits and one - for lower) and control them like a single virtual long one. This is the only solution that comes in mind.
i was interested in a thing about mainloop.

Let's say for example that i want to do:

wait 120
fire a bullets
Don't use wait in mainloop!
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on April 30, 2012, 12:23:09 AM
Danmakufu numbers are floats. The wiki entry (http://en.wikipedia.org/wiki/Single-precision_floating-point_format) and such can explain it a lot better than I can, but I fear nobody will read it because of jargon and length.

Basically, it's like scientific notation. But in binary. You have a fraction portion and an exponent portion. There's also a sign bit to determine negative values but I'm going to ignore that. In decimal scientific notation, you have numbers like 4.296*10^3 to express the number 4296. 4.296 is the significant/precision/fraction portion, 10 is simply the base, and 3 is the exponent. With floating point, to express something like 5, it would be 1.25*2^2 (in decimal representation).

The fraction as also be expressed as a "mantisse", which is sort of just an easier way to visualize the numbers. The mantisse starts at 1.0. Rather, if your fraction portion is all zeroes, your mantisse is 1.0. If your fraction portion is a 1 and then all zeroes (1000...), that signifies the 1/2 bit is flipped, and your mantisse is 1.5. If the fraction is 01000..., the 1/4 bit is flipped and your mantisse is 1.25. If you want to think of it this way, each fraction bit starting from the left signifies "one, over its power of two", like 1/2, 1/4, 1/8, 1/16, etc. Following this, if it were 11000... the mantisse is 1 + 1/2 + 1/4 = 1.75. Likewise, 001101000... is 1 + 1/8 + 1/16 + 1/64 = 1.203125.

The exponent part itself is a twos-complement number. If all the bits are 0, you have -127. Each exponent bit starting from the right signifies its power of two. This also means the leftmost bit adds 128, so if your exponent is 10000000, your exponent is 1. Likewise, 00000001 is -126; 10000001 is 2; 10000011 is 4; 10010100 is 21.

Putting these together, say you want to express 8 as a floating point. This would be simply 1.0*2^3. Knowing the 1.0 is your mantisse and the 3 is your exponent, 8 in binary is:
S EEEEEEEE FFFFFFFFFFFFFFFFFFFFFFF
0 10000010 00000000000000000000000

Now as for the problem, look at 16777215 and 16777216:
0 10010110 11111111111111111111111
0 10010111 00000000000000000000000

But the next possible value is:
0 10010111 00000000000000000000001
which is (1+1/(2^23)) * 2^24 = 16777218. Oh no. This is the loss in precision that turns up when you have numbers too complex for the data structure to hold, and is why Danmakufu won't let you use 123456789 as a number.

You can play around with this converter (http://www.h-schmidt.net/FloatConverter/IEEE754.html) for more examples.

Numbers that pass a certain value will screw up things randomly if you don't keep it under control, probably because memory starts leaking around. Naut and I were working on things a while back and after a significant amount of time, graphics would randomly begin to shit themselves because time counters and other arbitrary value counters started to pass the possible values. It was pretty weird. Your instance of DrawText is actually pretty smart, since it's actually still counting the number in memory somewhere. Normally, if you hit a maximum you'd have to explicitly start working with the next exponent upwards: say you had 16777216, you wouldn't be able to add 1 to it anymore, but you could keep adding 2, or 4, or 8, etc. Once you hit 33554432, you wouldn't be able to add 2. At 67108864 you can't add 4, and so on. 123456789 is greater than 67108864, so the lowest precision it can keep at that point is 8. Tada! You've learned why your number is increasing in increments of 8. Notice how this doesn't answer your question on how to get around it.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: puremrz on May 01, 2012, 10:31:50 AM
:wikipedia:

Yow, then I should keep in mind that very long variables == bad idea. This is probably the reason why my gui sometimes vanishes when playing through a 50 minute+ game...

But I got the solution. A good soul in chat told me to use arrays For example: score[1,2,3,4,5,6,7,8,9,0,etc]; (This also makes it easier to convert a number into custom text)
Now to work that into a script...
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on May 02, 2012, 07:50:47 PM
Hi all, i have some problems with objects.

1- If i understand well, objects are like normal bullets but instead of 1 bullet, a object can summon for example 10 bullets in the same time right? So, i i use createshot01 with angle = 90, i shoot a bullet down.  With objects i can shoot 10 bullets down in the same time. Right?

2- So... how to create objects that bounce on the walls??

I'm using both mainloop and tasks in my scripts.

Thanks!
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: JmLyan on May 02, 2012, 08:21:46 PM
Not quite right, object bullets are bullets that you can keep track of easily because you can store its ID in a variable.

If you want an object bullet to bounce on walls, you'll need a task that keeps track of the bullet and constantly checks the bullets position. If the bullet then is outside of the screen, you simply move the bullet back to the screen and change it's angle based on which side it left the screen.

If the bullet leaves the screen at the top or bottom, you need to change it's angle to the negative counterpart, either by multiplying it's angle by -1 or by setting it's angle to 0 and subtract the angle it had before.

If the bullet leaves the screen at the left or right side, you need to change it's angle to 180 minus the angle it had before.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on May 02, 2012, 08:33:30 PM
Mmm, seems hard. But i have to insert the bounce bullets in my spellcard so slowly i will try to grasp that. Thanks!
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: adrian7 on May 16, 2012, 12:49:45 PM
I'm having a constant problem with the boss graphic, and I can't really get what I'm doing wrong.

Code: [Select]
@DrawLoop {   
SetTexture(ImgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale (1, 1);
SetGraphicAngle (0, 0, 0);
SetGraphicMove;
DrawGraphic (GetX, GetY);
}

This one was copied right from this forum:

Code: [Select]
sub SetGraphicStop  { SetGraphicRect(  0,   0,  140,  80); }
sub SetGraphicLeft  { SetGraphicRect(  140,   0,  280,  80); }
sub SetGraphicRight  { SetGraphicRect(  280,   0,  420,  80); }
sub SetGraphicMove
{
        if (GetSpeedX < 0){SetGraphicLeft;}
else{
if (GetSpeedX > 0){SetGraphicRight;}
else{
if (GetSpeedX == 0){SetGraphicStop;}
}   
}
     }

Now, when I make the boss go right, left or stay in place, everything is fine.  But when it goes straight up or straight down, the graphic changes to the "SetGraphicRight". Is the SetGraphicMove; misplaced?  Or is there something wrong with GetSpeedX ?


EDIT:
Oh, I also encountered an another problem - non-spell backgrounds.  I found an answer on the forum:
Quote from: Helepolis
If you want background for non-spells, you need to work with stage scripts.
But no matter what I write in the stage script, I can't force the background to appear during the non-spells.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: TheTeff007 on May 16, 2012, 10:30:14 PM
Get Speed X gets the horizontal velocity.

For what you're asking, GetSpeedY will do the job.

And the Backgrounds from the script are the backgrounds for the stage, not the boss. The backgrounds are meant for spellcards, but you can use Object Effects to have Backgrounds even on Nonspells
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: adrian7 on May 16, 2012, 11:19:10 PM
But I want it to completely ignore the Y velocity.
When GetSpeedX<0, use "fly left" graphic,
When GetSpeedX==0, use "don't move "graphic,
When GetSpeedX>0, use "fly right" graphic.
Instead, what happens is:
X speed==0 and Y speed==0 -> "don't move" graphic visible, OK.
X speed==0 and Y speed!=0 -> "fly right" graphic visible, I don't know why it happens :(

Thanks, I will try using the object effects tomorrow.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on May 17, 2012, 01:41:29 AM
Just to note, GetSpeedX is pretty wacky. If you really want a solid function you might want to make one. I've never really had a huge problem with this because in nearly all cases you aren't actually going to be moving an enemy straight up, so at its root this is more of a design problem than anything. Anyways, DNH seems to handle the function in hilariously bad ways; sometimes useful, sometimes not. In particular, if you use SetMovePosition01 and move straight up and down it'll return something like -0.003187, which would cause your problem. Try putting...
CreateDebugWindow;
OutputDebugString(5,"bla",GetSpeedX);

somewhere where it'll update every frame (like the draw loop) and see what you're getting.

In any case, this would be a more concise way to put your SetGraphicMove:
if(GetSpeedX < 0){SetGraphicLeft;}
else if(GetSpeedX > 0){SetGraphicRight;}
else{SetGraphicStop;}

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: TheTeff007 on May 17, 2012, 06:07:48 AM
Edit: Nevermind, didn't saw Drake's post.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: adrian7 on May 17, 2012, 09:45:40 AM
Thanks, Drake! I used the debug window to get both X and Y velocity. I seems like whenever I use SetMovePosition03 (no matter the actual direction and speed), the X velocity is set to 1 or -1 and Y velocity is set to 0.
(http://img855.imageshack.us/img855/4135/debugd.png)
You were also right about the nonzero GetSpeedX value during  SetMovePosition01 movements.
you aren't actually going to be moving an enemy straight up, so at its root this is more of a design problem than anything.
You are right here, I suppose, In my script, the boss stayed in (GetCenterX,GetClipMinY + 100) during the non-spell and moved vertically outside the screen at the beginning of the spell card. This can be changed easily, but it's still inconvenient. I wonder, does the ph3 version behave similarly? If not, it could be a good excuse to port the code...
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on May 18, 2012, 09:35:44 AM
Hi, i need a little help for a script i'm making.

I need to do a master spark like bullet, and i think it is in the supershot.txt

I'm using tasks btw... can someone please tell me how to do it starting from zero? (i mean, how to upload in the script the supershot.txt ; what to write to make it works , how to select a kind of bullet and insert it in the task)

Thank you for your kindness!

(Btw, where can i find the famous supershot.txt???)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: TheTeff007 on May 18, 2012, 11:36:55 AM
The Master Spark can be done as a Object Bullet, but I'm not really sure, as I haven't tried it before.

You can find the different Shotsheets here: http://www.shrinemaiden.org/forum/index.php/topic,1050.0.html

To make it work, place the supershot inside the lib folder in Danmakufu (It's where the executable is located, if you don't see the folder, create it.) and dumpo it there.

Then, in any nonspell, just place #include_function ".\lib\insert the name of the folder of the shotsheet here\ insert the name of the file here" and that should do it,
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on May 18, 2012, 09:42:28 PM
Thanks! I have another question btw...

i need to make 2 tasks, 1 for the attack and the other for setting the object i use.

So i make a indestructible bullet like this:

task MyObjectBullet2 (x, y, velocity, angle, graphic, delay) {
    let obji = Obj_Create(OBJ_SHOT);
   
    Obj_SetPosition(obji, x, y);
    Obj_SetSpeed(obji, velocity);
    Obj_SetAngle(obji, angle);
    ObjShot_SetGraphic(obji, graphic);
    ObjShot_SetDelay(obji, delay);
    ObjShot_SetBombResist(obji, true);
}

But how can i insert this object bullet in my maintask? i need to make this indestructible bullet that is shoot from the boss and after 30 frames it stops.

I could use simply createshotA, but i need that the bullet remains even if the player dies because i have to Addshot and the Addshot function doesn't work if the main bullet is deleted.

How can i do this?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: TheTeff007 on May 19, 2012, 12:19:30 PM
Just use this:

Code: [Select]
task MyObjectBullet2 (x, y, velocity, angle, graphic, delay) {
    let obji = Obj_Create(OBJ_SHOT);
   
    Obj_SetPosition(obji, x, y);
    Obj_SetSpeed(obji, velocity);
    Obj_SetAngle(obji, angle);
    ObjShot_SetGraphic(obji, graphic);
    ObjShot_SetDelay(obji, delay);
    ObjShot_SetBombResist(obji, true);

while(!Obj_BeDeleted(obji)
{

wait(30);
Obj_SetSpeed(obji, 0);

}
}


After the Obj_SetSpeed, then place whatever you want your bullet to do next.

An Advice though, having no wait or yield in a while function will freeze danmakufu. Take note of that.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: SparklingOrange on May 23, 2012, 02:09:34 AM
Hi.

Been fiddling about with Danmakufu after a long hiatus, and I was thinking if it's possible to do a spellcard (cutin and everything) without changing the stage background. I noticed that if I SetScore to a nonzero value in the Initialize loop, the spellcard sound plays, and the background gets changed automatically to whatever's in the current script's DrawLoop.

I worked around this by doing AddScore in the Finalize loop instead and doing SetScore to 0. Unfortunately, even if the PC bombs, the score isn't forfeited, nor does it decrease as the timer goes. I also lose the sound, so I would have to play a custom one manually.

Is there another workaround, or am I doing this wrong? I have yet to learn more about custom objects and drawing things.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on May 23, 2012, 03:35:53 AM
SetScore sets the flag for which all of danmakufu's functions for Spell Cards activate. Even if you modify or remove the default graphics and such, the background will be black. In other words, you can't use SetScore, but if you don't it isn't technically a Spell Card (for danmakufu). Unfortunately, this means you have to make one yourself. However, this means you get to make one yourself!

You're on the right track though. You can use GetBombCountInThisSpell and GetMissCountInThisSpell, or OnPlayerMissed and OnBomb, and Spell Card bonus is arbitrary so yeah.

Code: [Select]
let spellCardBonus = 1000000;
@Initialize{
SetSpellCardBonus;
}
task SetSpellCardBonus(){
while(spellCardBonus>0){
spellCardBonus-=1000;
if(OnPlayerMissed||OnBomb){spellCardBonus=0;}
yield;
}
spellCardBonus=0;
}
@Finalize{
AddScore(spellCardBonus);
spellCardBonus=0;
}

Of course, there are many ways you could set this up instead. This is a reeeally crappy example and should only be used if it's a one-time thing. If you plan on doing a lot like this you might want to think up an actual system.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: SparklingOrange on May 25, 2012, 01:26:47 AM
Thanks, Drake. Yeah, it would be redundant if I had to put this into every single spellcard I have. What would be an example of a higher-scale system? Would it be something I'd put in the stage script or the boss script?

Also, I noticed from a long time ago that you can't play sounds in the Finalize loop. If I wanted to play a sound to indicate a spell card bonus, would it have to be in the Initialize loop instead?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on May 25, 2012, 01:39:38 AM
Also, I noticed from a long time ago that you can't play sounds in the Finalize loop.
Huh? You can play sounds from @Finalize. Or at least I've always been able to
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: sjasogun1 on May 25, 2012, 04:12:03 PM
I'm getting a problem with an animation I'm trying to do: the animation won't play. The code is supposed to do the following:
1. Draw the regular, unanimated sprite until the location specified in @initialize is reached (GetCenterX,120)
2. Once this point is reached, start doing the animation
3. Once the animation is over, the actual fight will start, keeping the sprite as the final frame of the animation.

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

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

I can't figure out what I did wrong, so I hope one of you can help me.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on May 25, 2012, 09:14:18 PM
I'm getting a problem with an animation I'm trying to do: the animation won't play. The code is supposed to do the following:
1. Draw the regular, unanimated sprite until the location specified in @initialize is reached (GetCenterX,120)
2. Once this point is reached, start doing the animation
3. Once the animation is over, the actual fight will start, keeping the sprite as the final frame of the animation.

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

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

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

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

Code: [Select]
task mainTask {
        while(introdone != 1) { yield; }
        wait(120); // The extra yield is unnecessary. You might as well write wait(121);
        fire;
        movement;
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: sjasogun1 on May 26, 2012, 08:01:16 AM
That's odd. The mainTask is indeed only called once in @initialize, but somehow in my old version of this file (where mainTask is exactly the same save for the if-statement) it does keep on looping continuously. I'm confused  ??? Especially since the mainTask starts with a yield? Never mind, the yield will simply cause it to go back to @maintask once before it proceeds, although I still don't understand why the mainTask is in @initialize.

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

Also, I got the outlines of the script from this (http://www.youtube.com/watch?v=OYpwkQWGFbk) tutorial.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on May 27, 2012, 06:32:33 AM
That's odd. The mainTask is indeed only called once in @initialize, but somehow in my old version of this file (where mainTask is exactly the same save for the if-statement) it does keep on looping continuously. I'm confused  ??? Especially since the mainTask starts with a yield? Never mind, the yield will simply cause it to go back to @maintask once before it proceeds, although I still don't understand why the mainTask is in @initialize.

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

Also, I got the outlines of the script from this (http://www.youtube.com/watch?v=OYpwkQWGFbk) tutorial.

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

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

The script loops just fine without the if statement because fire and movement (called by mainTask) both loop on their own. Your mainTask should only ever be called once, just to start the fire and movement loops. When it is called, the script has just started and introdone is still 0. Thus, the if statement doesnt do anything and mainTask finishes. With the code I gave before, mainTask will wait until introdone = 1 and then run the remainder of the task.
 
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: sjasogun1 on May 27, 2012, 07:38:04 AM
Thank you, the animation works now!  :D I used your solution for the attack loop from the previous post as well and added a ForbidShot to make sure the boss can't be hit during the animation.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on May 27, 2012, 07:43:24 PM
Rather than preventing the player from shooting, I would use SetInvincibility(frames) to make the boss invincible during the animation instead. Just stick in @Initialize. That will also prevent damage from bombs during prior attacks from carrying over.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: xForeverFanaticx on June 06, 2012, 12:24:53 AM
Ugh, deciding to come back to Danmakufu and see if I can do much @@

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

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

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

Also, can somebody direct me to somewhere where I can find what all the layers of the game screen are?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on June 06, 2012, 01:19:56 AM
-Create a folder in the root dnh directory called se and create blank files with the names of the default sound effects:
sePlayerShot01.wav   
seGraze.wav   
sePlayerCollision.wav
sePlayerSpellCard.wav
se1UP.wav   
seScore.wav   
seBomb_ReimuA.wav   
seExplode01.wav   
seBomb_ReimuB.wav
seUseSpellCard.wav
seGetSpellCardBonus.wav
seEnemyExplode01.wav   
seSuperNaturalBorder1.wav   
seSuperNaturalBorder2.wav

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

0: background
1: nothing
2: enemies
3: player, default effect objects
4: items
5: bullets
6: event images/dialog
7: nothing
8: frame (if you draw something on 8 the frame is set to redraw every frame)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on June 06, 2012, 01:37:55 AM
I always use DeleteSE in the beginning of scripts to get rid of the default sound effects. I image DeleteGraphic would also work for the default images but I have yet to try it for myself. I've noticed that sound effects deleted in this way remain deleted until Danmakufu itself is reset. So it only needs to be called once for a stage script for example.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: xForeverFanaticx on June 06, 2012, 02:22:34 AM
Hmm... I looked through the existing img file (dunno if it was left from another game or something) but I see no "system.png"
Is there not supposed to be that file in the img folder initially? If I were do put a file with that name in it, would it override the original file if it exists elsewhere? :V

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

(lol and yeah, I'm feeling quite lazy to learn some of the miniscule functions, so I'm planning on winging it and improv scripting to make things work xD)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on June 06, 2012, 04:13:16 AM
The folders and files don't exist on a fresh install, but adding the folders and making new images/sounds will get danmakufu to load those instsead.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: xForeverFanaticx on June 06, 2012, 11:08:41 AM
The folders and files don't exist on a fresh install, but adding the folders and making new images/sounds will get danmakufu to load those instsead.

Ah, I see. Thanks to all of you! ^^
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: xForeverFanaticx on June 06, 2012, 10:08:28 PM
Sorry for the double post, but I'm wondering what exactly each type of blending in danmakufu does? :V

ie. Alpha, Additive, Subtractive, and Multiplicative Blending? :V
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on June 06, 2012, 10:43:34 PM
http://en.wikipedia.org/wiki/Blend_modes
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: PezGeneral on June 07, 2012, 02:14:39 AM
This may seem like a stupid question, but to those out there who know how to do all of that editing stuff with making bullet-shot sounds different along with their looks could you please tell me how? I have been wanting to make my own custom (playable) character with his/her own things to shoot instead of like Reimu's cards or something. I was almost hoping you'd know how to change the sound of bullets and how to make a custom player spellcard? This all seems a bit confusing to explain on a forum, and since it's my first post I feel very awkward, but anyway, any replies with helpful (not hateful, malicious, or rude in general) words would be very much appreciated.  :3
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on June 07, 2012, 02:59:13 AM
General Info and FAQ thread:
http://www.shrinemaiden.org/forum/index.php/topic,6181.0.html

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

And then we have the two stickied Q&A threads if you have any further questions (which is likely).
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Zomoni on June 14, 2012, 08:25:51 PM
How do you make an effect object similar to medicine's poison or shikieiki's vortexes?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on June 14, 2012, 10:35:07 PM
Do you just mean "how do I make an effect object"? The only difference with Eiki's vortexes is that bullets are fired from it, and Medicine's is only slightly more complex. In any case, they do different things entirely, so I can only guess you mean to ask how to get an effect on screen.
Here's a tutorial on how to do so (http://dmf.shrinemaiden.org/wiki/index.php?title=Nuclear_Cheese%27s_Effect_Object_Tutorial). Here's another (http://www.youtube.com/watch?v=EMw7DOWYMkw). If there's anything after that you need help with, don't hesitate.


I'm going to personally note that modifying player movement as substantially and arbitrarily as Medicine's poison is a bad design choice. Youmu and Sakuya work well because their danmaku is designed around the notion that player motion will be affected and don't do anything silly while active. Youmu slows down the game and actually makes it somewhat easier, while Sakuya stops time so that the player actually gets to see the new bullets being spawned before they fire. Both of these use time shenanigans in a precise, patterned and predictable manner; firing poison clouds that slow you down is not timely and will affect you arbitrarily regardless of what else is on the screen.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Zomoni on June 17, 2012, 01:59:45 PM
I already know how to make effect objects that sit there and look pretty, like yuyuko's fan.
I want to know how to make effect objects that actually have effects, like affecting enemy bullets or player movement.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on June 17, 2012, 05:30:10 PM
You're missing something quite significant here then, but I'm not sure exactly what. There is no difference between an object that sits there and an object that does something besides adding in the code for the "does something". Are you wondering how to actually run other code after the object's initial creation? How to do something during that period like firing bullets? How to get the condition for "the player hits this object", or some other condition? If you know how to do these three then you should have no problem, so...
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Zomoni on June 17, 2012, 06:48:33 PM
^That's exactly the part I need to know
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Fujiwara no Mokou on June 17, 2012, 07:08:51 PM
^That's exactly the part I need to know

If you want the object effect to manipulate bullets somehow, the easiest way to go about this is to make the bullets themselves objects as well. You're not giving too much detail here, so I'm guessing you want the bullets to behave some way when they come close to the effect object. You're going to have to do a proximity check as well as a branch routine.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on June 17, 2012, 09:45:29 PM
^That's exactly the part I need to know
...You never said which of the three you needed help with. You also haven't posted anything you've already done, so I'm literally going on nothing here dude, come on. I don't want to have to spoonfeed if I can help it.

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

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

This is kind of why I don't know what your actual problem is. If you know how to make effect objects and you've read the intermediate tutorial, this should be easy, so I'm a bit confused.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: shirobon on June 23, 2012, 03:05:32 PM
How can I do the Extend System? [Like when you have 50/50 points, geta nother life n bomb, then set it to 50/120?]
Yeah, i'm noobish xD
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on June 24, 2012, 05:01:17 PM
How can I do the Extend System? [Like when you have 50/50 points, geta nother life n bomb, then set it to 50/120?]
Yeah, i'm noobish xD

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

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

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

Now I have my own question. I've been toying around with 3D backgrounds (which has been very frustrating). I just want a scrolling floor texture to scroll out of the screen from another background. How can I get the floor texture to fade into the background? I though that SetFog to fade the floor texture into the same color of the background would work. However, SetFog seems to have made the entire texture the color rather than only that part that's far enough away (unless I'm doing something wrong). I can pastebin code if it helps.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Chau on June 30, 2012, 06:01:38 PM
No, I'm not dead yet! Still working on my full game, but very slowly...

I have a problem with color gradients. If I play in windowed mode, everything is fine, but when I switch to fullscreen mode, there are weird-looking stripes. I'm not sure whether this problem is Danmakufu-related, though.
(http://oi49.tinypic.com/vy1pmr.jpg)

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: TheTeff007 on June 30, 2012, 07:01:47 PM
My guess is because the image extends itself to fit the screen, then gets less resolution?

A possible solution: Make a bigger image and shrink it to fit the screen, this way, I suppose when enlarging the screen the effect will be less, if not, noticeable.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: fondue on July 01, 2012, 04:02:31 PM
My guess is because the image extends itself to fit the screen, then gets less resolution?

A possible solution: Make a bigger image and shrink it to fit the screen, this way, I suppose when enlarging the screen the effect will be less, if not, noticeable.
Also, the image canvas (width and length of the whole image itself) should be a power of 2 (2,4,8,16,32,64,128,256,512 etc). It will help prevent blurriness, it's not complementary but it's recommended.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Chau on July 01, 2012, 04:50:45 PM
I tried this with a test image (512*1024) and shrinked it to fit the screen: (left: windowed mode; right: fullscreen)
http://oi46.tinypic.com/288o6s2.jpg (http://oi46.tinypic.com/288o6s2.jpg)
I looked around in the internet and found that it maybe has something to do with "color banding" or 8/16/24-bit or my video card. I don't know much about this, these are just words I stumbled upon.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: professor_scissors on July 01, 2012, 09:32:55 PM
Currently working on adding a framework for stage backgrounds to my game. What I WANT to do is add this to each stage script:

Code: [Select]
@BackGround {
stageBG(1);
}

Then have a single unified stageBG function defined in a shared include file that renders the appropriate background. However, I'm running into a problem with this - if I attempt to call DrawGraphic3D anywhere outside of a stage block, including in defining a function to be used in multiple stage blocks, it gets a syntax error for being an undefined function. This looks like it makes it impossible for me to do this any way other than repeating a whole lot of code.

Is there a possible workaround for this?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on July 02, 2012, 12:33:36 AM
I'm assuming you're running into this problem because you're defining your stageBG function in a file that you include everywhere. Instead, try making a separate file with just the 3D background stuff and include that in only the stages.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: professor_scissors on July 02, 2012, 01:55:02 AM
I'm assuming you're running into this problem because you're defining your stageBG function in a file that you include everywhere. Instead, try making a separate file with just the 3D background stuff and include that in only the stages.
Ah! That makes sense. In other words, it's not complaining because it's being defined in an external file, it's complaining because that file is also referenced by non-stages.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ShedPH93 on July 03, 2012, 03:14:34 AM
In most scripts I download, you can't see the spellcard/nonspell files in the main menu, only the full game. Does anyone know how to hide them?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on July 03, 2012, 03:57:23 AM
In most scripts I download, you can't see the spellcard/nonspell files in the main menu, only the full game. Does anyone know how to hide them?

Simply remove #TouhouDanmakufu from the top of the script. Other scripts will still be able to use them.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: TheTeff007 on July 09, 2012, 10:32:47 PM
Yes... I'm having this little trouble with a script.... is about intereaction between two objects.


---------------------------
ScriptError「C:UsersTeff007DesktopTeffGamesTouhou Myofudono ~ Sealed Ancient SpectrumscriptBossesStage31 - SukyN3.txt」
---------------------------
一回も代入していない変数を使おうとしました(335行目)

   if(Obj_GetX(Obj1) <  TempoX + 100 && Obj_GetX(Obj1) > TempoX - 100 && Obj_GetY(Obj1) < TempoY + 100 && Obj_GetY(Obj1) > Tempo
~~~
---------------------------
Aceptar   
---------------------------


here is the danmaku code: http://pastebin.com/R2Fysg68
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on July 09, 2012, 11:42:14 PM
Tempos don't have a value when they're first called (and possibly later), because you call Fire and then Ignite.

if(Obj_GetX(Obj1) <  TempoX + 100 && Obj_GetX(Obj1) > TempoX - 100 && Obj_GetY(Obj1) < TempoY + 100 && Obj_GetY(Obj1) > TempoY - 100)
is also better written as
if( (|Obj_GetX(Obj1) - TempoX|) < 100 && (|Obj_GetY(Obj1) - TempoY|) < 100 )
But if this is a collision then why not use distance calculation?

Lastly you probably should have picked up on
Obj_Delete(Obj1);
CreateShot01(Obj_GetX(Obj1), Obj_GetY(Obj1), Obj_GetSpeed(Obj1), Obj_GetAngle(Obj1), rand_int(237,238), 60);

Swap the two.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: SusiKette on July 14, 2012, 12:44:02 PM
I'm trying to make a spell card for custom character that:
1. spawns on player's position 2x bigger than the bullet's real size and fully transparent (doesn't follow player movements)
2. starts to decrease in size until it's 1x size and turns visible in 30 frames ("fades in")
3. bullet launches foward with speed of 5 (270 degree angle)
4. bullet decelerates and stops after travelling 200 pixels foward. deceleration happens from speed of 5 to 0 in 30 frames
5. bullet explodes with a different texture that damages enemies/boss and destroys bullets (explosion texture grows 4x bigger in 25 frames and quickly "fades out" in the end)

Hopefully I explained this clearly enough. Values doesn't need to be exact
Is there anyone who is able to make this for me
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Ginko on July 14, 2012, 06:27:50 PM
Quote
4. bullet decelerates and stops after travelling 200 pixels foward. deceleration happens from speed of 5 to 0 in 30 frames

That part is quite puzzling, I must say.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: fondue on July 14, 2012, 07:56:03 PM
That part is quite puzzling, I must say.
I think he means when the bullet is fired, it decelerates, then fully stops when it's 200 pixels away from it's spawn point. Then the bullet will accelerate backwards until it's speed is -5 or something. In the last part the said bullet will reach -5 pixels when 300 frames have passed.

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on July 14, 2012, 11:19:23 PM
1. spawns on player's position 2x bigger than the bullet's real size and fully transparent (doesn't follow player movements)
Object position starts at GetPlayerXYs. Make an effect object, use ObjEffect_SetScale and ascent(i in 0..4){ ObjEffect_SetVertexColor(obj,i,0,255,255,255) } for the other two (assuming your render has 4 vertices).

2. starts to decrease in size until it's 1x size and turns visible in 30 frames ("fades in")
Same SetScale and SetColor as previous. Scale decreases each frame by 1/30, alpha value increases by 255/30.

3. bullet launches foward with speed of 5 (270 degree angle)
Obj_SetAngle and SetSpeed

4. bullet decelerates and stops after travelling 200 pixels foward. deceleration happens from speed of 5 to 0 in 30 frames
SetSpeed, object speed decreases each frame by 5/30 or 1/6.

5. bullet explodes with a different texture that damages enemies/boss and destroys bullets (explosion texture grows 4x bigger in 25 frames and quickly "fades out" in the end)
Change the UV vertices and XY if needed. SetScale, scale increases by 4/25 per frame. ObjEffect_SetVertexColor for alpha, same as before, have it decrease at whatever speed you want, I guess. Only useable in spell card scripts, SetIntersectionCircle(x, y, radius, power, true) is what you want for damage and bullet deletion.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Ginko on July 15, 2012, 12:05:50 AM
Quote
4. bullet decelerates and stops after travelling 200 pixels foward. deceleration happens from speed of 5 to 0 in 30 frames
SetSpeed, object speed decreases each frame by 5/30 or 1/6.

Then again, the bullet would only go like 75 pixels forward if we did that, which is why I'd like him to make things clear. Is the bullet supposed to go forward 200 px, then decelerate for 75 px; or is it 125 px, then 75 px; or something else again, like a continuous deceleration from 5px/s to 0 on 200 pixels (which would then take more than 30 frames) ?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on July 15, 2012, 02:36:44 AM
Whoooops my bad. The question is malformed, yes, unless the deceleration is nonlinear. The bullet would have to accelerate to go 200 pixels in 30 frames, starting at 5.

In any case, I don't think he realizes how short a timespan 30 frames is. That's half a second, basically. These numbers don't seem practical.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Moriarzipan on July 17, 2012, 01:09:38 AM
Hi! I'm relatively new to Danmakufu, I've watched a few tutorials and actually managed to get a working script off the ground.

I just have a general question regarding familiars. I'm trying to figure out a way to have the familiars spawn at the boss and then have them fly down to the bottom in set positions. Right now I have them where they're in the position I want them to at the bottom, they just don't spawn from the boss and spread out as such.  Basically, I'm just having difficulty getting the first part down.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on July 17, 2012, 07:53:45 AM
Hi! I'm relatively new to Danmakufu, I've watched a few tutorials and actually managed to get a working script off the ground.

I just have a general question regarding familiars. I'm trying to figure out a way to have the familiars spawn at the boss and then have them fly down to the bottom in set positions. Right now I have them where they're in the position I want them to at the bottom, they just don't spawn from the boss and spread out as such.  Basically, I'm just having difficulty getting the first part down.
Ah, that is quite easy. You need to use the 2nd and 3rd parameter if you're using the following. GetEnemyX and Y will always get the boss location as coordinates. Later on you use the movement syntax inside the familiar section to make it move.

Code: [Select]
CreateEnemyFromScript("fam",GetEnemyX,GetEnemyY,0,0,NULL);

...

script_enemy fam{

SetMovePosition01(x,y,speed); // You can use any movement if you wish.

}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lunasa Prismriver on July 19, 2012, 08:00:05 PM
Hello everyone, I recently registered on the forum.

I actually make a full game and I search a function to create a rain/snow/fall of cherry blossom into a stage script. I've already search and I found Blargel's function but i'm still not comfortable with multidimensional arrays. Thank you in advance.

PS : Excuse me for my bad english, i'm french. :P
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on July 23, 2012, 09:05:39 PM
Hello. I'm learning Danmakufu right now. All was going well until the part where I learned to add a background and a cut-in. Whenever I try to run the script I'm making, I get an error similar to this:
(http://i45.tinypic.com/2r2yqmp.png)

I try editing the script, but I don't know what's wrong. It was working just fine up until that point. If anyone wants to download the script and take a look, here it is:
The script I'm using to learn danmakufu. (http://storenow.net/my/?f=4931) Can't post a mirror because stupid Mediafire won't let me view my files or upload >.<

Can someone please help me out with this? Thanks.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: puremrz on July 23, 2012, 09:17:38 PM
   CutIn(YOUMU, "Test Sign [My First Spell]",cut,0,0,512,512
is missing ); at the end. ;)
You should post such things in another topic thpugh: http://www.shrinemaiden.org/forum/index.php/topic,12397.90.html
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on July 23, 2012, 09:30:50 PM
Oh herp derp! How did I miss two such obvious things?!  *facepalm* The semicolon, then forgetting to post in the proper thread?! DX

Thanks for the help, anyway. :)

Edit: Added the semicolon, still got the error. ???
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on July 23, 2012, 11:26:40 PM
Closing parentheses AND semicolon. You still didn't add the parentheses.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on July 23, 2012, 11:36:43 PM
Yay, it worked. I'm such an idiot for not knowing something as simple as parentheses closing before the semicolon. :colonveeplusalpha:

Thanks for the help, everyone.  :]
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on July 24, 2012, 12:21:10 AM
Whenever I boot up my script on Danmakufu now, I get an error. Did I miss a simple error again? Here's the code:
Code: [Select]
#TouhouDanmakufu
#Title [Test Sign 'My First Script']
#Text [AKA character testing script!]
#ScriptVersion [2]

script_enemy_main {

let CSD = GetCurrentScriptDirectory;

let yukari = CSD ~ "system\yukari1.png";
let bg = CSD ~ "system\yukaribg.png";
let cut = CSD ~ "system\yukaricutin.png";

@Initialize {
        SetX(GetCenterX);
        SetY(GetClipMinY + 80);
        SetLife(5000);
SetTimer(60);
SetScore(10000);

LoadGraphic(yukari);
LoadGraphic(cut);
LoadGraphic(bg);
CutIn(YOUMU,"Test Sign -My First Spell-",cut,0,0,512,512);
    }

    @MainLoop{
let x = 0;
let dir = 0;

        SetCollisionA(GetX, GetY, 24);
        SetCollisionB(GetX, GetY, 24);

while (x<36){
        CreateShotA(1,GetEnemyX,GetEnemyY,30);
SetShotDataA(1,0,0,dir,0,0,0,PURPLE31);
SetShotDataA(1,60,2,dir,0.2,0,2,PURPLE31);

FireShot(1);

dir+=360/36;
x++;

}
x = 0;
dir = 0;
wait (60);

yield
            }

}

    @DrawLoop {
SetTexture(yukari);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,80,96);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
        DrawGraphic(GetX, GetY);

    }

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

    }

    @Finalize {
        DeleteGraphic(yukari);
DeleteGraphic(bg);
DeleteGraphic(cut);
    }
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on July 24, 2012, 12:43:38 AM
wait (60); shouldn't have a space
yield needs a semicolon
extra closing bracket in MainLoop that terminates the script
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on July 24, 2012, 12:55:09 AM
'Kay, so I fixed all those, and now the script looks like this:
Code: [Select]
#TouhouDanmakufu
#Title [Test Sign 'My First Script']
#Text [AKA character testing script!]
#ScriptVersion [2]

script_enemy_main {

let CSD = GetCurrentScriptDirectory;

let yukari = CSD ~ "system\yukari1.png";
let bg = CSD ~ "system\yukaribg.png";
let cut = CSD ~ "system\yukaricutin.png";

@Initialize {
        SetX(GetCenterX);
        SetY(GetClipMinY + 80);
        SetLife(5000);
SetTimer(60);
SetScore(10000);

LoadGraphic(yukari);
LoadGraphic(cut);
LoadGraphic(bg);
CutIn(YOUMU,"Test Sign -My First Spell-",cut,0,0,512,512);
    }

    @MainLoop{
let x = 0;
let dir = 0;

        SetCollisionA(GetX, GetY, 24);
        SetCollisionB(GetX, GetY, 24);

while (x<36){
        CreateShotA(1,GetEnemyX,GetEnemyY,30);
SetShotDataA(1,0,0,dir,0,0,0,PURPLE31);
SetShotDataA(1,60,2,dir,0.2,0,2,PURPLE31);

FireShot(1);

dir+=360/36;
x++;

}
x = 0;
dir = 0;
wait(60);

yield;
            }

    @DrawLoop {
SetTexture(yukari);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,80,96);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
        DrawGraphic(GetX, GetY);

    }

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

    }

    @Finalize {
        DeleteGraphic(yukari);
DeleteGraphic(bg);
DeleteGraphic(cut);
    }
}
However, there's still something wrong with it. Did I put the closing bracket in the wrong space or what? Sorry for being so annoying, I'm still learning the basics of Danmakufu.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on July 24, 2012, 02:23:46 AM
Oh. wait() isn't a predefined function in Danmakufu, so you have to define it yourself. It's probably telling you that wait is undefined. In the future though, if an error message pops up, please post it, otherwise there's no insight as to what's wrong.
Also, wait() by common definition is just multiple yields. First minor thing is that saying wait(60) and then yield is just 61 yields, but more importantly, if you aren't putting those yields in a microthread (a task), they won't do anything useful. MainLoop runs every frame without exception, and when it hits a yield, this tells danmakufu to stop executing that code and go to the next microthread waiting in line. Once all of those are done, it goes back to the yield in MainLoop, continues executing until MainLoop ends and then restarts the next frame. This is why you need a yield in MainLoop if you're starting other tasks; otherwise it won't reach MainLoop and freeze. I guess it's an issue because none of our guides really give a good explanation for how microthreads really work.

In any case, if you're just using MainLoop to execute all of your code (as you're doing), you don't use yield and wait to space your code; instead you take advantage of MainLoop executing every frame and count the frames until it reaches a certain value. Like this:
Code: [Select]
let count = 0;
@MainLoop{
if(count==60){
//your code
while(x < 36){
//bullets
}
//your code
count = 0;
}
count++;
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on July 27, 2012, 06:27:05 AM
So, I managed to at least open the script after adding that bit in. However, danmakufu soon force closes after the cut-in. Is something else wrong?
Code: [Select]
    @MainLoop{
let x = 0;
let dir = 0;

        SetCollisionA(GetX, GetY, 24);
        SetCollisionB(GetX, GetY, 24);

while (x<36){
        CreateShotA(1,GetEnemyX,GetEnemyY,30);
SetShotDataA(1,0,0,dir,0,0,0,PURPLE31);
SetShotDataA(1,60,2,dir,0.2,0,2,PURPLE31);

FireShot(1);

dir+=360/36;
x++;

}
x = 0;
dir = 0;

if(count==60){
//your code
while(x < 36){
//bullets
}
//your code
count = 0;
}
count++;
            }
I may have added an extra exit bracket on accident, but I don't know where.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on July 27, 2012, 07:19:51 AM
wait what

The //your code thing was literally supposed to be your bullet code pasted into it. The point was that you wanted count to increase every frame, and when it hits 60, it fires your 36 bullets and counts to 60 again.

The reason why it freezes is because you have this beauty:
while(x < 36){   
   //bullets
}

that makes an infinite loop. Clearly, x will never hit 36 here if there's nothing in the loop.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Ginko on July 27, 2012, 07:25:10 AM
Please try to be more specific about what happens when you run the script. Well anyway ...

Code: [Select]
while(x < 36){ }
Try to figure out what happens ... =|.

You're supposed to put your code inside the structure Drake gave you ... not to just put it after your own code. The goal is, if you want to shoot your 36 bullets every 60 frames for example, to have "count" count the number of frames that passed since the beginning. In order to do that, every frame (every time the main loop is executed), you will add 1 to it. That's what "count++" means. It's an equivalent for "count=count+1".
Then if when you execute the mainloop, count equals 60, it means 60 frames have passed. It's time to shoot your bullets.

Checking the value of count is done with the if(count==60) part. The code that is in the brackets that follow will be executed only when the condition is met. In other words, that's where you have to put your code for shooting your bullets.

And then, since a complete loop of the pattern has been done, it's time to make sure everything is just as it as when the pattern started. Here, the only thing that changed with time was count. You reset it by making it 0. Of course, you still do it inside the if brackets. You have to reset only every 60 frames.

Note that there is another solution.

Instead

Code: [Select]
if(count==60){

//bullets

count = 0;
}

you can have

Code: [Select]
if(count%60==0){

//bullets

}

count%60 is "count modulo 60", that is, a number between 0 and 59 that verifies (count-count%60) is a multiple of 60. If you prefer it that way, count%60 = count - n*60, where n is chosen so that count is between 0 and 59.
So if count%60 equals 0, that means count=n*60, and so count%60==0 will be true exactly every 60 frames, without any need to reset your counter count.

I don't really know about your programming and maths level so I detailed a bit too much maybe, but your error show quite a misunderstanding of the basics.



Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on July 27, 2012, 08:42:03 AM
Hi all, i have a problem...

First of all, let's say that i have a shootsheet (txt file and png file).

1- Where should i put them in the script (CSD) folder?

2- Ok, i have them in the folder. Now what should i write in script_enemy_main, initialize etc etc to make the shootsheet works?

3- Once the shootsheet works, here is my second question: i want to make nice looking lasers like Nue in UFO or in general lasers like the ones in the late games. What shootsheet should i download? What bullets in the shootsheet should i call? (as, for examples black amulets are number 95...nice lasers are number...? )

That said, thank you for your help. Post here a reply or even a PM if you want.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on July 27, 2012, 06:17:21 PM
Thanks Drake! Now I just need to make some modifications to make it look better. :D
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: I have no name on July 27, 2012, 07:15:20 PM
So I'm trying to get curvy lasers to shoot bullets to generate a pattern. I know my code is kind of inefficient at the moment, but right now I just want it to work.
Code: [Select]
//example loop in case the problem lies there
while(i<12){
laser1(1,0,5,dir,4,0,5);
i++;
dir+=30;
}

//laser1
task laser1(id,frame,speed,angle,turn,accel,g){
CreateLaserC(id,GetX,GetY,12,50,108,0);
SetLaserDataC(id,frame,speed,angle,turn,accel,g);
SetLaserDataC(id,90,1.5*speed,angle,0,0,g);
CreateShotA(8,Obj_GetX(id),Obj_GetY(id),15);
SetShotDataA(8,0,1.5,Obj_GetAngle(id)+90,0,0,1.5,109);
CreateShotA(9,Obj_GetX(id),Obj_GetY(id),15);
SetShotDataA(9,0,1.5,Obj_GetAngle(id)-90,0,0,1.5,109);
AddShot(0,id,8,0);                 //inefficient but it's a test
AddShot(0,id,9,0);
AddShot(15,id,8,0);
AddShot(15,id,9,0);
AddShot(30,id,8,0);
AddShot(30,id,9,0);
AddShot(45,id,8,0);
AddShot(45,id,9,0);
AddShot(60,id,8,0);
AddShot(60,id,9,0);
AddShot(75,id,8,0);
AddShot(75,id,9,0);
AddShot(90,id,8,0);
AddShot(90,id,9,0);
AddShot(105,id,8,0);
AddShot(105,id,9,0);
FireShot(id);
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on July 27, 2012, 08:08:27 PM
Hi all, i have a problem...

First of all, let's say that i have a shootsheet (txt file and png file).

1- Where should i put them in the script (CSD) folder?

2- Ok, i have them in the folder. Now what should i write in script_enemy_main, initialize etc etc to make the shootsheet works?

3- Once the shootsheet works, here is my second question: i want to make nice looking lasers like Nue in UFO or in general lasers like the ones in the late games. What shootsheet should i download? What bullets in the shootsheet should i call? (as, for examples black amulets are number 95...nice lasers are number...? )

That said, thank you for your help. Post here a reply or even a PM if you want.

1. Technically you can place them anywhere you want but obviously it'd be better if you organize things. For the sake of simplicity, let's say your script is at script/stuff/MyScript.txt. If it's just a simple script, you can put the shotsheet image and script in script/stuff as well so you'll have script/stuff/shotsheet.png and script/stuff/shotsheet.txt.

2. In @Intialize, you need to put LoadUserShotData("path/to/the/shotsheet.txt");. You can do something like this and it should work.
Code: [Select]
let shotsheet = GetCurrentScriptDirectory ~ "shotsheet.txt";
LoadUserShotData(shotsheet);
I can't remember if LoadUserShotData actually loads the graphic automatically or not, but if it doesn't, you'll have to add LoadGraphic somewhere in @Initialize as well.

3. Sorry, I don't know about this one.



So I'm trying to get curvy lasers to shoot bullets to generate a pattern. I know my code is kind of inefficient at the moment, but right now I just want it to work.

code removed

I can't run Danmakufu anymore so you'll have to describe what's wrong (or someone else can run the code and answer I guess lol). I don't use AddShot in the same way that you do, but to my understanding what you have should work. Can you describe what you're expecting to happen and what's really happening?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: I have no name on July 27, 2012, 08:11:52 PM
I can't run Danmakufu anymore so you'll have to describe what's wrong (or someone else can run the code and answer I guess lol). I don't use AddShot in the same way that you do, but to my understanding what you have should work. Can you describe what you're expecting to happen and what's really happening?
I'm expecting the lasers to fire bullets off in opposite directions perpendicular to the current direction of the laser.  What is happening is bullets are aiming straight up and down from the center of the pattern (the addshot at 0, setting this to 1 made a larger "ring" aimed up and down)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on July 27, 2012, 09:11:57 PM
Okay, so my very first Danmakufu script is almost done. Here's how it looks so far:
http://i45.tinypic.com/npoydx.png

I mainly want to know how to get the indigo bullets (which I will change to purple for the final release) to spin around so there are no ⑨ blindspots (they're in abundance right now.) Like the large circle bullets in this video. (http://www.youtube.com/watch?v=9S4cQnw-d0s&feature=related) or Yukari's Border of Wave and Particle (http://www.youtube.com/watch?v=lIyirkeh6GQ). I'll make it go slower than those examples, of course, but the examples are to give you an idea what I'm talking about.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on July 27, 2012, 11:05:39 PM
I'm expecting the lasers to fire bullets off in opposite directions perpendicular to the current direction of the laser.  What is happening is bullets are aiming straight up and down from the center of the pattern (the addshot at 0, setting this to 1 made a larger "ring" aimed up and down)

One thing I noticed was that in CreateShotA(8,Obj_GetX(id),Obj_GetY(id),15); you're using Obj_GetX(id) and Obj_GetY(id). That's not doing what you expect it to do, but it's still working because of a funny coincidence. You're supposed to put 0 for both x and y if you plan to use AddShot because it adds the x and y that you specify to the target bullet's x and y at the time. Obj_GetX and Obj_GetY is used for objects created with Obj_Create which you didn't use. If you pass in an unknown id into those functions, they happen to just return 0.

Likewise, Obj_GetAngle(id)+90 will actually return 0+90, so that's why it's shooting straight down. I'm not sure if there's a way to do what you want to do, but SetShotDirectionType (http://dmf.shrinemaiden.org/wiki/index.php?title=Bullet_Control_Functions#SetShotDirectionType) may have some sort of application that you can use. Otherwise, you'll need to use object sinuate lasers, or perhaps someone else knows a way to do what you want.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: I have no name on July 27, 2012, 11:32:48 PM
I see, I suppose I could do it with a series of carefully placed familiars and carefully timed bullets that shoot bullets, but I was hoping to do it with just the lasers.
Or object lasers.

edit
Why doesn't the following code make the boss move in an infinity sign (technical term leminscante I believe)
Code: [Select]
loop{
SetMovePositionHermite(GetX,GetY,0,330,2,90,180);
wait(180);
SetMovePositionHermite(GetX,GetY,0,90,2,210,180);
wait(180);
SetMovePositionHermite(GetX,GetY,0,210,2,90,180);
wait(180);
SetMovePositionHermite(GetX,GetY,0,90,2,330,180);
wait(180);
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on July 28, 2012, 05:29:04 AM
Sorry for my annoyance, but I'm now trying to get Helepolis' Custom Cutin script to work on my script. I keep getting an error with some faulty code, yet I do not know what's wrong:

http://pastebin.com/C8AcKGsS

Oh, here's the error:
(http://i48.tinypic.com/21e6m1g.png)
If someone could please help me, that would be great. Thanks.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on July 28, 2012, 05:33:17 AM
Sorry for my annoyance, but I'm now trying to get Helepolis' Custom Cutin script to work on my script. I keep getting an error with some faulty code, yet I do not know what's wrong:
Code: [Select]
*Huge Block of Code*Oh, here's the error:
(http://i48.tinypic.com/21e6m1g.png)
If someone could please help me, that would be great. Thanks.
I think you guys may be forgetting the "large blocks of code in pastebin" rule.

Anyway, you're not doing the syntax for #include_function right. Remove the brackets and write it like this: #include_function ".\function_cutin.txt";
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: I have no name on July 28, 2012, 05:58:27 AM
I think you guys may be forgetting the "large blocks of code in pastebin" rule.
Didn't realize that was a rule, didn't think my block of code was that large.  I'll keep that in mind for the future though.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: arch on August 01, 2012, 11:33:09 PM
I have a quick question, is it possible to change the default font seen on the title screen and on the side bar during game?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lunasa Prismriver on August 04, 2012, 09:40:27 AM
You can't change the font directly but you can change the font of the frame with objects effects.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: KiKi-KaiKai on August 05, 2012, 09:58:42 PM
trying to do my first script. why the hell won't my graphics show up in danmakufu? I set the rect to the correct coordinates, and no matter how I even set it where images are, nothing will show. what is going on?! ;n;
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on August 05, 2012, 10:05:34 PM
trying to do my first script. why the hell won't my graphics show up in danmakufu? I set the rect to the correct coordinates, and no matter how I even set it where images are, nothing will show. what is going on?! ;n;
Are you loading the graphics? That's often the problem.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: KiKi-KaiKai on August 05, 2012, 10:13:35 PM
Are you loading the graphics? That's often the problem.

 
well, I've got this...

script_enemy_main {
    let imgBoss = "script\img\komachidot.png";
    let angle = 90;
    let frame = 0;
    @Initialize {
        SetX(GetCenterX);
        SetY(GetClipMinY + 120);
        SetLife(2000);

        LoadGraphic(imgBoss);
        SetTexture(imgBoss);
        SetGraphicRect(0, 0, 103, 161);
    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 24);
        SetCollisionB(GetX, GetY, 24);

    @DrawLoop {
        DrawGraphic(GetX, GetY);
    }

    @Finalize {
        DeleteGraphic(imgBoss);
    }
}

anything wrong here?     
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on August 05, 2012, 10:19:02 PM
SetTexture and SetGraphicRect go in the DrawLoop.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: KiKi-KaiKai on August 05, 2012, 10:31:45 PM
I did that, no image still shows...

these are the images, btw.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on August 05, 2012, 10:51:48 PM
Oops your MainLoop has no closing bracket.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: KiKi-KaiKai on August 05, 2012, 10:57:19 PM
oops, sorry about that. that's fixed, but how come the image isn't showing if everything is correct? ;n;
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on August 06, 2012, 12:52:44 AM
oops, sorry about that. that's fixed, but how come the image isn't showing if everything is correct? ;n;
Taking those corrections into account, I'm able to get the image to show up. Check that the file path to the image is correct.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: KiKi-KaiKai on August 06, 2012, 01:16:57 AM
is it? because I tried with exrumia.png as a test in the folder earlier, and she showed up though..
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Shizzo on August 24, 2012, 07:36:24 PM
 Hi everyone!

I'm having a bit of trouble running the fangame The Last Comer (http://th-jss.cocolog-nifty.com/blog/) on my danmakufu. 

I downloaded and moved the bgm files to the game's folder, but whenever I tried to play it the game crashes when the stage 1 boss appears for the boss battle.  Has anybody here downloaded the game and got it running properly, or knows how to fix the event script so it works?  Thanks in advance. 
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on August 26, 2012, 03:02:43 AM
I'm having trouble trying to get my script to work (AGAIN. Whenever I try to edit one single thing, it crashes and I have to change it back >.<) This time, I've got an error at the DrawLoop section. However, I can't figure out what it is, so I've posted it and a few lines above to hopefully ring a bell (that reminds me; I really need to get over my loss and start playing ToV PS3 again) :
Code: [Select]
count = 0;

count++;
            }

    @DrawLoop {
SetTexture(yukari);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,80,96);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
        DrawGraphic(GetX, GetY);

    }
What is the error? Thanks. :)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: I have no name on August 26, 2012, 03:06:58 AM
The loop itself looks fine, the first thing I can think of would be a bracket error somewhere in the code (probably up with the count stuff) but that's impossible to tell without seeing the rest.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on August 26, 2012, 03:55:02 AM
Well, I have a pastebin link to the entire code right here:
http://pastebin.com/A6ybRELj
If you want me to post the entire script folder on Mediafire, I can do that, too. Just ask.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: I have no name on August 26, 2012, 04:02:33 AM
Yep, if you look carefully at MainLoop, you need another bracket at the end.

Code: [Select]
count++;
            }
}   <---this wasn't there before

    @DrawLoop {
That should work.
One other thing I noticed is there's no yield statements, so if Danmakufu crashes when you try to run the script (no errors) that's why.  Not sure if MainLoop scripting needs those though.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on August 26, 2012, 05:26:02 AM
So that's fixed, but now I can't get anything other than the purple bullets to fire. Did I put in the wrong things?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: I have no name on August 26, 2012, 05:49:35 AM
I decided to take a closer look at your script and found a few other things.  I have no idea if my changes are correct or not, as I've been using a shotsheet (and task scripting instead of MainLoop scripting)

I've helpfully added comments to what I changed explaining why I changed it.  If you're not clear on anything, ask, and I or someone else will answer by tomorrow afternoon.  For now though, sleep.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on August 26, 2012, 05:17:18 PM
Maintask is invalid for some reason. When trying to boot up the script, I get this error:
(http://img59.imageshack.us/img59/1077/scriptn.png)
Thanks for the revision, by the way.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: I have no name on August 26, 2012, 06:38:10 PM
The only difference from what I have working (aside from parameters and such) is I don't have shotinit-what exactly does that do/what happens if you comment it out?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Fujiwara no Mokou on August 26, 2012, 09:49:23 PM
maintask and @Finalize  are prematurely omitted because of the two '}'.
You may want to get rid of it.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on August 26, 2012, 10:33:30 PM
You might want to find a better text editor because it seems like a bunch of your errors are due to mismatched brackets and you're unable to find where those mismatches are. Maybe if you get some bracket highlighting up in there you can start concentrating on things that matter.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on August 27, 2012, 02:35:15 AM
It doesn't work, though I have a feeling I removed some braces I shouldn't have. Here is the new script. (http://pastebin.com/1483XKLt)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: I have no name on August 27, 2012, 02:57:01 AM
Have a version with the brackets as they should be.
I would suggest Notepad++ for that, as when you click on a bracket it shows the partnered one.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on August 27, 2012, 04:57:40 PM
Great. Just great. When I remove the end bracked, it gets a mismatched brackets error. When I add the bracket, the script is terminated and the game crashes. ???
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on August 27, 2012, 09:33:08 PM
Dude are you actually looking at the brackets and how they match up? Or even, do you understand what the brackets do and why they're there? The revision IHNN gave you should be fine.

If you remove "the end bracket" as in the final final bracket at the end of the file, you then are either not ending the script, or some parts of the script are cut off. If you add a bracket in a place that matches up with script_enemy_main's opening bracket before some other parts of your script, then the script obviously closes early and the same happens.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on August 28, 2012, 05:00:44 PM
Hi, i have a BIG problem... i am trying to learn the ARRAYS, and i tryed evrithing : tutorials online, tutorials here, etc etc...

Now, or i am dumb or i don't really know... but seeing lines like   a = [ 0 , 1 , 2 , 3 ] or similar i don't understand nothing. Also, i can't apply arrays in the scripts...i mean, i don't even know how to make bullets and controlling them using arrays!

So, if someone could explain me the arrays, ( from less than zero... i barely understand what is the meaning of the word array!) i would be really gratefull.

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on August 29, 2012, 06:33:52 AM
Let's take this in steps.

If I put let str = "words words and more words"; you understand what that is right? The variable str is holding the string "words words and more words" which you can use in a function if you want to. Something like DrawText(str, GetCenterX(), GetCenterY(), 12, 255);

Now let's take a very basic look at arrays. If I put let arr = ["string1", "string2", "string3"]; then I have an array with three strings. Obviously, because an array is not a string, you cannot use it like a string. As such,  DrawText(arr, GetCenterX(), GetCenterY(), 12, 255); will not work. However, there is a way to take each string out of the array to use it. If I put let str = arr[0] then the variable str will now hold the string "string1". The 0 in the square brackets ("[" and "]") is telling it to grab the 0th thing in the array (computers start at 0 instead of 1 so 0th place to a computer is 1st place to humans) which happened to be "string1".

Anyway, now that you have your str variable which equals "string1", you can use it in the DrawText function like normal: DrawText(str, GetCenterX(), GetCenterY(), 12, 255); However, you do not have to put arr[0] (or arr[1] or arr[2]) into a new variable first before you use it. Instead, you could just do this instead: DrawText(arr[0], GetCenterX(), GetCenterY(), 12, 255);

Basically, arrays are a group of things rather than a single thing, which you can put into a variable. You can also think of it as a way for a variable to hold many values at the same time under the same name. Do you understand this so far? If so, try taking a look at some tutorials again because if I go any further I'll probably be repeating things that have been written many times already. If you don't understand, try to point out what doesn't make sense with examples and I'll try my best to clarify.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on August 29, 2012, 09:59:36 AM
Mmm... thanks Blargel, i'm trying to understand what you wrote.
In the mean time, i give you an example of one of my standard problems with the arrays:

Create a stream of bullets where each bullet at a given time (or from the start) go in different directions...
i understand i have to make an array with all the wanted directions and use it in the bullet function... but since i still have problems understanding arrays, i can say that i have an almost clear idea of why and how to use them.

What i lack, are the mathematical skills and scripting abilityes to use them... i really can't understand how to write strings involving arrays.

And that is why i don't understand tutorials, they give many technical info but i guess i am one of those people who need also practical examples to understand a concept.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on August 29, 2012, 04:50:28 PM
In the mean time, i give you an example of one of my standard problems with the arrays:

Create a stream of bullets where each bullet at a given time (or from the start) go in different directions...

I'm not sure why an array would be necessary for that. You could just write CreateShot01 multiple times without any variables whatsoever to accomplish this. However, you would be right in thinking that you could shorten the code by using an array if you really wanted to.

No array version:
Code: [Select]
CreateShot01(GetX(), GetY(), 3, 10, RED01, 10);
CreateShot01(GetX(), GetY(), 3, 25, RED01, 10);
CreateShot01(GetX(), GetY(), 3, 30, RED01, 10);
CreateShot01(GetX(), GetY(), 3, 47, RED01, 10);
CreateShot01(GetX(), GetY(), 3, 62, RED01, 10);
CreateShot01(GetX(), GetY(), 3, 99, RED01, 10);
CreateShot01(GetX(), GetY(), 3, 122, RED01, 10);
CreateShot01(GetX(), GetY(), 3, 136, RED01, 10);
CreateShot01(GetX(), GetY(), 3, 154, RED01, 10);
CreateShot01(GetX(), GetY(), 3, 169, RED01, 10);

Array version (not shortened)
Code: [Select]
let angles = [10, 25, 30, 47, 62, 99, 122, 136, 154, 169];

CreateShot01(GetX(), GetY(), 3, angles[0], RED01, 10);
CreateShot01(GetX(), GetY(), 3, angles[1], RED01, 10);
CreateShot01(GetX(), GetY(), 3, angles[2], RED01, 10);
CreateShot01(GetX(), GetY(), 3, angles[3], RED01, 10);
CreateShot01(GetX(), GetY(), 3, angles[4], RED01, 10);
CreateShot01(GetX(), GetY(), 3, angles[5], RED01, 10);
CreateShot01(GetX(), GetY(), 3, angles[6], RED01, 10);
CreateShot01(GetX(), GetY(), 3, angles[7], RED01, 10);
CreateShot01(GetX(), GetY(), 3, angles[8], RED01, 10);
CreateShot01(GetX(), GetY(), 3, angles[9], RED01, 10);

Array version (shortened)
Code: [Select]
let angles = [10, 25, 30, 47, 62, 99, 122, 136, 154, 169];
let i = 0;
while(i < length(angles)){
  CreateShot01(GetX(), GetY(), 3, angles[i], RED01, 10);
  i++;
}

Array version (shortened, also using ascent)
Code: [Select]
let angles = [10, 25, 30, 47, 62, 99, 122, 136, 154, 169];
ascent(i in 0..length(angles)){
  CreateShot01(GetX(), GetY(), 3, angles[i], RED01, 10);
}

I wasn't sure if you knew how to use ascent, but if you don't then just ignore that last one. It's just me trying to make it as short as possible. Anyway, each block of code there does the same thing.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on August 29, 2012, 10:08:12 PM
Wow Blargel, thank you so much!

But there is something i don't understand....

let angles = [10, 25, 30, 47, 62, 99, 122, 136, 154, 169];
let i = 0;
while(i < length(angles)){
  CreateShot01(GetX(), GetY(), 3, angles, RED01, 10);
  i++;
}

why angles ? you said that angles was = the array, so if you put ...danmafuku won't use 0 since you wrote let i = 0;     ?

Also in while(i < length(angles)){ what is the meaning of "length" in danmakufu speech?

You know, i'm trying to learn arrays so that in the future i could do Nue spell "Danmaku chimera", because i bet he used arrays to make the bullets
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: I have no name on August 29, 2012, 10:17:14 PM
in that example, angles[0] points to the first element in the array, in this case, the 10.

let angles = [10, 25, 30, 47, 62, 99, 122, 136, 154, 169];
let i = 0;
while(i < length(angles)){
  CreateShot01(GetX(), GetY(), 3, angles[ i ], RED01, 10);
  i++;
}

why angles[ i ] ?
angles[ i ] points to the i-th element in the array, and the code there cycles through every element int he array and will shoot a bullet in those angles.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on August 30, 2012, 12:14:06 AM
You guys keep posting [i] and activating BBCode italics. Good job lol.

Matteo, putting in let i = 0; was just to declare the variable and give it an initial value. length(array) is a function that returns the size/length of an array; with the angles array it would return 10, since there are 10 elements in the array. So, the while loop means "while i is less than 10", basically. At the end of the loop, it increments i, so i loops from 0 up to 9. So where it says angles[i], it loops through the contents of the array since it will be angles[0] then angles[1] then angles[2] and so on.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on August 30, 2012, 09:01:00 AM
Ok, really thank you so much evryone...and Drake, thanks for your excellent explaination.

I'm starting to get it i think, but i found a huge problem in a pattern i made.

I wanted to create a line of bullets that first go down, then after 90 frames the array start and each bullet go up,down,up,down,etc etc...

But i really can't grasp it...it's almost 2 hours of tryes!

task aimed{
   loop{
      let a = 0;
   loop(30){

      Bullet(32+a, GetY(), 2, 90, RED01, 60);
      a += 20;
      wait(5);
      }
      wait(60);
      }
         
}

This is the line of bullet obj, and this

task Bullet(x, y, v, angle, graphic, delay) {
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x, y);
Obj_SetAngle(obj, angle);
Obj_SetSpeed(obj, v);
ObjShot_SetGraphic(obj, graphic);
ObjShot_SetDelay  (obj, delay);
ObjShot_SetBombResist (obj, true);
wait(90);
let angles = [90, -90];
      Obj_SetAngle(obj, angles[0,1]);      
}

is the obj, where i tryed to set that the bullets had to go after 90 frames up,down,up,down,etc etc...

Before you say "where is the i, the lenght function explained before etc etc" , i tryed them too and the only thing i got was that all the bullets went up (so i guess only the -90 of the array worked).

I really don't understand where i do wrong... (even if i think that maybe my i don't return to 0, so it remains in the last place of the array, [-90] )  But... while, if and in geveral values++; never worked to me inside tasks.

Boh, again i need help, and again i'm here to bother you with this things that i realize are simple for most scripters...
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on August 31, 2012, 12:46:42 AM
I'm not entirely sure what you want the end result to be, but I'm assuming you want each horizontal line of bullets to break off so that every odd-numbered bullet goes up and every even-numbered bullet goes down, or something.

If that's the case, then you can do it a different way where you don't need arrays at all. Instead, you add a parameter to your bullet function that tells the bullet which angle to change to after the 90 frames. Then, all you need is an extra variable for your 30-bullet loop that switches between 90 and -90. If you initialize the variable to either, you can switch between the two simply by going angle *= -1; which will multiply the number by -1 and so switch its sign.

Code: [Select]
task aimed{
   loop{
      let a = 0;
      let angle2 = 90;   //initializes angle2 to 90
      loop(30){
         Bullet(32+a, GetY(), 2, 90, RED01, 60, angle2);
         a += 20;
         angle2 *= -1;   //flips angle2 from 90 to -90 and vice-versa
         wait(5);
      }
      wait(60);
   }
}

task Bullet(x, y, v, angle, graphic, delay, angle2) {
   let obj=Obj_Create(OBJ_SHOT);
   Obj_SetPosition(obj, x, y);
   Obj_SetAngle(obj, angle);
   Obj_SetSpeed(obj, v);
   ObjShot_SetGraphic(obj, graphic);
   ObjShot_SetDelay  (obj, delay);
   ObjShot_SetBombResist (obj, true);
   wait(90);
   Obj_SetAngle(obj, angle2);
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on August 31, 2012, 01:37:30 AM
Quote
let angles = [90, -90];
      Obj_SetAngle(obj, angles[0,1]);     
}

Quote
angles[0,1]

How did you not get a syntax error?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on September 18, 2012, 03:11:50 AM
Sorry to bump the thread, but I need even more help. Sorry to be so annoying, but I put this at the very end of my script:
Code: [Select]
function wait(w){15;
loop(w) { yield; }
}
I always get a syntax error when I execute it. I worked out (almost) all the kinks, and if I were to clear that one out I'd have a better understanding of my script. Please help and thanks. :)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on September 18, 2012, 03:28:31 AM
What is the 15; doing there, exactly.

Alternately, make sure you're still putting it inside the script_enemy_main scope and not after it closes.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on September 18, 2012, 04:27:13 AM
Ah. The 15 was supposed to represent how many frames to wait, I'll change it back to zero.

Where in script_enemy_main should I put it?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: I have no name on September 18, 2012, 05:37:02 AM
Ah. The 15 was supposed to represent how many frames to wait, I'll change it back to zero.

Where in script_enemy_main should I put it?
That number doesn't need to be there at all.  In fact, that's why it's breaking.
I have it at the very bottom of script_enemy_main.

When you want to have it wait 15 frames, you go to where you want it to wait and type "wait(15);".
That will make it wait 15 frames.  The number inside the function tells it how long to wait.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on September 19, 2012, 12:58:16 AM
Okay, so I worked out the bugs and redid the graphics. Now my first spellcard looks like this:
(http://imageshack.us/a/img171/1672/thdnh2012091817533166.png)
The blue bullets are aimed at you, the aqua bullets change position slightly with each spin and the purple bullets I haven't paid much attention to.

The purple orb covers the boss. Any idea how to fix that? I want people to see Yukari (who is now with her CtC sprite instead of her PCB one).
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: I have no name on September 19, 2012, 02:02:19 AM
Do you have a delay cloud?  If so, that's why.  Delay clouds are mostly useful for when the bullets don't spawn from the boss.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on September 19, 2012, 03:23:10 AM
So that's fixed. However, I don't want the spell card to be TOO cheap. I want to give the player a chance to read the blue bullets by making them start later, and especially not before the spell even starts. How do I fix that? Here's the code for the blue bullets:
Code: [Select]
CreateShot01(GetEnemyX,GetEnemyY,30,GetAngleToPlayer,BLUE04,0);
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: I have no name on September 19, 2012, 03:26:59 AM
If I'm reading that right you have a speed of 30.  That's honestly excessive, 30 pixels per frame gives something like 12 frames (.2 seconds) to react.
besides, if the delay is to allow the player to read the bullets, how does a solid cloud help with that?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on September 19, 2012, 11:55:15 PM
So delay just gives a cloud? Well that bites. Thanks.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: I have no name on September 20, 2012, 12:27:40 AM
So delay just gives a cloud? Well that bites. Thanks.
Yeah, for bullets it gives a cloud but for lasers it shows the path of the center of the laser (this is non-indicative of width)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on September 20, 2012, 01:20:43 AM
So delay just gives a cloud? Well that bites. Thanks.
What are you expecting, rather? You fire a bullet with delay 20, it's going to make a delay cloud for 20 frames and then the bullet is fired. If you have delay 0, there is no delay cloud and the bullet fires immediately. How does this bite.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: I have no name on September 20, 2012, 01:22:52 AM
I think he wanted to show the path of the bullet before it fires.

I just realized that's possible with a laser of, say, delay 20 and duration 20 (along with keeping the bullet at delay 20) and you shoot them at the same time.  The laser shows the path the bullet will take then goes away when the bullet fires.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Pepperized on September 26, 2012, 07:38:39 PM
This requires you to be pretty damn good at maths:
I am trying to make a cardioid http://en.wikipedia.org/wiki/Cardioid (http://en.wikipedia.org/wiki/Cardioid) (heart-shape) danmaku pattern, so far so good, until I notice it is upside down, after hours of trying and googling I have to give up and come here, this is the small amount of code that makes the shape:
Code: [Select]
task fire{
loop{
let x = 0;
let dir = 0;
while(x<37){
CreateShotA(1,(GetEnemyX+50*(2*sin(dir)-sin((dir*2)))/3),(GetEnemyY+50*(2*cos(dir)-cos((dir*2)))/3),30);
SetShotDataA(1,0,0,90,0,0,0,AQUA01);
FireShot(1);
wait(3);
yield;
x++;
dir-=360/36;
}
SetShotDataA(1,60,2,GetAngleToPlayer,10,1,2,AQUA01);
x = 0;
yield;
}
}

And a screenshot of what is currently happening.

(http://i.imgur.com/TTPfq.png)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on September 27, 2012, 01:57:40 AM
Change (GetEnemyY+50*(2*cos(dir)-cos((dir*2)))/3)
into (GetEnemyY-50*(2*cos(dir)-cos((dir*2)))/3)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Pepperized on September 27, 2012, 04:21:59 PM
Holy shit...

It was that easy all along, thank you and kudos to you.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on September 30, 2012, 09:09:42 PM
I need some help. After I removed my last script on accident, I decided to relearn Danmakufu. So far, so good, until I got to the part about sprite animation. Certain frames show the entire sprite sheet instead of just the SetGraphicRect, even after I changed it so they would all be the same image. Here is a screenshot:
(http://i49.tinypic.com/2qciihh.png)
And here is the @DrawLoop part of my script:
Code: [Select]
    @DrawLoop {
SetTexture(sakuya);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);

if(int(GetSpeedX())==0) {
if(f<10){SetGraphicRect(44,34,87,95);}
if(f>=10 && f<20){SetGraphicRect(44,34,87,95);}
if(f>=20 && f<30){SetGraphicRect(44,34,87,95);}
}

DrawGraphic(GetX,GetY);

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

    }
FYI, I'm using Sakuya sprites from CtC. If someone could help me, that would be great, Thanks. :)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on September 30, 2012, 10:19:11 PM
Where's frames 30 to 40? Can I assume f starts at 0?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on September 30, 2012, 11:31:22 PM
My animation only has three frames. I figured out where I put in a number wrong. I assume f starts at zero.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: I have no name on September 30, 2012, 11:59:23 PM
Code: [Select]
if (f==40){f=0;}is the problem.  It should be f==30.

Code: [Select]
if(int(GetSpeedX())==0) {
if(f<10){SetGraphicRect(44,34,87,95);}
if(f>=10 && f<20){SetGraphicRect(44,34,87,95);}
if(f>=20 && f<30){SetGraphicRect(44,34,87,95);}
}
Additionally, this code is setting the graphic to the same spot for frames 0-10, 10-20 and 20-30.  You'll need to adjust the graphic rectangle for the latter 2.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on October 01, 2012, 12:44:37 AM
I realize both of those things. I was just testing at the time.

Now, I cannot, for the life of me, get these image coordinates correct! I've tried GIMP, paint and even an image mapping website, and nothing's working! Frame 1 shows the next sprite's scalp, frame 2 is a few pixels below and frame 3 doesn't show up at all (waaaaaaaaay below). I get approximates, but they don't work! Am I using CtC sprites right? Here's the image I'm working with:
(http://i49.tinypic.com/zusj0w.png)
and my new @DrawLoop:
Code: [Select]
    @DrawLoop {
SetTexture(sakuya);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);

if(int(GetSpeedX())==0) {
if(f<10){SetGraphicRect(50,34,76,94);}
if(f>=10 && f<20){SetGraphicRect(50,160,76,94);}
if(f>=20 && f<30){SetGraphicRect(50,294,76,94);}
}


DrawGraphic(GetX,GetY);

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

    }
Please help! Thanks.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on October 01, 2012, 03:18:19 AM
(http://i.imgur.com/LONxd.png)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on October 01, 2012, 03:26:00 AM
Sorry to be so stupid, but would you mind explaining that in words? I don't quite comprehend the image. Maybe I ought to replace Sakuya with Cirno...
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on October 01, 2012, 03:43:41 AM
SetGraphicRect(50,34,76,94) gives you the first rectangle.
SetGraphicRect(50,160,76,94) gives you the second rectangle upside-down.
SetGraphicRect(50,294,76,94) gives you the second and third rectangle upside-down.

Your coordinates aren't right. One of the rects should probably be working, at least.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on October 01, 2012, 04:23:20 AM
Isn't it left, top, right, bottom? I believe I only have to change the second value.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on October 01, 2012, 05:40:39 AM
It is LTRB.
Your second rect is saying 160 is the top of the rectangle and 94 is the bottom, so it's both upside-down and not actually selecting any sprite.
Your third rect is saying 294 is the top of the rectangle and 94 is the bottom, so it's selecting a really long rectangle that is upside-down, which has the second sprite near its middle, and the third sprite's hair near the top (both upside-down).

I'm not sure why you would think you don't have to change the bottom bound, of course you do.

The correct rects should be around
(49,35,77,95)
(49,163,77,223)
(49,291,77,351)
left, top, right, bottom
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on October 01, 2012, 02:48:41 PM
Thanks for the help. I can't believe how dumb I was. :colonveeplusalpha:
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on October 07, 2012, 10:22:24 AM
Hi all, i have a big problem concerning objects and not only.

So, first problem:

  i know how to make a circle of bullets with a x radius. I know that with getx+rcos(angle) and gety+r*sin(angle) i can make it spin... i also know that if i put a positive speed the circle expand.
 What i would really like to know is how to make the circle spin without expanding. Something like the moon, that moves around our planet but her "radius" is always the same.

Second problem: i know how bullet object works and i know how to use them. But sadly, i keep not understanding effect object... can someone kindly explain them to me? Maybe with an example? The only effect obj i know is the nue spell in which she create the black clouds , but obviously i don't even know where to start to make that.

Thanks


Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Delfigamer on October 07, 2012, 03:20:51 PM
  i know how to make a circle of bullets with a x radius. I know that with getx+rcos(angle) and gety+r*sin(angle) i can make it spin... i also know that if i put a positive speed the circle expand.
 What i would really like to know is how to make the circle spin without expanding. Something like the moon, that moves around our planet but her "radius" is always the same.
Shame. I don't know Danmakufu, but I know that here you must replace "getx" and "gety" with values that wouldn't depend on bullet's position. ._.
Hmm... something like that: "angle = angle + rotationSpeed * deltaTime; x = centerX + radius * cos (angle); y = centerY + radius * sin (angle)"; I hope you'll catch my idea.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: fondue on October 07, 2012, 03:42:13 PM
lolnope
I think he means for the bullet's X position he wants:
Code: [Select]
GetX+n*cos(t)
And for Y:

Code: [Select]
GetY+n*sin(t)
Replace n with a number, 50 for example. And replace t with a changing variable that every frame it increases by 1.
If he wants bullets to spawn then he should use CreateShot01 or something and input the X and Y things I made into the parameters.
If he wants something to rotate around the enemy the he will want to change the object's position every frame with the pieces of code I gave him.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Delfigamer on October 08, 2012, 05:14:35 AM
I thought GetX returns current bullet's position.

Also, (http://upload.wikimedia.org/math/a/f/4/af47ec7fbccc9ab1fb623ea891483d0c.png). `v`
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on October 08, 2012, 05:22:28 AM
uhm... thank you for the answers, but i did not understand much.

How should i control the bullet position in the object task in order to make the bullet spin in the circle without the expansion of said circle?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on October 08, 2012, 05:47:07 AM
I thought GetX returns current bullet's position.
No, it returns the current enemy's position. In a enemy boss script it returns the boss position, in an enemy script it returns the enemy position. Obj_GetX(obj) will return the object's x-position, which is what you're thinking of. However, both you and fondue are saying the same thing.

Second problem: i know how bullet object works and i know how to use them. But sadly, i keep not understanding effect object... can someone kindly explain them to me? Maybe with an example? The only effect obj i know is the nue spell in which she create the black clouds , but obviously i don't even know where to start to make that.
http://dmf.shrinemaiden.org/wiki/index.php?title=Nuclear_Cheese%27s_Effect_Object_Tutorial
Stuff's player script tutorial has some good examples too: http://www.shrinemaiden.org/forum/index.php/topic,210.0.html

Quote
How should i control the bullet position in the object task in order to make the bullet spin in the circle without the expansion of said circle?
http://www.shrinemaiden.org/forum/index.php/topic,865.0.html Look at the trigonometry part again and try and understand what's going on here:

Obj_SetX(obj, centerX + cos(t)*radius );
Obj_SetY(obj, centerY + sin(t)*radius );
t+=something;


Loop the above per frame. Every frame t will increase, and the object will move horizontally from the center position to cos(t) times the circle radius, and vertically sin(t) times the radius. If you still don't understand, get rid of either the SetX or the SetY and see how the object moves then.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: fondue on October 08, 2012, 09:48:06 AM

Also, (http://upload.wikimedia.org/math/a/f/4/af47ec7fbccc9ab1fb623ea891483d0c.png). `v`
What does that mean...
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Delfigamer on October 08, 2012, 12:32:40 PM
What does that mean...
If you want to know, that formula means "centripetal acceleration is linear velocity squared divided by curve radius". (http://en.wikipedia.org/wiki/Circular_motion)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on October 08, 2012, 12:58:33 PM
Thanks, it works!

that's what i made :

task Bullet(x, y, v, angle, graphic, delay,radius) {
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x, y);
Obj_SetAngle(obj, angle);
Obj_SetSpeed(obj, v);
ObjShot_SetGraphic(obj, graphic);
ObjShot_SetDelay  (obj, delay);
ObjShot_SetBombResist (obj, true);
      let t = 0;
      loop{
      Obj_SetX(obj, 224 + cos(t)*radius );
      Obj_SetY(obj, 240 + sin(t)*radius);
      t+= 1;
      yield;
      }      
}

Only, i founded problems while doing a circle. because if i call  Bullet(x, y, v, angle, graphic, delay,radius) in a (for example) loop(8) with angle += 360/8; the ring don't appear. And that is because the ring do what the obj says, so all 8 bullets go in

Obj_SetX(obj, 224 + cos(t)*radius );
Obj_SetY(obj, 240 + sin(t)*radius);

That define x,y of only 1 point. So, in order to make a ring of 8 bullets, i did:

loop(8){
      Bullet(GetX, GetY, 0, angle, 188, 30,90);
      angle += 360/8; wait(48);
      }

where wait(48); is used to spawn the 8 bullets in a circle. The problem is that each bullets move when is spawned , so at the end i can't do 8 bullets with the same distance...some bullets are too near or too far from the others.

Do you know a way to correct this maybe?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: puremrz on October 08, 2012, 05:59:20 PM
I want to get a bit more advanced with object effects and make something that uses more than 4 vertices.
The problem is, how do I set the coordinates? I tried various tests to make a 3x3 grid instead of the usual 2x2, but the closest I got was this:

(http://i32.photobucket.com/albums/d49/puremrz/th_kolerz.jpg) (http://s32.photobucket.com/albums/d49/puremrz/?action=view&current=kolerz.jpg)

The picture does not deform, but it is missing 4 triangles. (and it became some sort of SS flag...)

This is my current code:
Code: [Select]
task Effect{
let frame=0;

let xsize=300;
let ysize=300;
let obj=(Obj_Create(OBJ_EFFECT));

Obj_SetPosition(obj,cx,cy);
ObjEffect_SetScale(obj,1,1);
ObjEffect_SetLayer(obj,1);
ObjEffect_SetTexture(obj,EFtest);
ObjEffect_SetRenderState(obj,ALPHA);
ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(obj,8);

ObjEffect_SetVertexXY(obj,0,-150,-150);
ObjEffect_SetVertexXY(obj,1,0,-150);
ObjEffect_SetVertexXY(obj,2,150,-150);
ObjEffect_SetVertexXY(obj,3,-150,0);
ObjEffect_SetVertexXY(obj,4,0,0);
ObjEffect_SetVertexXY(obj,5,150,0);
ObjEffect_SetVertexXY(obj,6,-150,150);
ObjEffect_SetVertexXY(obj,7,0,150);
ObjEffect_SetVertexXY(obj,8,150,150);

ObjEffect_SetVertexUV(obj,0,0,0);
ObjEffect_SetVertexUV(obj,1,150,0);
ObjEffect_SetVertexUV(obj,2,300,0);
ObjEffect_SetVertexUV(obj,3,0,150);
ObjEffect_SetVertexUV(obj,4,150,150);
ObjEffect_SetVertexUV(obj,5,300,150);
ObjEffect_SetVertexUV(obj,6,0,300);
ObjEffect_SetVertexUV(obj,7,150,300);
ObjEffect_SetVertexUV(obj,8,300,300);

while(Obj_BeDeleted(obj)==false){

frame++;
yield;
}
}

How do I fix this? And how do you make circular shapes like the health bar in 10 Desires?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on October 09, 2012, 03:08:43 AM
It actually is deformed, you just can't see the deformed parts because they're lines.

With STRIP, a vertex t connects to the vertices t+1 and t+2.
With FAN, a vertex t connects to the vertices 0 and t+1.
With LIST, every three vertices connect to only each other.

(http://i.imgur.com/b7F24.png)
edit: oops in fan, 1 does not connect to 7; you need an extra vertex for that

To answer your second question, look at fans. Then make a fan with lots of vertices that form a circle. Then use an image that only shows up at the open end of the triangle, and poof you get a ring.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: SusiKette on October 09, 2012, 02:28:53 PM
EDIT: Problem fixed. My variable "CutIn" was confusing Danmakufu as it also is a name of the cut in function. But I also ran in another problem, the background appears black

I got this error during scripting and I don't know how to fix it:
(http://imageshack.us/a/img51/3056/dnherror.png) (http://imageshack.us/photo/my-images/51/dnherror.png/)

here is the script:
Code: [Select]
#TouhouDanmakufu
#Title[Reimu Attack #1]
#Text[Reimu's Non-Spell Attack #1]
#Player[FREE]
#ScriptVersion[2]
#BGM[.\BGM\A Maiden's Capriccio ~ Dream Battle.mp3"]

script_enemy_main {

#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
let CSD = GetCurrentScriptDirectory;
let CutIn = CSD ~ "IMG\CutInBoss.png";
let Boss = CSD ~ "IMG\ImgBoss.png";
let BottomBG = CSD ~ "IMG\SpellBGB";
let TopBG = CSD ~ "IMG\SpellBGT";
let f = 0;
let f2 = 0;
let slide = 0;

@Initialize {
shotinit;
SetLife(1500);
SetTimer(35);
SetScore(53200);
SetDamageRate(100, 25);
SetInvincibility(120);
SetEnemyMarker(true);
LoadGraphic(CutIn);
LoadGraphic(Boss);
LoadGraphic(BottomBG);
LoadGraphic(TopBG);
CutIn(YOUMU, "Test", CutIn, 0, 0, 503, 266);
SetMovePosition03(GetCenterX, GetCenterY-120, 7, 3);
mainTask;
}

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

@DrawLoop {
SetTexture(Boss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1, 1);
SetGraphicAngle(0, 0, 0);

if(int(GetSpeedX())==0) {
if(f<10){ SetGraphicRect(13, 2, 52, 73); }
if(f>=10 && f<20){ SetGraphicRect(77, 2, 116, 73); }
if(f>=20 && f<30){ SetGraphicRect(141, 2, 180, 73); }
if(f>=30){ SetGraphicRect(205, 2, 244, 73); }
f2=0;
}

if(GetSpeedX()>0) {
if(f2<5){ SetGraphicRect(11, 82, 51, 153); }
if(f2>=5 && f2<10){ SetGraphicRect(65, 82, 118, 153); }
if(f2>=10 && f2<15){ SetGraphicRect(130, 82, 186, 153); }
if(f2>=15){ SetGraphicRect(194, 82, 248, 153); }
f2++;
}

if(GetSpeedX()<0) {
SetGraphicAngle(180, 0, 0);
if(f2<5){ SetGraphicRect(11, 82, 51, 153); }
if(f2>=5 && f2<10){ SetGraphicRect(65, 82, 118, 153); }
if(f2>=10 && f2<15){ SetGraphicRect(130, 82, 186, 153); }
if(f2>=15){ SetGraphicRect(194, 82, 248, 153); }
f2++;
}

DrawGraphic(GetX, GetY);

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

@BackGround {
SetTexture(BottomBG);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0, 0, 256, 256);
SetGraphicScale(2, 2);
SetGraphicAngle(0, 0, 0);
DrawGraphic(GetCenterX, GetCenterY);

SetTexture(TopBG);
SetRenderState(ALPHA);
SetAlpha(155);
SetGraphicRect(0, 0, 256+slide, 256+slide);
SetGraphicScale(2, 2);
SetGraphicAngle(0, 0, 0);
DrawGraphic(GetCenterX+slide, GetCenterY+slide);

slide+=2;
}

@Finalize {
DeleteGraphic(CutIn);
DeleteGraphic(Boss);
DeleteGraphic(BottomBG);
DeleteGraphic(TopBG);
}

task mainTask {
wait(90);
movement;
}

task movement {
loop {
SetMovePositionRandom01(rand_int(50, 150), rand_int(50, 150), 2, GetClipMinX+60, GetClipMinY+60, GetClipMaxX-60, GetCenterY-120);
wait(180);
yield;
}
}

function wait(w) {
loop(w) {yield;}
}
}
and now that I'm posting something, can someone tell me that if I can safely update danmakufu to ph3 without it making my scripts unplayable
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on October 09, 2012, 06:16:34 PM
EDIT: Problem fixed. My variable "CutIn" was confusing Danmakufu as it also is a name of the cut in function. But I also ran in another problem, the background appears black

I got this error during scripting and I don't know how to fix it:
image removed from quote

here is the script:
Code: [Select]
holy shit lots of codeand now that I'm posting something, can someone tell me that if I can safely update danmakufu to ph3 without it making my scripts unplayable

1.) Please use pastebin (http://pastebin.com) when posting large blocks of code. Not only does it have line numbers for easy reference, it also makes it easier to scroll through pages of the thread.
2.) Run the program in Japanese locale. It looks like it's currently running in Chinese so the error is written in gibberish Chinese. You want the language that looks like 日本語
3.) I don't see a problem with your code for your drawing, so you're probably loading the images incorrectly somehow. Check your paths? That's the best I can think of at the moment.
4.) Incidentally, your background's logic has a problem, but fixing it won't make it show up without fixing something else that I don't know about first. SetGraphicRect(0, 0, 256+slide, 256+slide); will cause Danmakufu to draw a larger and larger image as time goes on. I believe you mean SetGraphicRect(slide, slide, 256+slide, 256+slide); which draws a 256x256 at all times. DrawGraphic(GetCenterX+slide, GetCenterY+slide); is also incorrect as that will move the image's center until it moves off screen. Just do DrawGraphic(GetCenterX, GetCenterY);
5.) Moving anything from 0.12m to ph3 will break the script entirely. 0.12m scripts only work on 0.12m and ph3 scripts only work on ph3. If you want to learn Danmakufu, stick with one. 0.12m is more beginner friendly so I'd suggest you stick with that. You would really only ever move to ph3 when you hit one of the limits of 0.12m that most people do not hit.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: puremrz on October 10, 2012, 05:33:15 PM
It actually is deformed, you just can't see the deformed parts because they're lines.

With STRIP, a vertex t connects to the vertices t+1 and t+2.
With FAN, a vertex t connects to the vertices 0 and t+1.
With LIST, every three vertices connect to only each other.

To answer your second question, look at fans. Then make a fan with lots of vertices that form a circle. Then use an image that only shows up at the open end of the triangle, and poof you get a ring.

Thanks, now I understand how it works.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: SusiKette on October 11, 2012, 06:11:29 AM
I don't see a problem with your code for your drawing, so you're probably loading the images incorrectly somehow. Check your paths? That's the best I can think of at the moment.
Yeah, I noticed that I forgot to add the .png after the bg images.

Incidentally, your background's logic has a problem, but fixing it won't make it show up without fixing something else that I don't know about first. SetGraphicRect(0, 0, 256+slide, 256+slide); will cause Danmakufu to draw a larger and larger image as time goes on. I believe you mean SetGraphicRect(slide, slide, 256+slide, 256+slide); which draws a 256x256 at all times. DrawGraphic(GetCenterX+slide, GetCenterY+slide); is also incorrect as that will move the image's center until it moves off screen. Just do DrawGraphic(GetCenterX, GetCenterY);
If I remember right this technic was in one of Helepolis's youtube tutorials as an added on-screen text saying that you could mage it this way too.

Also, I am making a attack that fires amulets up, down, left and right from random position and I want to make it so that the amulets don't spawn too close to the player
Here is one of the 4 fire tasks. Only difference between the tasks is the direction and colour. As far as I have tested it has worked, but because it's based on randomization it might not work at all, just begin' lucky not to get amulets spawned on the player
Code: [Select]
task fire01 {
let x = rand(GetClipMinX, GetClipMaxX);
let y = rand(GetClipMinY, GetClipMaxY);
loop {
CreateShotA(1, x, y, 20);
SetShotDataA(1, 0, 0, 0, 0, 0.015, rand(2, 5), BLUE56);
PlaySE(CSD ~ "SFX\se_tan02.wav");
if(x>GetPlayerX+20 || x<GetPlayerX-20 && y>GetPlayerY+20 || y<GetPlayerY-20) {
FireShot(1);
}
x = rand(GetClipMinX, GetClipMaxX);
y = rand(GetClipMinY, GetClipMaxY);
wait(5);
yield;
}
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on October 11, 2012, 06:45:36 AM
Well, you get the picture at least, but you're missing brackets. Another issue is that it won't actually fire every 5 frames, and that it'll still play the sound effect. Instead, just loop the random firing position until you get one within the proper bounds.
Also, the wait() function is defined as looping yields. wait(5); yield; is the same as wait(6); so you don't need that last yield there.
Code: [Select]
task fire01 {
let x;
let y;
loop {
x = rand(GetClipMinX, GetClipMaxX);
y = rand(GetClipMinY, GetClipMaxY);
while( (x<GetPlayerX+20 || x>GetPlayerX-20) && (y<GetPlayerY+20 || y>GetPlayerY-20) ){
//note the extra parentheses, and the flipped < > because I flipped your condition around
//get new firing points until it's away from the player
x = rand(GetClipMinX, GetClipMaxX);
y = rand(GetClipMinY, GetClipMaxY);
}
//so now you will always be firing bullets each time the task loops
CreateShotA(1, x, y, 20);
SetShotDataA(1, 0, 0, 0, 0, 0.015, rand(2, 5), BLUE56);
PlaySE(CSD ~ "SFX\se_tan02.wav");
FireShot(1);

wait(5); //<-- this is just five yields
}
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: SusiKette on October 11, 2012, 04:11:24 PM
Well, you get the picture at least, but you're missing brackets. Another issue is that it won't actually fire every 5 frames, and that it'll still play the sound effect. Instead, just loop the random firing position until you get one within the proper bounds.
Also, the wait() function is defined as looping yields. wait(5); yield; is the same as wait(6); so you don't need that last yield there.

Danmaku freezed, lol
Not sure what caused it in the new code, but I know it can't be the new bg code that I added at the same time, because I pasted it to all of my pre-made spell card bases and they worked just fine
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on October 11, 2012, 04:46:02 PM
Drake's code looks correct to me. Is there a yield in your @MainLoop?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on October 12, 2012, 12:30:22 AM
Herp nope.

while( x<GetPlayerX+20 && x>GetPlayerX-20 && y<GetPlayerY+20 && y>GetPlayerY-20 ){

before it looped for all values lol
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on October 12, 2012, 01:15:46 AM
Derp I'm stupid too.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: SusiKette on October 12, 2012, 04:02:26 PM
EDIT: I got it now so that the bullets will warp once, but the problem is that the (c<1) allows ALL the object bullets to warp that many times so it's a total amount, and when I renew the c value bullets on playfield will warp again and if I don't, newly spawned bullets won't warp. Also updated the code below

Alright, I created an object bullet that when it hits playfield border it comes out from the opposite side. Well... they do come out from the opposite side as I wanted but they do it for forever, I just want it to happen once and on the second time they fly out of the playfield normally. So I need someone to check the part of the script that has the counter.

Code: [Select]
while(!Obj_BeDeleted(obj)) {
if(Obj_GetY(obj) > GetClipMaxY) {
if(c<50) { // there are 50 bullets in one ring, just letting you know
Obj_SetPosition(obj, Obj_GetX(obj), GetClipMinY);
c++;
}
}
yield;
}

I remover the three other playfield collision things to save some space
I tried to use "while" instead of "if" in the "if(c<1) { }" part but it didn't work.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Arcorann on October 12, 2012, 10:57:55 PM
You need to declare c as a local variable if you're only using it within each bullet. Try adding the line let c = 0; before your first if statement.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on October 13, 2012, 01:05:36 AM
Mhm. Just in case you don't understand why, what you're doing is creating 50 bullet objects that each have their own warp variables inside the object's task. This way you can check on each one if their warp variable is false, and if so then they can warp. Otherwise they don't warp. Variables you create inside a task or function are valid to call only within that task, so there's no problem with having a bunch of them at once since they all keep track of their own things.


I guess the main thing to understand here is that creating a variable reserves some program memory to be used, and the name you give it lets you access that memory. The variable name itself is mostly helpful for you, it doesn't really have much meaning. As long as you're in different scopes, multiple variables named the same thing are no problem since they won't be defined in the other scope. For example, people naming most of their objects "obj" and yet obviously referencing different objects because they're all in different tasks. But if they're in the same scope (like if they're global variables, or if they're in the same function/task/etc) then setting the variable means you're taking the variable that already exists and giving it a different point in memory to reference, which you might not want.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: SusiKette on October 13, 2012, 05:03:52 PM
Seems kind of complicated to make it work properly... maby I'll just keep it the optional way that I ended up using (making the bullets fade delete afted specific time after the warp has occured)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on October 13, 2012, 07:54:49 PM
I have a technical question... i wanted to create a boss, using as sprite both vivit and vivit-angel form from 西方秋霜玉 ~ Shuusou Gyoku.

The problem is that the file that contains the images is not a trasparent image file, it is a paint file with a green background...how can i remove the green background?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on October 13, 2012, 08:54:39 PM
Seems kind of complicated to make it work properly... maby I'll just keep it the optional way that I ended up using (making the bullets fade delete afted specific time after the warp has occured)
Wait what, no no no. That blurb was for informational purposes, sorry if it went way over your head. The change is literally just
Code: [Select]
let c = 0; //initialize the variable inside the task instead of globally
while(!Obj_BeDeleted(obj)) {
if(Obj_GetY(obj) > GetClipMaxY) {
if(c==0) { //if the bullet hasn't warped yet
Obj_SetPosition(obj, Obj_GetX(obj), GetClipMinY);
c++; //bullet has now warped
}
}
yield;
}
And getting rid of the global c variable you were using.


I have a technical question... i wanted to create a boss, using as sprite both vivit and vivit-angel form from 西方秋霜玉 ~ Shuusou Gyoku.

The problem is that the file that contains the images is not a trasparent image file, it is a paint file with a green background...how can i remove the green background?
By doing it yourself in an image editing program that handles transparency. You're lucky that the image doesn't use transparency itself.
http://i.imgur.com/Uwdqu.png (http://i.imgur.com/Uwdqu.png)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on October 13, 2012, 09:12:49 PM
an image editing program that handles transparency?
Mmm, Drake i will try to figure it out, but do you know maybe a program that i can use? Paint is useless and GIMP too. That, or i am doing something wrong. Oh,  thank you! i was really lost
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on October 13, 2012, 09:29:30 PM
Paint is useless, but GIMP should handle transparency just fine. You need to add a transparency layer manually if you just open up the image rather than copying it into a new project, though.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on October 14, 2012, 07:47:37 PM
ok thx Drake.

Next problem... i'm doing a pattern in which the bullet go zig-zag to the player position:

task start{ loop{
      loop(8){ Bullet(GetX, GetY, 3.2, 45, RED11, 10); Bullet2(GetX, GetY, 3.2, 135, RED11, 10); wait(5); speed += 0.2; }
      wait(90);speed = 0;   }
}

task Bullet(x, y, v, angle, graphic, delay) {
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x, y);
Obj_SetAngle(obj, angle);
Obj_SetSpeed(obj, v);
ObjShot_SetGraphic(obj, graphic);
ObjShot_SetDelay  (obj, delay);
ObjShot_SetBombResist (obj, true);
wait(30);
Obj_SetAngle(obj,135);
wait(30);
Obj_SetAngle(obj, 45);      
wait(30);
Obj_SetAngle(obj, 135);
wait(30);
Obj_SetAngle(obj,45);      
wait(30);
Obj_SetAngle(obj, 135);
wait(30);
Obj_SetAngle(obj,45 );         
wait(30);
Obj_SetAngle(obj, 135);      
}

task Bullet2(x, y, v, angle, graphic, delay) {
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x, y);
Obj_SetAngle(obj, angle);
Obj_SetSpeed(obj, v);
ObjShot_SetGraphic(obj, graphic);
ObjShot_SetDelay  (obj, delay);
ObjShot_SetBombResist (obj, true);   
wait(30);
Obj_SetAngle(obj,+45);
wait(30);
Obj_SetAngle(obj, 135);      
wait(30);
Obj_SetAngle(obj, 45);
wait(30);
Obj_SetAngle(obj,135);      
wait(30);
Obj_SetAngle(obj, 45);
wait(30);
Obj_SetAngle(obj,135 );         
wait(30);
Obj_SetAngle(obj, 45);   
}

What i wanted to do was firing bullet1 and 2 to the player position and, using that angle, creating the pattern. So if player is at angle 60, bullet 1 and 2 should fire with angle 60 and then go zig-zag.
But... if i try to use atan2 in obj_setangle, strange things happens... help please.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Delfigamer on October 15, 2012, 08:42:52 AM
Trying to understand, what the hell is going here, I rewrited your script that way (http://pastebin.com/9kw3j6TM).
As you see, I wrapped multiple Obj_SetAngle in loop.
Then, I noticed that both tasks are very identical. Both of them crate bullet and periodically sets its angle to (90 +- (-1)^n * 45). We should replace them with one task that will take an extra parameter that will define bullet's direction.
...What's that? Wow, we already have parameter "angle"! And what's its purpose? Though we use it in first Obj_SetAngle; actually we know that in first task it is always set to 45, and in second - to 135; so now it is useless. Let's use this parameter for actual work. (http://pastebin.com/nn0ikWid)
Really, what angle we should use in commented line? I've noticed that 135 = 180 - 45, and 45 = 180 - 135. I know what value I should insert. But do you? Let's leave that for your homework.

Now, let's see what we can do to aim bullet at player's position. I think, we should introduce another variable, holding "player's angle". I hope you know where to insert that code:
Code: [Select]
  let angleOffset = 60;When we'll use it with "angle" in Obj_SetAngle in a certain way (what way? :3), whole zig-zag will turn by "angleOffset" degrees.
I think you now understand what we should place in "offset" instead of this constant value.
Actually, all my Danmakufu knowledge is latest Drake's posts recollection ( * ba dam tss! * ), and it doesn't include getting a direction to player, so let's ask Drake about it.
Drake, how we can get a direction from (X;Y) to player? :3
________

You will never learn how to play on piano without touching black and white keys. Programming, including scripting, is the same.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: SusiKette on October 15, 2012, 01:32:16 PM
Wait what, no no no. That blurb was for informational purposes, sorry if it went way over your head. The change is literally just
And getting rid of the global c variable you were using.

I guess I'm not going to edit that script anymore (maby when I'll get the whole plural script done) but I'll save that piece of code for later use if I'll make bullets bounce off the playfield borders :)
Btw, is there a place where you can share your danmakufu scripts or post a video to show others what you are making?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on October 15, 2012, 06:24:32 PM
Youtube for videos, and this forum for sharing scripts, basically. I guess there's http://www.shrinemaiden.org/forum/index.php/topic,2412.0.html too.

You can host finished scripts on http://www.bulletforge.org/ but I don't suggest posting things that are incomplete just for the sake of posting it.



Delfigamer: ph3 made this super easy with an included GetAngleToPlayer(obj) function. 0.12 has a GetAngleToPlayer() function, but it only uses the enemy's position.
In general,
Code: [Select]
function GetAngleToPoint(x1, y1, x2, y2){
   return atan2(y2 - y1, x2 - x1);
}
which becomes
Code: [Select]
function Obj_GetAngleToPlayer(obj){
   return atan2(GetPlayerY - Obj_GetY(obj), GetPlayerX - Obj_GetX(obj));
}
or
Code: [Select]
function GetAngleObjObj(obj1, obj2){
   return atan2(Obj_GetY(obj2) - Obj_GetY(obj1), Obj_GetX(obj2) - Obj_GetX(obj1));
}
The last is also more general and useful in ph3 (using ObjMove_Gets obv) because of pretty much everything being an object.

lol unnecessary detailed trigonometry explanation of atan2: If you have a point on the unit circle with angle t from the zero angle, then sin(t) describes its y-distance relative to the origin and cos(t) describes its x-distance. tan(t) = sin(t) / cos(t) and so is a function of both y-distance and x-distance. But since tan(t) is basically y-dist divided by x-dist, it is a ratio, and so can be equal to the point on any arbitrarily-sized circle with angle t from the zero angle. Using the inverse function of tan (atan) you can then find the angle to the zero angle given the y-distance and x-distance from the origin, or t = atan(y/x). However, if you consider the function atan(y/x), the division is done before the function, so atan(1, 1) will equal atan(-1, -1) which is the opposite angle. So, people developed a function atan2 where you use y and x as parameters. How the above atan2(y2 - y1, x2 - x1) measures the angle from one point to another becomes clear when you set (x1, y1) as (0, 0), which makes it atan2(y2 - 0, x2 - 0) = atan2(y2, x2). Ta da.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Delfigamer on October 16, 2012, 10:44:04 AM
lol unnecessary detailed trigonometry explanation of atan2: <...>
You forgot to mention that atan(dy,dx) even correctly works when dx=0, while "atan(100/0)" will raise the very funny error. :3 (http://pastebin.com/XAs35Gv2)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on October 18, 2012, 05:55:11 AM
Thank you all for your answers! Still...i don't really understand how to make that pattern i made always aim in the player direction...

but at least now i understand way better the use of atan2!
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Delfigamer on October 18, 2012, 07:14:19 AM
Be careful~ I left a mistake here~ (http://pastebin.com/XAs35Gv2)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: gtbot on October 18, 2012, 11:06:24 AM
Still...i don't really understand how to make that pattern i made always aim in the player direction...

Here's the code needed for this (http://=http://pastebin.com/C7MkKhBw). With this code, I got rid of the need for two separate tasks. Depending on how you want your zigzags, you can mess around with initialAngle and turnAngle. (For instance, if you want the zigzag to center on the player, or have an angle on the zigzag centered on the player, etc.) But for a recreation of your previous tasks with regard to player angle, use these:

Code: [Select]
Bullet(GetX,GetY, 3.2, GetAngleToPlayer, 90, RED11, 10); //Bullet 1
Bullet(GetX,GetY, 3.2, GetAngleToPlaye+90, -90, RED11, 10); //Bullet 2

Bullet(GetX,GetY, 3.2, GetAngleToPlaye+45, -45, RED11, 10); //Centered Version;
Bullet(GetX,GetY, 3.2, GetAngleToPlaye-45, 45, RED11, 10); //Centered Version;
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on October 18, 2012, 12:53:17 PM
Ok, thank you both Delfigamer and gtbot.

First of all, Delfigamer the errors where: let speed = 3.2 (i needed a ; ) and in the loop(7) obj set position(x,y) was to delete or the bullets after 30 seconds would "teleport" to getx and gety. Am i right? Did i find all?

Oh, thank you for your help, because having a 90% made script in which to find a error forced me to analize all the strings and i learned some useful thing changing those strings.

And gtbot, i modified a bit your sting: task bullet is untouched, but i modified the bullets:

From

 Bullet(GetX,GetY, 3.2, GetAngleToPlaye+45, -45, RED11, 10); //Centered Version;
Bullet(GetX,GetY, 3.2, GetAngleToPlaye-45, 45, RED11, 10); //Centered Version;

i made

Bullet(GetX,GetY, 3.2, GetAngleToPlayer+45, -135, RED11, 0); //Centered Version;
Bullet(GetX,GetY, 3.2, GetAngleToPlayer-45, +135, RED11, 0); //Centered Version;

As you see only turnangle was changed. But i still have a problem. Now i have the pattern that spawn in the player position, but since i do a stream of 7-8 bullets, if the player moves all the bullets take the current player position (that changes because the player is moving). This is ugly to see because all the bullets don't follow in line the pattern...so:

Is there a way to make bullets follow the pattern without changing the direction to the player position? The pattern should start  aiming at player position (atan2 i guess) and from there should zig-zag. What i can't make is make the the pattern to NOT changing angles while it zig-zag.

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: gtbot on October 18, 2012, 01:06:50 PM
Is there a way to make bullets follow the pattern without changing the direction to the player position? The pattern should start  aiming at player position (atan2 i guess) and from there should zig-zag. What i can't make is make the the pattern to NOT changing angles while it zig-zag.

Right before the loop, add a new variable with GetAngleToPlayer as its value, then use this variable instead of GetAngleToPlayer in the Bullet task. This will preserve the angle from first shot to last shot.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on October 18, 2012, 02:23:24 PM
mmm, now i have:

task start
{
  let fix = GetAngleToPlayer;
   let fix2 = atan2(GetPlayerY-GetY,GetPlayerX-GetX);
  loop
  {   
    loop(8)
    {
     Bullet(GetX,GetY, 3.2, fix2+45, -135, RED11, 0); //Centered Version;
Bullet(GetX,GetY, 3.2, fix2-45, +135, RED11, 0); //Centered Version;
   wait(5);
    }
    wait(90);
  }
}

using fix or fix2 the first pattern aim at player position (let's suppose 60?) , but the starting with the second time the bullets are fired again, the pattern no longer aim at the start to the player position...it keep aiming as the first time (in this example, the first player position , 60). So, now the ugly effect of bullets that each one follow your direction (only if you are moving when the bullets are fired because each one follow the player position) is solved. And that's because with your help gtbot now bullets aim at player only at the start. The only thing i'm trying to fix, and i'm failing, is making all of this loop. Because, as i sadly sayd, the bullet start from the first player position you take at the start of the script and then danmakufu memorize it and use it even if you move around the screen.

Not even SetShotDirectionType(PLAYER); works!   
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: fondue on October 18, 2012, 03:38:52 PM
That's because fix and fix2 was only declared once. For the bullets to keep aiming at the player "let fix = GetAngleToPlayer;" and "let fix2 = atan2(GetPlayerY-GetY,GetPlayerX-GetX);" have to be declared inside the loop.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on October 18, 2012, 04:20:52 PM
mmm, i don't understand. if i declare  "let fix = GetAngleToPlayer;" and "let fix2 = atan2(GetPlayerY-GetY,GetPlayerX-GetX);"  in my task start , i think that loop or not loop should be indifferent... fix and fix2 exist only in the task , so isn't obvious for danmakufu that each time they do the loop and se "fix" or "fix2" the aim should be set to the player position? Talking in a technical way...why putting "let..." in or out the loop should make difference?

I'm stating that exist a variable fix or fix2, i'm not saying fix/fix2 = (random value) . So even if the "let.." is out the loop, danmakufu should know that fix/fix2 is player position and for each loop this position should update.

But it seems that i'm wrong.

Btw, it works now. Thank you! But still, the "why" it works keep being hard to grasp. Eh...the life of a wannabe scripter that is absolutely awful in math is a hard one
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on October 18, 2012, 05:38:48 PM
When you use GetAngleToPlayer or atan2 and assign it to a variable, it takes the angle that it calculates at the time and sticks it in the variable. So for example, at the beginning of your code, when you call let fix = GetAngleToPlayer, let's say that angle is 90 at the time. fix is going to be 90 and always 90. The variable stores the number that the function returns, not the function itself so you need to call it again.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on October 18, 2012, 05:49:41 PM
Oh...this surely make sense. Thanks Blargel for your explaination
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Delfigamer on October 19, 2012, 08:56:00 AM
First of all, Delfigamer the errors where: let speed = 3.2 (i needed a ; ) and in the loop(7) obj set position(x,y) was to delete or the bullets after 30 seconds would "teleport" to getx and gety. Am i right? Did i find all?
Parameters of atan2~ Something's going wrong with them~
Talking in a technical way...why putting "let..." in or out the loop should make difference?
D: Operators outside a loop... don't loop. They're executed only once. And wave angle is calculated only once, at the start of the task.

Quote from: Matteo
Having Ran as my personal advisor and maid would be nice i guess.
I Yukari say that she's good maid, but her advices generally are useless. ?∇?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on October 19, 2012, 03:12:21 PM
o
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on October 19, 2012, 03:15:17 PM

Ops that's right Delfigamer, now that i notice... let angleOffset = atan2(GetPlayerX - x, GetPlayerY - y); is wrong, in atan2 y is before the x, not after, so the right way is atan2( GetPlayerY - y,GetPlayerX - x); am i right?

And thank you all for your help, so...now i will ask something more, a thing that is puzzling me.

What is the way to make all the different flower patterns that i see in many scripts? I thought that maybe i have to start with a ring of bullets and work with the speed, but i hardly got one of this patterns. Also, i go blindly with tryes, not knowing why i do what i do, so i think that i will have to be lucky to get a flower pattern!

But something keep telling me that i should start with a ring and make or bullets in the ring with different positions (how?) or bullets with different speed (easyer but i'm still trying to understand how to make for example change the speed of the bullet in the ring from 1 to 3 and then again to 1...usually i get or from 1 to 3 or from 3 to 1 only. maybe i should use a while function? But also that, the while thing, is something i still don't understand. Funny that in mainloop i know how to use the "if" but in tasks when i use the "while" usually i throw myself in a infinite loop or simply in an error or more simply...nothing happens because the while function is written bad.)

But returning to the topic of flower patterns... how do you make them? So that i can reproduce it in my way...i'm not asking a code, but if you want to give me an explaination it's surely welcome. Maybe with some examples? I'm the kind of man who needs examples to grasp a concept, not only words.

Thank you.

Quote
I Yukari say that she's good maid, but her advices generally are useless. ?∇?

Why? Poor Ran... if she is a kyuubi no kitsune she at least is 900 years old, so...life should have teached her enough.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: fondue on October 19, 2012, 04:48:10 PM
Why? Poor Ran... if she is a kyuubi no kitsune she at least is 900 years old, so...life should have teached her enough.

CORRECTION PLS
She is less than 900 years old. When she reaches that age she starts to lose her tails until she has 4 left then she enters divinity.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on October 20, 2012, 05:46:20 AM
Matteo, what exactly do you mean by a flower pattern? "Flower pattern" doesn't really mean anything, or it could mean a bunch of things.

But for your bullet speed question, if you make a bullet using CreateShotA you can give it the patterns you want.
CreateShotA(0, x, y, delay);
SetShotDataA(0, 0, 1, angle, 0, 0, 0, graphic);
SetShotDataA(0, 60, 3, NULL, 0, 0, 0, graphic);
SetShotDataA(0, 120, 1, NULL, 0, 0, 0, graphic);
FireShot(0);

This will have the bullet fire, then in 60 frames changes its speed to 3, then after another 60 frames change it back to 1. I'm not sure if I'm understanding what you want done exactly, but this would be one solution to your 1-3-1 problem. Another would be to fire the bullet inside a task, wait some frames and change its speed, then wait some more frames and change it back.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Arcorann on October 20, 2012, 06:04:36 AM
If I'm thinking of the right pattern, the trick is to create two sides of the pattern at the same time. I can best explain this with code. Something like this:
ascent(i in 0..10){
CreateShot01(x, y, 1 + 0.1*i, 5 * i, graphic, delay);
CreateShot01(x, y, 1 + 0.1*i, 90 - 5 * i, graphic, delay);
}
This gives 1/4 of a "flower pattern". The speed of the slowest bullets is 1 and the speed of the fastest bullets is 1.9.  Of course, the code needs to be fixed up properly so that we don't get a pair of bullets coinciding on each other.

CORRECTION PLS
She is less than 900 years old. When she reaches that age she starts to lose her tails until she has 4 left then she enters divinity.
Cite your sources or die we'll laugh at you.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on October 20, 2012, 07:13:04 AM
(read last posts on last page)

ascent(j in 0..5){
   ascent(i in 0..12){
      CreateShot01(GetCenterX, 125, 1+sin(i*180/12)/2, j*360/5 + (i*360/60), RED01, 0);
   }
}

rounder flower, you can also make the pointy flower with sines but eh w/e
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on October 21, 2012, 07:23:57 AM
First of all, thanks for the help with the flower patterns, i will study them as soon as possible.

First i had a basic problem, something i think is a must to understand if you want to make a good script. So...let's talk about collision wonders.


I read something in the wiki, but i understand not much.

I think that maybe i understood about deleting bullets in a circle aroun player (even if i'm not sure at 100% i understand it) , but what i keep not understanding is how to make bullets appear in random position on the screen, but keeping a collisioncircle around the player so that for example " bullets can appear in all the screen but not in a circle of 120 radius around the player" , and with bullets i mean normal ones and obj bullets too... the code on the wiki is hard to understand.

You know how to do it? 

Oh, btw this is the result of the zig-zag questions:
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: puremrz on October 21, 2012, 02:05:49 PM
Edit: Nevermind, the wiki isn't as deleted as I thought, the main page just changed or something.
From http://dmf.shrinemaiden.org/wiki/Index.php to http://dmf.shrinemaiden.org/wiki/Functions


===

If I use "ToString" on a number, it turns into a number with 7 digits. How do I prevent those extra 0's from happening?

Like this:
(http://i32.photobucket.com/albums/d49/puremrz/th_no.png) (http://s32.photobucket.com/albums/d49/puremrz/?action=view&current=no.png)

I know you can lengthen strings like this:
Code: [Select]
let text="123";
text=text~"456";
But is there a way to shorten strings?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Delfigamer on October 21, 2012, 04:28:22 PM
:/
In Pascal function Write, after numerical parameter you may add two specifiers, like "Write (FloatNum:5:3)", first is used for aligning, and second tells how many digits will be after dot.
In dnh... let's see wiki...

Hmm...
Don't know. :/
Try to trunc the number before ToStringing it.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on October 21, 2012, 04:59:31 PM
A problem... i have this:

task star{
   loop{
   loop(36){ascent(i in -2..2){
      Bullet2(GetX, GetY, 3, atan2(GetPlayerY-GetY,GetPlayerX-GetX)+angle2+2*i, WHITE21, 30);angle2 += 360/36;      }}
      wait(20); angle2 += 5;
      }}

What i want is put in speed 3+i/3 instead of simple 3. But if i do it, i have a ugly graphic...do you know how to solve this?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on October 22, 2012, 12:16:53 AM
Delfi: won't work lol
Puremrz: Danmakufu uses floating points for all of its numbers, which I explained in a shitload of detail (http://www.shrinemaiden.org/forum/index.php/topic,12397.msg824531.html#msg824531) previously in this thread. That's the reason why it always has the trailing zeroes, at least. But anyways, strings are just arrays of characters (which is why you can use ~ to concatenate in the first place), so you can do this:
Code: [Select]
function itos(n){
let s=ToString(n);
return s[0..length(s)-7];
}
You can use a loop of array = erase(array,index) as well, to actually erase elements from an array/string.


Matteo: Judging by the name "star" and how you set up your bullets, I think you want 3 + 1/((|i|)+1) ?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on October 22, 2012, 05:02:00 AM
Thanks Drake! Btw, i wanted to mix the previous floral patterns with a bit of lasers but... i was trying to make 4 familiars that spin around the enemy and fire a laserA that keep aiming at enemy while the sorce is always set on the familiars, who rotate...this is hard to do, since i'm trying to use it with obj_lasers.

Also, how does it works the laser_GetEndX or Y if i want to create lasers that spawn from the previous laser? I mean, like making a laserA with 120 lenght and making at lenght 120 another laser with different direction and so on.

People says that lasers are like longer bullets...well, i find that making bullets is way easyer both to create and understand.

Also, i hava a BIG problem :

i was doing a animated boss (look attachments to see the figure i used) and in this boss i had to animate 3 thing that i called "boss" "wingA" and "wingB".

So in drawloop i wrote:

SetTexture(boss);
                SetRenderState(ALPHA);
                SetAlpha(255);
      if(x==0){SetGraphicRect(0,0,55,74);}
      if(x==5){SetGraphicRect(230,0,285,74);}
      if(x==10){SetGraphicRect(285,0,340,74);}
      if(x==15){SetGraphicRect(395,0,450,74);}
      if(x==20){SetGraphicRect(450,0,505,74);}
      if(x==25){SetGraphicRect(505,0,555,74);}
      SetGraphicScale(1,1);
                SetGraphicAngle(0,0,0);
   DrawGraphic(GetX(),GetY());

   SetTexture(wingA);
                SetRenderState(ALPHA);
                SetAlpha(255);
      SetGraphicRect(0,176,128,360);
      SetGraphicScale(1,1);
                SetGraphicAngle(0,0,0);
   DrawGraphic(GetX()-fly,GetY()+5*sin(float));
      float -= 2;

   SetTexture(wingB);
                SetRenderState(ALPHA);
                SetAlpha(255);
      SetGraphicRect(128,176,256,360);
      SetGraphicScale(1,1);
                SetGraphicAngle(0,0,0);
   DrawGraphic(GetX()+fly+3,GetY()+5*sin(float));
      float -= 2;

While in the first task, in order to control the movement of "boss", i wrote

task Maintask {   
      SetColor(255,255,255);
      Concentration01(120);
      PlaySE(CSD ~ "SE\se_ch00.wav");
      wait(120);
      loop(75){
      fly++;
      yield;}
      start;   
      countdown1;
   }
   task sprite{
      loop(25){
      x++;yield;
      }
      x = 0;
   }
task start{
   loop{
   wait(120);
   sprite;      
   }
}

Ok, to explain what happens... "fly" is a variable used to move "wingA" and "wingB". It works, so wingA and B need no fix.
The problem is sprite "boss" because when i move it (controlling the movement with task sprite) i get a ugly effect...i mean, my boss move but in background also wingB appears in the boss position (don't know why).

 I think that maybe when task sprite start, danmakufu don't understand if SetGraphicRect refer to boss or one of the wings, so it modify all the 3 sprites.
Do you know how to solve this? Whithout a solution i am blocked because i can't make a plural with a boss whose animation is an abomination.

Really, really thanks if you know what i do wrong!
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: LadyScarlet on October 22, 2012, 02:53:07 PM
Okay. I'm about to go insane. EVERY SINGLE TIME I run this script. it says something is wrong with the MainTask. I checked if every line was semicoloned, it  was. If MainTask was its name, it was. I even tried my past mainTask.  Just about everything. Nothing works. Help???

http://pastebin.com/nJZ3714r
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: puremrz on October 22, 2012, 04:31:31 PM
Okay. I'm about to go insane. EVERY SINGLE TIME I run this script. it says something is wrong with the MainTask. I checked if every line was semicoloned, it  was. If MainTask was its name, it was. I even tried my past mainTask.  Just about everything. Nothing works. Help???

http://pastebin.com/nJZ3714r

Remove the 2nd } after @Finalize.
Also, your script lags a lot when firing, you might want to move PlaySE(shin); outside the loop of bullets.

I made your fire task a bit more efficient.
Code: [Select]
task fire{
loop{
CreateShot01(GetEnemyX,GetEnemyY,2,GetAngleToPlayer,BLUE32,0);
CreateShot01(GetEnemyX,GetEnemyY,2,GetAngleToPlayer-20,RED32,0);
CreateShot01(GetEnemyX,GetEnemyY,2,GetAngleToPlayer+20,GREEN32,0);
PlaySE(shot);
wait(5);

let dir=0;
loop(40){
CreateShotA(1,GetEnemyX,GetEnemyY,0);
SetShotDataA(1,0,2,dir,0,0,2,AQUA32);
SetShotDataA(1,60,NULL,NULL,0.5,0,2,AQUA32);
FireShot(1);
dir+=360/40;
}
PlaySE(shin);

wait(60);
yield;
}
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on October 23, 2012, 06:25:53 AM
Ok... now i really don't understand. I solved the last problem i posted in this way:

task sprite{
      loop(23){
      x++;yield;
      }
      x = 0;
   }

(as you see, loop 23, not 25)

and in drawloop

if(x>=0 && x<5){SetGraphicRect(0,0,55,74);}
      if(x>=5 && x<10){SetGraphicRect(230,0,285,74);}
      if(x>=10 && x<15){SetGraphicRect(285,0,340,74);}
      if(x>=15 && x<20){SetGraphicRect(395,0,450,74);}
      if(x>=20 && x<25){SetGraphicRect(450,0,505,74);}
      if(x>=25 && x<30){SetGraphicRect(505,0,560,74);}
      if(x>=30 && x<35){SetGraphicRect(0,0,55,74);}

Now... can someone help me what the hell i did? I mean, it's not really different from what i posted before, but this way works, in the other way it ddidn't work...  incoming headache!
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Delfigamer on October 23, 2012, 09:14:25 AM
Remove the 2nd } after @Finalize.
I remember that times when i used php. Just when I miss an ending bracket, the whole page dissapears, leaving pure white screen showing empty responce. ^o^

Ok... now i really don't understand. I solved the last problem i posted in this way:

task sprite{
      loop(23){
      x++;yield;
      }
      x = 0;
   }

(as you see, loop 23, not 25)

and in drawloop

if(x>=0 && x<5){SetGraphicRect(0,0,55,74);}
      if(x>=5 && x<10){SetGraphicRect(230,0,285,74);}
      if(x>=10 && x<15){SetGraphicRect(285,0,340,74);}
      if(x>=15 && x<20){SetGraphicRect(395,0,450,74);}
      if(x>=20 && x<25){SetGraphicRect(450,0,505,74);}
      if(x>=25 && x<30){SetGraphicRect(505,0,560,74);}
      if(x>=30 && x<35){SetGraphicRect(0,0,55,74);}

Now... can someone help me what the hell i did? I mean, it's not really different from what i posted before, but this way works, in the other way it ddidn't work...  incoming headache!
(http://img-fotki.yandex.ru/get/6622/44827875.22/0_884aa_e9646f67_L)
In task "sprite" you increase variable "x" by one every frame until it reaches 23, then reset it to 1 and continue increasing.
In that bunch of ifs (oh god (http://3.bp.blogspot.com/_EQdXJbGGc0A/Sw3U2xEs8JI/AAAAAAAAAcY/x5zv18eDKk8/s1600/kanakolight:shading.jpg) what is this) you select a graphicrect depending on current value of "x". And last two are useless since x never reaches 25 and 30.

We see what is written in this loop, but we don't see that "other way".
Why are you doing all this if you have nothing but headache?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on October 26, 2012, 04:10:51 AM
Can somebody tell me how to make scrolling background? Maybe explain it using also some examples?

Even helepolis video did not help me ( ..because i'm starting to think that with background scripting i'm really a Cirno).

Thanks!
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Byronyello on October 26, 2012, 04:42:19 AM
Could anyone explain 'sub' to me? I understand what 'function' and 'task' do, but there seems to be no overt difference in how sub operates.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on October 26, 2012, 06:21:13 AM
There is no huge difference in how subroutines are different than functions, except functions can take parameters and return a value. Tasks however are completely different.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on October 27, 2012, 10:35:48 AM
i tryed with gimp but nothing happened...i must do something wrong. So...

somebody could make this immage trasparent so that can be used in danmakufu please?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Delfigamer on October 27, 2012, 11:39:05 AM
i tryed with gimp but nothing happened...i must do something wrong. So...

somebody could make this immage trasparent so that can be used in danmakufu please?
Hmm, I'm not in mood to download gimp to show you how to make this transparent, so I show you how to do it in Paint.NET, which I use.
First, create a new bitmap.
[attach=1]
Then, import your image as a new layer
[attach=5]
If gimp will ask you to expand image, say "Yeah!".
[attach=6]
First layer can be deleted.
[attach=7]
Then, use a "magic wand" with global filling
[attach=2]
Click on area with the background color. All pixels with that color will be selected.
[attach=3]
And press [Delete].
[attach=4]
I hope you don't need a tutorial on saving bitmaps.

P.S.
(http://img-fotki.yandex.ru/get/6622/44827875.22/0_884aa_e9646f67_L)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on October 27, 2012, 12:48:44 PM
Thanks Delfigamer!

I used Paint.net and this is what i obtained.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lunasa Prismriver on October 27, 2012, 08:26:06 PM
With gimp, you can select a color on the picture. Here a tutorial from the official website : http://docs.gimp.org/en/gimp-tool-by-color-select.html (http://docs.gimp.org/en/gimp-tool-by-color-select.html). You will have a better result.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Byronyello on October 28, 2012, 01:29:42 PM
From the looks of that, gimp seems to offer a limited version of Paint.NET's Magic Wand, because Magic Wand has an option to act contiguously or globally.

Anyway, given subroutines' and functions' similarity, is there any real reason to use a subroutine rather than have no arguments for a function? Is it faster or something?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on October 28, 2012, 03:02:18 PM
I need help with Sinusate Lasers...

I am playing a bit, see the Attachment to see for example what i managed to make.

But i have a problem. I am trying to make something like the nue spell with the sinusate lasers but i :

1- can't make it

2- 2\3 of times danmaku laaaag because of too much lasers.

So, i have 2 request:

1- How to do it?

2- how to make sinusate lasers fire bullets?

Thanks!

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: fondue on October 28, 2012, 03:27:04 PM
I need help with Sinusate Lasers...

I am playing a bit, see the Attachment to see for example what i managed to make.

But i have a problem. I am trying to make something like the nue spell with the sinusate lasers but i :

1- can't make it

2- 2\3 of times danmaku laaaag because of too much lasers.

So, i have 2 request:

1- How to do it?

2- how to make sinusate lasers fire bullets?

Thanks!
Well for us to be able to help you properly it would great if you gave us your script. And sinuate lasers use up a lot of processing power. That's why they make Dnh lag.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on October 28, 2012, 03:50:12 PM
loop(1){let h = [RED01,GREEN01,BLUE01,YELLOW01,PURPLE01,AQUA01,ORANGE01,WHITE01];let t = 0;
      loop(36){
      
      CreateLaserC(8, GetX, GetY, 7, 80, h[t],0);
SetLaserDataC(8, 0, 3, GetAngleToPlayer+angle , 3, 0.5,3);
SetLaserDataC(8, 30, 5, NULL, 6, 0.1,3);
SetLaserDataC(8, 60, 5, NULL, -6, 0.1,3);
SetLaserDataC(8, 90, 5, NULL, 6, 0.1,3);

SetLaserDataC(8, 140, 3, NULL, 1.5, 0.1,5);
SetLaserDataC(8, 150, 3, NULL, -1.5, 0.1,5);
SetLaserDataC(8, 180, 3, NULL, 1.5, 0.1,5);
SetLaserDataC(8, 210, 3, NULL, -1.5, 0.1,5);
SetLaserDataC(8, 240, 3, NULL, 1.5, 0.1,5);
SetLaserDataC(8, 270, 3, NULL, -1.5, 0.1,5);
   FireShot(8);
angle += 360/36; t++; t%=length(h);

}
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: SusiKette on October 28, 2012, 06:02:56 PM
Could someone explain how ascent and descent commands work. I've been searching few sites but I feel like I didn't completely understand them. Also, how do I create variable that randomizes bullet shape or color or another variables value within the given values (for an example randomly chooses either 10, 20 or 30 but won't choose between the numbers)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on October 28, 2012, 10:42:43 PM
Could someone explain how ascent and descent commands work. I've been searching few sites but I feel like I didn't completely understand them. Also, how do I create variable that randomizes bullet shape or color or another variables value within the given values (for an example randomly chooses either 10, 20 or 30 but won't choose between the numbers)
ascent and descent are loops, which are given a temporary variable at the start, set to the minimum value. Every time it loops, the variable is increased by one until it reaches the maximum value, and then the loop ends.

ascent(var in 0..10){
   bla(var);
}
somethingelse;


Here we are starting a loop that initializes a variable var with a value of 0. The loop starts, and then we get to bla(var), which runs as bla(0). We hit the end of the loop, so we go back to the start, and increment var so that var = 1. var is still less than 10, so the loop runs again and we call bla(1). Similarly it'll loop through bla(2), bla(3), etc, and bla(9). Once you go to the start from var = 9 and increase it to var = 10, you've now reached the maximum value, so the loop is done and you go do somethingelse; instead of going through the loop again.
descent loops are the same, except you start with a maximum value and decrease it until you hit the minimum. Also, just to note, the variable in an ascent/descent loop is only accessible from inside the loop. After the loop it doesn't exist anymore.

In this way, you could rewrite the above like this:

local{
   let var = 0;
   while(var<10){
      bla(var);
      var++;
   }
}
somethingelse;



Your second question can be answered in a few different ways. Firstly, if you want to randomize between 10, 20 and 30, you can use math for that. rand_int(1,3) * 10 will choose a number from 1 to 3 (note, it includes the maximum) and then multiply it by ten, so you do get 10, 20 or 30. What you probably want though, is a use of arrays.
let array1 = [RED01, BLUE01, YELLOW01];
let array2 = [23, 81, 320000, -7, GetCenterX];

Given these arrays, if you want to choose a random element inside it, you can use array1[rand_int(0,2)] and array2[rand_int(0,4)]. rand_int will return an integer from 0 to 2 and 0 to 4 respectively, and since the elements in the arrays are numbered the same way, it will randomly select one of those elements.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on October 28, 2012, 10:59:30 PM
If this has been asked, I've never found the post so...
I'm making a stage, just playing around with it, and I notice, when I try to create a stream of enemies(that are the same), only the first one shoots the bullets. Anyway I can fix this?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on October 29, 2012, 07:07:45 PM
Could you post your scripts (on pastebin, just pasted one after the other)? From the sound of it, the reference to the enemy you give when firing the bullets ends up being the same one each time so it'll just fire all the bullets. This could be the case with a parent enemy, or with a variable being overwritten with different objects or something.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on October 29, 2012, 11:40:20 PM
http://pastebin.com/2hNkhsn5

Please put large code posts in pastebin as suggested by users.  -Helepolis
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: SusiKette on October 30, 2012, 06:21:36 PM
   task fire{
      let x = 0;
      loop{
         while(x<36){
            CreateShotA(1,GetEnemyX,GetEnemyY,0);
            SetShotDataA(1,0,3,GetAngleToPlayer,0,0,0,RED01);
            FireShot(1);
            x++;
         }
         x = 0;
         wait(30);
         yield;
      }
   }

Try using GetX and GetY instead of GetEnemyX and GetEnemyY
GetEnemyX and GetEnemyY gets X and Y of the boss and GetX and GetY gets X and Y of the current enemy, familiar or object bullet (in object bullet's case the codes are Obj_GetX(object name) and Obj_GetY(object name)). Danmakufu propably tought that the first appearing enemy was the boss and fired all from that.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on October 31, 2012, 02:58:53 AM
Quote
From the sound of it, the reference to the enemy you give when firing the bullets ends up being the same one each time so it'll just fire all the bullets
Yep.

Additionally,
- Non-boss enemies use script_enemy, not script_enemy_main. This is why GetEnemyXY are pointing to the first enemy.
- Aside from the shots, you're using GetEnemyX in the boundary detection as well. You are indeed using GetXY for the drawing though which I find hilarious.
- You have two DrawGraphics drawing the same thing.
- wait(10); yield; and wait(30); yield; are just wait(11) and wait(31) respectively.
- You do not need script headers (#TouhouDanmakufu #Title etc) in scripts that you are not going to run from the main menu, just to note.
- "@Background" in the stage script is bound to screw you up later, change it to @BackGround.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: nono_kaki on November 01, 2012, 07:55:47 PM
Hello there!
Please I don't get it, I followed every little step in the Helepolis custom player tutorial  and it seems the bomb can't activate. The screen turns black and I can't hear the sc sound, it has to be a mistake in the bomb definition  because I have already check multiples times  name errors, wrong pathname... (don't mind the ugly bullet...)
you can dl this folder first - it contains all you need, I think it's more efficient than giving the source code only -

http://www.mediafire.com/file/5e1vvoebsw4cgbr/marisaZE.rar (http://www.mediafire.com/file/5e1vvoebsw4cgbr/marisaZE.rar)

Thank you.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on November 02, 2012, 05:48:52 AM
The first thing that shouts at me is script_spell has "@Initialiize". The rest actually looks fairly clean.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: SusiKette on November 02, 2012, 08:27:17 PM
For some reason, now when I open danmakufu with applocale it crashes before danmakufu actually opens in a window and I didn't have this problem before. It could be another program I have recently installed (?) (possibly Google Chrome or Ad-Aware 10). Anyone know how to fix this?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on November 03, 2012, 12:06:51 AM
Highly doubtful it's Chrome, but just disable Ad-aware for a moment to see if it works again.
You could also check if the problem has to do with the locale by just opening it without AppLocale, since it only crashes when the program tries to access japanese text like when listing scripts.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: SusiKette on November 03, 2012, 08:08:34 AM
The problem was Ad-Aware 10, after disabling it danmakufu worked normally.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on November 05, 2012, 10:35:44 AM
That is quite odd to see an ad-block program was blocking it. What the hell. Was the Ad-aware 10 a software installed on your computer? Doesn't sounds as a browser extension to me.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: fondue on November 05, 2012, 01:26:35 PM
And why would an ad block program block Danmakufu? What makes it more confusing is that it's a browser extension.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Delfigamer on November 05, 2012, 01:45:03 PM
And why would an ad block program block Danmakufu? What makes it more confusing is that it's a browser extension.
Enwiki (http://en.wikipedia.org/wiki/Ad-Aware) says it is standalone application, which probably can block another executable.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: SusiKette on November 05, 2012, 07:12:07 PM
Enwiki (http://en.wikipedia.org/wiki/Ad-Aware) says it is standalone application, which probably can block another executable.

Yeah, and Danmakufu works as long as I don't use AppLocale, but then again Damakufu crashes when I open a sub-menu because I'm not running it on Japanese locale... When I try to open Danmakufu through AppLocale when Ad-Aware is on, Danmakufu crashes before it can actually open.

Anyway, how do I "draw" bullet lines (not only straight lines but curves too) in Danmakufu and possibly make them move once something happens (a good example would be Flandre's Kagome Kagome)
Also, I need help with using AddShot. When I try using AddShot the added shots won't spawn. I don't have an example script right now, but if someone could make a simple task that fires 8 LaserCs in a circle with a curving motion and make them spawn 12 type bullets from the tip of the laser to left and right (when the lasers curve the bullet firing directions should also change), or something like that so that I could look through it and do experiments with it.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on November 05, 2012, 11:41:17 PM
You can probably set exceptions in Ad-Aware to let you run AppLocale. Regardless, if you get rid of the players and scripts with japanese text you should be able to play without AppLocale.

Or you could get a better antivirus.


As for your first question, it's just a matter of moving a bullet spawn point around, and using CreateShotA with some delayed patterns. Like
CreateShotA(0, x, y, 20);
SetShotDataA(0, 0, 0, 0, 0, 0, 0, RED01);
SetShotDataA(0, 240, 0, angle, 0, 0.05, 2, RED01);
FireShot(0);
And just have the delayed movement frames for each bullet all occur at the same time whenever said event is supposed to happen.


AddShots: If I were to guess, you aren't building your bullets correctly.
http://www.shrinemaiden.org/forum/index.php/topic,30.msg202.html#msg202
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: puremrz on November 06, 2012, 06:18:13 PM
Is it possible to remove the message that you get when you capture a spellcard? It's quite ugly and I want to get rid of it.
I don't suppose it's possible to edit it out of Danmakufu itself...

Edit: Looks like you can't remove it, but by ending the script right before the message appears and adding a lot of complicated stuff to it, you can get around that.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lunasa Prismriver on November 10, 2012, 05:44:20 PM
You can try to show a object effect over to mask it.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on November 11, 2012, 02:28:26 AM
Is it possible to remove the message that you get when you capture a spellcard? It's quite ugly and I want to get rid of it.
I don't suppose it's possible to edit it out of Danmakufu itself...

Edit: Looks like you can't remove it, but by ending the script right before the message appears and adding a lot of complicated stuff to it, you can get around that.
Well, you might be able to get rid of it (you can change the string by hex editing, at least) but the easiest way is just to stop using SetScore. A SetScore declaration is what Danmakufu uses to designate any pattern as a card, and likewise omitting SetScore designates a noncard. Using SetScore also will activate DNH's spell circle, given that you haven't set MagicCircle to false.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on November 11, 2012, 07:50:07 PM
I have a question for which I haven't found an answer (although it is probably simpler than I imagined).

I am making a player script for an OC. However, when I put it into the player folder, I cannot load it. I've checked all of the {};# and I've correctly (hopefully) set up the starter #[XYZ] stuff. I've looked at a bunch of other player scripts, and I can't seem to find what is wrong with mine.

http://pastebin.com/embed_js.php?i=hK7P1yCV (http://pastebin.com/embed_js.php?i=hK7P1yCV)

I haven't learned much Danmakufu yet, and I pretty much based the entire thing off of the tutorial. There are most definitely numerous syntax errors and stuff inside. I'm not asking for people to check it (although that would be helpful); I just want to know if there is something that prevents it from being loaded by Danmakufu. If it is the temporary cutin, then I'll fix that; if it's something else, I'll fix that.

I haven't included the spell part because that's not filled yet. Sorry if it's too long.

Thanks.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lunasa Prismriver on November 11, 2012, 08:25:29 PM
The [ code ] balises shouldn't be there, it prevent Touhou Danmakufu to recognize the script as a player script. If it's not working, try to put #TouhouDanmakufu instead of #???˚?e????.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on November 11, 2012, 08:42:58 PM
Oops. It was from when I copied the code from the forum (I decided not to paste it here). Should be fixed soon.

Edit: Fixed the 'code' in brackets. Also, the TouhouDanmakufu[Player] allowed for the thing to be run, but nothing loads due to an error message.

Edit: Now it says that I have a token error
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on November 11, 2012, 11:25:10 PM
balises
balises y s'appelle "brackets" en anglais ;p

Sparen, that's a problem with the shot definition script, and the error doesn't really give any info. Can you post it?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on November 12, 2012, 12:23:42 AM
@Drake

http://pastebin.com/embed_js.php?i=kTexeiDe (http://pastebin.com/embed_js.php?i=kTexeiDe)

P.S. There are almost definitely errors regarding the coordinates. It's not easy for me to get used to a new coordinate system. As for the images, they are on a transparent background, and it is a png file. I edited 'all channels' using Seashore (derivative of GIMP).

Hope it helps.

Edit: Discovered that I forgot an equals sign after checking other scripts. Now, the error message is the following.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on November 12, 2012, 01:20:47 AM
One thing you keep doing is escaping the backslash like you would in regex, first of all. You only need ".\file", but it seems to work anyways so whatever.

It says incorrect file terminator. I just checked myself and yeah it's caused by the comment at the end, ridiculously enough.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on November 12, 2012, 02:35:21 AM
Wait, so that means that you can't end a script with a comment?!

Well, anyway, thanks. There're probably more issues though.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Byronyello on November 13, 2012, 11:51:45 PM
I've noticed that to make a bullet that can actually react to events, you have to use object bullets, and it seems, subsequently, that you also have to use 'yield;'s. Is there anyway to circumvent this, because my computer can barely handle more than 100 bullets yield;-ing at any one time, which isn't really that good for danmaku. (And certainly not for making patterns for higher difficulties.)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on November 14, 2012, 12:13:54 AM
I don't think you can circumvent it, at least not easily. It's used to exit a repeating procedure, so a script would go crazy and overload commands if it were removed.

On a side note, how do you do cutins for a player spell card? Danmakufu keeps on giving me a " ')' needed" or "Periods cannot be used" error.

Code: [Select]
@SpellCard {
    //SetSpeed(4,2);
    //UseSpellCard("TalismanEruption", 0);
    CutIn(KOUMA, "Seiryuu "\"Talisman Eruption"\"", img_cutin);
  }

This results in a 'periods cannot be used' error, although I have no lone periods in that one line. If I comment out the cut in, the script runs fine (although without a spellcard, which doesn't work due to this one line for some reason).
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on November 14, 2012, 01:07:57 AM
Your card name there is messed up; it reads the string "Seiryuu " then everything after is misformatted. You probably want "Seiryuu "Talisman Eruption"".
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on November 14, 2012, 01:48:03 AM
I did that, but I still get the same error message. Also, in a [single] script, that spell formatting works without issues. Is it something unique to a player script that I should watch out for or does it have to do with the locale? In a lot of the tutorials, they have things like "Crystal Sign uv[insert spell name here]uv"
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on November 14, 2012, 02:24:18 AM
the ?u and ?v are just the unicode characters 「 and 」, except flattened into an encoding that we can use. It just displays oddly.
I formatted the backslashes the way I did because they're escape characters. If you have a string "a" it displays a. If you have a  string """ it's malformed, since it ends prematurely. In order to have quotations in your string you need to escape it using \" .

In any case, the error is "single periods cannot be used in this script". This leads me to suspect your img_cutin variable, which would be a file path string, which might have an error in it. What is img_cutin?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on November 14, 2012, 02:46:53 AM
In any case, the error is "single periods cannot be used in this script". This leads me to suspect your img_cutin variable, which would be a file path string, which might have an error in it. What is img_cutin?

Code: [Select]
let img_cutin = GetCurrentScriptDirectory()~"cutin.png";
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on November 14, 2012, 03:23:17 AM
Welp, I have no idea. I would just try different parameters like using YOUMU, an empty string for the card name, different image, etc.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on November 14, 2012, 10:50:25 PM
I got another issue.

From what I know, this may be a stupid error, or it might be a serious issue.

http://i1164.photobucket.com/albums/q570/SparenofIria/Issue_zpsb76880e6.png (http://i1164.photobucket.com/albums/q570/SparenofIria/Issue_zpsb76880e6.png)

The gist of it is this: 'run()' (called in the spell's @initialize), has not been defined (although task run was defined in the spell main.)

The spell itself has major issues, but I can't even test it, so that's an issue (I've already fixed several or eight minor/major bugs).

Any help would be appreciated. Thank you.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on November 15, 2012, 12:00:33 AM
If you have a task/function defined inside of another task/function it's only valid to call within that task/function, just as if you declare a variable inside a task/function you can only read it within that task/function. Basically you just have to take run() out of main().
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on November 15, 2012, 01:03:58 AM
Maybe this is clearer.

http://pastebin.com/embed_js.php?i=nauq3Mtv (http://pastebin.com/embed_js.php?i=nauq3Mtv)

Quote
If you have a task/function defined inside of another task/function it's only valid to call within that task/function, just as if you declare a variable inside a task/function you can only read it within that task/function. Basically you just have to take run() out of main().

So I should take the task run() out of initialize and put it in the main body of script_spell?

In Karanum's Patchy,
Code: [Select]
@Initialize
{
LoadGraphic(img);
run;
}
is used. Is this also legitimate?

Also, I know this is not a high-level question, but on a side note, what does the () after run(); and GetCurrentScriptDirectory()~"XYZ"; do? I've never seen arguments in them.

Thanks.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: gtbot on November 15, 2012, 01:18:50 AM
So I should take the task run() out of initialize and put it in the main body of script_spell?

<cut>

Also, I know this is not a high-level question, but on a side note, what does the () after run(); and GetCurrentScriptDirectory()~"XYZ"; do? I've never seen arguments in them.
As Drake said, your run task is inside another task, so run will only be usable inside that task. For instance:
Code: [Select]
task A{
<can use task B, it is defined for this task>

task B{
<stuff>
}
}
task C{
<can not use task B, it is not defined for this task>
}

Task B will only be usable inside task A, and if you try to use task B inside task C, an error will raise, much like the one you are experiencing. Your run task is only good in the current task its in. What Drake was saying, was to take the actual run task out of the task its currently inside (like cut and pasting task B outside of task A, so that both A and C tasks can use it) so that @Initialize will be able to use it. Keep note that I only used tasks in this example, but this rule applies to all functions/subs/variables that you define.

As to your second question, the () parenthesis with no arguments are entirely optional in Danmakufu, and are up to personal preference.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on November 15, 2012, 01:42:00 AM
I didn't get what you and Drake said at first, but then I realized that I forgot to close the spell_talisman task with a }. It was a typo.
Thanks!
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on November 15, 2012, 03:46:10 AM
Ah, sorry, I wasn't very clear when I said take run() out.

Also, Danmakufu is a parsed language and one lazymode shortcut it provides is that you don't have to add the empty () to call a function with no parameters (whereas in compiled languages and whatnot you generally have to). I usually omit the parentheses myself, but when posting I would rather use them than not, since it makes it obvious that I'm talking about a function. That's all.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on November 17, 2012, 06:10:25 PM
I'm back again~
I have a similar problem from my last one. (The one with the stage and only the lead enemy would shoot the bullets.)
So I've fixed that problem, but now, when I kill an enemy, the others of it's kind's picture disappears. I know why, but I don't know how to fix it.
Do I just you like let w = GetArgument and then Loadgraphic(w); I don't even know if that would work though...
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lunasa Prismriver on November 17, 2012, 08:34:11 PM
In fairy's script, inside the shot task, try to use GetX and GetY instead of GetEnemyX/GetEnemyY.
EDIT : Sorry I misunderstand the question. Don't mind what I said.  :ohdear:
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on November 17, 2012, 11:24:41 PM
You're using DeleteGraphic() when you kill a fairy; don't. DeleteGraphic is a global command that clears the image data that you loaded from the program memory as to free up space. When you call it, you're going to have to reload the graphic again in order to use it again. In other words, if you're going to be reusing the image, don't delete it.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: arch on November 18, 2012, 02:20:50 AM
I want to make some minor changes to the original Danmakufu Reimu A/B and Marisa A/B, does anyone have them in a editable player script format?

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lunasa Prismriver on November 18, 2012, 07:22:21 AM
Unfortunately, Danmakufu's default's players can't be edit and I don't think their code have been found in thdnh.dat yet  :ohdear: . You can try to remake them into new scripts as they are just PCB shot types.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: SusiKette on November 18, 2012, 06:14:27 PM
I'm not sure what caused this but for some reason Danmakufu started to give me an error about word "wait"

The error was in the main task:
Code: [Select]
task mainTask {
SetShotDirectionType(PLAYER);
wait(120);
SetMovePosition03(GetPlayerX, GetPlayerY, 7, 3);
fire01;
wait(120);
fire02;
}

It worked properly but then I did some changes to the fire01; task, and Danmakufu started to give me this error. ( I've had this problem few times before and undoing changes I did won't help)
Here is the wait function: (don't really think that you'll need to see it since I didn't do any changes to it)
Code: [Select]
function wait(w) {
loop(w) {yield;}
}

And here is task fire01; because doing changes there caused this error:
Code: [Select]
task fire01 {
loop {
CreateShotA(1, GetEnemyX, GetEnemyY, 10);
CreateShotA(2, GetEnemyX, GetEnemyY, 10);
CreateShotA(3, GetEnemyX, GetEnemyY, 10);
CreateShotA(4, GetEnemyX, GetEnemyY, 10);
SetShotDataA(1, 0, 0, 0, 0.5, 0.025, 5, RED02);
SetShotDataA(2, 0, 0, 90, 0.5, 0.025, 5, RED02);
SetShotDataA(3, 0, 0, 180, 0.5, 0.025, 5, RED02);
SetShotDataA(4, 0, 0, 270, 0.5, 0.025, 5, RED02);
FireShot(1);
FireShot(2);
FireShot(3);
FireShot(4);
PlaySE(CSD ~ "sfx\se_tan02.wav");
wait(5);
yield;
}
}
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: gtbot on November 18, 2012, 06:46:03 PM
I'm not sure what caused this but for some reason Danmakufu started to give me an error about word "wait"

You have an extra bracket in the loop. Also for future reference, generally when you have tasks/functions that worked without error, then do a change anywhere in the script, and suddenly Danmakufu says it's undefined, you probably have an extra bracket somewhere.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on November 19, 2012, 12:23:35 AM
After seeing the above, how does Danmakufu respond when you assign loop without a number? Does it hit yield, loop indefinitely, or does it loop once?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on November 19, 2012, 12:41:25 AM
Indefinitely, unless you yield away of course (but it's still a basically indefinite loop). Danmakufu ends the thread and seems to do some garbage collection once the host of the task is deleted, so there's no immediate concern with looping indefinitely as there would "normally" be in most programming languages. You still have to watch out for things like infinitely incrementing variables that can lead to memory leaks, but for common purposes it's a completely normal usage.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: PhantomSong on November 19, 2012, 03:02:25 AM
I keep getting this error every time I try spawning danmaku in a circle.
http://tinypic.com/r/2vbmvis/6

My script:
http://pastebin.com/QDkqHPk5

I am following Helepolis' tutorial, and I've followed what he'd done and I still get this error...  :ohdear:
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on November 19, 2012, 03:12:31 AM
your lack of proper indentation makes me cry

Your dir+=360/36 just doesn't have a semicolon at the end.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on November 19, 2012, 09:21:30 PM
I've come across a minor issue.

Code: [Select]
@SpellCard {
    CutIn(KOUMA, "Seiryuu: Talisman Eruption", img_cutin);
    //SetSpeed(4,2);
    //UseSpellCard("TalismanEruption", 0);
  }

Basically, after bombing, the text in the bottom left that show the spell name just stays there and doesn't disappear.

If this is because the spell is commented out, then I'll have to fix it within the spell (which does not work at all).

Code: [Select]
//Temporary Spell. Currently just shoots blasts of talismans.
//Req: first, slowly fill ring with talismans, which are still. Then, they blast off. Then, twice, they erupt into three.
script_spell TalismanEruption{
  let spellcount=0;
  let spellangle=0;
  let spellimg_suiroga = GetCurrentScriptDirectory()~"suiroga.png";
  task spell_talisman(angle){
    let objtalisman=Obj_Create(OBJ_SPELL);
    let talismanxpos=GetPlayerX;
    let talismanypos=GetPlayerY;
    let talismanangle=angle;
    Obj_SetAlpha(objtalisman,200);
    ObjEffect_SetTexture(objtalisman,spellimg_suiroga);
    ObjEffect_SetRenderState(objtalisman,ADD);
    ObjEffect_CreateVertex(objtalisman,4);
    ObjEffect_SetPrimitiveType(objtalisman,PRIMITIVE_TRIANGLEFAN);
    ObjEffect_SetVertexUV(objtalisman,0,10,7);
    ObjEffect_SetVertexUV(objtalisman,1,27,7);
    ObjEffect_SetVertexUV(objtalisman,2,27,31);
    ObjEffect_SetVertexUV(objtalisman,3,10,31);
    while(!Obj_BeDeleted(objtalisman)){
      ObjSpell_SetIntersecrionCircle(objtalisman,talismanxpos,talismanypos,30,10,true);
      yield;
    }
  }
  task run{
    ForbidShot(false);
    loop(60){yield;} //When casting
    while(spellcount < 240){
      if(spellcount % 60 == 0){
spellangle = 0;
loop(45){
  spell_talisman(spellangle);
  spellangle += 8;
  }
}
      spellcount++;
      yield;
      }
    SetSpeed(5,3); //Restore it!
    loop(240){yield;} //Delay after for bullets to fly
    End();
  }

  @Initialize{
    SetPlayerInvincibility(480);
    LoadGraphic(spellimg_suiroga);
    //LoadSE
    run();
  }

  @MainLoop{
    CollectItems();
    yield;
  }

  @Finalize{
    DeleteGraphic(spellimg_suiroga);
  }
}

There are most likely mountains of issues with this code, but all I am certain of is that it raises an error and Danmakufu returns to the directory screen afterwards.
Req: states what I want the spell to do; I'm not yet experienced enough to do it.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: PhantomSong on November 19, 2012, 09:43:37 PM
your lack of proper indentation makes me cry

Your dir+=360/36 just doesn't have a semicolon at the end.
OHWOW I feel so dumb x3 Thanks~  :V
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Byronyello on November 20, 2012, 12:16:23 AM
I don't think you can circumvent it, at least not easily. It's used to exit a repeating procedure, so a script would go crazy and overload commands if it were removed.

That's not really what I meant. I was trying to ask how to handle object bullets without giving them their own thread - is there a way to do this? And sorry for not making my question obvious...
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on November 20, 2012, 12:33:28 AM
Another error. >.<
But this one is different, I have a player script error. I can't seem to load the player.
Here's the script (http://pastebin.com/ZZya1ApR).
Here's the error message (http://puu.sh/1s8lW). For anyone wonder, I crossed out the part with personal data. I don't know why they included that.  :3
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: gtbot on November 20, 2012, 01:16:31 AM
That's not really what I meant. I was trying to ask how to handle object bullets without giving them their own thread - is there a way to do this? And sorry for not making my question obvious...
You can use SetShotDataA (Click) (http://dmf.shrinemaiden.org/wiki/Bullet_Control_Functions_%280.12m%29#SetShotDataA). However, beyond anything more complex than that, there's nothing you can do without their own threads.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on November 20, 2012, 02:34:35 AM
I've noticed that to make a bullet that can actually react to events, you have to use object bullets, and it seems, subsequently, that you also have to use 'yield;'s. Is there anyway to circumvent this, because my computer can barely handle more than 100 bullets yield;-ing at any one time, which isn't really that good for danmaku. (And certainly not for making patterns for higher difficulties.)
I was trying to ask how to handle object bullets without giving them their own thread - is there a way to do this? And sorry for not making my question obvious...
Yielding takes essentially no extra processing, the underlying procedures are still at work. Microthreading is basically process organization.
Many bullets "reacting to events" can be cheesed just by using bullets that follow timed patterns (i.e. CreateShotA) and properly timing everything. But microthreading does absolutely nothing special besides really easy organization; I have trouble believing that your problem is inherent to yields.

Lavalake: It says it can't find Reimu. Not Reimu A, as your #Menu says. I'm not sure what the problem is but it's clearly something like naming issues.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on November 20, 2012, 09:09:39 AM
That's not really what I meant. I was trying to ask how to handle object bullets without giving them their own thread - is there a way to do this? And sorry for not making my question obvious...

In addition to what Drake mentioned above, I'd like to point out that the tasks that Danmakufu uses are not truly threads that run independently. If they were threads, they would indeed have some overhead processing that occurs when context switching. However, tasks are actually coroutines which are very different from threads. While threads are for concurrent processing, coroutines are still sequential so there is no context switching to process. It's really just a fancy way to give a sequence of directions to the program while writing it in a non-sequential way.

tl;dr Tasks are not threads and are not slow.

Also, have a stackoverflow link (http://stackoverflow.com/questions/1934715/difference-between-a-coroutine-and-a-thread).
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Byronyello on November 21, 2012, 12:28:06 PM
Ah! Thank you for correcting me. It seems then, that object bullets inherently are slower compared to those created with CreateShotX()... Or at least, that's what the speed of my scripts show. Hmm. (Maybe I should just try to get a less crappy computer so that it can handle all of this object bullet crap.) Anyway, surely CreateShotX and objecy bullets would have the same underlying code? (Waits to be corrected.)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: nono_kaki on November 22, 2012, 12:26:12 AM
/* please don't kill me because of my poor English */

Maybe a small detail but...

I was reading some script and I can't help but notice ";" was missing in some subroutine like "return" and such, but it doesn't prevent the script to work perfectly
I usually code in C/C++ and to see such a thing without the final ";" is well very irritating? shocking? unbearable XD ?
And here is my question (the question itself seems to be the answer, so I need a confirmation :D ) :

how does Danmakufu handle that ?
and for include_function "something.txt" and UserShotData script cases ? (it doesn't work with ";"  for the latter, why?)

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on November 22, 2012, 01:19:21 AM
I got applocale working, and the script doesn't have any errors (because I copied it), and when I click any script, I click play and nothing happans, i click again and Danmakufu X's out.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on November 22, 2012, 02:58:32 AM
Chaque script est interpr?t? compl?tement par le moteur de script de Danmakufu, alors c'est simplement un caprice de l'interpr?teur. Les scripts de balle-d?finition n'ont besoin pas des points-virgules, car aucun d?claration y est ex?cut?; il pourrait aussi bien ?tre XML ou quelque chose. D?clarations avec # sont headers donc ils sont aussi interpr?t?s. Les d?clarations #include sont remplac?s par le script r?f?renc?, alors encore rien est ex?cut?, et on ne besoin pas des points-virgules.

Je ne suis pas certain si return toujours y besoin des points-virgules, je ne les utiliserais pas quand m?me. Mais je sais que Danmakufu vous permet d'omettre les points-virgules s'il y a seulement une d?claration dans des brackets comme while(x > y){ z = a } mais c'est tr?s bizarre et je ne ferais jamais sugg?rer les omettant seulement parce que vous le pouvez.

(EN: Everything is interpreted by Danmakufu's scripting engine, so it's basically just an interpreter quirk. Shot data scripts need no semicolons because no statements are being executed, it might as well be XML or something. Statements with # are headers and are also just interpreted. The #include statements are just replaced by the referenced script, so again nothing is being executed.

Not too sure about return not requiring semicolons since I always use them anyways. I do know Danmakufu allows you to omit semicolons if a statement is the only one in a bracket, like while(x > y){ z = a } but it's still really weird and I would never suggest omitting them just because you can.)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Swerfawe on November 22, 2012, 05:09:59 AM
How do I use Lymia's .dat packer to make a .dat file and have it run in danmakufu?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on November 22, 2012, 07:05:26 AM
Drag your folder onto compress.bat or pack.bat (/verbose) and put the output.dat in your script folder.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Swerfawe on November 22, 2012, 05:37:51 PM
How do I use the command line interface in Windows XP? Right now i am getting an error message that reads, "Error: Unable to access jarfile th_dnh_archiver.jar" by clicking and dragging.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on November 22, 2012, 10:20:30 PM
With the command line, it is always possible to cd (change directory) to the directory in which the jar is located and then open it that way. On Windows, however, I can't help.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Delfigamer on November 22, 2012, 11:10:10 PM
How do I use the command line interface in Windows XP?
[Win+R], type "cmd" and press [Enter].

Right now i am getting an error message that reads, "Error: Unable to access jarfile th_dnh_archiver.jar" by clicking and dragging.
Are you sure "th_dnh_archiver.jar" and that .bat file are in the same folder? Didn't you move that .bat without other files?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Swerfawe on November 23, 2012, 02:32:00 AM
Everything is in the same file, and I only ever moved it as a whole folder. To make sure, I redownloaded the files and extracted them without moving anything and got the same problem. None of the .bat files seem to know the .jar file is in the same folder.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on November 23, 2012, 04:54:02 AM
Oh, XP. The readme says drag and drop doesn't work with XP. To open the command line you can hit Start -> Run -> cmd.exe
Then use the command cd to reach your folder like cd "C:\Documents and Settings\You\th_dnh_012\th_dnh_archiver" or cd "%USERPROFILE%\th_dnh_012\th_dnh_archiver" or whatever. Then the program syntax to compress an archive is
java -jar th_dnh_archiver.jar -c (your_input_folder) output.dat assuming you have java properly installed.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on November 23, 2012, 02:00:58 PM
 :derp: When  I click any stage, (even EXRumia ones) it freezes.  What do I do?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lunasa Prismriver on November 23, 2012, 05:51:46 PM
Use Applocale to run Danmakufu or put the local settings in Japanese.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on November 23, 2012, 08:19:00 PM
Use Applocale to run Danmakufu or put the local settings in Japanese.
I did Applocale and it still won't work.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on November 24, 2012, 04:37:01 AM
If it's freezing just before you select a character it's almost definitely rejecting japanese.

Grab a player script from someone here, as they probably won't have any japanese in it.
Copy one of the default scripts or make a script with nothing in it, and set #Player to only the player character downloaded. This way you won't see the default REIMU or MARISA.
Now go play the script. If you make it to the player select screen and get to play, then it confirms that you messed up AppLocale.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on November 24, 2012, 06:54:47 PM
If it's freezing just before you select a character it's almost definitely rejecting japanese.

Grab a player script from someone here, as they probably won't have any japanese in it.
Copy one of the default scripts or make a script with nothing in it, and set #Player to only the player character downloaded. This way you won't see the default REIMU or MARISA.
Now go play the script. If you make it to the player select screen and get to play, then it confirms that you messed up AppLocale.
THANK YOU SO MUCH! :DD :derp:
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on November 24, 2012, 09:17:56 PM
...Well, if that worked, it still doesn't solve the problem, it just confirms what the problem is.
How are you using AppLocale to begin with? The tutorial is here: http://www.shrinemaiden.org/forum/index.php/topic,4138.0.html
You have to install it, run AppLocale, select the exe you want to run, and set the language to Japanese. I've had mixed issues with the shortcut creation it suggests, but my suggested method is using the context menu edit here: http://alcahest.perso.sfr.fr/perso/apploc/applocale.html which makes launching things much easier.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: nono_kaki on December 05, 2012, 08:24:40 PM
Well, I'm making a stage script I want to fit with a bgm. In fact, it's a medley of songs from Subterranean Animism, each part corresponding to one boss.

Question :
Is there a way to freeze the music file when the player hits the  escape key and  play it where it was before when returning in the game, in order to keep the synchro ?

Here is my attempt (2 function to determine)

And this file (mp3 type) is of ~ 10 Mo (11 min long). How do I do to reduce the weight ? (I heard Danmakufu doesn't manage music file of 4 Mo and more very well, it's a shame :( ...)

http://pastebin.com/gLk0fLM2

Welcome to the forums! Please put large code blocks (like these) in pastebin.com url please =)  -Helepolis
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on December 05, 2012, 10:05:14 PM
Well, I'm making a stage script I want to fit with a bgm. In fact, it's a medley of songs from Subterranean Animism, each part corresponding to one boss.

Question :
Is there a way to freeze the music file when the player hits the  escape key and  play it where it was before when returning in the game, in order to keep the synchro ?

Here is my attempt (2 function to determine)

And this file (mp3 type) is of ~ 10 Mo (11 min long). How do I do to reduce the weight ? (I heard Danmakufu doesn't manage music file of 4 Mo and more very well, it's a shame :( ...)

http://pastebin.com/gLk0fLM2

Welcome to the forums! Please put large code blocks (like these) in pastebin.com url please =)  -Helepolis

Danamakufu 0.12m does not support this functionality. It also does not allow you to start a song at a specific time so there's no way to make such a functionality. If you want to do something like that, you'll have to use ph3. If you're planning to make something that is synced to music, it is also worth noting that if someone is not running Danmakufu at the same framerate as you are, it will desync when they play it. Generally, musicially synced scripts aren't a good idea because of these things, but if they work, they're pretty awesome.

Also, I have no idea what you mean by "reduce the weight" or what "Mo" is? Did you mean reducing the file size and MB? The only way to do that would be to reduce the sound quality but that's not really recommended.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: nono_kaki on December 06, 2012, 02:37:50 AM
Quote from: Blargel

Also, I have no idea what you mean by "reduce the weight" or what "Mo" is? Did you mean reducing the file size and MB? The only way to do that would be to reduce the sound quality but that's not really recommended.

Ah sorry because I'm French I forgot I was on an English-speaking board  :V, Mo means Megaoctet (ie Megabits) an octet being a number of 8 bits and yeah weight=file size.

So I have to abondon this synchro idea mmh -_-' ......I will try another way then...
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on December 07, 2012, 12:26:56 AM
I'm sorry if this doesn't belong here, still getting used to the forum.  :ohdear:
These following questions are more of a how to do...
QUESTION 1
How do I curve Player Reimu's shots
http://pastebin.com/Hd1xF0J6 <---- My script here, homing attack is task Amulet, it's just the tutorial SakuyaA calculations.  :3

QUESTION 2
I'm making a full game and I want to know how to make power-up boxes to power up.
I also want to know how to make it like in the original games, where you gain more power with each power-up 1.00, 2.00, 3.00, 4.00.

Sorry is this is asking too much. Help is very much appreciated.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on December 07, 2012, 01:44:13 AM
QUESTION 2
I'm making a full game and I want to know how to make power-up boxes to power up.
I also want to know how to make it like in the original games, where you gain more power with each power-up 1.00, 2.00, 3.00, 4.00.

Danmakufu doesn't include it by default, as you've probably noticed, so you'll have to recreate the entire system. Some have managed it; Juuni Juumon has a working Power System, as do some other full games; but since it's not built in, you will have to write the code from scratch in order for it to work for you. The player scripts will probably not be fully compatible with other scripts as well.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lunasa Prismriver on December 07, 2012, 09:37:17 PM
You must use Common Data and Object Effects for recreate power-ups.
After if you want to make your player script usable without powerups in other scripts, just test if the common data of power ups exists at the start of your player script.  :3c
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on December 07, 2012, 11:15:32 PM
Okay. I have a question regarding Helepolis's Cutin script.

Put simply, it doesn't work for me, and the issue is most likely  really small issue that I overlooked.

Anyway, here's the code I used.

Code: [Select]
script_enemy_main {
    #include_function ".\function_cutin.txt";
    let count = -60;
    let angle = 0;
    let angle2 = 0;
    let BossImage = GetCurrentScriptDirectory~"pikachu.png";
    let BossCutIn = GetCurrentScriptDirectory~"pikachu.png";
    let bullet = GetCurrentScriptDirectory~"bullet.wav";
    let ZUNbullet = GetCurrentScriptDirectory~"supershot.txt";

    @Initialize {
LoadGraphic(BossImage);
LoadGraphic(BossCutIn);
LoadUserShotData(ZUNbullet);
SetLife(5000);
SetDamageRate(80, 60); //% of shot damage, % of bomb damage
SetTimer(50);
SetInvincibility(30);
cutin("NAZRIN","Sparkle"\""Mini Shocker"\",BossCutIn,0,0,262,193);
SetScore(1000000);
SetEnemyMarker(true);
//SetDurableSpellCard;
//LastSpell;
Concentration01(30); //Frames to charge energy
MagicCircle(true);
//SetEffectForZeroLife(30, 130, 0); //TimeIntensitySlowdown0=none
SetMovePosition02(GetCenterX, GetCenterY - 10, 10);
LoadSE(bullet);
}

When the spell is called, nothing happens at the start. No cutin, no hexagonal and diagonal displays, and no spellcard name. Everything else works fine.

If this is my issue, I'd like to know ASAP so that I don't make a mistake again. If not, the problem may be that Wine can't read the directory path, or may be another error.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lunasa Prismriver on December 08, 2012, 09:47:47 AM
Have you put yield; into @MainLoop ?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on December 08, 2012, 04:38:49 PM
No. I have not put in a yield;. Since I didn't have any tasks in the script, I didn't put it there.

I'll put it there and see what happens.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on December 08, 2012, 07:59:16 PM
Why do I keep getting problems.
http://pastebin.com/Y2MRPM86 This is my script.
The problem is that when I try to run it, it gives me the standard 'program is not responding' error message.
Is there a flaw that I'm possibly overlooking?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lunasa Prismriver on December 08, 2012, 08:31:06 PM
Your code seems to be ok. Your problem sounds like an infinite loop (probably in your enemy script). Search if you don't forget a yield; somewhere.  :)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on December 08, 2012, 08:36:47 PM
Okay. I now have a problem where Danmakufu crashes during a player script spell.

From my previous knowledge of programming, there is probably a 90% chance that the freezing was due to an infinite recursion.

http://pastebin.com/embed_js.php?i=WZLvnfhK (http://pastebin.com/embed_js.php?i=WZLvnfhK)

Code: [Select]
if(spellcount > 0 && spellcount % 90 == 0){
spell_talisman(Obj_GetAngle(objtalisman) - 30, Obj_GetX(objtalisman), Obj_GetY(objtalisman));
spell_talisman(Obj_GetAngle(objtalisman) + 30, Obj_GetX(objtalisman), Obj_GetY(objtalisman));
      }

Above is the specific code that most likely caused the freezing. Basically, what the spell is *supposed* to do is first shoot a ring of object shots, which then erupt into three. After moving farther, they erupt again, and exit the screen. They are standard Talisman shape bullets.

I have two issues. First, was it really an act of infinite recursion? The first wave of bullets never appeared. Second, if it is, how do I circumvent  that? What I'm basically trying to do is make each object bullet hatch two more bullets at 30 and -30 degrees to it. But in the first wave, I DO NOT WANT those newly created bullets to execute the same procedure, since that'd just crash Danmakufu.

P.S. Adding yield; to Main Loop didn't fix the #function_cutin completely; it gave the YOUMU cutin instead of the "NAZRIN" cutin.

Edit: I now found an error with my other player script. Apparently, a variable is not defined. Even though I defined it at the start of the spell. This issue will probably take a few seconds to solve; I tweaked it and it still wouldn't work. The code is at the same location, just at the bottom of the pastebin thing.

http://pastebin.com/embed_js.php?i=WZLvnfhK (http://pastebin.com/embed_js.php?i=WZLvnfhK)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lunasa Prismriver on December 08, 2012, 09:48:05 PM
Danmakufu is quirky. When you want to create a variable into a if/else statement, you must define the variable before and change the value into the statement.

Instead of :
Code: [Select]
if(GetKeyState(VK_SLOWMOVE) == KEY_PUSH || GetKeyState(VK_SLOWMOVE) == KEY_HOLD){
    let slashdist = 10;
  }else{
    let slashdist = 20;
  }

Try to use :
Code: [Select]
let slashdist;
if(GetKeyState(VK_SLOWMOVE) == KEY_PUSH || GetKeyState(VK_SLOWMOVE) == KEY_HOLD){
    slashdist = 10;
}else{
    slashdist = 20;
}
About spell_talisman, it seems to be a infinite recursion because spell_talisman always be called. Try to add an if/else statement which controls how many times the recursion function was called.

Finally, about the function, verify the path of the image used by the cut in function (spellcardanm.png).  ???


Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on December 09, 2012, 12:17:47 AM
About spell_talisman, it seems to be a infinite recursion because spell_talisman always be called. Try to add an if/else statement which controls how many times the recursion function was called.

For this, how would I control the spawn points and how should I control which bullets have already erupted? I think I'll make a short video of what exactly I am trying to do, although it's basically an object bullet spawning other object bullets (which do not undergo the same procedure.) In NetLogo, you can add a turtles-own variable or use a 'with [boolean]' statement to control objects, but I do not know how to do that on NetLogo with Object bullets.

http://www.youtube.com/watch?v=NBBSGDBOjWg&feature=youtu.be (http://www.youtube.com/watch?v=NBBSGDBOjWg&feature=youtu.be)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on December 09, 2012, 02:10:44 AM
Danmakufu is quirky. When you want to create a variable into a if/else statement, you must define the variable before and change the value into the statement.
That isn't quirky, that's common sense programming practice. Having the variable not defined after the if block is just a formality; in general you cannot assert that the variable exists or has been given an initial value if it's done inside of an if block, even if you capture all scenarios in the if-then-else.

Lavalake: Whoops thought you were the same person, sorry for the confusion
As for your first stage problem, without being able to see the enemy script, the only thing I can propose is that you're attempting to draw the enemy on the very first frame of the script, which will cause crashing in 0.12. Your flow is @Initialize -> stage() -> CreateStream() -> CreateEnemyFromFile(), upon which I'm going to guess that you attempt to draw the enemy immediately. This would cause a crash. Add one yield at the very beginning of stage().

Sparen:

Your spell problem is just infinite recursion going. First of all I have to say the logical structure of the spell is pretty confusing and probably weak, but that's a different issue.
Your one amulet should not be calling the same amulets. If you don't want an infinite loop of talismans you need to either use different amulet bullet tasks, or use flags to tell the task not to loop, or set how many times it will loop, etc. Because the secondary bullets aren't going to pause at all (or fire new bullets), you should use the first option. General structure will go like this.
Code: [Select]
task run{
    loop(bla){
        spell_talisman();
    }

    loop(howlongthespelllasts){ yield; }
    End();
}

task spell_talisman(){
    let count = 0;
    make the bullet and stuff
    loop(somepause){ yield; }
    Obj_SetSpeed(obj, speed);
    while(!Obj_BeDeleted(obj)){
        if(count==90 || count==180){
            leaf_talisman();
            leaf_talisman();
        }
        count++;
        yield;
    }
}

task leaf_talisman(){
   just make the bullet and stuff, all they do is fire
}

Also more things!

You don't need to use spell objects if you aren't already planning on using effect objects in your spell. As you're just using pseudo-bullets, all you need to do is define and fire them like you would any other bullets and just use DeleteEnemyShotToItemInCircle(SHOT, Obj_GetX(obj), Obj_GetY(obj), radius) to delete other bullets that hit the amulet. This way you can easily avoid all the clutter and setup you use with spell/effect objects. Tbh Stuffman should have used this method in the Player Tutorial, but at least he got to explain how spell objects work since they aren't really covered elsewhere.

Obj_SetAlpha(objtalisman,200) will not do anything. Obj_SetAlpha() does not work on effect/spell objects. You have to instead modify the alpha value of each vertex, which for a rectangular object will be ascent(i in 0..4){ ObjEffect_SetVertexColor(obj, i, alpha, 255, 255, 255); }

Your amulets still won't show up because you have no XY position for the object and no XY vertices set. You aren't actually setting the angle of the object anywhere either.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on December 09, 2012, 03:06:51 AM

Your spell problem is just infinite recursion going. First of all I have to say the logical structure of the spell is pretty confusing and probably weak, but that's a different issue.
Your one amulet should not be calling the same amulets. If you don't want an infinite loop of talismans you need to either use different amulet bullet tasks, or use flags to tell the task not to loop, or set how many times it will loop, etc. Because the secondary bullets aren't going to pause at all (or fire new bullets), you should use the first option.

Also more things!

You don't need to use spell objects if you aren't already planning on using effect objects in your spell. As you're just using pseudo-bullets, all you need to do is define and fire them like you would any other bullets and just use DeleteEnemyShotToItemInCircle(SHOT, Obj_GetX(obj), Obj_GetY(obj), radius) to delete other bullets that hit the amulet. This way you can easily avoid all the clutter and setup you use with spell/effect objects. Tbh Stuffman should have used this method in the Player Tutorial, but at least he got to explain how spell objects work since they aren't really covered elsewhere.

Obj_SetAlpha(objtalisman,200) will not do anything. Obj_SetAlpha() does not work on effect/spell objects. You have to instead modify the alpha value of each vertex, which for a rectangular object will be ascent(i in 0..4){ ObjEffect_SetVertexColor(obj, i, alpha, 255, 255, 255); }

Your amulets still won't show up because you have no XY position for the object and no XY vertices set. You aren't actually setting the angle of the object anywhere either.

Thanks. I actually can't believe that I managed to forget to set speed, angle, and position when I had the variables defined right there. As for the effects, which ones are actually necessary to draw the shots? Most of the player scripts I've downloaded are far out of my comprehension with my limited knowledge of Danmakufu, so I assumed that all of the ObjEffect_XYZ stuff was necessary.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on December 09, 2012, 03:30:56 AM
Just define your amulets in the player's shotsheet, load the shotsheet in the spell script and use them as object bullets instead. The only difference between spell objects and effect objects is that spell objects can only be used in spell scripts and have hardcoded bullet deletion functions, as far as I can tell.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on December 09, 2012, 06:29:45 AM
Your code seems to be ok. Your problem sounds like an infinite loop (probably in your enemy script). Search if you don't forget a yield; somewhere.  :)

Nope, I've tested my enemies individually, they work perfectly.
http://pastebin.com/Y2MRPM86 Is is because they think 'filepath' is the file path of the enemy?
I've also checked the actual file path.
Oh wait... Didn't see Drakums mention my post. :| This post can be deleted.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on December 09, 2012, 12:45:20 PM
Hi, i have a big problem with lasers:

I am trying to make a laser that has a lenght that increase for the first 60 frames and than decrease from frame 60 to frame 120. But...how to do it?

With laser1 i can't. With laserB or C i can't. With laserA i managed to do it, but there is a problem: the laser source. I can't delete it and i don't know how to use lasers if i make them object (meaning that i can use lasers, but laser objects no).

Any idea?  ???

(Oh, the laser moves also, from top to bottom. and while it moves the lenght first gradually decrese than gradually increase)

This is what i made for now...but the laser source should be deleted somehow, wonder how...

CreateLaserA(1, GetX, GetClipMinY, 1, 10, RED01, 30);
      SetLaserDataA(1, 0, 90, 0, 1, 1, 90);
      SetLaserDataA(1, 60, 90, 0, -1, 1, 90);
      SetLaserDataA(1, 120, 90, 0, 1, 1, 90);
      FireShot(1);
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lunasa Prismriver on December 09, 2012, 03:42:36 PM
If you want to delete the laser's source. You must pass by objects lasers.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on December 09, 2012, 07:05:54 PM
and an ellipse? Someone knows how to create an ellipse of bullets?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lunasa Prismriver on December 09, 2012, 07:27:06 PM
Magic of the trigonometry  ;)

Code: [Select]
CreateShot01(GetX+100*sin(Angle),GetY+50*cos(Angle),1,Angle,RED01,10);
Change the number before sine and cosine (If they are the same, you'll have a circle). You can also switch them from memory.  :)
Hope I help you :)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on December 12, 2012, 01:50:36 AM
Multiple questions wee...
Question 1
How do I delete an enemy once it gets offscreen?

Question 2
How do I make a function in a stage script that tells to wait n frames to advance, but having zero enemies also advances on? For example...
CreateEnemyFromFile(...)
[Wait for either zero enemies or the given frames, then advance]
CreateEnemyFromFile(...)

Question 3
How do you have an image appear in the front of the player. (Like the stage intros in the Touhou games, or of CtC) And how big is the screen. (In frames) Only the areas where danmaku happens though.

Question 4
How do I make a BG scroll using @Background{

That was a lot. Help is very much appreciated. I tried to fit all the questions I can think of in one post, just to save space. :3
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on December 12, 2012, 02:07:16 AM
Multiple questions wee...
Question 1
How do I delete an enemy once it gets offscreen?

From what I know, it's automatic. Unless you do something that tells Danmakufu NOT to delete it...
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on December 12, 2012, 03:03:06 AM
How do I delete an enemy once it gets offscreen?
Generally happens automatically. You can change what the boundaries are if needed.

How do I make a function in a stage script that tells to wait n frames to advance, but having zero enemies also advances on? For example...
CreateEnemyFromFile(...)
[Wait for either zero enemies or the given frames, then advance]
CreateEnemyFromFile(...)

let f = 0;
while(GetEnemyNum!=0 && f<n){ f++; yield; }

Erm, are you aware of the simple logic structure? Or was the question more about getting the number of enemies?

How do you have an image appear in the front of the player. (Like the stage intros in the Touhou games, or of CtC) And how big is the screen. (In frames) Only the areas where danmaku happens though.
Draw it on a higher layer, i.e 4 to 8.

GetCenterX*2 by GetCenterY*2
..or 448x480

How do I make a BG scroll using @Background{
Have variables that count backwards or forwards in the @BG loop, and use DrawGraphic at your original position plus the counting variable. That's all.

...I'm pretty sure all of these questions would be answered if you looked through the function lists and read/watched the tutorials :C
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on December 13, 2012, 02:41:10 AM
 :ohdear: I'm very sorry for last time's post. I just couldn't find it anywhere in the tutorials. I might be overlooking something... This problem I have right now... I know it's not in the tutorials.

http://pastebin.com/FpUExLcW Script
It's a cut-in error, it gives me an error message.
http://puu.sh/1Aj3l Error Message

Sorry for last time, wasn't looking hard enough.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on December 13, 2012, 03:09:21 AM
:ohdear: I'm very sorry for last time's post. I just couldn't find it anywhere in the tutorials. I might be overlooking something... This problem I have right now... I know it's not in the tutorials.

http://pastebin.com/FpUExLcW Script
It's a cut-in error, it gives me an error message.
http://puu.sh/1Aj3l Error Message

Sorry for last time, wasn't looking hard enough.

Code: [Select]
let CutIn = CSD ~ "System\Kona-Cut-in.png";
Code: [Select]
CutIn(YOUMU,"Wind Sign "\""Dropping Hurricanes"\",CutIn,0,0,250,375);
Don't name a variable after a function that already exists.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on December 13, 2012, 10:05:40 PM
Code: [Select]
let CutIn = CSD ~ "System\Kona-Cut-in.png";
Code: [Select]
CutIn(YOUMU,"Wind Sign "\""Dropping Hurricanes"\",CutIn,0,0,250,375);
Don't name a variable after a function that already exists.

To circumvent this, most use 'cut' to define the variable. Some also use cutin, but that's a commonly used user defined function. Might want to rename it konacut or something more specific if you need organization. Just a suggestion.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on December 14, 2012, 05:48:48 AM
For sounds and graphics paths, I usually just prefix my variables. imgReimuCutIn, sfxShot01, bgmStage01... something like that.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on December 18, 2012, 03:11:53 PM
ok...time for questions:

1 - How can i create and use a collision circle? I mean, for example how can i create a 90 radius collision circle around the player that say " random bullets can be spawned anywhere but not inside this ring" or "if bullets enter in the ring, the bullets are deleted" ?

2 - how can i create geometric figures "stars, exagons, etc etc" with lasers or bullets?

3 - when i use a familiar, how can i do that it moves in the player position but without stopping when it reach the player position?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lunasa Prismriver on December 18, 2012, 07:58:42 PM
1 - How can i create and use a collision circle? I mean, for example how can i create a 90 radius collision circle around the player that say " random bullets can be spawned anywhere but not inside this ring" or "if bullets enter in the ring, the bullets are deleted" ?
Code: [Select]
DeleteEnemyShotInCircle(ALL,GetPlayerX,GetPlayerY,90);http://dmf.shrinemaiden.org/wiki/Bullet_Control_Functions_%280.12m%29#DeleteEnemyShotInCircle  (http://dmf.shrinemaiden.org/wiki/Bullet_Control_Functions_%280.12m%29#DeleteEnemyShotInCircle)
Other variations of this function are listed in the wiki :)

2 - how can i create geometric figures "stars, hexagons, etc etc" with lasers or bullets?

For a regular polygon (not a star).
Example :

Code: [Select]
task DrawPolygon(x,y,radius,numberfaces){
    ascent(i in 0..numberfaces){
        let radiuscoorX = x+radius*cos((360/numberfaces)*i); //I find the points using sine and cosine because we want a regular polygon
        let radiuscoorY = y+radius*sin((360/numberfaces)*i);
        let angleface = atan2( (y+radius*sin( (360/numberfaces)*(i+1) ) ) - (y+radius*sin( (360/numberfaces)*i) ),(x+radius*cos((360/numberfaces)*(i+1)))-(x+radius*cos((360/numberfaces)*i))); // Some mathematical stuff
        let facelength = 2*radius*sin(180/numberfaces); //Other math stuff

        DrawFace(radiuscoorX ,radiuscoorY,angleface,facelength) //Draw the laser
    }   
    task DrawFace(x,y,angle,facelength){ //Draw a basic laser with a object bullet.
            let ObjPrism = Obj_Create(OBJ_LASER);

            Obj_SetSpeed(ObjPrism, 0);
            ObjShot_SetBombResist(ObjPrism, true);
            ObjShot_SetGraphic(ObjPrism, AQUA01);
            ObjLaser_SetWidth(ObjPrism,;
            ObjShot_SetDelay(ObjPrism, 32);
            ObjLaser_SetSource(ObjPrism, false);
            Obj_SetAlpha(ObjPrism, 192);
            while(!Obj_BeDeleted(ObjPrism)){
                ObjLaser_SetLength(ObjPrism, facelength);   
                Obj_SetPosition(ObjPrism,x,y);
                Obj_SetAngle(ObjPrism, angle);
                yield;
            }
    }
}
For a star :
You can use the function upside, you just have to rely the points in a different order. But I think it's easier to calculate points coordinates and rely them manually.


3 - when i use a familiar, how can i do that it moves in the player position but without stopping when it reach the player position?

I'm don't sure it's works but you can try this (Call this function in @initialize) :

Code: [Select]
task MoveFamiliar {   
      SetAngle(atan2(GetPlayerY-GetY,GetPlayerX-GetX));
      SetSpeed(1);
}

I hope i help you.  :3c
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on December 18, 2012, 09:47:25 PM
Wow, thx!

i have to try them, especially point 2. I wonder how to make the polygon move like a shot, in all the possible way. Move it like a whole or like Zun star of Sanae, that appear as a star but then is fired as a lot of single bullets

Also, i have 2 last mayor questions:

1 - Arrays... what should i write in a script to make them works for, like, give different angles or speed to bullets? So, how do i use in general arrays? I know what they are and what they do, but i keep failing when i use them...i freeze danmakufu. So, maybe i type the wrong strings when i create and use an array...

2 - effect objects. How to use them? How do they work? I read a lot of times Blargel's tutorial about them but...i keep not understanding these kind of object. So, could you give me kindly an explaination and maybe an example? (same thing with the arrays if you can).

Thanks!
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on December 19, 2012, 01:30:22 AM
As for the collision circle question it would be best to just not spawn any bullets in that area at all, rather than firing and deleting them immediately. You can perform a check by calculating the "random" position beforehand and then checking if it's within the radius like this:
posx = rand(32, 416);
posy = rand(16, 464);
//while the spawning position is inside that circle
while(((posy-GetPlayerY)^2+(posx-GetPlayerX)^2)^0.5 < radius){
   //recalculate the position to something else
   posx = rand(32, 416);
   posy = rand(16, 464);
}
shootbullet(posx, posy);


Quote
I wonder how to make the polygon move like a shot, in all the possible way. Move it like a whole or like Zun star of Sanae, that appear as a star but then is fired as a lot of single bullets
This requires a basic knowledge of trigonometry and how to manipulate objects. Unfortunately, even if we give you one example, you will likely not be able to figure out how to change the pattern around, without having enough know-how to do the whole thing yourself in the first place.

Quote
Arrays... what should i write in a script to make them works for, like, give different angles or speed to bullets? So, how do i use in general arrays? I know what they are and what they do, but i keep failing when i use them...i freeze danmakufu. So, maybe i type the wrong strings when i create and use an array...
Type the wrong string? Hm? Not sure what you mean. In general you don't need to really use arrays to hold angles and speeds unless the values are so odd/unrelated that you couldn't just type the values out when using them. Arrays aren't really used for that sort of thing. But freezing danmakufu when using arrays definitely means you aren't using them properly, so if you could provide an example of something that freezes/crashes/etc, that would be nice.

Effect Objects: Have you tried watching Hele's tutorial(s)? It also covers effect objects. (Also the written effect object tutorial is by Nuclear Cheese)
http://www.youtube.com/watch?v=EMw7DOWYMkw
Additionally, do you understand how objects work in general? What in particular is troublesome?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on December 19, 2012, 02:18:02 AM
Quick question:

If you want to use the C button in a player script to change the nature of what is happening, what would you insert into the if/while statement?

Code: [Select]
if(GetKeyState(VK_USER)==KEY_PUSH)
The above is what was used in the Byakuren script I saw, but does that always refer to the C button or can it refer to something else as well?

To be more specific, I've realized that the player script I'm working on has an absurdly difficult set of spellcards, and I'm going to port my current project instead. The issue is that if I use set drops like in the original, it's going to be inconvenient, so I thought about a shot/bomb change similar to Puremrz's in Juuni Jumon. The problem is correctly implementing it while preventing DrawLoop failures and while allowing it to work with the C button.

P.S. This can probably be answered by looking at the Remilia player script, but how do you create a laser shot that stays in place and constantly does damage, and how do you control the graphics for it?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on December 19, 2012, 03:15:14 AM
In 0.12, it always refers to the C key. Development was halted before the actual virtual key functionality was implemented. In ph3 you can set all virtual keys in the config and it works as it was originally intended.

Checking the C key is just a matter of having a global flag variable and starting a task on @Init where it checks per frame if VK_USER is pushed/held, or if it's released/off. Then it sets the global variable accordingly. This doesn't really need to be done since checking the key state is essentially a flag to begin with, but it removes clutter and gives you a bit more control over what the flag signifies and how it can be changed.

As far as modifying behaviour based on the flag, you could split two variants of one behaviour into two functions. Each frame you would check the flag, and if it's off you run behaviour A and if it's on you run behaviour B. Again, this mostly just organizes the code better and makes modifying things easier.

Laser: Isolate the effect and the damage. Damage is generally done by an extending line segment plus-minus some width, and is easy to calculate if the laser just points up. Or, you could have shot segments as objects that move around according to normal firing behaviour plus moving around with the player. There are a bunch of ways to do it, but you mainly want to avoid using the effect as the damage source. What exactly do you mean by "stays in place", though? Like leaving the lasers somewhere while you move around? If that's the case, you just use an object or position marker as the laser/shot source rather than the player.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on December 20, 2012, 01:11:03 AM
I have another very annoying question (probably can find dozens of errors in the slightly updated script).

http://pastebin.com/embed_js.php?i=ZmqJJkHi (http://pastebin.com/embed_js.php?i=ZmqJJkHi)

Basically, after calling the spell once, nothing spawns (expected that much). Once the invincibility period is up, nothing happens. Once the set of yields before the End() is done executing, the player disappears, the option graphics disappear, and all of the lives are gone (or at least the icons are lost). Calling a spellcard again has an OK cutin, but immediately after, Danmakufu crashes.

If you have something to say about the leaf tasks, refer it back to the main spell_talisman task if possible, since those two were copies of the original.

Thanks.

P.S. How do you control bullet speeds for spell objects? No other scripts I see have Obj_SetSpeed or Obj_SetAngle (which I understand to be normal object bullet commands).

P.P.S. I know that there's a lot of clutter and that I haven't removed any of the object effects. It's because I don't know what's going wrong in the first place, and if it is possible to fix it, I'd prefer to fix the bigger problem first.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on December 20, 2012, 02:08:51 AM
I have another very annoying question (probably can find dozens of errors in the slightly updated script).

http://pastebin.com/embed_js.php?i=ZmqJJkHi (http://pastebin.com/embed_js.php?i=ZmqJJkHi)

Basically, after calling the spell once, nothing spawns (expected that much). Once the invincibility period is up, nothing happens. Once the set of yields before the End() is done executing, the player disappears, the option graphics disappear, and all of the lives are gone (or at least the icons are lost). Calling a spellcard again has an OK cutin, but immediately after, Danmakufu crashes.

If you have something to say about the leaf tasks, refer it back to the main spell_talisman task if possible, since those two were copies of the original.

Thanks.


You haven't used ObjEffect_SetVertexXY yet. UV coordinates is where on the image each vertex corresponds to. XY coordinates is where in the playing field you want each vertex, relative to the object's position. This makes it possible to warp images if you wish to do so. As you're probably just trying to make each image look the same, and the UV coordinates indicate to me that your talisman is 17x24, you probably want to add the following code:
Code: [Select]
    ObjEffect_SetVertexXY(objtalisman,0,-8,-12);
    ObjEffect_SetVertexXY(objtalisman,1,9,-12);
    ObjEffect_SetVertexXY(objtalisman,2,9,12);
    ObjEffect_SetVertexXY(objtalisman,3,-8,12);

Of course, you'll need to change your leaf tasks as well.

Quote
P.S. How do you control bullet speeds for spell objects? No other scripts I see have Obj_SetSpeed or Obj_SetAngle (which I understand to be normal object bullet commands).
If Obj_SetSpeed and Obj_SetAngle don't work, then manually move them every frame with Obj_SetPosition.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on December 20, 2012, 02:23:00 AM
Thanks!

Now the talismans appear! Of course, the images still disappear, danmakufu still crashes, and they don't execute the commands I want them to execute, but at least they appear!
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on December 20, 2012, 03:26:55 AM
Judging by what you meant by "normal object bullet commands", you seem to think that spell objects are object bullets. They aren't. Spell objects are a subset of effect objects, which themselves are also not object bullets. You should still be able to use SetAngle and SetSpeed with spell objects, but they won't affect the graphical angle of the object.

First off, the line to change the vertex alpha values is written before the vertices are created. This might be the cause of the crash?
Next, make sure to adjust your talismanxpos and ypos each frame, otherwise the intersection circle stays at their spawn point. Or rather, since you're still using spell objects, do as Blargel said and use Obj_SetXY to move the object, and then use Obj_GetXY in place of your talismanpos variables.

You also never increase spellcount, so it will never make the child shots. Oh yes you do, you just do it in a weird way. The thing is, you don't really need to reference the global spellcount in order to fire your shots. This part:
Code: [Select]
while(!Obj_BeDeleted(objtalisman)){
   ObjSpell_SetIntersecrionCircle(objtalisman,talismanxpos,talismanypos,30,10,true);
   if(spellcount == 90 || spellcount == 0){ //Split at 90, 180 only.
      spell_leaf1(Obj_GetAngle(objtalisman) - 30, Obj_GetX(objtalisman), Obj_GetY(objtalisman));
      spell_leaf1(Obj_GetAngle(objtalisman) + 30, Obj_GetX(objtalisman), Obj_GetY(objtalisman));
   }
   yield;
}
can be trivially changed to
Code: [Select]
loop(90){
   ObjSpell_SetIntersecrionCircle(objtalisman,talismanxpos,talismanypos,30,10,true);
   yield;
}
spell_leaf1(Obj_GetAngle(objtalisman) - 30, Obj_GetX(objtalisman), Obj_GetY(objtalisman));
spell_leaf1(Obj_GetAngle(objtalisman) + 30, Obj_GetX(objtalisman), Obj_GetY(objtalisman));
loop(90){
   ObjSpell_SetIntersecrionCircle(objtalisman,talismanxpos,talismanypos,30,10,true);
   yield;
}

and it can be done similarly in the first leaf function when waiting 90 frames from its creation to make the second leaves.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on December 20, 2012, 03:33:34 AM
You never increase spellcount, so it will never make the child shots.

Code: [Select]
while(spellcount < 240){
      if(spellcount == 0){
spellangle = 0;
loop(30){
  spell_talisman(spellangle, GetPlayerX, GetPlayerY);
  spellangle += 12;
}
      }
      spellcount++;
      yield;
    } //closes while statement

I'm sure that the spell count++ is enclosed within the while(spell count < 240) statement. Or is it something that involves the spell talisman task not reading the spellcount increment?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on December 20, 2012, 03:43:49 AM
My mistake, yes. I corrected it immediately but I included another suggestion and you got here before I could submit it.

It's good practice to not use global variables in tasks and functions unless completely necessary. Instead if you need to you should be passing the global variables as arguments. This keeps everything needed in the function inside of that function and only that function. I didn't see your use of spellcount because in most cases you would use a local spellcount variable per task rather than referencing the one, or omit its usage entirely like my above suggestion.

Additionally, with the way you have it set up, once you get this working you can compact your three tasks into one recursive task and save a bunch of space.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on December 20, 2012, 04:33:23 AM
OK. I see what you mean.

Basically, instead of incrementing the global var, I just set up an action for that time period (since my Main Loop has a yield, count is already being incremented, and the task is being done at the same rate), then perform an action (the eruption), then do the same procedure once more to create the desired effect.

It sort of looks like the organization of some of the stage scripts where you don't even increment a variable but just wait for a certain point before executing the next command. I think I can implement this part successfully (everything else is a different story).

Thank you very much.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on December 21, 2012, 12:18:17 AM
Okay. The crash still occurs; I'll post a video of it.

The only major issues with the first player script now are the fact that the spell bullets don't change their heading when they fly at a different direction (can probably do this by looking at the previous responses and the Function list), and the issue regarding the crash, so this script is almost bug free.

Code: [Select]
fixme:d3d8:d3d8_device_GetInfo iface 0x1a15e0, info_id 0x4, info 0x328534, info_size 16 stub!
Assertion failed: (iface->lpVtbl == (const IDirect3DBaseTexture8Vtbl *)&Direct3DTexture8_Vtbl || iface->lpVtbl == (const IDirect3DBaseTexture8Vtbl *)&Direct3DCubeTexture8_Vtbl || iface->lpVtbl == (const IDirect3DBaseTexture8Vtbl *)&Direct3DVolumeTexture8_Vtbl), function unsafe_impl_from_IDirect3DBaseTexture8, file texture.c, line 1160.
wine: Assertion failed at address 0x000b:0x9389d9c6 (thread 0009), starting debugger...

Above is the error message that appeared in the Terminal Window.

Below is the Video Link:
http://www.youtube.com/watch?v=V4xQetjxsEE&feature=youtu.be (http://www.youtube.com/watch?v=V4xQetjxsEE&feature=youtu.be)

The most likely cause of the bug is the following:
For the main script, I have a picture called "Suiroga.png" that holds all of the spell data, shot and user pictures, etc.
This is called during @Initialize of the main script as a variable.
The same picture is also used in the spells, but is called with a different variable name. At the end of the spell, in @Finalize, this variable is deleted.

Perhaps Danmakufu deleted data for the first (called in the main script's Initialize) call as well? If so, then I just move it to a different image.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on December 21, 2012, 12:50:13 AM
EDIT: Crash resolved. However, Danmakufu cannot read the new .png for some reason. (although I just renamed an edited copy of the original shotsheet.)

Code: [Select]
script_spell TalismanEruption{
  let spellcount=0;
  let spellangle=0;
  let spimg_suiroga = GetCurrentScriptDirectory()~"spellA.png";
  task spell_talisman(angle, x, y){
    let objtalisman=Obj_Create(OBJ_SPELL);
    let talismanangle=angle;
    Obj_SetPosition(objtalisman, x, y);
    Obj_SetAngle(objtalisman, angle);
    Obj_SetSpeed(objtalisman, 5);
    ObjEffect_SetTexture(objtalisman,spimg_suiroga);
    ObjEffect_SetRenderState(objtalisman,ADD);
    ObjEffect_CreateVertex(objtalisman,4);
    ObjEffect_SetPrimitiveType(objtalisman,PRIMITIVE_TRIANGLEFAN);
    ObjEffect_SetVertexUV(objtalisman,0,10,7);
    ObjEffect_SetVertexUV(objtalisman,1,27,7);
    ObjEffect_SetVertexUV(objtalisman,2,27,31);
    ObjEffect_SetVertexUV(objtalisman,3,10,31);
    ObjEffect_SetVertexXY(objtalisman,0,-8,-12);
    ObjEffect_SetVertexXY(objtalisman,1,9,-12);
    ObjEffect_SetVertexXY(objtalisman,2,9,12);
    ObjEffect_SetVertexXY(objtalisman,3,-8,12);
    //Obj_SetAlpha(objtalisman,200); //Orig
    ascent(i in 0..4){ObjEffect_SetVertexColor(objtalisman, i, 255, 255, 255, 255);}

Above is the code that lists the object properties. Below is a screenshot proving that spellA.png exists.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on December 21, 2012, 01:58:22 AM
I don't see anything particularly wrong with the posted code, so let's get the obvious question out of the way.

Did you load the image? It's definitely not in the code snippet you gave us.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on December 21, 2012, 02:12:24 AM
I don't see anything particularly wrong with the posted code, so let's get the obvious question out of the way.

Did you load the image? It's definitely not in the code snippet you gave us.

O_O

...Oops.

Edit: My SuirogaA player script now works beautifully (except for the artwork). I don't thing the angular direction matters much, and the bomb has been weakened to the point that no longer does 18000 damage point blank. Thanks! (Now I'll start asking questions about spell lasers and image control).
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on December 21, 2012, 05:56:14 AM
Whoo, another annoying question. But I've been searching everywhere for the problem.
http://pastebin.com/tsV2Geve <----Code Basic Stuff, The firing looks confusing, want to test it but...
http://puu.sh/1DpZw BAM Error Message with japanese that I can't understand  :V
And then BAM, another error message with the same message saying that about SetGraphicScale in Drawloop.
I tried lots of stuff, like taking the commands out, but the error message just targeted another command to pinpoint an error to. Why is this doing this?
Thanks in advance.  :3
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on December 21, 2012, 07:16:47 AM
Quote
dir++;
dir++;
dir++;
dir++;
dir++;
oh god dir+=5; please
Quote
wait(60);
yield;
wait(61);

You forgot your #ScriptVersion[2].
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on December 22, 2012, 03:42:53 AM
OK. In a player script, how would you use player lasers?

Code: [Select]
  task LighdraOption{ //INCOMPLETE
    //Following adapted from AliceMain (Team Sorcery script)
    //In all honesty, it'd be more efficient to have them just move along...
    let obj_bluelaser = Obj_Create(OBJ_LASER);
    ObjShot_SetGraphic(obj_bluelaser, 11);
    ObjShot_SetDamage(obj_bluelaser, 0.5);
    ObjShot_SetPenetration(obj_bluelaser, 10000);
    ObjLaser_SetWidth(obj_bluelaser, 5);
    ObjLaser_SetLength(obj_bluelaser, GetClipMaxY());
    ObjLaser_SetSource(obj_bluelaser, false); //delay cloud at source shown or not
    Obj_SetAlpha(obj_bluelaser, 230);
    Obj_SetAngle(obj_bluelaser, 270);
    Obj_SetSpeed(obj_bluelaser, 0);
    Obj_SetAutoDelete(obj_bluelaser,true); //I'm going to delete every frame, so... //MotK: This part is questionable, and feel free to tell me to set it to false.
  }

My aim for this task is to get the options to fire a laser forwards and backwards, similar to the attached picture. It moves along with the option. However, it only lasts when that shottype is in action (you can change shottypes in mid-battle by pressing C, which alters a global variable and changes the DrawLoop, shots, etc.). The issue is making sure that the laser stops firing when the variable changes, and that the image loads correctly. Also, the laser hitbox moves along with the options, allowing for sweeping the enemies in a stage clean.

The picture attached shows the NetLogo original; what I am planning to do is for Danmakufu, add lasers going at a 180 degree heading (danmakufu 90 degrees) from the options.

Any help would be greatly appreciated; the source from where I derived the above code has been cited in the second comment.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lunasa Prismriver on December 22, 2012, 11:11:05 AM
I'm not sure if it would work but you can try.  :ohdear:
Add this in your task.
Code: [Select]
while(!Obj_BeDeleted(obj_bluelaser)){
    if(GetCommonData("ShotTypeGlobalVariable") != "C"){ //Test your global variable
        Obj_Delete(obj_bluelaser);
    }
    yield;
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on December 22, 2012, 03:06:21 PM
Thanks for the Obj_Delete help.

Now... how exactly do you use 'User Defined Arguments?' In one script, they were put inside [], and I assume that in that scenario, they chose which option task's variables to access. Is that correct?

Either way, this is my current code for options firing lasers up and downwards. The lasers should move along with the options, and continuously pierce.

Code: [Select]
task LighdraOption(OrigX,OrigY,dir,optionID){ //INCOMPLETE
    //Following adapted from AliceMain (Team Sorcery script) and MarisaA
    //In all honesty, it'd be more efficient to have them just move along...
    //while not being deleted, set the lasers to options with GetPlayer#+optionpos.[ID] (ID of options)
    let obj_bluelaser = Obj_Create(OBJ_LASER);
    ObjShot_SetGraphic(obj_bluelaser, 11);
    ObjShot_SetDamage(obj_bluelaser, 0.5);
    ObjShot_SetPenetration(obj_bluelaser, 10000);
    ObjLaser_SetWidth(obj_bluelaser, 5);
    ObjLaser_SetLength(obj_bluelaser, 512); //Alt, GetClipMaxY or GetClipMinY
    ObjLaser_SetSource(obj_bluelaser, false); //delay cloud at source shown or not
    Obj_SetPosition(OrigX, OrigY);
    Obj_SetAlpha(obj_bluelaser, 230);
    Obj_SetAngle(obj_bluelaser, dir);
    Obj_SetSpeed(obj_bluelaser, 0);
    Obj_SetAutoDelete(obj_bluelaser,false);
    Obj_SetCollisionToPlayer(obj_bluelaser,false);
    while(!Obj_BeDeleted(obj_bluelaser)){
      if(Veetype != 2){ //Test your global variable
        Obj_Delete(obj_bluelaser);
        }
      Obj_SetX(obj_bluelaser, Obj_GetX(obj_option)[optionID]);
      yield;
      }
    }

The following code is called within the option tasks.

Code: [Select]
if(veetype == 2){ //Lighdra
  //LighdraOption(GetPlayerX()+optionxpos,GetPlayerY()+optionypos,90,ID)
  //LighdraOption(GetPlayerX()+optionxpos,GetPlayerY()+optionypos,270,ID)
}

Each option task begins like this:

Code: [Select]
task OptionL(position) {
    let ID=position;

I'm not specifically asking if the code works (because it probably doesn't as of right now). However, it any of you can give some advice on laser shots, I'd appreciate it. Thank you.

P.S. I don't know if the image I used is long enough. Would the solution be to alter the Y direction scale of the image and have the actual image of the laser as a seperate Obj_Effect?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: puremrz on December 22, 2012, 08:38:43 PM
I'm trying to create a semi-random number generator without any success so far.
At the beginning of the script a CommonData is made with a number between 0.00001 and 1 which will be used as a seed for the rest of the script.

This is what I have so far:
Code: [Select]
step 1: function Random(value){
step 2: GetCommonData("RandomNumber")*value???
step 3: return(a new number between 0 and 1); }
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on December 22, 2012, 11:07:49 PM
What you want is psrand (http://dmf.shrinemaiden.org/wiki/Mathematical_or_Information_Functions_%280.12m%29#psrand) to set the seed and prand (http://dmf.shrinemaiden.org/wiki/Mathematical_or_Information_Functions_%280.12m%29#prand) or prand_int (http://dmf.shrinemaiden.org/wiki/Mathematical_or_Information_Functions_%280.12m%29#prand_int) to generate the random number.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Chuckolator on December 26, 2012, 07:10:25 AM
Is there any way to play with frameskip like the real games? I wouldn't be surprised if I was getting 20FPS at some points, and 1/2 frameskip would make it tolerable.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on December 26, 2012, 08:18:29 AM
It's right there in the config.exe.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Chuckolator on December 26, 2012, 06:14:35 PM
how did I not see that before <_<
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on December 31, 2012, 08:43:55 PM
Okay. Danmakufu... CRASH REPORT!

Attached is the Wine Backtrace! I will post the player script ASAP.

Background: I have a player script that changes forms when you press the C button. Each individual form has different shots, bombs, etc. However, two of the possible forms currently do not have a set bomb (it is not even called) and all of the bombs use the same .png file for their shots. The crash occurs when bombing in a different form twice. That means, bomb in one form, change to another form, then bomb in that form, then bomb in that form again. I do not know the cause, but it is not the incorrect Obj_Effect syntax (I have tested this already, and the usage of Obj_SetSpeed/Angle/Position with effect objects is not the cause of the crash).

All and any help would be appreciated if possible.

http://pastebin.com/NGdes41Q (http://pastebin.com/NGdes41Q)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Captainragequit on January 02, 2013, 06:01:29 AM
I've been following this tutorial
http://www.youtube.com/watch?v=B1Ok4kkhY38

And came across a problem. The image will not load. I tried tweaking everything, but the image for the boss just doesn't appear.
http://pastebin.com/QyEBfkcN
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on January 02, 2013, 06:29:53 AM
GetCurrentScriptDirectory ~ ("script   utorialzeke1.png") probably doesn't exist unless you did something really weird making directories. It's likely "script   utorialzeke1.png" (as an absolute path) or GetCurrentScriptDirectory ~ "zeke1.png" (as a relative path).

Also wait(60); yield; is just wait(61) or loop(61){ yield; }
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Captainragequit on January 02, 2013, 07:07:00 AM
ah, that fixed it. Thanks!  :derp:
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Atfyntify on January 02, 2013, 08:25:02 AM
http://pastebin.com/EYFxgz4T

I have a problem with the sprite animation there o3o

can anyone help?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on January 02, 2013, 10:27:08 AM
You never defined f, silly.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Atfyntify on January 02, 2013, 11:34:49 AM
You never defined f, silly.
Oh haha, dumb problem. Fixed. thanks drake. c:
Oh wait its not exactly fixed yet. ._.
http://pastebin.com/1H3rNCHs

I have a problem with the Superbullet. .n.
welp I'm still new at writing scripts lol
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lunasa Prismriver on January 02, 2013, 01:10:30 PM
You forget to include your function file and to call it in @Initialize.  :)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Byronyello on January 02, 2013, 03:38:37 PM
I've been wondering, how would you create a pentagram, in order to reflect Sanae's types of spells? Actual code is unnecessary, unless it helps with explaining it. Thanks in advance.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lunasa Prismriver on January 02, 2013, 04:30:50 PM
The easiest manner to create a pentagram is to find the 5 points and then to rely them (ther order is 1,3,5, and 4). Besides,you can use invisible familiars for this. For a regular pentagram, finding the points is easy, you just have to use sine and cosine and add 360/5 each times.  :)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Atfyntify on January 03, 2013, 08:09:18 AM
You forget to include your function file and to call it in @Initialize.  :)
Hmm I don't exactly get what you mean? I do have @Initialize. And what function file? o:
sorry for asking these questions lol I'm still sorta new at writing scripts
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lunasa Prismriver on January 03, 2013, 11:20:36 AM
Forgot all what I said in my previous post. I misread your code :ohdear:
 
Your supershot function is full of typo :
Code: [Select]
task Superbullet(x,y,v,dir,graphic,delay){
                       let obj - obj_create(OBJ_SHOT);
               Obj_SetPosition(obj,3,5);
               Obj_SetSpeed(obj,0.9);
               Obj_SetAngle(obj,54);
               Obj Shot_Setgraphic(obj,AQUA01);
               Obj Shot_SetDelay(obj,30);
          } 
You've put "-" instead of "=" at "let obj".
The two last lines have a useless space between Obj and Shot.
You forget the capital at SetGraphic and Obj_Create.
Your task is asking for arguments but you're not using them. So here a better code  ;) :
Code: [Select]
task Superbullet(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);
          } 
I hope I help you.  :)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Byronyello on January 03, 2013, 03:03:34 PM
The easiest manner to create a pentagram is to find the 5 points and then to rely them (ther order is 1,3,5, and 4). Besides,you can use invisible familiars for this. For a regular pentagram, finding the points is easy, you just have to use sine and cosine and add 360/5 each times.  :)

Hmm. That's what I did, just not with invisible familiars. I'll give it another try and see what happens. Oh, and: "you just have to use sine and cosine and add 360/5 each times" isn't helpful. If I didn't know what you meant, I'd be wondering 'use sine and cosine how?' and 'add 360/5 to what?'.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lunasa Prismriver on January 03, 2013, 03:42:47 PM
Yeah, I'll explain this more.
Since I'm not very good at english, here a little scheme for explain the idea how find the coordinates of the five points.
[attach=1]
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Captainragequit on January 03, 2013, 09:05:10 PM
http://pastebin.com/H0t0sASK

I keep getting an error saying
"script_enemy_main<complete gibberish in square symbols>"
I have all of my brackets and quotes in order. What did I mess up on? I finished working on adding movement patterns.

never mind, I spotted it, I forgot to place a bracket

Actually that didn't fix it.... darn it.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Alicirno on January 03, 2013, 09:52:41 PM
Code: [Select]
task movement{
loop{
SetMovePosition01(GetCenterX -100,120,5);
wait(120);
SetMovePosition01(GetCenterX +100,120,5);
wait(120);
yield;
}

to
Code: [Select]
task movement{
loop{
SetMovePosition01(GetCenterX -100,120,5);
wait(120);
SetMovePosition01(GetCenterX +100,120,5);
wait(120);
}
}
There was a bracket missing at the end of the movement task. It worked after I added it. I removed an unnecessary yield; (I'm not sure where you put the extra bracket)

Also, doing
Code: [Select]
wait(30);
yield;
is basically telling the script to do
Code: [Select]
wait(31);
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Atfyntify on January 04, 2013, 08:29:45 AM
Forgot all what I said in my previous post. I misread your code :ohdear:
 
Your supershot function is full of typo :
Code: [Select]
task Superbullet(x,y,v,dir,graphic,delay){
                       let obj - obj_create(OBJ_SHOT);
               Obj_SetPosition(obj,3,5);
               Obj_SetSpeed(obj,0.9);
               Obj_SetAngle(obj,54);
               Obj Shot_Setgraphic(obj,AQUA01);
               Obj Shot_SetDelay(obj,30);
          } 
You've put "-" instead of "=" at "let obj".
The two last lines have a useless space between Obj and Shot.
You forget the capital at SetGraphic and Obj_Create.
Your task is asking for arguments but you're not using them. So here a better code  ;) :
Code: [Select]
task Superbullet(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);
          } 
I hope I help you.  :)

(http://i47.tinypic.com/htd17p.png)

I replaced what I wrote with yours, but I get this error :(
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lunasa Prismriver on January 04, 2013, 10:06:40 AM
You must put arguments like this :
Code: [Select]
Superbullet(GetX,GetY,2,GetAngleToPlayer,AQUA22,10);
http://pastebin.com/H0t0sASK (http://pastebin.com/H0t0sASK)

I keep getting an error saying
"script_enemy_main<complete gibberish in square symbols>"
I have all of my brackets and quotes in order. What did I mess up on? I finished working on adding movement patterns.

never mind, I spotted it, I forgot to place a bracket

Actually that didn't fix it.... darn it.

In movement task, you forget a "}".
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 05, 2013, 12:08:39 AM
@Atfyntify

Are you using Japanese Locale? Looks like Chinese to me. The error messages won't make much sense unless you are using Japanese Locale, and that may hamper future translation of the error messages.

Just a suggestion.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Byronyello on January 05, 2013, 03:22:44 AM
Yeah, I'll explain this more.
Since I'm not very good at english, here a little scheme for explain the idea how find the coordinates of the five points.
[attach=1]
Eh.. I already knew what you meant. I was just saying that when you're exaplaining it to others, you won't want to say: "use sine and cosine and add 360/5 each times". I say this because I imagine a lot of people who can't use Google properlyneed help won't know what sine/cosine even do, never mind how to use them in the context of a game.

Anyway, I'm wondering how one would go about finding the path that the familiar(s) would have to take? Off the top of my head:
Code: [Select]
// assume we have a 'wait' task, a 'sqrt' function and a 'spawnBullet' function.
task TMoveFamiliar
{
//This is where the familarA = Obj_Create(OBJ_EFFECT) etc. goes.
//The radius of the 5 points from the boss is 100 pixels.

//Not sure whether this is the correct syntax for creating empty arrays... :P
let xPositions = [];
let yPositions = [];
let angles = [];
let distanceToNext[];
let radius = 100;

ascent(i in 0..5)
{
xPositions[i] = GetX+radius*cos(144*i);
yPositions[i] = GetY+radius*cos(144*i);
if(i!=5)
{
angles[i] = atan2(yPositions[i+1]-yPositions[i], xPositions[i+1]-xPositions[i]);
distanceToNext[i] = sqrt((xPositions[i]-xPositions[i+1])^2+(yPositions[i]-yPositions[i+1])^2);
} else {
angles[i] = atan2(yPositions[0]-yPositions[i], xPositions[0]-xPositions[i]);
distanceToNext[i] = sqrt((xPositions[i]-xPositions[0])^2+(yPositions[i]-yPositions[0])^2);
}
}

let starCreateTime = 120; //time it takes to make the star in frames.
ascent(i in 0..5)
{
SetAngle(angles[i]);
SetSpeed(distanceToNext[i]/(starCreateTime/5));
wait(starCreateTime/5);
spawnBullet(args);
}
}
Do you think this would work?

Also, I realise that all of the values in the 'distanceToNext' array will be the same, by virtue of being a regular pentagram. I'll clean it up when I'm properly coding it.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on January 05, 2013, 05:59:56 AM
You can do it without any fancy arrays, but yeah that's it. Each next line in the star is 144 degrees in the circle, so each chord that makes up the star is going to have the same length. There's a way to get the value other ways, but notice the chord from 72 degrees to -72 degrees in the previous picture makes a vertical line, and both are clearly the same distance from the zero-angle/origin. Since sin(72) is the vertical distance from the origin, just double it to get the chord length for the unit circle. Then you can multiply by the radius of the circle.
Because the star begins straight, you only add half the "turning" angle to get your first angle. You can see the turning angle is 144 (but you can figure it out as 360 - 36 + 180).

The code would be like:
Code: [Select]
task star{
   let radius = 100;
   let chord = sin(72)*2*radius;
   let fam = Obj_Create(OBJ_EFFECT);
   Obj_SetPosition(fam, GetEnemyX, GetEnemyY - 100);
   let time = 150;
   ascent(i in 0..5){
      Obj_SetSpeed(fam, chord/(time/5));
      Obj_SetAngle(fam, 72 + i*144);
      loop(time/5){ yield; }
   }
   Obj_Delete(fam);
}
Of course the actual bullets part is missing, but you can do that a few different ways.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Pepperized on January 05, 2013, 05:41:41 PM
Trying to run a stage script that executes enemy scripts.

I'm getting an error message saying script_enemy_main(bunch'a moonrunes)

I have checked the { }s and they are fine.

Enemy
Code: [Select]
script_enemy_main{

let spin = 0;
let CSD = GetCurrentScriptDirectory;
let imgFam = CSD ~ "system\fam.png";



@Initialize{
SetLife(3000);
LoadGraphic(imgFam);
mainTask;
}

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

@DrawLoop{

SetTexture(imgFam);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,235,215);
SetGraphicScale(0.1,0.1);
SetGraphicAngle(0,0,spin);
DrawGraphic(GetX,GetY);
spin-=10


}

@BackGround{
}

@Finalize{
DeleteGraphic(imgFam);
}

task mainTask{
yield;
movement;
fire;
}

task fire{
loop{
let x = 0;
while(x<7){
CreateShot02(GetX,GetY,0.5,GetAngleToPlayer,0.02,3,RED01,0);
CreateShot02(GetX,GetY,0.5,GetAngleToPlayer+20,0.02,3,RED01,0);
CreateShot02(GetX,GetY,0.5,GetAngleToPlayer-20,0.02,3,RED01,0);
x++;
yield;
wait(2);

}
x = 0;
wait(30);
yield;
}
}

task movement{
loop{
SetMovePositionHermite(GetX+100,GetY,300,90,300,270,40);
wait(240);
SetMovePosition01(GetClipMaxX,GetY,2);
wait(240);
yield;
}
}

function wait(w){
loop(w){yield;}
}

}

Stage
Code: [Select]
#TouhouDanmakufu[Stage1]
#Title[Stage1]
#Text[How to make stages in Danmakufu]
#Image[]
#Background[]
#BGM[]
#Player[FREE]
#ScriptVersion[2]

script_stage_main{

function Wait(let frames){
loop(frames){yield;}
}

function WaitForZeroEnemy{
while(GetEnemyNum != 0){yield;}
}

task stage{
Wait(120);
CreateEnemyFromFile(GetCurrentScriptDirectory~"enemy01.txt", GetCenterX-100, GetClipMinY, 0, 0, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"enemy01.txt", GetCenterX+100, GetClipMinY, 0, 0, 0);
WaitForZeroEnemy;
CreateEnemyFromScript("enemy01", GetCenterX, GetCenterY, 0, 0, 0);
WaitForZeroEnemy;
CreateEnemyBossFromFile(GetCurrentScriptDirectory~"elenna.txt", 0, 0, 0, 0, 0);
WaitForZeroEnemy;
Wait(60);
Clear;
}

@Initialize{
stage;
}
@MainLoop{
yield;
}
@Background{

}
@Finalize{

}
}
Code: [Select]
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Pepperized on January 05, 2013, 05:46:11 PM
Well this is embaressing.

I had #TouhouDanmakufu[Stage1] instead of [Stage]

Woops
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 05, 2013, 07:19:24 PM
Okay, a player script question.
My player script changes the character when you press C, and all of the characters have different bombs. If you are hit, you revert to a specific character. How can I alter it so that you deathbomb with the character you are in?

In script player main
Code: [Select]
  let veetype=0; //0=Veemon, 1=Exveemon 2=Lighdramon, 3=Fladramon, 4=Magnamon
In Initialize
Code: [Select]
    SetRebirthFrame(20); //Deathbomb time is a third of a second
    SetRebirthFrameReduction(0); //Make sure that death bomb time isn't reduced every deathbomb
In Main Loop
Code: [Select]
     if(GetKeyState(VK_USER)==KEY_PUSH){
      if(veetype < 4){
veetype++;
      }else{ //For Magnamon to ExVee
veetype = 1;
      }
    }
Code: [Select]
  @Missed {
    SetRebirthFrame(30);
    veetype = 0;
    SetSpeed(3.5,1);
  }
  @SpellCard {
    if(veetype==0){CutIn(KOUMA, "Three Ray Vee Blaster", img_cutinV);
      UseSpellCard("VeeBlaster", 0);
    }
    if(veetype==1){CutIn(KOUMA, "X Laser", img_cutinX);
      UseSpellCard("XLaser", 0);
    }
    if(veetype==2){CutIn(KOUMA, "Lightning Discharge", img_cutinL);
      UseSpellCard("LightningDischarge", 0);
    } //No pun intended
    if(veetype==3){CutIn(KOUMA, "Triple Flame Wave", img_cutinF);
      UseSpellCard("FlameWave", 0);
    }
    if(veetype==4){CutIn(KOUMA, "Holy Wipeout", img_cutinM);
      UseSpellCard("HolyWipeout", 0);
    }
  }
The above statements all control the deaths, bombs, and player forms. The question is, how do I alter it so that I can death bomb with the character in play? Or is there an "if(!"DEATHBOMB"){}" method? (there's OnBomb, but the player deathbombs after he has already been hit and the stuff has been executed.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lunasa Prismriver on January 05, 2013, 09:53:54 PM
Code: [Select]
@SpellCard{
 if(IsLastSpell == true){
  CutIn(KOUMA, "Last Spell Bomb", img_cutinL);
  UseSpellCard("Last Spell Bomb", 0);
 }else{
  CutIn(KOUMA, "Lightning Discharge", img_cutinL);
  UseSpellCard("LightningDischarge", 0);
 }
}

Other useful functions for players scripts : http://dmf.shrinemaiden.org/wiki/Character_Script_Functions_(0.12m)#IsLastSpell (http://dmf.shrinemaiden.org/wiki/Character_Script_Functions_(0.12m)#IsLastSpell)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on January 05, 2013, 10:26:17 PM
Well this is embaressing.

I had #TouhouDanmakufu[Stage1] instead of [Stage]

Woops
You also have spin-=10 without a semicolon. And please, next time put whole scripts and long segments of code into pastebin.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 05, 2013, 11:05:16 PM
Code: [Select]
@SpellCard{
 if(IsLastSpell == true){
  CutIn(KOUMA, "Last Spell Bomb", img_cutinL);
  UseSpellCard("Last Spell Bomb", 0);
 }else{
  CutIn(KOUMA, "Lightning Discharge", img_cutinL);
  UseSpellCard("LightningDischarge", 0);
 }
}

This code actually doesn't help at all; I'm not trying to have a separate bomb for normal spell and last spell (though that IsLastSpell will come in handy later on). By the time the spell is called, @MainLoop has already finished and the player has already changed player types. It will counter bomb with the default bomb rather than the bomb of the character that was just in play.

To give an example of what I am trying to do, imagine SAMarisaB(Patchy) but with different bombs, different speed,etc. for each form. Sort of like Puremrz' Juuni Jumon player character, except that you revert to a specific character upon death and can change types with a press of a button.

Also, what trigonometric functions would you use for the SetVertexXY values of an effect laser that always points at a certain degree angle and moves along with the player? The laser's width is 5 pixels.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on January 05, 2013, 11:36:16 PM
Try yielding the Missed loop for the deathbomb period before resetting the type.

Laser: You don't rotate graphics by manually changing their XYs. Just use ObjEffect_SetAngle(obj, 0, 0, z).
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Byronyello on January 06, 2013, 12:12:08 AM
You can do it without any fancy arrays, but yeah that's it. Each next line in the star is 144 degrees in the circle, so each chord that makes up the star is going to have the same length. There's a way to get the value other ways, but notice the chord from 72 degrees to -72 degrees in the previous picture makes a vertical line, and both are clearly the same distance from the zero-angle/origin. Since sin(72) is the vertical distance from the origin, just double it to get the chord length for the unit circle. Then you can multiply by the radius of the circle.
Because the star begins straight, you only add half the "turning" angle to get your first angle. You can see the turning angle is 144 (but you can figure it out as 360 - 36 + 180).

The code would be like:
Code: [Select]
snipOf course the actual bullets part is missing, but you can do that a few different ways.

That's ace. Thanks!
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 06, 2013, 12:53:50 AM
Try yielding the Missed loop for the deathbomb period before resetting the type.

Laser: You don't rotate graphics by manually changing their XYs. Just use ObjEffect_SetAngle(obj, 0, 0, z).

For the first, you mean adding a yield; to the @Missed? The deathbomb time is 1/3 second, and that yield; would technically run MainLoop once, in 1/60 second. Wouldn't that still result in a large margin of error for the bomb?

For the laser, I have an actual laser with no graphic, and I have an effect laser that has the graphic. Do I still use SetVertexXY for the effect laser, or do I just use a ObjEffect_SetAngle? If I only use the latter, Danmakufu has no sense about the scale (which is why I'm using an effect object in the first place).

http://pastebin.com/KtPNwNYU (http://pastebin.com/KtPNwNYU)

The current task code is located above. The code is SUPPOSED to create an object laser and its graphic separately. The laser does damage, then is deleted immediately afterwards. Same will eventually happen to the graphic to prevent Danmakufu slowdown, but the results are currently unknown since I wasn't ready to test the unstable version.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on January 06, 2013, 03:43:26 AM
@Missed runs instead of MainLoop when you're hit, until you respawn. By yielding 20 frames and then resetting the type, you've waited through the deathbomb period and change back afterwards. I assume that @Missed ends if you deathbomb.

I'm not sure what you mean with your laser. Sure there's an invisible laser for damage purposes, and setting the XY vertices tells where around the object position to draw in order to make an accurate representation of the image. SetAngle then takes care of turning the graphic if needed. You don't really use the XYs to turn the graphic unless you're warping the image.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 06, 2013, 05:04:50 AM
...How do you use ObjEffect_SetAngle?

Besides Experimentation, that is. I understand using two angles to form 3D, but I'm not familiar with using 2 different values for a single 2D angle.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on January 06, 2013, 07:53:21 AM
That's why I wrote the parameters as (obj, 0, 0, z). You don't touch the x and y angles, just the z-angle.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 06, 2013, 01:43:05 PM
That's why I wrote the parameters as (obj, 0, 0, z). You don't touch the x and y angles, just the z-angle.

OK. So the plane you are viewing is the Z axis by default for object effects then?

Edit: The following is the current error, with all of the code of the task.

http://i1164.photobucket.com/albums/q570/SparenofIria/ScreenShot2013-01-06at90148AM_zpsc0f50393.png (http://i1164.photobucket.com/albums/q570/SparenofIria/ScreenShot2013-01-06at90148AM_zpsc0f50393.png)

Here's a breakdown of what Danmakufu does:
-The lasers fire correctly. No surprise there. (or at least I'm assuming they do, since the damage is building up on the DPS monitor)
-The effects don't work AT ALL. In the picture, there are supposed to be no lasers, since the task wasn't even called. Somehow, the task to create the image is being executed, yet it's not actually called. When the call to shoot is actually made, none of the lasers that are supposed to show up actually show up.

Refer to the image in this post for what is SUPPOSED to occur. (although the picture doesn't show the backwards blue lasers)
http://www.shrinemaiden.org/forum/index.php/topic,12397.msg927053.html#msg927053 (http://www.shrinemaiden.org/forum/index.php/topic,12397.msg927053.html#msg927053)

P.S. The Deathbomb things still didn't work.
Code: [Select]
  @Missed {
    loop(20){yield;}
    SetRebirthFrame(20);
    veetype = 0;
    SetSpeed(3.5,1);
  }

1/7/2013 Edit: I've released the current script here (I decided to change the original image rather than deal with the problems with the effects; I'll have to reread the Effect Object tutorial for everything else). http://www.shrinemaiden.org/forum/index.php/topic,13738.msg933431.html#msg933431 (http://www.shrinemaiden.org/forum/index.php/topic,13738.msg933431.html#msg933431)
It's hosted on Bulletforge. The death bomb issue is still a factor though.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on January 09, 2013, 02:57:33 AM
I'm not sure why I thought that would work. It doesn't work in the MainLoop because it runs every frame regardless and it's the exact same thing with Missed, so that was a dumb mistake on my part.

One way to do it would be to imitate how tasks interact with the MainLoop: start the designated task at the time you want and let it run its course. The only difference is that it's easy to do this with Initialize, but as far as I can tell you don't have a natural one-time event when you die, you just have the several frames of Missed. (ph3 solves this with Events!)
Instead you can start a task on Initialize that runs per frame and checks if you've died, then runs accordingly. You would also just need a yield in the Missed loop. It would basically be this:
Code: [Select]
task checkdeath{
loop{
if(OnMissed){
loop(GetRebirthFrame+60){yield;}
if(OnMissed){stuff;}
}
yield;
}
}

One way you can get around Missed's several frames is if you make a separate counting variable that goes up during Missed until GetRebirthFrame+60 and then does stuff and then stops working until you die again, but that's a bit roundabout and silly.

Another way is to have a flag variable for dying. Starts as false, you make it true during Missed, then in MainLoop you ask if it's true and if so do things and then reset. Less code, a bit messier in some aspects yet a bit cleaner in others than the first option, and by changing things on the first frame you've respawned it's juuuuust a bit possible that the changes happen too late, I'm not sure.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 09, 2013, 11:25:47 PM
Okay, a new question, regarding honing player shot bullets.

Code: [Select]
  task Magnahoning(speed, graphic, x, y){ //Based off of the Rumia script that comes with Danmakufu.
    let obj_smallhone = Obj_Create(OBJ_SHOT);
    Obj_SetX(obj_smallhone, x);
    Obj_SetY(obj_smallhone, y);
    Obj_SetSpeed(obj_smallhone, speed);
    ObjShot_SetGraphic(obj_smallhone, graphic);
    ObjShot_SetDamage(obj_smallhone, 2);
    ObjShot_SetPenetration(obj_smallhone, 1);
    while(!Obj_BeDeleted(obj_smallhone)){
      //let toAngle=atan2(GetEnemyY()-Obj_GetY(obj_smallhone), GetEnemyX()-Obj_GetX(obj_smallhone)); //old code
      //Obj_SetAngle(obj_smallhone, toAngle);
      if(GetEnemyNum > 0){ //V1.1 code
let toAngle=atan2(GetEnemyY()-Obj_GetY(obj_smallhone), GetEnemyX()-Obj_GetX(obj_smallhone));
        Obj_SetAngle(obj_smallhone, toAngle);
      }else{
Obj_SetAngle(obj_smallhone, 270);
      }
      yield;
    }
  }

I use this above code, which works fine. Usually. I even went and put the check to see if there's an enemy there. Apparently, that bit of code still messes up now and then, and I need a way to fix it.

I discovered the issue while testing out the ExRumia script that comes with the game, and it occured during the survival spell. Magnamon's bullets all honed in on the target, but since the target could not take any damage, they JUST SAT THERE and lagged Danmakufu. I read the player script tutorial for honing bullets, but this honing hones behind you and I decided that using someone else's script was sort of defeating the purpose of what I was trying to do, since my script is different.

An out of date script (Version 1.8 ) can be found in my code dump (PDDVee). http://www.shrinemaiden.org/forum/index.php/topic,13738.msg933431.html#msg933431 (http://www.shrinemaiden.org/forum/index.php/topic,13738.msg933431.html#msg933431) It should exhibit this problem perfectly when on Magnamon during any spell where the enemy is immune to bullets (and the enemy has no graphic, I guess.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 11, 2013, 11:17:49 PM
...And another question, regarding Stage scripts. 
Code: [Select]
  let section1 = GetCurrentScriptDirectory~"Danmaku101Section1.txt";
  let section2 = GetCurrentScriptDirectory~"Danmaku101Section2.txt";
  let music1 = GetCurrentScriptDirectory~"XW26.wav";

  task Stage{
    wait(1); //Required to be here, greater than 0.
    CreateEnemyBossFromFile(section1, GetCenterX, 0, 1.4, 90, 0);
    wait(60);
    CreateEnemyBossFromFile(section2, GetCenterX, 0, 1.4, 90, 0);
    WaitForZeroEnemy;
    wait(180);
    Clear;
  }

The code above is SUPPOSED to call the first section, then call the second section. The issue is that it never does.
Edit: Apparently, not having a "WaitForZeroEnemy" after the first call is the issue. It's solved now.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on January 12, 2013, 12:41:50 AM
For your homing bullet problem. Just make it stop homing after a set time and fly off the edge of the screen to be deleted.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 12, 2013, 12:59:52 AM
If I set a variable in the task and decrement it, then the bug will still be present, just hidden slightly. The bullets will still cluster at the site of the "boss."

Also, the only place I've seen the bug having an ugly effect is the ExRumia script. It also occurs while a boss is dying. The bug is attached below.

ExRumia Script bug with PDDVee V2.0 (http://i1164.photobucket.com/albums/q570/SparenofIria/Bug_zps878726a9.png)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on January 12, 2013, 03:54:29 AM
It'll happen any time the boss has no hitbox but still has an id and/or position attached to it. There is no way to check if the boss has a hitbox associated with it in Danmakufu 0.12m so you have to do something to account for this in the bullet's logic. If you don't like my first idea, you can try this instead: if you make it check how close it is to the boss and turns off the homing logic at a close distance, you will have an effect where the shots head towards the boss's position, but passes through them if they don 't have a hitbox.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 13, 2013, 07:32:57 PM
New question: How do you control the acceleration of object bullets?

In my setup, I have a bullet bounce off a wall. I want that bullet to begin accelerating with gravity. All of my attempts have failed so far; I'm not doing the method that is usually accepted. For more specifics, the gravity effect I want is that of Shizuha's midboss spell.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lunasa Prismriver on January 13, 2013, 09:22:29 PM
New question: How do you control the acceleration of object bullets?

In my setup, I have a bullet bounce off a wall. I want that bullet to begin accelerating with gravity. All of my attempts have failed so far; I'm not doing the method that is usually accepted. For more specifics, the gravity effect I want is that of Shizuha's midboss spell.
I haven't tested the code but I think it should work.
 
Code: [Select]
task AccelerationShot(x,y,startspeed,acceleration,angle,graphic,delay) {
 let ObjShot = Obj_Create(OBJ_SHOT);
 let OldSpeed = startspeed;
   
 Obj_SetPosition(ObjShot,x,y);
 Obj_SetSpeed(ObjShot, startspeed);
 ObjShot_SetBombResist(ObjShot, false);
 ObjShot_SetGraphic(ObjShot, graphic);
 Obj_SetAngle(ObjShot, angle);
 ObjShot_SetDelay(ObjShot, delay);
 while(!Obj_BeDeleted(ObjShot)){
  Obj_SetSpeed(ObjShot, OldSpeed+acceleration);
  OldSpeed = OldSpeed+acceleration;
  yield; 
 }
}
 
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 13, 2013, 09:32:32 PM
The angle changes as well based on the acceleration. That's my problem.

The issue is that I do not know how to change an angle measure into x and y accelerations and velocities, or how to take an angle and speed and then increment them after they have bounced off of a wall so that they fall like gravity.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on January 13, 2013, 10:01:48 PM
Look at a right triangle.
(http://i.imgur.com/xl9iU.png)
Your getting from point A to point B is length c which is the hypotenuse where the side a is your vertical speed and the side b is your horizontal speed. You can get c of course using the Pythagorean Theorem with c = (a^2 + b^2)^0.5. This is your speed.
If you're going from point A to B, you want to find the angle at A (or θA). Given you already have your XY speeds a and b, you can use them sohcahtoa rules to know tan(θA) = a/b, and so θA =  atan(a/b).

So now that you can simply get your usual vector angle and speed, all you need to do differently is use two separate variables to track/modify x-speed and y-speed instead of keeping an angle and speed. To simulate "gravity" you keep the x-speed constant and just accelerate the y-speed. Of course remember that increasing x means right and decreasing means left, while increasing y means down and decreasing means up.

EDIT: If you're firing the bullet with speed and angle first, then if you look at the triangle again notice you would already have θA and c, so with those you can get the x-speed and y-speed with sohcahtoa again (as you usually see all the time in Danmakufu, really): b = cos(θA)*c and a = sin(θA)*c. So when you bounce, reflect the angle first and then convert to your initial xy speeds.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 13, 2013, 10:37:55 PM
Still, how would you implement it into the code?

Since Danmakufu 0.12m does not have any way to control the acceleration of object bullets, would I still use Obj_SetSpeed and Obj_SetAngle? The speed would depend on the angle, and the angle would be based off of the trig functions. However, how would you use the existing
Code: [Select]
          xvel = cos(Obj_GetAngle(obj))*Obj_GetSpeed(obj);
          yvel = sin(Obj_GetAngle(obj))*Obj_GetSpeed(obj);
to set the new angle and speed? Since your bullet has reflected off of a wall and now has different Vx, Vy, Ax, Ay, Xcor, Ycor, Angle, etc, Obj_SetPosition becomes too impractical to use.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on January 14, 2013, 12:13:22 AM
You keep track of the speed by using two variables, rather than one, and then use those two variables to determine the "actual" vector speed. The difference is that you aren't accelerating the whole speed (both x and y-velocities), just the velocity of one direction (y-velocity). This way your y-acceleration does not affect the x-speed, and so the angle will work as intended. It's just an implementation of CreateShotA_XY with some extra stuff. Hell, you could even do exactly what you want by deleting the bullet on contact with the wall and then using A_XY to make a new one, but you asked how to do it with one object.

Obj_SetPosition fails when you're using bullet graphics like arrowheads and rice that need to turn based on angle, because Set_Position doesn't affect graphic angle. It would be more or less the same as below, but with different calculations.

I pretty much gave you everything you needed. You're supposed to read and try to understand what I wrote and then use it to implement it yourself rather than me just giving you the code, which would have been easier on my part. There's a reason I explain these things. Anyways...

Code: [Select]
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x, y);
Obj_SetSpeed(obj, s1); //this is initial θA
Obj_SetAngle(obj, a1); //this is initial c
//etc

while(!hitwall){ yield; } //wait until bullet hits wall

let a2 = (180 - a1) % 360; //horizontal reflection
let xvel = cos(a2) * s1; //x-velocity after bounce
let yvel = sin(a2) * s1; //y-velocity after bounce
//note, you don't need a2 anymore

while(!deleted){
Obj_SetSpeed(obj, (xvel^2 + yvel^2)^0.5); //this is your new c
Obj_SetAngle(obj, atan(yvel / xvel)); //this is your new θA
yvel += accel; //increases only y-velocity, hence pseudogravity effect
yield;
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 14, 2013, 12:28:11 AM
OK. So you'd use the arc tangent in order to obtain the speeds. That's the part that I was missing. Thanks!

Edit: It half works. Bullets with an angle of <90 or >270 will bounce, then disappear. (angle issue). Bullets with an angle of >225 and <270 will go straight through the roof and will not bounce.

http://pastebin.com/XJTbFpJu (http://pastebin.com/XJTbFpJu)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on January 14, 2013, 01:46:04 AM
Your program flow is kind of weird, you have the if bouncecount==0 in the >0 loop and depend on the previous if statements to get it to zero and then immediately set it to -1. I can see potential problems with that. Are you really expecting the bullets to bounce more than once? Also, what do you mean by disappear?

225 hitting the top will be 2*(180-225) = -45 which is clearly not a bounce. 2*(180-270) is -180. So your top-bounce is completely wrong.
It's really just -angle.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 14, 2013, 01:50:10 AM
Your program flow is kind of weird, you have the if bouncecount==0 in the >0 loop and depend on the previous if statements to get it to zero and then immediately set it to -1. I can see potential problems with that. Are you really expecting the bullets to bounce more than once? Also, what do you mean by disappear?

225 hitting the top will be 2*(180-225) = -45 which is clearly not a bounce. 2*(180-270) is -180. So your top-bounce is completely wrong.
It's really just -angle.

I have it set so that bullets can bounce twice, thrice, etc. I also forgot about Danmakufu actually going from -90 to 90, so that'll be fixed, but I apparently made a stupid error and edited it. The original that I used in NetLogo was similar to Obj_SetAngle(obj, Obj_GetAngle(obj) + (2 * (180 - Obj_GetAngle(obj)))); Also, 2*(180-225) = -90. It confused me while I was retesting the formula I had been using.

By 'disappear' I mean that the bullet just leaves the screen.

EDIT: Problem fixed.
Code: [Select]
if(bouncecount < 0){
  if(xvel>=0){Obj_SetSpeed(obj, (xvel^2+yvel^2)^0.5);}
  if(xvel<0){Obj_SetSpeed(obj, -(xvel^2+yvel^2)^0.5);}
If the bullet is traveling with a negative x velocity, it will turn positive when fed in, and it will not respond correctly.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on January 14, 2013, 03:05:30 AM
Me with some questions that can be answered really easily. I must be missing something...

Question 1: You know how I asked how to destroy an enemy upon exiting the game screen? Well... my enemies don't automaticall delete after exiting the screen. I tried
Quote
   
                CreateStream(GetCurrentScriptDirectory ~ "Enemy\Red_Fairy1.txt",GetClipMaxX-100,0,0,0,1,10,20);
      WaitZero(600);
Even though it only takes about 200 frames to exit the screen. (600 is the max amount of time it pauses if there are still enemies)
Here's the function for those who need to see it to makes sense of CreateStream:
Quote
   function CreateStream(filepath,x,y,s,dir,argument,lo,wa){
      loop(lo){
         CreateEnemyFromFile(filepath,x,y,s,dir,argument);
         wait(wa);
      }
    }
Anyways... After all the enemies exit the screen, the games waits another 400 frames, before continuing, the shot SE are also still there. Something's wrong...

Question 2: Simple... The BGM will glitch out about 3 seconds from the end of the song, and won't play the 3 seconds, it immediately loops back to the beginning. Reason?

Edit: Question 3: I'm using the Zun Shots, but why won't the small pellets and small bullets appear for me? They used to work(they still do in my old scripts), but in my newer scripts, they don't seem to show up at all.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on January 14, 2013, 05:30:40 AM
EDIT: Problem fixed. If the bullet is traveling with a negative x velocity, it will turn positive when fed in, and it will not respond correctly.
The problem is actually with the angle then. Even if the bullet is traveling with a negative x velocity, as a vector it should still be positive; the angle is what should be adjusted. If it works it works, but yeah you shouldn't actually have a negative speed there.

Lavalake:
1: Have you tested setting the deletion boundaries so you can see the enemies delete? Are you sure it isn't a problem with WaitZero? Does it pass instantly if you don't spawn the enemies?

2: Danmakufu 0.12 sucks ass with BGM. We had a huge debacle on this a few years ago and there is no solid solution. The main way to get around music problems is just by making a really long music file with your own loops so the one little blip every 5 minutes isn't a big nuisance. You can try playing around with the length by adding silence at the end but you'll never get a good result.

3: That's pretty unspecific. Are you sure the IDs are right? Are the graphic coordinates messed up? Are you testing using something simple like CreateShot01?

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 14, 2013, 10:44:29 PM
Edit: Question 3: I'm using the Zun Shots, but why won't the small pellets and small bullets appear for me? They used to work(they still do in my old scripts), but in my newer scripts, they don't seem to show up at all.

The filepaths are correct, right? At first, some things messed up because certain files are set up to be in a certain folder. Also, are you sure that a stray / wasn't added anywhere in your shot data information? That will mess everything past the first / up.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on January 15, 2013, 01:12:13 AM
Question 1: WaitZero seems to work really well, I've defeated all the enemies and it instantly skipped the rest of the yields. Setting the boundaries?(Looks through all the tutorials for that.) I don't know the function to do that.  :ohdear:

Question 3: Everything Sparen said, I mad sure was incorrect. Besides, my old script and new script are in the same folder, meaning they share the same folder using the shots. If my old ones load the graphics and hitboxes, why can't the newer ones?

Edit: Question 3: It doesn't work on my older ones now.  Small bullets and small pellets don't appear, and they have no hitboxes.
http://pastebin.com/GEY5rXFg (http://pastebin.com/GEY5rXFg) The code up to those two.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 19, 2013, 04:33:09 PM
Edit: Question 3: It doesn't work on my older ones now.  Small bullets and small pellets don't appear, and they have no hitboxes.
http://pastebin.com/GEY5rXFg (http://pastebin.com/GEY5rXFg) The code up to those two.

What do you use /* for?

From what I know about the /, it will render the next set of data (until the next /) unusable.

I suggest comparing with the Zun Shotdata that you can get anywhere. Also, I suggest downloading one of your older versions and comparing the two shotdata sheets (the .txt ones). That should show you what you may have done wrong/changed for the worse.

Mythic Lullaby V 0.01 should be good for this (I hope I got the version # right).

If it still doesn't work... upload the current version (upload 0.04, note it as an unstable version/devel version), and then other scripters can scour it for possible errors.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on January 19, 2013, 07:46:00 PM
What do you use /* for?

From what I know about the /, it will render the next set of data (until the next /) unusable.

/* and */ was already there when I downloaded the shots. It tells Danmaku which shot to use(Since many shots have the same ID.)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 19, 2013, 07:53:34 PM
Try deleting those.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on January 19, 2013, 11:35:03 PM
asdf

To be completely honest I have no idea why your script doesn't just plain throw you an error, unless you just haven't mentioned it. Block comments are /* */, not */ /*. When you start the script it should give you a tokenizer failure and then not spawn any of the bullets 49 and up.

(also Sparen, / doesn't do anything. // is a line comment and /* */ is a block comment)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 20, 2013, 01:40:07 AM
I've ended up with the same issue as LavaLake regarding stage enemies not being deleted upon exiting the screen.

My proof came when I had a WaitForZeroEnemy that never came and sound effects constantly repeating. Also, for testing the boundaries, do you use config.exe?

Here is my enemy script. (only important parts)
FYI: I never tested this particular one b/c it never appeared. However, I copied and pasted an earlier enemy script that shared the problem and just added the movement and different bullets.
Code: [Select]
script_enemy_main{
  //vars
  @Initialize{
    LoadGraphic(yrm);
    LoadUserShotData(ZUNbullet);
    SetLife(500);
    LoadSE(bullet);
  }
  @MainLoop{
    SetCollisionA(GetX, GetY, 32);
    SetCollisionB(GetX, GetY, 24);
    SetMovePosition01(GetArgument, GetCenterY - 20, 4)
    if(count > 150 && count % 30 == 0){
      //bullet data
      PlaySE(bullet);
    }
    count++;
    yield;
  }
  @DrawLoop{
    SetTexture(yrm);
    DrawGraphic(GetX,GetY);
  }
  @Finalize{
  //item
  }
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on January 20, 2013, 04:28:54 AM
For some reason I was thinking they would delete like shots if they went enough off screen. Hrm. In any case,
Code: [Select]
function CheckBoundaries(l, r, t, b){
if(GetX < l || GetX > r || GetY < t || GetY > b){
VanishEnemy;
}
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 20, 2013, 02:45:00 PM
For some reason I was thinking they would delete like shots if they went enough off screen. Hrm. In any case,
Code: [Select]
function CheckBoundaries(l, r, t, b){
if(GetX < l || GetX > r || GetY < t || GetY > b){
VanishEnemy;
}
}

That's an extremely roundabout method. However, when I look at other stage scripts, they seen to not have the error. Well, thank you anyway. I'll see if it works.
P.S. Would you insert GetClipM(in/ax)(X/Y) into the function?

Edit: Shockman's stage does not even delete the enemies in the enemy script. The Last Comer uses the function that you just posted above (a variation) and something that I cannot find the meaning of (it's a boolean called enmfin). THe SA Phantasm uses vanish time.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on January 20, 2013, 11:11:09 PM
You wouldn't use GetClips. Clip distance is pretty short and in most cases you want the enemies to start behind the clip distance.

The best method is probably having the enemy delete after a certain amount of time since it uses almost no extra processing. But you can't really generalize something like that; you have to cater it specifically to the stage and enemy, so it's slightly more difficult to implement. At least if you set boundaries you can just give it to every enemy and call it a day.
Also, Shockman does use a deletion timer, you weren't looking hard enough :P
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 20, 2013, 11:56:28 PM
When I try to create an object bullet, it freezes.:wat: Wat do I do to fix it?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on January 21, 2013, 12:13:38 AM
put your script on pastebin and post the pastebin link here so we can see what you're talking about
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 21, 2013, 01:31:10 AM
Well, the stage enemy fix is done. I decided that I'd alternate between the two methods depending on what was needed, and the stage script now runs almost-perfectly.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 21, 2013, 04:25:42 PM
New question about stage scripts:
Code: [Select]
  task Stage{
    wait(1); //Required to be here, greater than 0.
    PlayMusic(music1);
    CreateEnemyBossFromFile(section1, GetCenterX, 0, 1.4, 90, 0);
    WaitForZeroEnemy; //MANDATORY or the rest of the code will never be executed!!!
    wait(60);
    CreateEnemyBossFromFile(section2, GetCenterX, 0, 1.4, 90, 0);
    WaitForZeroEnemy;
    FadeOutMusic(music1, 30); //3 seconds to fade out
    wait(120);
    Stage1;
    wait(120);
    PlayMusic(music1);
    CreateEnemyBossFromFile(section4, GetCenterX, 0, 1.4, 90, 0);
    WaitForZeroEnemy;
    wait(180);
    Clear;
  }

Basically, the second PLayMusic(music1) does not work and the music never plays. Is there a way to get the music to play other than loading it as a separate music file?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 21, 2013, 06:26:02 PM
put your script on pastebin and post the pastebin link here so we can see what you're talking about
http://pastebin.com/4apkSg51 <---Everything after finalize
( I'm really bad at this )
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 21, 2013, 06:42:15 PM
http://pastebin.com/4apkSg51 <---Everything after finalize
( I'm really bad at this )

Please specify:
1)When does it freeze? Does it freeze immediately upon starting the script? Is there an error message? Please post the entire script, not just what is after @Finalize. How you call mainTask is also important (if you call it during @MainLoop, I suspect overflow to the point of crashing or maybe even infinite recursion; I haven't looked at the code very carefully), and knowing about how you call the tasks may result in a faster understanding of the problem.
2) What kind of script is this? Stage enemy? Boss? (I assume boss)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 21, 2013, 06:50:36 PM
Please specify:
1)When does it freeze? Does it freeze immediately upon starting the script? Is there an error message? Please post the entire script, not just what is after @Finalize. How you call mainTask is also important (if you call it during @MainLoop, I suspect overflow to the point of crashing or maybe even infinite recursion; I haven't looked at the code very carefully), and knowing about how you call the tasks may result in a faster understanding of the problem.
2) What kind of script is this? Stage enemy? Boss? (I assume boss)
Sorry, entire code--->http://pastebin.com/RMjst9Py
It freezes when I start playing it, there is no error message, and it's a boss script.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on January 21, 2013, 07:01:01 PM
Qwerty: Your #TouhouDanmakufu needs a [Single], assuming it's a single pattern. That would fix the crash probably, but it would still error.

Firstly, you don't need to put SetMovePosition inside the loop. As it is, it's running SetMovePosition every frame which is sort of redundant if the boss is already at that position. It wouldn't cause an error, but you only need to call it once. while(Obj_BeDeleted(obj)==false){  yield;  } is redundant too. It won't do anything extra besides extra empty processing.

task fire(GetEnemyX, GetEnemyY, 2, GetAngleToPlayer): You do not put your parameters in the function declaration, you put them when you call the function. But considering you put the exact same things (GetAngleToPlayer etc) in the function itself rather than using any actual parameters, you don't even need any parameters for the function.

Here is that last part fixed: http://pastebin.com/w4H6Uv9H


Sparen: You have to Delete and reload.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 21, 2013, 07:28:09 PM
Sparen: You have to Delete and reload.

You mean DeleteMusic(music1) INSIDE the task stage? (see asterisks)
Code: [Select]
task Stage{
    wait(1); //Required to be here, greater than 0.
    PlayMusic(music1);
    CreateEnemyBossFromFile(section1, GetCenterX, 0, 1.4, 90, 0);
    WaitForZeroEnemy; //MANDATORY or the rest of the code will never be executed!!!
    wait(60);
    CreateEnemyBossFromFile(section2, GetCenterX, 0, 1.4, 90, 0);
    WaitForZeroEnemy;
    FadeOutMusic(music1, 30); //3 seconds to fade out
    wait(120);
    *DeleteMusic(music1);
    Stage1;
    *LoadMusic(music1);
    wait(120);
    PlayMusic(music1);
    CreateEnemyBossFromFile(section4, GetCenterX, 0, 1.4, 90, 0);
    WaitForZeroEnemy;
    wait(180);
    Clear;
  }
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 21, 2013, 07:52:11 PM
Qwerty: Your #TouhouDanmakufu needs a [Single], assuming it's a single pattern. That would fix the crash probably, but it would still error.

Firstly, you don't need to put SetMovePosition inside the loop. As it is, it's running SetMovePosition every frame which is sort of redundant if the boss is already at that position. It wouldn't cause an error, but you only need to call it once. while(Obj_BeDeleted(obj)==false){  yield;  } is redundant too. It won't do anything extra besides extra empty processing.

task fire(GetEnemyX, GetEnemyY, 2, GetAngleToPlayer): You do not put your parameters in the function declaration, you put them when you call the function. But considering you put the exact same things (GetAngleToPlayer etc) in the function itself rather than using any actual parameters, you don't even need any parameters for the function.

Here is that last part fixed: http://pastebin.com/w4H6Uv9H

Sparen: You have to Delete and reload.
Thank You! :)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on January 21, 2013, 10:05:49 PM
You mean DeleteMusic(music1) INSIDE the task stage?
...Yes. If you had time to write that out did you not have time to test it?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 21, 2013, 10:12:04 PM
Just wanted to confirm beforehand because I though that you could only use DeleteXYZ in @Finalize and LoadXYZ only in @Initialize.

Anyway, it worked.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 21, 2013, 11:34:30 PM
Back to an older question that I thought was solved until I found an exception.
Code: [Select]
task checkdeath{ //Added Jan 9 and removed stuff from Missed
    loop{
      if(OnMissed){
        loop(GetRebirthFrame){ //Orig: GetRebirthFrame+60. @Missed runs 75 times.
  if(IsLastSpell){LS = 1;} //To keep your Veetype
  yield;
}
        if(LS==0){
  veetype = 0;
          SetSpeed(3.5,1);
          }
        LS = 0;
      }yield;}}
The code is supposed to preserve veetype if you death bomb. LS == 0 refers to a normal death, LS == 1 refers to a death bomb. If you die normally, you technically should return to veetype = 0. but that apparently doesn't happen. The code is called in @Initialize and is set in an infinite loop (without building the stack). I collapsed parts of the task that aren't important.

Basically, I want to find out why either
Code: [Select]
if(IsLastSpell){LS = 1;} or
Code: [Select]
if(LS==0){veetype = 0; SetSpeed(3.5,1);} doesn't work.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on January 22, 2013, 12:04:01 AM
This question isn't much of a problem, more of a "how to" question.  :3
What I want to know is how do I insert a custom STG Frame in danmakufu. This might seem like a lot for a question though. Or you can just give me a script that tells danmakufu to insert an STG Frame.
I have many danmakufu games but I can't find the scripts containing the STG Frames. This would help a lot to me. Hopefully this is not too much trouble.  :ohdear:
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 22, 2013, 12:13:55 AM
@Lavalake: http://www.bulletforge.org/u/shockman/p/mima-boss-battle/v/12 (http://www.bulletforge.org/u/shockman/p/mima-boss-battle/v/12)
It's the featured project on BulletForge. XD.

The below is the frame task from Shockman's script. You should be able to understand most of it; otherwise you can look at the Danmakufu Wiki's function list.
Code: [Select]
task stgframe{
let obj=Obj_Create(OBJ_EFFECT);
Obj_SetX(obj,0);
Obj_SetY(obj,0);
ObjEffect_SetLayer(obj,8);
ObjEffect_SetRenderState(obj,ALPHA);
ObjEffect_SetTexture(obj,frame);
ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLEFAN);
ObjEffect_SetScale(obj,1,1);
ObjEffect_SetAngle(obj,0,0,0);
ObjEffect_CreateVertex(obj,4);
ObjEffect_SetVertexUV(obj,0,0,0);
ObjEffect_SetVertexUV(obj,1,640,0);
ObjEffect_SetVertexUV(obj,2,640,480);
ObjEffect_SetVertexUV(obj,3,0,480);
ObjEffect_SetVertexXY(obj,0,0,0);
ObjEffect_SetVertexXY(obj,1,640,0);
ObjEffect_SetVertexXY(obj,2,640,480);
ObjEffect_SetVertexXY(obj,3,0,480);
yield;}
Basically, you have a frame matching Danmakufu's window coordinates, with a massive empty transparent space where the action takes place, and you just run the task in @DrawLoop.

Hope it helps.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 22, 2013, 02:07:26 AM
I'm having trouble with the stage and familiar part...I create 2 familiars for the stage and when I shoot one, the picture of the other one goes away, but is still there.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on January 22, 2013, 03:55:27 AM
I'm having trouble with the stage and familiar part...I create 2 familiars for the stage and when I shoot one, the picture of the other one goes away, but is still there.
Ahh. I had this similar question a while ago.
Did you put "DeleteGraphic" in Finalize?
You shouldn't do that if you have multiple of the same enemies since it just makes the graphics disappear until another "LoadGraphic" activates. But by then, most of the familiars' scripts will have bypassed the "LoadGraphic" in their scripts.
In short, don't DeleteGraphic when your making familiars for a stage. :3
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 22, 2013, 11:17:33 PM
Ahh. I had this similar question a while ago.
Did you put "DeleteGraphic" in Finalize?
You shouldn't do that if you have multiple of the same enemies since it just makes the graphics disappear until another "LoadGraphic" activates. But by then, most of the familiars' scripts will have bypassed the "LoadGraphic" in their scripts.
In short, don't DeleteGraphic when your making familiars for a stage. :3c
Thanks! :D I read the message after I figured it out though xD
Anyway, do you know how to make my familiars shoot?  :)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 22, 2013, 11:45:54 PM
Thanks! :D I read the message after I figured it out though xD
Anyway, do you know how to make my familiars shoot?  :)

In the while(!Obj_BeDeleted) statement, add whatever you need.

Obj_GetX(obj)
Obj_GetY(obj)
Obj_GetAngle(obj)

etc. will help you do what you need to do.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 23, 2013, 12:05:08 AM
In the while(!Obj_BeDeleted) statement, add whatever you need.

Obj_GetX(obj)
Obj_GetY(obj)
Obj_GetAngle(obj)

etc. will help you do what you need to do.
I'm a little confused, are we talking about object bullets or familiars?  ???
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on January 23, 2013, 12:24:14 AM
Thanks! :D I read the message after I figured it out though xD
Anyway, do you know how to make my familiars shoot?  :)

Basically, bosses are like the main familiars of each stage. If you know how to shoot with bosses, familiars would be easy to script.
So you can just use CreateShot01, Object bullets, etc.
Unless you're talking about Player Familiars(The ones for a player script.)? Those are more complex with scripting.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 23, 2013, 12:31:18 AM
Basically, bosses are like the main familiars of each stage. If you know how to shoot with bosses, familiars would be easy to script.
So you can just use CreateShot01, Object bullets, etc.
Unless you're talking about Player Familiars(The ones for a player script.)? Those are more complex with scripting.
Tried that and it either freezes or doesnt shoot bullets. No it isn't a Player Familiar either.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on January 23, 2013, 01:18:12 AM
Hmm. Can you post the script on pastebin.  :3 I need to find what the matter is in the script.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 23, 2013, 01:23:04 AM
I'm a little confused, are we talking about object bullets or familiars?  ???

I did not know if you were using object familiars or if you were using familiars that were loaded like stage enemies. I assume now that you are using the latter, in which case you run the script like a normal enemy or boss attack. Fill in your variables, then fill in MainLoop or whatever tasks you are going to be using.

And yes; definitely post the code so that we have an idea of what is going on.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 23, 2013, 01:27:30 AM
Hmm. Can you post the script on pastebin.  :3c I need to find what the matter is in the script.
Familiar: http://pastebin.com/yv6DqJg3 (http://pastebin.com/yv6DqJg3)
Stage: http://pastebin.com/cnEvevGW (http://pastebin.com/cnEvevGW)
 
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 23, 2013, 01:42:43 AM
Familiar: http://pastebin.com/yv6DqJg3 (http://pastebin.com/yv6DqJg3)
Stage: http://pastebin.com/cnEvevGW (http://pastebin.com/cnEvevGW)

You never called MainTask in @Initialize of your familiar script. That's why it doesn't shoot. Also, a speed of 7, along with 12 bullets per second, is extremely hard to dodge is you aren't streaming or if there are other bullets.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 23, 2013, 01:51:29 AM
You never called MainTask in @Initialize of your familiar script. That's why it doesn't shoot. Also, a speed of 7, along with 12 bullets per second, is extremely hard to dodge is you aren't streaming or if there are other bullets.
THANK YOU! :DD Oh, and yes, it's just streaming. :V
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 23, 2013, 02:00:01 AM
You never called MainTask in @Initialize of your familiar script. That's why it doesn't shoot. Also, a speed of 7, along with 12 bullets per second, is extremely hard to dodge is you aren't streaming or if there are other bullets.
It's sort of glitching, the first familiar shoots bullets wierd, and then the others and enemy 2 dont shoot at all
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 23, 2013, 02:14:39 AM
It's sort of glitching, the first familiar shoots bullets wierd, and then the others and enemy 2 dont shoot at all

Elaborate, and post the enemy code. Also post the code that spawns the familiar.

When you say it shoots weird, please provide a screenshot or describe what is going awry.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on January 23, 2013, 02:54:53 AM
It's sort of glitching, the first familiar shoots bullets wierd, and then the others and enemy 2 dont shoot at all

I think I also had this problem. Don't use GetEnemyX/GetEnemyY for familiars. It's only used for if you want to attack with the main enemy.
Instead, just use GetX/GetY. This should solve your problem.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 23, 2013, 02:58:16 AM
I think I also had this problem. Don't use GetEnemyX/GetEnemyY for familiars. It's only used for if you want to attack with the main enemy.
Instead, just use GetX/GetY. This should solve your problem.
I'll try  :)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 23, 2013, 03:23:12 AM
I'll try  :)

Geez. You're not seriously running Danmakufu on Linux, are you?
If it still doesn't work, post the code on pastebin and we'll see what we can do.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 23, 2013, 08:41:13 PM
Geez. You're not seriously running Danmakufu on Linux, are you?
If it still doesn't work, post the code on pastebin and we'll see what we can do.
No i'm not, a couple messages I sent were from my Nook, i'm doing it on Windows 7.  :V
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 23, 2013, 10:00:23 PM
Thanks all! It worked!!  :)
I have ANOTHER question though, how do I make multiple object bullets shoot? I can only get one to...
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 23, 2013, 10:19:12 PM
Just call the object bullet more than once. For example:
Code: [Select]
@MainLoop
    //collision
    loop(4){Bullet(GetX, GetY, 3, angle, 34, 0, true); angle += 90;}
}

Where 'Bullet' is a task that creates an object bullet. The code above creates a ring of 4 object bullets.
P.S. There are tutorials for this you know... They might clear up some misconceptions.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 23, 2013, 10:38:02 PM
Just call the object bullet more than once. For example:
Code: [Select]
@MainLoop
    //collision
    loop(4){Bullet(GetX, GetY, 3, angle, 34, 0, true); angle  = 90;}
}

Where 'Bullet' is a task that creates an object bullet. The code above creates a ring of 4 object bullets.
P.S. There are tutorials for this you know... They might clear up some misconceptions.
Nevermind, I fixed it xD I forgot the loop{.
(And I meant make multiple shoot from the enemy, I know I worded that strangely)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 25, 2013, 03:18:38 PM
Does anyone know what's wrong with this script?
http://pastebin.com/Gwa8MJ8r (http://pastebin.com/Gwa8MJ8r)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 25, 2013, 05:27:06 PM
Does anyone know what's wrong with this script?
http://pastebin.com/Gwa8MJ8r (http://pastebin.com/Gwa8MJ8r)

You have an extra closing bracket at the end, I believe.

Please read the following: Danmakufu Error Message Troubleshooting (http://www.shrinemaiden.org/forum/index.php/topic,4155.0.html)

Technically, it's part of the sticky, so if you get an error message, please consult this page before posting here. I also suggest learning Katakana, so that you can tell some of the error messages apart without looking at the page.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 25, 2013, 05:37:48 PM
You have an extra closing bracket at the end, I believe.

Please read the following: Danmakufu Error Message Troubleshooting (http://www.shrinemaiden.org/forum/index.php/topic,4155.0.html)

Technically, it's part of the sticky, so if you get an error message, please consult this page before posting here. I also suggest learning Katakana, so that you can tell some of the error messages apart without looking at the page.
It doesn't give me an error, it freezes.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 25, 2013, 05:52:02 PM
It doesn't give me an error, it freezes.

If something freezes, that means that there was probably an infinite loop. I'll check.

Edit: If getting rid of that last } doesn't give you an error message and it still freezes, put a yield; in maintask and see what happens. I'm not an expert with scripts where you run a maintask instead of @MainLoop, so I can't help much more than this.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on January 25, 2013, 07:10:22 PM
There doesn't need to be a yield in mainTask. Tasks don't inherently need a yield until you want to pass processing to a different thread. At that, a mainTask that just calls other tasks without delay doesn't even need to be a task, and really you could just skip it and plop fire; effect; in @Initialize.

That being said, I can't immediately see why it would crash, since there isn't actually an extra bracket. I just tried it myself, without the images and code related to the images, and it ran fine.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 25, 2013, 07:22:16 PM
There doesn't need to be a yield in mainTask. Tasks don't inherently need a yield until you want to pass processing to a different thread. At that, a mainTask that just calls other tasks without delay doesn't even need to be a task, and really you could just skip it and plop fire; effect; in @Initialize.

That being said, I can't immediately see why it would crash, since there isn't actually an extra bracket. I just tried it myself, without the images and code related to the images, and it ran fine.
I think it might have to do with the SetVertexes, for an image that is 0, 0, 88, 90, would they be correct?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on January 25, 2013, 07:58:14 PM
You can't make an effect object on the first frame, as this script is doing. In your effect task, put a yield before you even create the effect.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 25, 2013, 08:10:54 PM
You can't make an effect object on the first frame, as this script is doing. In your effect task, put a yield before you even create the effect.
Before   let obj=Obj_Create(OBJ_EFFECT);? I did that and it still freezes
 
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on January 25, 2013, 10:43:53 PM
Comment out the lines that have to do with each individual graphic, one at a time. Comment out the effect graphic and the lines that refer to it, try running. Comment out the references to the boss image and drawing, try running. Comment out the cutin image and function, try running. Comment out the bg and actual background, etc.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 27, 2013, 06:11:43 PM
Comment out the lines that have to do with each individual graphic, one at a time. Comment out the effect graphic and the lines that refer to it, try running. Comment out the references to the boss image and drawing, try running. Comment out the cutin image and function, try running. Comment out the bg and actual background, etc.
It didn't work.  ???
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on January 28, 2013, 12:12:09 AM
What. So your script is like this, but still freezes?

http://pastebin.com/9hbb9kyi
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 28, 2013, 01:02:30 AM
What. So your script is like this, but still freezes?

http://pastebin.com/9hbb9kyi (http://pastebin.com/9hbb9kyi)
Wait no, your code doesn't freeze  :) . (nothing shows up though)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 28, 2013, 01:42:16 AM
Compare your code to his (besides the /* */). See what's different. Then maybe you'll find your error.

Also, I know that this is an EXTREMELY stupid question, but you're definitely using 0.12m, right? Not ph3.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 28, 2013, 02:04:32 AM
Compare your code to his (besides the /* */). See what's different. Then maybe you'll find your error.

Also, I know that this is an EXTREMELY stupid question, but you're definitely using 0.12m, right? Not ph3.
Yes, i'm using 0.12,  :)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 29, 2013, 10:54:31 PM
What. So your script is like this, but still freezes?

http://pastebin.com/9hbb9kyi (http://pastebin.com/9hbb9kyi)
OK, I tried your method, and I figured out the problem has to do with the effect task. Anyway to fix the freeze?
(And I know i'm asking lots of questions but, how do I make the script wait a certain amount of frames before shooting bullets?)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 29, 2013, 11:14:48 PM
(And I know i'm asking lots of questions but, how do I make the script wait a certain amount of frames before shooting bullets?)

In general, make your count variable start negative, and increment it up. I use -60 as my default.

As for objects, Danmakufu executes from top down. Therefore, if you wait(60); then do something, Danmakufu will wait 1 second before executing the code below it.

For bullet control, use % or have multiple counting variables.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 30, 2013, 12:16:44 AM
In general, make your count variable start negative, and increment it up. I use -60 as my default.

As for objects, Danmakufu executes from top down. Therefore, if you wait(60); then do something, Danmakufu will wait 1 second before executing the code below it.

For bullet control, use % or have multiple counting variables.
Thank you! :D
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 30, 2013, 01:17:41 AM
Thank you! :D

You're welcome. Also, your effect task DOESN'T LOAD ANYTHING. I hope you realize this. You did not load any file, so no image will ever show up (i.e. you never set the file from where the vertices are going to select the image in the task). Also, the image will appear twisted when it is loaded, I think. Has to do with the UV vertices.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on January 30, 2013, 01:59:22 AM
You're welcome. Also, your effect task DOESN'T LOAD ANYTHING. I hope you realize this. You did not load any file, so no image will ever show up (i.e. you never set the file from where the vertices are going to select the image in the task). Also, the image will appear twisted when it is loaded, I think. Has to do with the UV vertices.
Oh wow,  I guess i'll fix that. But how?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on January 30, 2013, 02:02:21 AM
ObjEffect_SetTexture(obj, filewiththeimage);

filewiththeimage is a variable you define earlier in the task or in script_enemy_main

For the latter part,
ObjEffect_SetVertexUV(obj, 0, 0, 0);
ObjEffect_SetVertexUV(obj, 1, 90, 0);
ObjEffect_SetVertexUV(obj, 2, 90, 88);
ObjEffect_SetVertexUV(obj, 3, 0, 88);

should work, I think.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on January 30, 2013, 04:30:12 AM
no

His ObjEffect_SetTexture() is right there at the beginning and he loads his graphics beforehand. The only reason a is there is because I put it there to test and didn't bother changing it back to what he had before. It's worth noting that even if the script didn't crash, it would still error because he defined effect twice, so Qwerty, you should change the variable or task name.

Also his vertices are fine. The ones you just posted would cross the image.

Qwerty, I still cannot replicate a freeze. I'm really not sure what you're doing if you found out the effect task is somehow the problem.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 01, 2013, 03:40:36 PM
no

His ObjEffect_SetTexture() is right there at the beginning and he loads his graphics beforehand. The only reason a is there is because I put it there to test and didn't bother changing it back to what he had before. It's worth noting that even if the script didn't crash, it would still error because he defined effect twice, so Qwerty, you should change the variable or task name.
Thank you! I finally got it to work! :)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: sjasogun1 on February 01, 2013, 04:27:31 PM
So, I have this task here:
Code: [Select]
task hypocycloid2(a,b,r,k,l){
loop{
let t = 0;
loop(210){
t += 12;
let x = a + r * ( (1 - k) * cos(t) + l * k * cos((1 - k) / k * t));
let y = b + r * ( (1 - k) * sin(t) - l * k * sin((1 - k) / k * t));
???
}
wait(300);
}
}
That will generate coordinates of a Hypocycloid. Placing bullets on these co?rdinates isn't hard, I can just use the regular bullets for that. But I want these shapes to 'spin' around their center (being a,b) while also moving downward. The problem is that the distance from a,b to a bullet will be different most of the time, making it very hard to do this. I tried several thing with object bullets already, even trying to put the function for the rotating object bullets inside the Hypocycloid task to enable me to use a and b directly instead of having to pass them as arguments, but all to no avail. Help?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on February 02, 2013, 12:23:00 AM
This doesn't look like a parametric equation for a hypocycloid. You mixed up the variables for the smaller circle r and the larger circle R = rk, and tried to factor out the wrong one, and you also didn't actually distribute r inside the second trig function (which also has the order mixed up).
  r*((1-k)*cos(t) + l*k*cos((1-k)/k*t))
= r*(1-k)*cos(t) + l*r*k*cos((1-k)/k*t)
= (r-R)*cos(t) + l*R*cos((1-k)/k*t)

When you want to end up with
  (R-r)*cos(t) + l*r*cos((R-r)/r*t)
= r*(k-1)*cos(t) + l*r*cos(r*(k-1)/r*t)
= r*((k-1)*cos(t) + l*cos((k-1)*t))

So your xy should be
x = a + r*((k-1)*cos(t) + l*cos((k-1)*t))
y = b + r*((k-1)*sin(t) - l*sin((k-1)*t))


But yeah, you're trying to essentially fire a spinning hypocycloid of bullets? If so, you were on the right track with the object bullets, it would be difficult to have them move down at the same time otherwise. There's probably a much better way to move a bullet along the same unknown radius the whole time, but I can't think of anything immediately other than finding the bullet's distance and angle to the center, then "moving" the bullet to the center and back out at a new angle.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: sjasogun1 on February 02, 2013, 11:33:06 AM
Okay, I'll try around some more with the object bullets then I guess.

Also, the formula here is correct, see here (http://en.wikipedia.org/wiki/Spirograph#Mathematical_basis) for the derivation of the formula. It isn't exactly the same as the hypocycloid one, I know, but I explicitly picked this one because the mathematical derivation was given with it (needed that for a school project). Besides, the formula produces the required hypocycloids as I want it to, the problem is just trying to get them to spin while retaining their shape.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 04, 2013, 12:20:27 AM
Are there ant Danmakufu quizzes/tests? (I need more practice).
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: JCTechnic on February 04, 2013, 12:59:15 AM
OK I'm sorry for barging in on this current question but I have my own.
I'm trying to create a new bullet using a PNG image, the thing is no matter where i go there's nothing answering me on how to do so.
I went to the touhou wikia and found nothing in the tutorials that could help me.

I tried using the CreateShotFromScript but i don't really know how to use it.
And I've tried creating a new bullet with the #UserShotData in another TXT and  loading it in the game script with LoadUserShotData to no avail.

Help me please.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 04, 2013, 02:18:35 AM
Are there ant Danmakufu quizzes/tests? (I need more practice).

What do you mean?

If you want basic assignments like they give in a standard Introduction to Science course such as "HW #1: Create six rings of bullets that fire from points in a semicircular arc above the boss with a radius of 120 pixels. Rings should start with 12 bullets and then increment up by one every 20 frames." It wouldn't be too hard for me to test you.

OK I'm sorry for barging in on this current question but I have my own.
I'm trying to create a new bullet using a PNG image, the thing is no matter where i go there's nothing answering me on how to do so.
I went to the touhou wikia and found nothing in the tutorials that could help me.

I tried using the CreateShotFromScript but i don't really know how to use it.
And I've tried creating a new bullet with the #UserShotData in another TXT and  loading it in the game script with LoadUserShotData to no avail.

What exactly do you mean? Are you using object bullets? Standard shot bullets loaded using LoadUserShotData from a predefined file path?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on February 04, 2013, 02:34:19 AM
JC: Don't bother using shot scripts just yet, they aren't really needed ever to begin with, it's really just a matter of utility.

First you have your png image with the graphic in it. Then you have a separate script file for shot data as you probably already have.
Code: (shotdata.txt) [Select]
#UserShotData
ShotImage = ".\shotimage.png"

ShotData{
id = 1 //bullet ID
rect = (0,0,32,32) //bullet image rects
}
And then in your main script, usually in @Initialize, you will call LoadUserShotData(GetCurrentScriptDirectory~"shotdata.txt");
Once you do this you can fire your bullet with, say, CreateShot01(GetEnemyX, GetEnemyY, 3, GetAngleToPlayer, 1, 0).

You say that you've already done this, so if you can't see a mistake I'd like you to pastebin your scripts. Also, confirm that your bullet graphic rects are correct.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 04, 2013, 02:41:31 AM
What do you mean?
If you want basic assignments like they give in a standard Introduction to Science course such as "HW #1: Create six rings of bullets that fire from points in a semicircular arc above the boss with a radius of 120 pixels. Rings should start with 12 bullets and then increment up by one every 20 frames." It wouldn't be too hard for me to test you.
I guess, and maybe muiltiple choice, open ended, etc...anything good for practice.
You to test me? How? Would you just PM me or something?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on February 04, 2013, 02:56:52 AM
I guess, or like muiltiple choice, open ended, etc...anything good for practice.
You to test me? How? Through personal messages or something?
I don't think multiple choices for scripting would be a good test. Hands on projects are much better to test your ability.

But since I also have a question.
I'm making a star shaped cyclone, that homes in on the player. I know how to make a star, I just don't know how to make it go in the player's direction while keeping it's shape.  :3 It should only go in the player's direction once though. Like the most basic enemies, except with stars. Help?
Oh yeah, I'm using object bullets. But Obj_SetAngle is being used to make the star spin.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 04, 2013, 03:21:10 AM
I guess, and maybe muiltiple choice, open ended, etc...anything good for practice.
You to test me? How? Would you just PM me or something?

If you need, I can probably create a thread or we can do this elsewhere. However, having the ability to attach attachments would be nice, so maybe a thread would be appropriate. However, you'd be PMming answers to me as attached files. I'll PM you back with results and comments to better your code and for overall stuff. If you would like to do this, send me a confirmation PM; it'll take a little while for me to come up with ideas, and remember:

The following link is your friend. http://dmf.shrinemaiden.org/wiki/Functions_(0.12m) (http://dmf.shrinemaiden.org/wiki/Functions_(0.12m))
Though that applies to everyone. Always consult the dictionary when in doubt~
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on February 04, 2013, 03:43:34 AM
I'm making a star shaped cyclone, that homes in on the player. I know how to make a star, I just don't know how to make it go in the player's direction while keeping it's shape.  :3 It should only go in the player's direction once though. Like the most basic enemies, except with stars. Help?
Oh yeah, I'm using object bullets. But Obj_SetAngle is being used to make the star spin.
Use atan2 to get the angle from the center of the star to the player when creating the star, and pass it to the bullets (or just make sure to do it all at once per bullet, but that would take a lot of needless processing). Then you use SetPosition to move as well, with the usual cos(angle)*speed stuff.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on February 04, 2013, 04:44:41 AM
Use atan2 to get the angle from the center of the star to the player when creating the star, and pass it to the bullets (or just make sure to do it all at once per bullet, but that would take a lot of needless processing). Then you use SetPosition to move as well, with the usual cos(angle)*speed stuff.

Hmm? But how do I pass it to the bullets? -Clueless- Unless I'm skipping over something really obvious.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on February 04, 2013, 06:39:47 AM
I'm assuming you have your setup like this:

star{
   centerx = something;
   centery = something;
   loop{
      bullet(centerx + bla, centery + bla, other parameters);
   }
}

bullet{
   blablabla
   while(!deleted){
      Obj_SetAngle(obj, angle + something); //in order to turn
   yield;
   }
}

You need to calculate the angle from (centerx, centery) to the player in the "star" block and use it as a parameter when spawning the "bullet". Then bullet uses that angle to move.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: sjasogun1 on February 04, 2013, 03:29:10 PM
Okay, got the spinning working, but for some reason my code acts rather strangely. It is supposed to generate a spinning hypocycloid of bullets every 300 frames (5 seconds), but instead it makes a second hypocycloid on top of the first one, regardless of its location, and then increases the speed of both of them. Another minor problem is that the shape somehow generates at x=GetCenterX and y=0 despite giving GetEnemyX and GetEnemyY as the coordinates, but I suspect I simply made a dumb mistake in the movement task there. Anyway, the entire code is below, along with added comments to explain what's going on.

NOTE: comments apply to the lines below them, not to those above them.
NOTE 2: You may want to change the wait(300); on line 172 to wait(30); to make the duplicating effect more visible.

--> Pastebin Here <-- (http://pastebin.com/c730WtVZ)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: JCTechnic on February 04, 2013, 04:18:00 PM
JC: Don't bother using shot scripts just yet, they aren't really needed ever to begin with, it's really just a matter of utility.

First you have your png image with the graphic in it. Then you have a separate script file for shot data as you probably already have.
Code: (shotdata.txt) [Select]
#UserShotData
ShotImage = ".\shotimage.png"

ShotData{
id = 1 //bullet ID
rect = (0,0,32,32) //bullet image rects
}
And then in your main script, usually in @Initialize, you will call LoadUserShotData(GetCurrentScriptDirectory~"shotdata.txt");
Once you do this you can fire your bullet with, say, CreateShot01(GetEnemyX, GetEnemyY, 3, GetAngleToPlayer, 1, 0).

You say that you've already done this, so if you can't see a mistake I'd like you to pastebin your scripts. Also, confirm that your bullet graphic rects are correct.

Thank you it works now, my problem was that i thought when you created a new bullet it would override the premade list of bullets, so a bullet i created with the id 1 would replace the premade bullet 1, with that being said, when youd create the bullet you had to add the WHITE01 to make the new bullet appear. But the id is a new id, this thing wasn't all that clear in the tutorials or the wikia so my mistake.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 04, 2013, 09:34:05 PM
The following link is your friend. http://dmf.shrinemaiden.org/wiki/Functions_(0.12m) (http://dmf.shrinemaiden.org/wiki/Functions_(0.12m))
Though that applies to everyone. Always consult the dictionary when in doubt~
THANK YOU FSWJGHFLUIYGEFLIYGTOLESWFIY&GUWOFLIYGUWF !!!  :getdown:
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 04, 2013, 10:29:02 PM
THANK YOU FSWJGHFLUIYGEFLIYGTOLESWFIY&GUWOFLIYGUWF !!!  :getdown:

You're welcome, although the dictionary is something you should know about by now...

I'll start a thread, which you should click 'notify' to. If a mod moves it, keep that in mind.

http://www.shrinemaiden.org/forum/index.php/topic,14251.new.html#new (http://www.shrinemaiden.org/forum/index.php/topic,14251.new.html#new)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 05, 2013, 11:11:19 PM
So, new question.

http://pastebin.com/i2tE5gyr (http://pastebin.com/i2tE5gyr)

Basically, the laser graphics are screwed up. I want 8 (or 12, I don't know if I changed it) lasers to face either the boss or the center of the screen, depending on whether or not there is a boss. They are to end at the boss, giving the impression that they are charging the sun at the middle.

The issues? Well, the graphics seem to interpret GetCenterX as the bottom right corner. I don't know why. Also, my trig is almost definitely screwed over. I may have also made SetVertexXY errors.

The only issue here is the spell_laser. Everything else I can tweak to my liking (the sun actually forms correctly, not that it matters if if it spawns elsewhere given that it wipes the screen clear).
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on February 06, 2013, 01:11:19 AM
Okay, got the spinning working, but for some reason my code acts rather strangely. It is supposed to generate a spinning hypocycloid of bullets every 300 frames (5 seconds), but instead it makes a second hypocycloid on top of the first one, regardless of its location, and then increases the speed of both of them. Another minor problem is that the shape somehow generates at x=GetCenterX and y=0 despite giving GetEnemyX and GetEnemyY as the coordinates, but I suspect I simply made a dumb mistake in the movement task there. Anyway, the entire code is below, along with added comments to explain what's going on.
First thing, you call SetMovePosition01(center) in @Initialize, and then without waiting the five frames your start the movement task which does something else. It should just overwrite after the first frame, but it looks like you don't yield during the hypocycloid task and the movement task comes after that, so the center will be based on coordinates that are going to immediately change. I'm not sure how this actually affects the center coordinate but it's worth looking at.

As for the super speed, since you never define a and b locally you're modifying the parameter variables passed to the hypocycloid task. You're increasing b by 0.01 per bullet per frame, hence by 1 per frame overall. I'm not sure why it would spawn two cycloids on top of each other, though.

Here's mine, for reference. It's really lazily done and not optimized whatsoever, obviously.
http://pastebin.com/T5cpEM6N

Lavalake, you actually might want to take a look at sjasogun's script (and by proxy, mine above). There are a lot of things unrelated to your situation, but the core "rotate shape of bullets and fire it in a direction" is there and it might help.

Sparen: Oh god man if you're trying to just rotate the lasers to fit the angle just use ObjEffect_SetAngle(obj, 0, 0, angle). That's what it's there for. Don't start screwing around with the XYs when you don't have to.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 06, 2013, 01:34:48 AM
Sparen: Oh god man if you're trying to just rotate the lasers to fit the angle just use ObjEffect_SetAngle(obj, 0, 0, angle). That's what it's there for. Don't start screwing around with the XYs when you don't have to.

Well... after having lighdramon's lasers inverted and thrust sideways with ObjEffect_SetAngle, here's the new mess.

And yes, these lasers ares supposed to all meet at the spawn point of that sun.

Edit: A bit of experimentation later, I realized that SOMETHING is wrong with this entire thing, and iti s probably the same as with the Lighdra Lasers from before.

Firstly, I have no way of testing the following code.
Code: [Select]
loop(8){
  spell_laser(spellangle+180, GetCenterX + 60*cos(spellangle), GetCenterY + 60*sin(spellangle));
  spellangle+=45;
}
The graphics are the only thing that allow me to actually test the crud. The graphics are completely off. When I adjust the radius (or what I hope to be the radius), I get something completely weird and unrelated to the pattern I'm trying to make.

Secondly, this entire chunk has something completely wrong with it.
Code: [Select]
    ObjEffect_SetVertexXY(objdwarf,0,x-10,-170);
    ObjEffect_SetVertexXY(objdwarf,1,x+10,-170);
    ObjEffect_SetVertexXY(objdwarf,2,x+10,0);
    ObjEffect_SetVertexXY(objdwarf,3,x-10,0);
    ObjEffect_SetAngle(objdwarf, 0, 0, angle);
    ascent(i in 0..4){ObjEffect_SetVertexColor(objdwarf, i, 255, 255, 255, 255);}
    while(!Obj_BeDeleted(objdwarf)){
      if(bosspres == 1){
ObjSpell_SetIntersecrionLine(objdwarf,Obj_GetX(objdwarf),Obj_GetY(objdwarf),GetEnemyX,GetEnemyY,10,2,true);
      }else{
ObjSpell_SetIntersecrionLine(objdwarf,Obj_GetX(objdwarf),Obj_GetY(objdwarf),GetCenterX,GetCenterY,10,2,true);
      }

The intersecrion lines are untestable, but I know for a fact that they aren't matching up with the graphics. They're probably correct, given that I murdered ExRumia with a single bomb (and with all 8 lasers on top of her hitbox dealing 12 damage per frame). The issue is what is above.

ObjEffect_SetAngle has never worked for me, period. Basically, I have a ring of lasers around a target pointing at the target. Or at least that's what I want (not what I get). The angle in question is the angle from the base of the laser to the boss. The SetVertexXYs I used to state the length and width of the laser's graphics. x is the original xposition (the base of the laser), and I planned to rotate the laser around the base using ObjEffectSetAngle to point directly at the center. (It doesn't work, of course.)

The question is... what am I doing wrong, because I've tweaked this, drawn diagrams covered in trig, and have absolutely no clue what is going on.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on February 06, 2013, 03:06:59 AM
If you're adding x in the XYs you're doing it wrong. You were doing the same thing wrong in the previous version too but I only just realized it since I saw trig in there and "abort-abort"-ed.
The XYs designate the vertices' coordinates relative to the object's position. The SetAngle also rotates the vertices around the object position. You've already set the object position to be (x,y). You want your XYs to theoretically draw your thing pointing rightwards (0 degrees), in order to rotate it using SetAngle, so your XYs should be something like
ObjEffect_SetVertexXY(objdwarf,0, 170, -10);
ObjEffect_SetVertexXY(objdwarf,1, 170, 10);
ObjEffect_SetVertexXY(objdwarf,2, 0, 10);
ObjEffect_SetVertexXY(objdwarf,3, 0, -10);

If this is really the problem, it's only really the one concept you're messing up. The XY vertices are not meant to precisely draw where the vertices should be on the screen, they're meant to take the graphic and UV coordinates, and turn it into a renderable image (and to skew the graphic if needed). For rectangular objects that are just drawn rectangular (i.e. most things), you set your XYs as if you were just drawing the object flatly on some random point with no modifications. The object position takes care of the drawing position, the angle takes care of rotating graphics, the scale takes care of making it bigger and smaller, etc.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 06, 2013, 10:01:27 PM
Thank's Drake. OkuuB player script completed. (I just hope that I got the Intersecrion line right...)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: JCTechnic on February 08, 2013, 06:51:06 AM
Hey, back again with another question ~

Or might be several actually, First of all, is there a Random function in danmakufu? like Y = Random(100); I wanted to make like a random value for Y so the bullet shots horizontaly.

Second, I'm fairly new to danmakufu but i wanted to know if there's away to make a bullet's full trajectory. Like go up, right up, left, down, etc. or writting the coordinates. Might as well ask, can you make homing bullets?

And last question i can remember, what's the measure of the playable area?

Thanks in advance
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Matteo on February 08, 2013, 07:05:17 AM
Hi, do you know where could i find a Sariel boss image to use in a script as a boss? Like iryan's sariel one, i mean. But obviously i don't want his sariel because:

1- i don't know where to find it
2- it's not right to steal a image without permission.

If you can help me...thx!
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: TheTeff007 on February 08, 2013, 02:48:33 PM
What's the way SetPosition02 works? I mean, what's the formula to calculate the speed?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on February 08, 2013, 06:14:16 PM
What's the way SetPosition02 works? I mean, what's the formula to calculate the speed?

Do you mean SetMovePosition02? That just moves the enemy to the position in x amount of frames. If the distance from the boss to the position you want to move it to is 100 pixels and you tell it to move to that position in 50 frames, then the boss will travel at 100/50, or 2, pixels per frame. In that case, using SetMovePosition01 with a speed of 2 would produce the exact same results.


Hi, do you know where could i find a Sariel boss image to use in a script as a boss? Like iryan's sariel one, i mean. But obviously i don't want his sariel because:

1- i don't know where to find it
2- it's not right to steal a image without permission.

If you can help me...thx!

I'm sure he wouldn't mind but you can always just ask Iryan via PM on the forums.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on February 08, 2013, 11:11:16 PM
if you're looking for the movement speed when using setmoveposition02

then


just use setmoveposition01
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: sjasogun1 on February 10, 2013, 11:14:49 AM
Okay, thanks to Drake's tips I managed to fix most of the script now, but there is one problem remaining. Somehow the RotatingBullet task will only generate half of the Hypocycloid, while replacing it with CreateShot01 will generate the Hypocycloid in one piece. The odd thing is that it really leaves half of the Hypocycloid out, as if cutting it in half, instead of just generating half of it which would make it look completely different (picture a smaller circle rolling inside of a bigger circle three times instead of six: the shape will still be circular but not closed. This is not what I'm seeing in my code.) Below the parts of code that I changed, the rest is still the same, save for the movement code which I omitted completely and replaced with SetX(GetCenterX); and SetY(GetClipMaxY/4); in @initialize. The odd thing is that this ought to have fixed the problem, since I thought that the enemy initially being at (GetCenterX, 0) made half of the shape generate off-screen, thereby deleting that half. But somehow that didn't fix anything. If you want to take a look at my entire code, below is another pastebin too.

-->Pastebin<-- (http://pastebin.com/itZgk2RT)

The Hypocycloid task:
Code: [Select]
task hypocycloid2(a,b,r,k,l){
loop{
k = absolute(trunc(10*k)/10 - trunc(k));
let limit = 360 * (ToFractionNom(k) / GCD(ToFractionNom(k), ToFractionDeNom(k)));
let t = 0;
loop(200){
t += limit/200;
let x = a + r * ( (1 - k) * cos(t) + l * k * cos((1 - k) / k * t));
let y = b + r * ( (1 - k) * sin(t) - l * k * sin((1 - k) / k * t));
RotatingBullet(a, b, x, y, GetAngleToPlayer, RED01);
}
wait(300);
}
}

task RotatingBullet(a, b, x, y, angle, graphic) {
let obj=Obj_Create(OBJ_SHOT);

Obj_SetPosition(obj, x, y);
ObjShot_SetGraphic(obj, graphic);
ObjShot_SetBombResist (obj, true);

let angle2 = atan3(x-a,y-b);
let t2 = 0;
let r = dist(x,y,a,b);
while(Obj_BeDeleted(obj)==false) {
t2 += 1;
a += 2*cos(angle);
b += 2*sin(angle);
x = a + r * cos(t2 + angle2);
y = b + r * sin(t2 + angle2);
Obj_SetPosition(obj, x, y);
yield;
}
}

function dist(x1,y1,x2,y2){
let d = ((x1-x2)^2 + (y1-y2)^2)^0.5;
return d;
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 10, 2013, 06:32:19 PM
OK. Another Question, this time regarding Sparks.

I'm trying to make a master spark, but combining an obj_laser and obj_effect doesn't seem to work. There are two main issues: the first is that the spark turns out red ( I don't know what happened; there's NO red in my picture, and the UV vertices should be fine. THe values are 255, 255, 255, 255 as well.)

The second is that I do not know how to apply delay to the spark. I mean, like a precursor laser before the spark comes. Technically, I could do that by altering the object, but...

Yeah, I have no clue how to do this. I also have no scripts besides player scripts that have sparks in them. My only reason for using an effect object is because my shotsheet doesn't contain the spark built in, so I have to summon it via other means.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on February 11, 2013, 12:14:20 AM
Shotsheets are terrible for large objects anyways, especially detailed lasers.

Use Obj_SetScale() and only modify the x-scale, really, that's all you need. And don't give it a hitbox until it starts growing. I can't guess why it would turn red besides maybe the laser beneath it being red and not invisible lol.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 11, 2013, 12:55:14 AM
Shotsheets are terrible for large objects anyways, especially detailed lasers.

Use Obj_SetScale() and only modify the x-scale, really, that's all you need. And don't give it a hitbox until it starts growing. I can't guess why it would turn red besides maybe the laser beneath it being red and not invisible lol.

Regarding the hitbox, I stared at the list of commands available for 0.12m, and I saw no way to put delay on an object laser. Should I use loop(XYZ){yield;} and cram it somewhere? Thank you.

(P.S. There is absolutely no red in the picture... And I don't think it's possible for my Okuu shotdata to have carried over.)

The script in question is attached. (no pastebin yet because I just wrote three long essays right now)

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on February 11, 2013, 02:32:00 AM
Your program flow doesn't work right, firstly. You make a loop for the laser part, wait for it to be deleted, and then make another loop for the effect part. Even if this worked, they would run one at a time, not together. It doesn't work like this either though, because the laser is never being deleted so the second loop isn't actually ever reached.
Anyways, the solution besides fixing your flow is just to fire the laser when the effect starts expanding. You also don't need the counting variables or the notdeleted loop since the task is just divided into several parts that don't rely on any condition.

Here, I assumed some things about how you have things set up, but I redid like the whole task for you. It should work given your graphic is set up the way I think it is and whatnot.
http://pastebin.com/rSmiHMqj
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: TheTeff007 on February 12, 2013, 03:58:06 PM
How to mimic Miko's effect of her Butterfly Wings? I'm not 100% sure that manipulating the Z distance could help (Oh my, I'm so outdated with coding...)

Forget about it, played around with coding and found out how (Inefficient, but functional. Will update)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: sjasogun1 on February 14, 2013, 11:19:25 AM
Solved my problem (bottom of previous page). My atan3 function wasn't working properly: turns out Danmakufu can't handle negative angles. In the code below, the line before the return had a = -a; instead of a += 180;
Code: [Select]
function atan3(x,y){
if ( x == 0 && y == 0 ){
break;
}
if ( x == 0 ){
if ( y > 0 ){
return 90;
}else{
return 270;
}
}
if ( y == 0 ){
if ( x > 0 ){
return 0;
}else{
return 180;
}
}
let a = atan(y/x);
if ( x < 0 ){a += 180;}
return a;
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 14, 2013, 09:43:41 PM
Hey, back again with another question ~

Or might be several actually, First of all, is there a Random function in danmakufu? like Y = Random(100); I wanted to make like a random value for Y so the bullet shots horizontaly.

Second, I'm fairly new to danmakufu but i wanted to know if there's away to make a bullet's full trajectory. Like go up, right up, left, down, etc. or writting the coordinates. Might as well ask, can you make homing bullets?

And last question i can remember, what's the measure of the playable area?

Thanks in advance
1. For random stuff, just put rand(min,max), an example is "rand(1,48)" whic means, Danmakufu would choose a random number between 1 and 48. (including decimals) Full Example: CreateShot01(GetX, GetY-rand(-50,50) ,3, 90, BLUE05, 0); Did I explain that clearly?
2. Right=0 Down=90 Left=180 Up=270 So 83 would be aimed down and a little to the right. Aimed at player=GetAngleToPlayer (caps are important!)
3. Don't know about the last one, but you can just use these:
GetClipMinY: Top of the playable area.
GetClipMaxY: Bottom of the playable area.
GetClipMinX: Far left of the playable area.
GetClipMaxX: Far right of the playable area.
Wait, I just found this: http://dmf.shrinemaiden.org/wiki/Mathematical_or_Information_Functions_(0.12m)#GetClipMinX (Better explained and answers your question).
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: PhantomSong on February 14, 2013, 10:15:47 PM
1. For random stuff, just put rand(min,max), an example is "rand(1,48)" whic means, Danmakufu would choose a random number between 1 and 48. (including decimals) Full Example: CreateShot01(GetX, GetY-rand(-50,50) ,3, 90, BLUE05, 0); Did I explain that clearly?

Alternatively, you can call: let (enter your varable) = rand(Min Number, MaxNumber) in task fire. IE: let rand = rand(0,359). <- This tells Danmakufu that you want this bullet to fire anywhere from 0-359 (360 is 0)

Calling it will make your life easier and it'll make your script much cleaner.
Code: [Select]
task fire{
    let rand = rand(0,360);     
 
loop{
   CreateShot01(GetX-100,GetY,2,rand,RED01,20);   
           
wait(60);
                       yield;     
        }
                          }
       

Also, if you want to use whole numbers you can use: rand_int(Min number, Max number).

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on February 14, 2013, 11:58:21 PM
Solved my problem (bottom of previous page). My atan3 function wasn't working properly: turns out Danmakufu can't handle negative angles. In the code below, the line before the return had a = -a; instead of a += 180;
Wait what. A negative angle is just not the same thing as an angle+180, that's all.

PhantomSong: lol what is with that tabbing. More notably, that will save the one random angle and just keep firing the bullet at that angle every time. Using the word "rand" as a variable might bork as well, since it's already defined.

...And wait(60); yield; is just wait(61).
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 15, 2013, 01:36:17 AM
Ok, I have another question.
How to I make a spell harder as the boss's life decreases? (Specifically decreasing the wait function)
Would I use if statements? If so how would I write it?
Edit: And how do I make object bullets bounce of walls, but not stahp?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: PhantomSong on February 15, 2013, 02:03:14 AM

Edit: And how do I make object bullets bounce of walls, but not stahp?

What do you mean by they stop?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 15, 2013, 02:04:51 AM
What do you mean by they stop?
They bounce once, then not bounce again on another wall.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 15, 2013, 02:12:04 AM
Ok, I have another question.
How to I make a spell harder as the boss's life decreases? (Specifically decreasing the wait function)
Would I use if statements? If so how would I write it?
Edit: And how do I make object bullets bounce of walls, but not stop?

1&2
Code: [Select]
if((GetLife < 3000 || count > 900)&&count%30==0){
  angle=GetAngleToPlayer;
  loop(15){
    CreateShot01(GetX, GetY, 2, angle, 5, 0);
    angle+=24;
  }
}
Use GetLife and/or a counter variable.

3
I have a task that does that, but accepts a user-defined amount of bounces.

// Wall and sky reflecting bullets.

    task QED(x, y, speed, angle, graphic, delay, num, Bombres) {
      let obj=Obj_Create(OBJ_SHOT);
      let bouncecount = num;
      Obj_SetPosition(obj, x, y);
      Obj_SetAngle(obj, angle);
      Obj_SetSpeed(obj, speed);
      ObjShot_SetGraphic(obj, graphic);
      ObjShot_SetDelay(obj, 0);
      ObjShot_SetBombResist (obj, Bombres);
      while(Obj_BeDeleted(obj)==false && bouncecount > 0) {
        if(Obj_GetX(obj)<GetClipMinX) {
          Obj_SetAngle(obj, 180 - Obj_GetAngle(obj) );
          Obj_SetX(obj,  Obj_GetX(obj) + 0.1);
          bouncecount -= 1;
        }
        if(Obj_GetX(obj)>GetClipMaxX) {
          Obj_SetAngle(obj, 180 - Obj_GetAngle(obj) );
          Obj_SetX(obj,  Obj_GetX(obj) - 0.1);
          bouncecount -= 1;
        }
        if(Obj_GetY(obj)<GetClipMinY) {
          //Obj_SetAngle(obj, Obj_GetAngle(obj) + (2 * (180 - Obj_GetAngle(obj))) ); //Original NetLogo code
          Obj_SetAngle(obj, -1*Obj_GetAngle(obj)); //Equally correct code for Danmakufu
          Obj_SetY(obj,  Obj_GetY(obj) + 0.1);
          bouncecount -= 1;
        }
        yield;
      }
    }


If you don't want the sky reflection, just get rid of the GetClipMinY part.
P.S. Try to make something original; just spamming things like this isn't going to receive an excellent reception most of the time.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 15, 2013, 03:13:28 AM
1&2
Code: [Select]
if((GetLife < 3000 || count > 900)&&count%30==0){
  angle=GetAngleToPlayer;
  loop(15){
    CreateShot01(GetX, GetY, 2, angle, 5, 0);
    angle+=24;
  }
}
Use GetLife and/or a counter variable.

3
I have a task that does that, but accepts a user-defined amount of bounces.

// Wall and sky reflecting bullets.

    task QED(x, y, speed, angle, graphic, delay, num, Bombres) {
      let obj=Obj_Create(OBJ_SHOT);
      let bouncecount = num;
      Obj_SetPosition(obj, x, y);
      Obj_SetAngle(obj, angle);
      Obj_SetSpeed(obj, speed);
      ObjShot_SetGraphic(obj, graphic);
      ObjShot_SetDelay(obj, 0);
      ObjShot_SetBombResist (obj, Bombres);
      while(Obj_BeDeleted(obj)==false && bouncecount > 0) {
        if(Obj_GetX(obj)<GetClipMinX) {
          Obj_SetAngle(obj, 180 - Obj_GetAngle(obj) );
          Obj_SetX(obj,  Obj_GetX(obj) + 0.1);
          bouncecount -= 1;
        }
        if(Obj_GetX(obj)>GetClipMaxX) {
          Obj_SetAngle(obj, 180 - Obj_GetAngle(obj) );
          Obj_SetX(obj,  Obj_GetX(obj) - 0.1);
          bouncecount -= 1;
        }
        if(Obj_GetY(obj)<GetClipMinY) {
          //Obj_SetAngle(obj, Obj_GetAngle(obj) + (2 * (180 - Obj_GetAngle(obj))) ); //Original NetLogo code
          Obj_SetAngle(obj, -1*Obj_GetAngle(obj)); //Equally correct code for Danmakufu
          Obj_SetY(obj,  Obj_GetY(obj) + 0.1);
          bouncecount -= 1;
        }
        yield;
      }
    }


If you don't want the sky reflection, just get rid of the GetClipMinY part.
P.S. Try to make something original; just spamming things like this isn't going to receive an excellent reception most of the time.
wut

Sorry, but I didn't understand that bouncecount thing.
 
 :blush:
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 15, 2013, 11:05:43 PM
num is stated when you call the task. It is how many times the bullet can bounce off of walls

The PS: Don't take things that others have created and spit them out as if they were your own. The QED task is one of the most commonly used tasks in Danmakufu among beginners, for example. Everyone uses it at one point or another. I'm saying to create something creative, new, and original. Something that you can be proud of.

For example, you need to put thought into what you do.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 15, 2013, 11:14:14 PM
num is stated when you call the task. It is how many times the bullet can bounce off of walls

The PS: Don't take things that others have created and spit them out as if they were your own. The QED task is one of the most commonly used tasks in Danmakufu among beginners, for example. Everyone uses it at one point or another. I'm saying to create something creative, new, and original. Something that you can be proud of.

For example, you need to put thought into what you do.
Ok, guess I understand moar... :derp:
The PS: k (potassium lol)  :derp: :derp: :derp: :derp: :derp: :derp: :derp: :derp: :derp: :derp: :derp: :derp: :derp: :derp: :derp: :derp: :derp: :derp: :derp:
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Keegster2 on February 16, 2013, 08:45:18 AM
I tried to install AppLocal (In English), and then installed this game, I then installed AppLocal in Japanese, but it still doesn't work (It crashes as soon as it starts), what am I doing wrong?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 16, 2013, 03:21:36 PM
I tried to install AppLocal (In English), and then installed this game, I then installed AppLocal in Japanese, but it still doesn't work (It crashes as soon as it starts), what am I doing wrong?

You have to RUN Touhou Danmakufu in Japanese Locale. Installing it and then doing nothing with it will not help you.

There should be at least three or four Applocale help threads in this forum. If you have no luck searching in RaNGE (Read the stickies), then check the Tech Help board.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 17, 2013, 05:48:48 PM
I now have ANOTHER issue with effect objects. Given that I've done this so many times already, it's probably a stupid error somewhere. However, after the red master spark which used graphics from a completely different folder, I'm starting to question what's going on.

Code: [Select]
    task thunderorb(angle, xcor, ycor){
let thorb = Obj_Create(OBJ_EFFECT);
let origangle = angle;
let thorbx = xcor;
let thorby = ycor;
let orbcount = 0;
let shots = GetCurrentScriptDirectory~"shots.png";
Obj_SetPosition(thorb,thorbx,thorby);
        Obj_SetSpeed(thorb,0);
ObjEffect_SetTexture(thorb, shots);
ObjEffect_SetRenderState(thorb, ADD);
ObjEffect_CreateVertex(thorb,4);
        ObjEffect_SetPrimitiveType(thorb,PRIMITIVE_TRIANGLEFAN);
        ObjEffect_SetVertexUV(thorb,0,99,8);
        ObjEffect_SetVertexUV(thorb,1,143,8);
        ObjEffect_SetVertexUV(thorb,2,143,52);
        ObjEffect_SetVertexUV(thorb,3,99,52);
ObjEffect_SetVertexXY(thorb,0,-22,-22);
        ObjEffect_SetVertexXY(thorb,1,22,-22);
        ObjEffect_SetVertexXY(thorb,2,22,22);
        ObjEffect_SetVertexXY(thorb,3,-22,22);
        ascent(i in 0..4){ObjEffect_SetVertexColor(thorb, i, 255, 255, 255, 255);}
while(!Obj_BeDeleted(thorb)){
  thorbx = GetPlayerX+45*cos(angle+orbcount);
  thorby = GetPlayerY+45*sin(angle+orbcount);
  Obj_SetPosition(thorb,thorbx,thorby);
          SetCollisionB(GetX, GetY, 24); //I don't know if this is how to do it.
  //etc.
  orbcount++;
  yield;
}
    }
Basically, there are eight orbs rotating around the boss. Problem: The graphics don't load.

Code: [Select]
if(count == 20){
  loop(8){
    thunderorb(angle, GetX+45*cos(angle), GetY+45*sin(angle));
    angle+=45;
  }
PlaySE(bullet);
}
I call it with this. However, the SFX plays, so that means that the objects were indeed created. That's why I'm so confused.

Any and all help will be greatly appreciated.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: TheTeff007 on February 17, 2013, 06:04:27 PM
Not entirely sure that it will work, but replace this line...

Code: [Select]
let shots = GetCurrentScriptDirectory~"shots.png";
...with this one...

Code: [Select]
let shots = GetCurrentScriptDirectory ~ ".\shots.png";
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 17, 2013, 06:25:45 PM
Not entirely sure that it will work, but replace this line...
Code: [Select]
let shots = GetCurrentScriptDirectory~"shots.png"; ...with this one...
Code: [Select]
let shots = GetCurrentScriptDirectory ~ ".\shots.png";

Didn't work.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on February 18, 2013, 03:56:10 AM
Heh. I'm past the "This doesn't work" stage. At least I hope.
So this is more of a "How do I do this?"
Question
I've seen many games use their own fonts, but I just don't know how to implement them and not have all of the letters cram together.

Question #2
In a Mima Script. I saw custom bomb and player images for the default players. How do I do that?

Question #3
Simplest question: Those lines that are under the name of the a spellcard in a spellcard looks editable. Do I have to create a new cutin function to implement that?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: JCTechnic on February 19, 2013, 02:04:52 PM
1. For random stuff, just put rand(min,max), an example is "rand(1,48)" whic means, Danmakufu would choose a random number between 1 and 48. (including decimals) Full Example: CreateShot01(GetX, GetY-rand(-50,50) ,3, 90, BLUE05, 0); Did I explain that clearly?
2. Right=0 Down=90 Left=180 Up=270 So 83 would be aimed down and a little to the right. Aimed at player=GetAngleToPlayer (caps are important!)
3. Don't know about the last one, but you can just use these:
GetClipMinY: Top of the playable area.
GetClipMaxY: Bottom of the playable area.
GetClipMinX: Far left of the playable area.
GetClipMaxX: Far right of the playable area.
Wait, I just found this: http://dmf.shrinemaiden.org/wiki/Mathematical_or_Information_Functions_(0.12m)#GetClipMinX (Better explained and answers your question).

THank you for answering my questions, although I'm asking another thing on the second question.
What I meant was when defining the coordinates I was refering to where the bullet travels to, for example
The bullet first travels to the coordinates (100,300) then goes to (80,100) and finishes at (300,400).
So if we started with the enemy in the top middle the bullet would go, down and left, up and left, down and right.

And a homing bullet I was refering to a bulllet that would follow the player wherever he moved, not just shot at the player's general direction and continue until the end of the screen.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 19, 2013, 03:37:43 PM
THank you for answering my questions, although I'm asking another thing on the second question.
What I meant was when defining the coordinates I was refering to where the bullet travels to, for example
The bullet first travels to the coordinates (100,300) then goes to (80,100) and finishes at (300,400).
So if we started with the enemy in the top middle the bullet would go, down and left, up and left, down and right.

And a homing bullet I was refering to a bulllet that would follow the player wherever he moved, not just shot at the player's general direction and continue until the end of the screen.

Honing bullet: Create an object bullet that, while a certain variable is a certain number, sets Obj_SetAngle to GetAngleToPlayer. If you want it to hone infinitely, then just say GetAngleToPlayer every frame.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 19, 2013, 10:29:22 PM
How do I make a bullet curve back and forth? (Like the familiars in SA stage 1)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 19, 2013, 10:47:10 PM
@Qwertyzxcv: Object bullets that, if var is less than number, set angle angle+= number, or if var >, etc.

I have an annoying question. Basically, my thunder orbs showed up. the bigger issue for me is that using the same collision data, my Seiga bullets refuse to collide with the player.

http://pastebin.com/mYFX10kg (http://pastebin.com/mYFX10kg)

the thunder orb task works perfectly. The seigabullet task would work perfectly if it wasn't for that weird inability for the hitbox to work.

[attach=1]
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on February 20, 2013, 03:06:56 AM
Honing bullet: Create an object bullet that, while a certain variable is a certain number, sets Obj_SetAngle to GetAngleToPlayer. If you want it to hone infinitely, then just say GetAngleToPlayer every frame.
GetAngleToPlayer returns the angle from the Boss to the Player. If you want to get the angle from any other point (like from the homing bullet) to the player, you will need to use something like this instead: atan2(GetPlayerY - Obj_GetY(objbullet), GetPlayerX - Obj_GetX(objbullet))
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 20, 2013, 03:22:13 AM
GetAngleToPlayer returns the angle from the Boss to the Player. If you want to get the angle from any other point (like from the homing bullet) to the player, you will need to use something like this instead: atan2(GetPlayerY - Obj_GetY(objbullet), GetPlayerX - Obj_GetX(objbullet))

*Shoot. I forgot*

Now I have another question, this time regarding one of those stupid issues with Danmakufu.

Apparently, you can only load a certain amount of images at once, correct? Because
Code: [Select]
    let BossImage = GetCurrentScriptDirectory~"suiroga.png";
    let BossCutIn = GetCurrentScriptDirectory~"\system\cutin.png";
    let bullet = GetCurrentScriptDirectory~"bullet.wav";
    let laser = GetCurrentScriptDirectory~"laser.wav";
    let wave = GetCurrentScriptDirectory~"wave.wav";
    let ZUNbullet = GetCurrentScriptDirectory~"supershot.txt";
    let spellsfx = GetCurrentScriptDirectory~"spell.wav";
    let charge = GetCurrentScriptDirectory~"charge.wav";
    let Background = GetCurrentScriptDirectory~"\system\Underwater.jpg";
    let backicon = GetCurrentScriptDirectory~"\system\thunderorb.png";

    @Initialize {
LoadGraphic(BossImage);
LoadGraphic(BossCutIn);
LoadUserShotData(ZUNbullet);
LoadGraphic(Background);
LoadGraphic(backicon);
cutin("NAZRIN","Seiryuu "\""Talisman Eruption"\",BossCutIn,0,0,340,443);
Does not run the cutin correctly while
Code: [Select]
    let BossImage = GetCurrentScriptDirectory~"suiroga.png";
    let BossCutIn = GetCurrentScriptDirectory~"\system\cutin.png";
    let bullet = GetCurrentScriptDirectory~"bullet.wav";
    let laser = GetCurrentScriptDirectory~"laser.wav";
    let wave = GetCurrentScriptDirectory~"wave.wav";
    let ZUNbullet = GetCurrentScriptDirectory~"supershot.txt";
    let spellsfx = GetCurrentScriptDirectory~"spell.wav";
    let charge = GetCurrentScriptDirectory~"charge.wav";
    let Background = GetCurrentScriptDirectory~"\system\Underwater.jpg";
    let backicon = GetCurrentScriptDirectory~"\system\thunderorb.png";

    @Initialize {
LoadGraphic(BossImage);
LoadGraphic(BossCutIn);
LoadUserShotData(ZUNbullet);
//LoadGraphic(Background);
LoadGraphic(backicon);
cutin("NAZRIN","Seiryuu "\""Talisman Eruption"\",BossCutIn,0,0,340,443);
does. I just noticed it AFTER I posted the Version 0.19 video and realized that with the backgrounds, the cutins decided not to load. I tried running cutin("NAZRIN","Seiryuu "\""Talisman Eruption"\",GetCurrentScriptDirectory~"\system\cutin.png",0,0,340,443);, but that didn't work.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 21, 2013, 02:32:38 AM
@Qwertyzxcv: Object bullets that, if var is less than number, set angle angle+= number, or if var >, etc.
Can I have an example code?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 21, 2013, 02:44:38 AM
Can I have an example code?
Code: [Select]
let count = 0;
//Obj declarations
while(!ObjBeDeleted(obj)){
count++;
if(count%20<10){Obj_SetAngle(obj, Obj_GetAngle(obj)+1);}else{Obj_SetAngle(obj, Obj_GetAngle(obj)-1);}
}

Tweak it for your own purposes, and experiment. Maybe you'll want to put a % 2 limit or something.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: JCTechnic on February 21, 2013, 03:31:38 PM
Honing bullet: Create an object bullet that, while a certain variable is a certain number, sets Obj_SetAngle to GetAngleToPlayer. If you want it to hone infinitely, then just say GetAngleToPlayer every frame.

I never actually used the Obj_Create, but I found a code for Homing bullet in the Touhou Wikia,
http://touhou.wikia.com/wiki/Touhou_Danmakufu:_Object_Bullets (http://touhou.wikia.com/wiki/Touhou_Danmakufu:_Object_Bullets)

When I use it in the script the bullets only go down (90 degree, the starting angle of the bullets).
Is there anything I need to add to the code?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Maths ~Angelic Version~ on February 21, 2013, 04:41:40 PM
I never actually used the Obj_Create, but I found a code for Homing bullet in the Touhou Wikia,
http://en.touhouwiki.net/wiki/Touhou_Danmakufu:_Object_Bullets (http://en.touhouwiki.net/wiki/Touhou_Danmakufu:_Object_Bullets)

When I use it in the script the bullets only go down (90 degree, the starting angle of the bullets).
Is there anything I need to add to the code?
Do you have a yield in your @MainLoop?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 21, 2013, 10:52:05 PM
Code: [Select]
let count = 0;
//Obj declarations
while(!ObjBeDeleted(obj)){
count++;
if(count%20<10){Obj_SetAngle(obj, Obj_GetAngle(obj)+1);}else{Obj_SetAngle(obj, Obj_GetAngle(obj)-1);}
}

Tweak it for your own purposes, and experiment. Maybe you'll want to put a % 2 limit or something.
It froze  ???
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on February 21, 2013, 10:56:33 PM
It froze  ???
You need a yield inside the loop. Or else it freezes/crashes.

let count = 0;
//Obj declarations
while(!ObjBeDeleted(obj)){
                count++;
                if(count%20<10){Obj_SetAngle(obj, Obj_GetAngle(obj)+1);}else{Obj_SetAngle(obj, Obj_GetAngle(obj)-1); }
                yield;
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 21, 2013, 11:00:31 PM
You need a yield inside the loop. Or else it freezes/crashes.

let count = 0;
//Obj declarations
while(!ObjBeDeleted(obj)){
                count++;
                if(count%20<10){Obj_SetAngle(obj, Obj_GetAngle(obj)+1);}else{Obj_SetAngle(obj, Obj_GetAngle(obj)-1); }
                yield;
}
I was thinking the it should be there...THANKS  :)

Edit:
weird...it still freezes
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 22, 2013, 02:14:37 AM
weird...it still freezes

Please submit code. All of it. There may be problems with MainLoop or elsewhere.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: JCTechnic on February 22, 2013, 05:03:33 AM
Do you have a yield in your @MainLoop?

Tried it now adding the yield and it works perfectly. Thank you.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Fujiwara no Mokou on February 22, 2013, 09:19:18 AM
Tried it now adding the yield and it works perfectly. Thank you.

Haha, I remember when I had the same problem. Oh, those were the days...
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: JCTechnic on February 22, 2013, 05:05:03 PM
Haha, I remember when I had the same problem. Oh, those were the days...

I'm only just starting out so I'm prone to get lots of errors xD, I have another one now, for some reason when I create an object for player bullets they won't show up, everything works perfectly except the bullet actually appearing. maybe it's because my bullet has (0,0,4,40).
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 22, 2013, 09:24:39 PM
Ok, I haz another question...
How do I connect stages together:
Like so:
Stage 5 + Boss
Score
Stage 6 + Boss
All Clear Score
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 22, 2013, 09:44:46 PM
Ok, I haz another question...
How do I connect stages together:
Like so:
Stage 5 + Boss
Score
Stage 6 + Boss
All Clear Score

Depends on how you want to do it.

For my next project, I'll use the following method: First create the stage, then copy it and rename that one as a function. Then, in your master script, use #include_function and execute the function.

See Luminous Dream.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 22, 2013, 11:21:27 PM
OK.

Besides the Seiga bullet hitbox issue that I have yet to resolve, the cutin issue's cause has been discovered.

Basically, my background is being drawn OVER the cut in.

Is there any way to rectify this? The background stuff is in DrawLoop.

Edit: Seigabullet issue has been fixed (and has caused a smaller, but less problematic issue which I can hopefully ignore).
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on February 23, 2013, 04:00:32 PM
OK.

Besides the Seiga bullet hitbox issue that I have yet to resolve, the cutin issue's cause has been discovered.

Basically, my background is being drawn OVER the cut in.

Is there any way to rectify this? The background stuff is in DrawLoop.

Edit: Seigabullet issue has been fixed (and has caused a smaller, but less problematic issue which I can hopefully ignore).
What layer is the cut in image being drawn on?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 23, 2013, 04:13:13 PM
What layer is the cut in image being drawn on?

The default layer for the CutIn function. I don't know the specific layer. It'd be extremely helpful if I could dump the background to a lower layer though.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 23, 2013, 07:47:16 PM
Please submit code. All of it. There may be problems with MainLoop or elsewhere.
Aain, missig lettrs  >:(
Ok, sorry fordoig this late:
http://pastebin.com/TU02HsAz (http://pastebin.com/TU02HsAz)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 23, 2013, 08:15:20 PM
Aain, missig lettrs  >:(
Ok, sorry fordoig this late:
http://pastebin.com/TU02HsAz (http://pastebin.com/TU02HsAz)

You have so much unnecessary space and such disorganized open/close {} that it's hard to read your code.
Also, you forgot to use Obj_Delete (obj) after the bullet bounces. If you do not delete it, it will repeat the procedure every frame and will crash Danmakufu via overload.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 23, 2013, 11:40:06 PM
You have so much unnecessary space and such disorganized open/close {} that it's hard to read your code.
Also, you forgot to use Obj_Delete (obj) after the bullet bounces. If you do not delete it, it will repeat the procedure every frame and will crash Danmakufu via overload.
Pastebin messed up my code for some reason, it put a bunch of spaces.
Anyway about the fix, I did that and it didn't work.
I went to windowed mode to see the error and apparently it has to do with the thing you gave me for curving bullets.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: gtbot on February 23, 2013, 11:51:19 PM
Pastebin messed up my code for some reason, it put a bunch of spaces.
Anyway about the fix, I did that and it didn't work.
I went to windowed mode to see the error and apparently it has to do with the thing you gave me for curving bullets.

I thought that might've just a pasting error, since you previously didn't specify that it gave an error window or when it crashed. An error is coming up because there's an unexpected bracket on line 149, 20[<10. Remove the bracket.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 24, 2013, 12:30:44 AM
I thought that might've just a pasting error, since you previously didn't specify that it gave an error window or when it crashed. An error is coming up because there's an unexpected bracket on line 149, 20[<10. Remove the bracket.
If this works, i'm thanking you in advance c:
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on February 24, 2013, 05:54:48 AM
The default layer for the CutIn function. I don't know the specific layer. It'd be extremely helpful if I could dump the background to a lower layer though.
Right, I don't know why I didn't notice before. The default layer for CutIn is drawn under @DrawLoop. Is there a reason you didn't put the background inside of @BackGround?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 24, 2013, 02:27:00 PM
Right, I don't know why I didn't notice before. The default layer for CutIn is drawn under @DrawLoop. Is there a reason you didn't put the background inside of @BackGround?

It's not a stage script, so @Background is ignored by Danmakufu. I tried it and it turns out that @Background wasn't read at all. Perhaps I should just leave it as #Touhou Danmakufu and not put [Single] afterwards.  I don't know if that'll work though.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on February 24, 2013, 05:42:54 PM
It's not a stage script, so @Background is ignored by Danmakufu. I tried it and it turns out that @Background wasn't read at all. Perhaps I should just leave it as #Touhou Danmakufu and not put [Single] afterwards.  I don't know if that'll work though.
Wait, what kind of script is it anyway? If it's a spellcard then @BackGround should be running. If not than the only way to do a proper background with a single nonspell is with #BackGround or something like that. I've never really used it myself. The best way to get a background on nonspells is to run them in a stage that has the background you want. But if you want it to be playable in Singles with the background you've going to probably have to use #BackGround or make your own cut in so it's on a higher layer than @DrawLoop or something.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 24, 2013, 06:58:50 PM
Wait, what kind of script is it anyway? If it's a spellcard then @BackGround should be running. If not than the only way to do a proper background with a single nonspell is with #BackGround or something like that. I've never really used it myself. The best way to get a background on nonspells is to run them in a stage that has the background you want. But if you want it to be playable in Singles with the background you've going to probably have to use #BackGround or make your own cut in so it's on a higher layer than @DrawLoop or something.

Would @Background work if you left out the [Single] or [Plural]?

I'm planning to check, but... yeah. Using #Background poses a heap of problems because I actually have a background and a floating background, so it isn't possible for me to use #Background without dumping the floating one.

Oh yeah, and I'm using cutin, not CutIn. I don't remember who made it, and I certainly don't know how to put the cutin on a higher layer yet, although it's in either the function list or one of the tutorials. I'll see if I can tweak it for my purposes.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on February 24, 2013, 09:36:00 PM
Would @Background work if you left out the [Single] or [Plural]?

I'm planning to check, but... yeah. Using #Background poses a heap of problems because I actually have a background and a floating background, so it isn't possible for me to use #Background without dumping the floating one.

Oh yeah, and I'm using cutin, not CutIn. I don't remember who made it, and I certainly don't know how to put the cutin on a higher layer yet, although it's in either the function list or one of the tutorials. I'll see if I can tweak it for my purposes.
You mean the MoF/SA/UFO cutin? Because that function was made by Helepolis.
And I've never put [Single] after #TouhouDanmakufu. But @BackGround still runs for me.
You can just make the background at the zero layer. (http://en.touhouwiki.net/wiki/Touhou_Danmakufu:_Object_Control_Functions#ObjEffect_SetLayer) But the floating BG is a problem, since the Cutins are at layer 1(For the Helepolis cutin.) But that can be solved for just going into the function script and changing what layer the cutin is made on to 2.
Code: [Select]
ObjEffect_SetLayer(obj,1);
To
Code: [Select]
ObjEffect_SetLayer(obj,2);
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 24, 2013, 10:26:52 PM
New question regarding #include_function.

Basically, I have a directory called script. Inside the script directory, I have scripts. Outside of it, I have my function stuff. How would I do an include_function?

    #include_function "..\FxnList.txt"

Will fail with this:
[attach=1]
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on February 24, 2013, 11:33:02 PM
Sparen, your BG code will definitely be ignored if you're putting it in @Background and not @BackGround. If you don't call SetScore(), which identifies a script as a spell card, @BackGround will also not run. (Of course this makes some sense in the context of a stage since a noncard background should be the stage background, but the score flag handling everything internally is a pretty awful way to handle things.)

As for this one, what is actually in your FxnList? It looks like you're trying to include one script that includes other scripts.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 24, 2013, 11:40:02 PM
As for this one, what is actually in your FxnList? It looks like you're trying to include one script that includes other scripts.

Wait, WaitforZeroEnemy, GetDistance, IsSameAngle, sec, scs, etc.

Or is the problem the fact that it starts with a comment?
Code: [Select]
//General Functions

  function wait(let frames){
    loop(frames){yield;}
  }
  function WaitForZeroEnemy{
    while(GetEnemyNum != 0){yield;}
  }

    function Obj_GetAngleToPlayer(obj){
      return Obj_GetAngleToPoint(obj,GetPlayerX,GetPlayerY)
    }
    function Obj_GetAngleToPoint(obj,tarX,tarY){
      if(Obj_GetX(obj) > tarX){
        return 180 - atan2((|Obj_GetY(obj)-tarY|),(| Obj_GetX(obj)-tarX |));
      }
    return atan2((|Obj_GetY(obj)-tarY|),(| Obj_GetX(obj)-tarX |));
    }

function GetPreviousScriptDirectory(){
  let current = GetCurrentScriptDirectory();
  current = erase(current, length(current)-1);
  while(current[length(current)-1] != '\'){
    current = erase(current, length(current)-1);
  }
  return current;
}

Oh, and thanks for the @BackGround info. I've been able to restore function_cutin to its original state now that spell cutins work properly, as does the stage  background. Only one more spell before I get into the pre-boss section... and have to deal with finding a working Akyu sprite. (making my own would be painful considering how poorly my pixel art is right now).
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on February 25, 2013, 12:19:47 AM
Well, your error doesn't say that FxnList is unable to be found, but that function_cutin isn't able to be found. I assumed you called more includes inside FxnList because your error has nothing to do with it. The problem is where you're putting/reading function_cutin, but you just said it works, so...
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 25, 2013, 12:27:29 AM
Well, your error doesn't say that FxnList is unable to be found, but that function_cutin isn't able to be found. I assumed you called more includes inside FxnList because your error has nothing to do with it. The problem is where you're putting/reading function_cutin, but you just said it works, so...

Function_cutin works with Suiroga's TC Extra Stage.

The error message I posted was for another project. A completely different project that hasn't gotten off of the ground yet. In other words, the bug regarding function_cutin still exists. Just in a different project. But it's ... UGH.

I'm just going to attached the bug game and... yeah. There's a Directory Navigation file that shows what's in what.

The attachment should clarify everything. This is going to be my first attempt at creating an entire game, and I really didn't want to have to dump everything into a single folder and have to search for stuff. The only file that should be run is the test file, which is a spell (it was meant to test SFX, but it picked up on an equally infuriating error). The two template scripts are just templates for when I actually start the project in about a month.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: gtbot on February 25, 2013, 05:51:19 AM
I'm just going to attached the bug game and... yeah. There's a Directory Navigation file that shows what's in what.
Within the test.txt file, you must put the '.\' before the '..\' so that Danmakufu knows to begin its directory within the script's location before moving up tiers. The fix is simple:
Code: [Select]
    #include_function ".\..\function_cutin.txt";
    #include_function ".\..\FxnList.txt"
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Vincent_Prismriver on February 25, 2013, 08:32:42 PM
Hi there! (I'm a new member)
I've got a question.

Since I'm still a newbie about Danmakufu, I've watched DoubleVla's tutorial about making a Custom Player Script, just a few minutes ago (But I already know the basics of the Spell Cards).
I've typed everything correctly, closed all the brackets (or at least I hope so) but when i select my custom player, the engine give me an error message.

Here's my code: http://pastebin.com/ksHjScU5

I really can't get what is the problem, I checked everything many times.
Could someone please help me?

(I hope I've written the message correctly, due to English not being my first language... this is also my first post here)

EDIT 22:41

Here's the Error Message I get:
(http://i47.tinypic.com/atlylk.png)

I don't know what to do ?_?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 25, 2013, 09:31:58 PM
Within the test.txt file, you must put the '.\' before the '..\' so that Danmakufu knows to begin its directory within the script's location before moving up tiers. The fix is simple:
Code: [Select]
    #include_function ".\..\function_cutin.txt";
    #include_function ".\..\FxnList.txt"

Thanks. I wish that this kind of info was easier to find.

@Vincent: Please post an image of the error message. If there is a line number given, then look at the section in question.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on February 26, 2013, 12:15:12 AM
The logical OR operator is ||, not |space|. That's all.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 26, 2013, 01:58:14 AM
Can there be object bullets effect objects in stages?
Every time I try it doesn't work...
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 26, 2013, 02:10:53 AM
Can there be object bullets in stages?
Every time I try it doesn't work...

It should technically work if you're trying to do a PC-98-ish or EoSD-ish bullets from the screen. Please state what you tried, how you called the bullets, and any error messages. Start with the task, then go for how it was called.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 26, 2013, 02:29:28 AM
It should technically work if you're trying to do a PC-98-ish or EoSD-ish bullets from the screen. Please state what you tried, how you called the bullets, and any error messages. Start with the task, then go for how it was called.
Ok, they aren't actually bullets. I meant to say effect objects...xD
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 26, 2013, 02:53:38 AM
Ok, they aren't actually bullets. I meant to say effect objects...xD

Explain what you are trying to to and show the code used. Also:
http://dmf.shrinemaiden.org/wiki/Nuclear_Cheese%27s_Drawing_Tutorial (http://dmf.shrinemaiden.org/wiki/Nuclear_Cheese%27s_Drawing_Tutorial)

For most of the stuff, you can probably dump it in either @DrawLoop or @BackGround.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on February 26, 2013, 02:56:17 AM
Qwerty: If by "it doesn't work" you mean "it crashes", Danmakufu often has issues with drawing on the first frame of a stage script.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 26, 2013, 03:00:47 AM
Qwerty: If by "it doesn't work" you mean "it crashes", Danmakufu often has issues with drawing on the first frame of a stage script.

I.E. the first thing you should do is wait(#);
From Danmaku Dodging for Dummies:
Code: [Select]
  task Stage{
    wait(1); //Required to be here, greater than 0.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: JCTechnic on February 26, 2013, 02:25:15 PM
Hello again, I got a new problem yay!

Like Vincent_Prismriver, I also watched the DoubleVla's tutorial and like him I had an error when it comes to Custom Player Script as well, it seem's that my bullets don't show up, I can hear the SFX of the shooting but I can't see the bullets.

I'm not on my true computer where everything is saved so I can't really show how my code turned out, but is there some common error when you create a Custom Player Script?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on February 26, 2013, 04:00:48 PM
Hello again, I got a new problem yay!

Like Vincent_Prismriver, I also watched the DoubleVla's tutorial and like him I had an error when it comes to Custom Player Script as well, it seem's that my bullets don't show up, I can hear the SFX of the shooting but I can't see the bullets.

I'm not on my true computer where everything is saved so I can't really show how my code turned out, but is there some common error when you create a Custom Player Script?
Since you're saying your bullets don't appear but it does run the sound it means that this might be a graphical issue.
- Check whether you correctly declared the dimensions for the player bullet
- Check whether you loaded the graphics required for the player bullets

When you're on your true PC, please post pastebin log.


Code: [Select]
task Stage{
    wait(1); //Required to be here, greater than 0.
Be careful that not everybody who uses the wait function will understand that. In this case you need to use a 'yield'.

To elaborate on Drake's post about Danmakufu not liking drawing on first frame. It is quite easy. Don't call Effect Objects in @initialize or during initializations of the script. If you're scripting mainloop style, you might want to start out with a 'yield' as first line. If you're task based scripting, then make sure that before your effect object gets called to add a Yield;
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Vincent_Prismriver on February 26, 2013, 05:47:13 PM
Quote
The logical OR operator is ||, not |space|. That's all.

Only that? Oh my, I feel so embarassed right now ^///^
Thanks for the help, but now I have another problem.  :getdown:

The shot works fine, but now the problem is with the player's sprite. I don't understand where is the error.

Error Picture:
(http://i48.tinypic.com/15qajrl.png)

Custom Player Script Code:
http://pastebin.com/F8F6UWTJ

The Sprite I want to use (I don't want animations or anything):
(http://i52.tinypic.com/bfgswz.png)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on February 26, 2013, 07:10:18 PM
Huh? If you don't want any animations or anything you might as well remove the entire  if(GetKeyState(VK_LEFT)==KEY_PUSH) || GetKeyState(VK_LEFT)==KEY_HOLD) {  section. So your drawloop becomes this:

Code: [Select]
@DrawLoop{
SetTexture(Ntex);
SetAlpha(255);
        SetGraphicAngle(0,0,0);
SetGraphicScale(1,1);
SetGraphicRect(0,0,64,64);
DrawGraphic(GetPlayerX,GetPlayerY);
}

You can delete the entire animation code with the if/else statements.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Vincent_Prismriver on February 26, 2013, 07:26:35 PM
So, I removed all the unnecessary parts, and my DrawLoop is like that.
But when I've opened Danmakufu to test it out, here comes another error message.

(http://i54.tinypic.com/jh3q6r.jpg)

What the hell...? ;_;
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on February 26, 2013, 07:36:45 PM
i have never seen that before ever

please pastebin your script, this is unprecedented serious affair

EDIT: google says there might be an incompatibility with your graphics card, please post that too if you know what it is
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Vincent_Prismriver on February 26, 2013, 07:43:09 PM
EDIT: I restarted my computer. Now it works fine, I can open the program.
At least if it happens again, I'll know what to do.

But the issue about my custom player character hasn't been solved yet.
If I play a script the sprite... like... doesn't appear.
There's only the hitbox if I focus.

Code: http://pastebin.com/iCf4pxLt

Screen: (http://i54.tinypic.com/10qysrt.jpg)

This sure is strange... the character sprite doesn't appear on the screen, but it does in the HUD (I've set the same sprite)
(http://i52.tinypic.com/bfgswz.png)

Actually, I've encountered this problem before, so I thought I should've added those animation lines (which were useless as a result)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: JCTechnic on February 26, 2013, 08:46:15 PM
Since you're saying your bullets don't appear but it does run the sound it means that this might be a graphical issue.
- Check whether you correctly declared the dimensions for the player bullet
- Check whether you loaded the graphics required for the player bullets

When you're on your true PC, please post pastebin log.

http://pastebin.com/jWr0U1QB (http://pastebin.com/jWr0U1QB)

I tried decreasing  the bullet to less pixels but still nothing, there's the link to my code.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on February 26, 2013, 09:39:43 PM
http://pastebin.com/jWr0U1QB (http://pastebin.com/jWr0U1QB)

I tried decreasing  the bullet to less pixels but still nothing, there's the link to my code.

Code: [Select]
goodshot(GetPlayerX, GetPlayerY, 15, 270, WHITE01, 5);You're calling your object shot, but giving it a WHITE01 as graphics while your own bullet is defined as ID 01 (I think you need to make it 1, not 01)

Code: [Select]
ShotData { id = 1 rect=(0,0,111,111) render=ALPHA alpha=255 }
---
goodshot(GetPlayerX, GetPlayerY, 15, 270, 1, 5);

Change your ID to 1. And give your goodshot graphic parameter a '1'. This should fix it.


Code: http://pastebin.com/iCf4pxLt
You didn't define any rect in your @DrawLoop? Please scroll up to see my previous post :V
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: JCTechnic on February 26, 2013, 10:31:59 PM
Code: [Select]
goodshot(GetPlayerX, GetPlayerY, 15, 270, WHITE01, 5);You're calling your object shot, but giving it a WHITE01 as graphics while your own bullet is defined as ID 01 (I think you need to make it 1, not 01)

Code: [Select]
ShotData { id = 1 rect=(0,0,111,111) render=ALPHA alpha=255 }
---
goodshot(GetPlayerX, GetPlayerY, 15, 270, 1, 5);

Change your ID to 1. And give your goodshot graphic parameter a '1'. This should fix it.

Ups sorry but, I forgot I edited the code before to try and work around the error, but to no avail.
I edited the code back to it's original state with everything you said but still nothing, maybe it's something quite obvious that I just don't know about :/

http://pastebin.com/jWr0U1QB

^Edited
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 26, 2013, 11:08:06 PM
I've figured out the effect object thing...it was some other error.  :derp:
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 26, 2013, 11:15:41 PM
Ups sorry but, I forgot I edited the code before to try and work around the error, but to no avail.
I edited the code back to it's original state with everything you said but still nothing, maybe it's something quite obvious that I just don't know about :/

http://pastebin.com/jWr0U1QB

^Edited

Line 58:
Code: [Select]
else if
You have an error there. I think that's why it says you need a {

Also, I think the Player Shot Data needs a capital P.

#PlayerShotData
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: gtbot on February 26, 2013, 11:41:36 PM
Code: [Select]
else if
You have an error there. I think that's why it says you need a {
else if does not cause an error.

Ups sorry but, I forgot I edited the code before to try and work around the error, but to no avail.
I edited the code back to it's original state with everything you said but still nothing, maybe it's something quite obvious that I just don't know about :/

You are missing a final bracket to close off script_player_main (you missed a } bracket right after the yield; in the wait function). And as Sparen mentioned, you need #PlayerShotData, with a capital P.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 27, 2013, 01:11:00 AM
How do I create a CreateShotA object bullet?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on February 27, 2013, 01:19:34 AM
How do I create a CreateShotA object bullet?
You can't. CreateShotA bullets are treated the same way as CreateShot01 bullets, only with additional ways to control them after they are fired. Object bullets, while you can manipulate them in much the same way (only with even MORE things you can do with them), are created differently and are treated differently by the system than CreateShotA bullets.

In short, you can't fire object bullets with any of the CreateShot functions.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on February 27, 2013, 01:25:15 AM
As said, you can't exactly do that in 0.12 since you aren't given control over objects created using the CreateShot series and the like. You can create a structure that works similarly, but for all intended purposes it works much simpler by just writing the object bullet from scratch unless the behaviour is really simple. But if you're looking for the same "build-a-bullet" sort of things then don't bother trying to copy CreateShotA.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 27, 2013, 01:26:32 AM
You can't. CreateShotA bullets are treated the same way as CreateShot01 bullets, only with additional ways to control them after they are fired. Object bullets, while you can manipulate them in much the same way (only with even MORE things you can do with them), are created differently and are treated differently by the system than CreateShotA bullets.

In short, you can't fire object bullets with any of the CreateShot functions.

On this issue, angular velocity is basically, Obj_SetAngle(obj, Obj_GetAngle(obj)+XXX) in the while !BeDeleted statement. Acceleration is if(Obj_GetSpeed(obj) >/< (depends) Max/min speed){Obj_SetSpeed(obj, Obj_GetSpeed+XXX)}

Basically, you can do everything else as you want to. The only issues are x and y accelerations and x and y velocities.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 27, 2013, 01:29:42 AM
Ok, I meant the parameters, of SetShotDataA, mainly curving...because I want indestructable curving bullets that are set in the shot, not in the object bullet. :)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 27, 2013, 01:31:19 AM
Ok, I meant the parameters, of SetShotDataA, mainly curving...because I want indestructable curving bullets. :)

It's stated in the tutorial how to give angular velocity to an object bullet. Just make sure not to go too overboard~ Sometimes having bullets return from the bottom of the screen can result in death.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 27, 2013, 01:37:19 AM
It's stated in the tutorial how to give angular velocity to an object bullet. Just make sure not to go too overboard~ Sometimes having bullets return from the bottom of the screen can result in death.
Well, does that mean I have to recreat the bullet into an object bullet?
Or can I add a paramter?
 
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 27, 2013, 01:59:50 AM
Well, does that mean I have to recreat the bullet into an object bullet?
Or can I add a paramter?

It's already an object bullet, right? You can do whatever you want. Obj_Delete(obj) can be used to clear stuff.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on February 27, 2013, 02:09:24 AM
Code: [Select]
function CreateShotA2(x, y, speed, accel, maxspeed, angle, angvel, graphic, delay){
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x, y);
Obj_SetSpeed(obj, speed);
ObjShot_SetGraphic(obj, graphic);
ObjShot_SetDelay(obj, delay);
shot_main();
return obj;

task shot_main(){
while((speed < maxspeed && accel > 0) || (speed > maxspeed && accel < 0)){
Obj_SetSpeed(obj, speed);
speed += accel;
Obj_SetAngle(obj, angle);
angle += angvel;
yield;
}
Obj_SetSpeed(obj, maxspeed);

while(!Obj_BeDeleted(obj)){
Obj_SetAngle(obj, angle);
angle += angvel;
yield;
}
}
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 27, 2013, 02:16:01 AM
It's already an object bullet, right? You can do whatever you want. Obj_Delete(obj) can be used to clear stuff.
nope, its just createshota
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 27, 2013, 02:17:18 AM
nope, its just createshota

You can't add parameters to it unless you create an object bullet.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 27, 2013, 02:26:28 AM
You can't add parameters to it unless you create an object bullet.
ill look at Drake's code
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: JCTechnic on February 27, 2013, 02:58:10 AM
Line 58:
Code: [Select]
else if
You have an error there. I think that's why it says you need a {

Also, I think the Player Shot Data needs a capital P.

#PlayerShotData

Thanks again danmakufu community, it was that damn capital P, that little rascal made me almost lose my mind!

On another note, as I now know how to make custom players and bosses,the next step is the stage, do any of you know where I can find a good stage tutorial? With calling the fairies and what not? Thanks in advance.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 27, 2013, 03:16:36 AM
Thanks again danmakufu community, it was that damn capital P, that little rascal made me almost lose my mind!

On another note, as I now know how to make custom players and bosses,the next step is the stage, do any of you know where I can find a good stage tutorial? With calling the fairies and what not? Thanks in advance.

http://dmf.shrinemaiden.org/wiki/Danmakufu_Intermediate_Tutorial#How_to_make_Stages.21 (http://dmf.shrinemaiden.org/wiki/Danmakufu_Intermediate_Tutorial#How_to_make_Stages.21)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Vincent_Prismriver on February 27, 2013, 12:05:35 PM
EDIT: I restarted my computer. Now it works fine, I can open the program.
At least if it happens again, I'll know what to do.

But the issue about my custom player character hasn't been solved yet.
If I play a script the sprite... like... doesn't appear.
There's only the hitbox if I focus.

Code: http://pastebin.com/iCf4pxLt

Screen: (http://i54.tinypic.com/10qysrt.jpg)

This sure is strange... the character sprite doesn't appear on the screen, but it does in the HUD (I've set the same sprite)
(http://i52.tinypic.com/bfgswz.png)

Actually, I've encountered this problem before, so I thought I should've added those animation lines (which were useless as a result)

Excuse me, does someone know what might be the problem? Thanks in advance.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: gtbot on February 27, 2013, 01:07:24 PM
Excuse me, does someone know what might be the problem? Thanks in advance.
You didn't define any rect in your @DrawLoop? Please scroll up to see my previous post :V
You are still missing SetGraphicRect. (http://www.shrinemaiden.org/forum/index.php/topic,12397.msg951896.html#msg951896)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Vincent_Prismriver on February 27, 2013, 01:31:16 PM
OH MY, I'M SUCH A RETARD  :V

Everything worked fine, sorry for bothering you so much  :3
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on February 27, 2013, 02:21:00 PM
OH MY, I'M SUCH A RETARD  :V

Everything worked fine, sorry for bothering you so much  :3
We'll forgive you! For this time. Next time you'll have to code 10000 lines of "I will carefully read the posts"



...on paper.
( Good to hear it worked out )
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 27, 2013, 11:17:10 PM
Code: [Select]
function CreateShotA2(x, y, speed, accel, maxspeed, angle, angvel, graphic, delay){
   let obj = Obj_Create(OBJ_SHOT);
   Obj_SetPosition(obj, x, y);
   Obj_SetSpeed(obj, speed);
   ObjShot_SetGraphic(obj, graphic);
   ObjShot_SetDelay(obj, delay);
   shot_main();
   return obj;

   task shot_main(){
      while((speed < maxspeed && accel > 0) || (speed > maxspeed && accel < 0)){
         Obj_SetSpeed(obj, speed);
         speed += accel;
         Obj_SetAngle(obj, angle);
         angle += angvel;
         yield;
      }
      Obj_SetSpeed(obj, maxspeed);

      while(!Obj_BeDeleted(obj)){
         Obj_SetAngle(obj, angle);
         angle += angvel;
         yield;
      }
   }
}
THATS COOL AND WORKED!  :toot:
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 28, 2013, 12:28:09 AM
OK~ Crash report.

Code: [Select]
#TouhouDanmakufu[Stage]
#Title[Pok?DigiDanmaku Stage 1 Easy]
#Text[Stage 1
Made by Sparen.]
#PlayLevel[Easy]
#Player[player\PDDVee\veemon.dnh]
#ScriptVersion[2]

Is there anything wrong with this heading? I specifically refer to the player call, because that seems to be what crashed Danmakufu. If there isn't something wrong, then I'll check the rest of the stage script once I start scripting the rest of the stage enemies.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on February 28, 2013, 12:32:14 AM
OK~ Crash report.

Code: [Select]
#TouhouDanmakufu[Stage]
#Title[Pok?DigiDanmaku Stage 1 Easy]
#Text[Stage 1
Made by Sparen.]
#PlayLevel[Easy]
#Player[player\PDDVee\veemon.dnh]
#ScriptVersion[2]

Is there anything wrong with this heading? I specifically refer to the player call, because that seems to be what crashed Danmakufu. If there isn't something wrong, then I'll check the rest of the stage script once I start scripting the rest of the stage enemies.
Do you need .\ before "player\PDDVee\veemon.dnh"?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 28, 2013, 12:44:36 AM
Do you need .\ before "player\PDDVee\veemon.dnh"?

I checked Luminous Dream. There was no .\

I have a feeling that it may have been something else. I'm going to retest.

Test Results: It froze upon loading Veemon, then... loaded the screen. Couldn't move. Then played music, ran through script, and then resumed normal function. I have no clue what happened. What I do know is that it didn't play the second track, and that Veemon was rendered immobile. Maybe I forgot to yield or something.

Scratch that.
Code: [Select]
  @MainLoop{
    yield; 
  }

Edit: Apparently, the freezing has nothing to do with the player script. There's a serious error somewhere. When I ran it through ReimuC, the options would rotate, then stop, then rotate, then stop. The music also refused to work correctly.

http://pastebin.com/zPbP3NsU (http://pastebin.com/zPbP3NsU)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on February 28, 2013, 06:53:09 AM
Not quite sure. You'll need to apply trial & error by returning as much as possible to basics. Though suspecting your music.
- Disable all sfx / music (don't load/play them)
- Disable playerscript (don't load it specifically, put to FREE)
- Disable any includes if possible (no idea what FxnList does)

If that works, enable the music only and repeat.

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on February 28, 2013, 11:13:15 PM
Not quite sure. You'll need to apply trial & error by returning as much as possible to basics. Though suspecting your music.
- Disable all sfx / music (don't load/play them)
- Disable playerscript (don't load it specifically, put to FREE)
- Disable any includes if possible (no idea what FxnList does)

If that works, enable the music only and repeat.

Disabling the music seems to work, I think. However, the bug does not occur in TC Extra, where twice the amount of music is being loaded. I'll add stage enemies and see what happens.

FREE: Still doesn't work
Includes: Adding wait and Wait for zero enemy to the main script and elimination the include does not solve the problem. On a side note, I simple /**/ed the include. Don't know if that will actually work.

Edit: Now there are two issues: one is the music. Basically, removing the Play part stops the freezing. However, the second track never loads.
Secondly, my enemy script graphic refuses to work correctly, and basically... duplicates the image 60000 times. Don't know what to do.

http://www.mediafire.com/?m7s4ahjqsbht1 (http://www.mediafire.com/?m7s4ahjqsbht1)

Current version (0.02) can be found above. Any and all bugfix suggestions will be greatly appreciated.
I apologize in advance for the music size. However, it's sort of important to have the music because that's one of the problems.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on March 01, 2013, 08:39:18 AM
It isn't about the number of songs loaded, it is about the song itself being loaded or played. Just as some OGG music files can cause crashes/strange things, you might want to verify. If your script runs fine without music then you need to trial & error down to which music/wav/sfx file is the culprit. I think that is quite obvious now.

I cannot download files (especially large ones). Please post pastebin of your issue with the graphic duplication. Sounds pretty much as something you are looping and constantly creating the object/effect.

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Aesir108 on March 01, 2013, 01:04:13 PM
i've always love Shou's spellcard background,but i don't know how to extract it.anyone wanna help ?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: gtbot on March 01, 2013, 01:05:19 PM
http://pastebin.com/YueYSbNm (http://pastebin.com/YueYSbNm)
I narrowed down both issues to both songs (when I changed both there were no freezes) so you may want to change them or lower their file size.
The sprite error seems to come from this particular code:
Code: [Select]
    if(GetAngle>315&&GetAngle<=45){SetGraphicRect(61, 16, 79, 42);} //Rt
    if(GetAngle>45&&GetAngle<=135){SetGraphicRect(19, 17, 41, 41);} //Down
    if(GetAngle>135&&GetAngle<=225){SetGraphicRect(81, 16, 99, 42);}//Left
    if(GetAngle>225&&GetAngle<=315){SetGraphicRect(40, 16, 58, 39);}//Up
Upon removing all SetGraphicRects ifs and leaving just one without an if, it seems to work fine, so I'm led to believe its this. I'm not familiar with how GetAngle works (ph3 confused me), so I'm not sure what the solution would be.

 Also another thing, you are setting the sprite path to what appears to be a cutin instead of the actual sprite.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Aesir108 on March 01, 2013, 02:12:17 PM
umm... i mean i'll save it as a picture
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 02, 2013, 12:49:46 AM
i've always love Shou's spellcard background,but i don't know how to extract it.anyone wanna help ?

Go to Touhou Projects under this board and go to Drake's page.

http://pastebin.com/YueYSbNm (http://pastebin.com/YueYSbNm)
I narrowed down both issues to both songs (when I changed both there were no freezes) so you may want to change them or lower their file size.
The sprite error seems to come from this particular code:
Code: [Select]
    if(GetAngle>315&&GetAngle<=45){SetGraphicRect(61, 16, 79, 42);} //Rt
    if(GetAngle>45&&GetAngle<=135){SetGraphicRect(19, 17, 41, 41);} //Down
    if(GetAngle>135&&GetAngle<=225){SetGraphicRect(81, 16, 99, 42);}//Left
    if(GetAngle>225&&GetAngle<=315){SetGraphicRect(40, 16, 58, 39);}//Up
Upon removing all SetGraphicRects ifs and leaving just one without an if, it seems to work fine, so I'm led to believe its this. I'm not familiar with how GetAngle works (ph3 confused me), so I'm not sure what the solution would be.

 Also another thing, you are setting the sprite path to what appears to be a cutin instead of the actual sprite.

Basically, I'm assuming that Danmakufu requires a SetGraphicRect, so... it just basically failed when there wasn't a guaranteed one. In that case, I'll try it with *ugh* a long series of if else statements.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 02, 2013, 01:08:05 AM
Hoe do i make the timeout sound effect when there is10 seconds left?
would it be like if timer = 10 playse(gjffgc):?
If so, where woulld i put it?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 02, 2013, 01:25:24 AM
Hoe do i make the timeout sound effect when there is10 seconds left?
would it be like if timer = 10 playse(gjffgc):?
If so, where woulld i put it?

I would put it in MainLoop because that's how I run things. If you decide to do it, you'd use a built in function like get time or something, and you'd insert it before yield;

For my problem: changing music to .mp3 did not solve anything, and the lag has not decreased. Is this a problem of too many directories, or is it something else? Also, the yield; in the main loop seems to not work, which is a terrifying prospect. Also, even with the decreased file size for .mp3 files, it still refuses to load the second track. The bug has not occurred with Suiroga's stage, which is worrisome since I have 50 MB of music loaded there (perfectly fine).
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 02, 2013, 02:23:01 AM
I'm not going to bother with the rest of the issues, but notably (GetAngle>315&&GetAngle<=45) is an impossible condition.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 02, 2013, 02:44:59 AM
I'm not going to bother with the rest of the issues, but notably (GetAngle>315&&GetAngle<=45) is an impossible condition.

That part has been changed.

Update: The stage enemy graphics problem is FIXED
Code: [Select]
    SetGraphicRect(19, 17, 41, 41); //Down. Default
    if(GetAngle>-45&&GetAngle<=45){SetGraphicRect(64, 16, 82, 42);} //Rt
    if(GetAngle>135&&GetAngle<=225){SetGraphicRect(84, 16, 102, 42);}//Left
    if(GetAngle>225&&GetAngle<=315){SetGraphicRect(40, 16, 61, 44);}//Up

The only remaining issue as of right now is the issue of the music and the fact that using wait() doesn't allow the player to move.

EDIT:

It is the music. I swapped in Suiroga's music and it worked perfectly fine. In other words... I now need to find working versions of every single track. I'm going to post a request list on my project page.

Edit: It seems that Danmakufu could handle an export of ZUN's work, but couldn't handle something recorded from system audio. Are there any specifications on the types of music Danmakufu can load? It wouldn't run a certain .mp3 track, and my own piece froze it. I really need to find out what's going on and why it doesn't work. The main issue is that Suiroga's music works, but the current music doesn't for some unknown reason.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 02, 2013, 05:10:00 PM
http://pastebin.com/dh3TmXTH (http://pastebin.com/dh3TmXTH)
Why are there like 8 layers of bullets? xD
 
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 02, 2013, 05:11:33 PM
http://pastebin.com/dh3TmXTH (http://pastebin.com/dh3TmXTH)
Why are there like 8 layers of bullets? xD

Please elaborate on what exactly is going wrong.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 02, 2013, 05:18:19 PM
Please elaborate on what exactly is going wrong.
OK,
The bullets look weird so when I graze ONE bullet my graze goes up EIGHT.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 02, 2013, 05:59:34 PM
OK,
The bullets look weird so when I graze ONE bullet my graze goes up EIGHT.

You just happened to spawn 8 bullets there. Check loops, check other stuff, and check... yeah.

Task Fire:
Code: [Select]
                ang+=5000/5;
                dir+=5000/5;
What is this supposed to accomplish?

OK. So... a lot of your bullets overlap because you coded it that way. When you create two bullets with the same parameters, yeah...

Basically, not every bullet = 8 bullets. Just a few. However, rectifying the issue isn' practical because your script depends on the layout of bullets and angle incrementations that you have in place.

I have an error message that needs decoding.

Basically, it occurred in my Stage script and then crashed. I didn't change anything, so...
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Maths ~Angelic Version~ on March 02, 2013, 06:26:51 PM
Well, I can try to help you with "firec" (aimed light blue bullets):
Change line 91 to
Code: [Select]
                while(x<9){and change line 112 to
Code: [Select]
                dir+=360/9;
If you want to fire a circle of nine bullets, the best way is simply
Code: [Select]
let dir=0;
loop( 9)
{
CreateShot01(GetX, GetY, 4, dir, AQUA04,0);
dir+=360/9;
x++;
}
Note: I only put the space in front of the first nine to prevent it from becoming "loop(9)".
This fires the first bullet at 0 degrees, the next at 40 degrees, then 80, 120 etc.
loop(n){stuff;} just runs "stuff" n times without requiring you to define a variable. I used to prefer while loops for making circles, but I have switched to the "standard" loop. I find it easier to use.
A full circle is 360 degrees, hence the number 360. If you use that number (or 180 for semicircles, 90 for one quarter of a circle etc) instead of a weird number like "5000/5", it's much easier to see what you want to do.
I highly recommend writing "360/9" even though it's easy to see that 360/9=40. If you write "40", others will look at your code and wonder where the strange number 40 came from. Also, if you want to fire n bullets and n is a variable, you have no choice but to write "360/n" anyway.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 02, 2013, 06:29:01 PM
You just happened to spawn 8 bullets there. Check loops, check other stuff, and check... yeah.

Task Fire:
Code: [Select]
                ang+=5000/5;
                dir+=5000/5;
What is this supposed to accomplish?

OK. So... a lot of your bullets overlap because you coded it that way. When you create two bullets with the same parameters, yeah...

Basically, not every bullet = 8 bullets. Just a few. However, rectifying the issue isn' practical because your script depends on the layout of bullets and angle incrementations that you have in place.
Yup, my graze goes up 16 for fire...
I fixed what you said and now it goes up 8.
The green squares also are overlapping, so  ??? .
Edit: @Maths ~Angelic Version~, Thanks, that fixed firec! :D
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 02, 2013, 06:49:05 PM
NOW, I messed with it a lot and now the only thing is fireb is 2 bullts:
Code: [Select]
task fireb{
  wait(60);
  let dir = 0;
  let x = 0;
  loop{
  while(x<36){
  CreateShot01(GetX, GetY, 3, dir, BLUE02,0);
  dir+=500/5;
  x++;
  }
  x = 0;
  dir=0;
  wait(12);
  yield;
  }}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 02, 2013, 07:44:12 PM
OK. My question and error message have been resolved.

["E", -40] is illegal because an array must have the same characteristics throughout.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 02, 2013, 11:23:44 PM
NOW, I messed with it a lot and now the only thing is fireb is 2 bullts:
Code: [Select]
while(x<36){
   dir+=500/5;
   x++;
}
You just didn't really pay attention to how your angles will work out. Angles work in modulo 360; that is, 360 = 0, 361 = 1, 390 = 30, etc.
You're increasing the angle by 100 every loop, over 36 times. You get this sequence:
0, 100, 200, 300, 40, 140, 240, 340, 80, 180, 280, 20, 120, 220, 320, 60, 160, 260... 360 = 0.
Then it repeats that sequence for the next 18 loops, so you end up with 2 bullets on top of each other.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 02, 2013, 11:54:15 PM
You just didn't really pay attention to how your angles will work out. Angles work in modulo 360; that is, 360 = 0, 361 = 1, 390 = 30, etc.
You're increasing the angle by 100 every loop, over 36 times. You get this sequence:
0, 100, 200, 300, 40, 140, 240, 340, 80, 180, 280, 20, 120, 220, 320, 60, 160, 260... 360 = 0.
Then it repeats that sequence for the next 18 loops, so you end up with 2 bullets on top of each other.
OHHHHHH  :derp: 
Thanks!
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: TheTeff007 on March 03, 2013, 06:13:42 PM
So I have this problem with the Events...


It's supposed to load the image of the boss for the conversation, but instead it loads that.


The code is the next one (I Apologize for not using pastebin, but it does not open right now for some reason...)

Code: [Select]
#TouhouDanmakufu[Single]
#Title[Stage 1 Boss Conversation]
#Text[Chimei Jigyosho Pre-Battle Conversation (Reimu)]
#Player[FREE]
#BackGround[Default]
#ScriptVersion[2]

script_event Event01
{
let Boss1 = GetCurrentScriptDirectory ~ ".\enm1img\Chimei00b.png";
let Boss2 = GetCurrentScriptDirectory ~ ".\enm1img\Chimei00c.png";
let Boss3 = GetCurrentScriptDirectory ~ ".\enm1img\Chimei00d.png";
let Boss4 = GetCurrentScriptDirectory ~ ".\enm1img\Chimei00e.png";

let White = GetCurrentScriptDirectory ~ ".\enm1img\white.png";
let BGM = GetCurrentScriptDirectory ~ ".\enm1bgm\02.mp3";

let BossAll = [Boss1, Boss2, Boss3, Boss4];

@Initialize
{

ascent(i in 0..length(BossAll)){LoadGraphic(BossAll[i]);}
LoadGraphic(White);
LoadMusic(BGM);

}

@MainLoop
{
SetChar(LEFT, White);
SetGraphicRect(LEFT, 0, 0, 1, 1);
MoveChar(LEFT, FRONT);
TextOut("\c[BLUE]Plants are acting berserk \naround here...");
TextOut("\c[BLUE]Somebody must be surely causing \ntroubles!");

MoveChar(LEFT,BACK);
TextOut("\c[RED]T-that's probably my master.");

SetChar(RIGHT, BossAll[0]);
MoveChar(RIGHT, FRONT);
SetGraphicRect(LEFT, 0, 0, 384, 512);
TextOut("\c[RED]She is resurrecting plants /nall over the forest.");


End;
}

@DrawLoop
{

}

@Finalize
{

}
}

script_enemy_main
{

@Initialize
{
SetLife(1);
SetMovePosition01(GetCenterX, GetCenterY-100, 2);
CreateEventFromScript("Event01");
}

@MainLoop
{
yield;

if(OnEvent == false){SetLife(0);}
}

@DrawLoop
{
}

@Finalize
{
}
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on March 03, 2013, 06:39:39 PM
Code: [Select]
let Boss1 = GetCurrentScriptDirectory ~ ".enm1imgChimei00b.png";
let Boss2 = GetCurrentScriptDirectory ~ ".enm1imgChimei00c.png";
let Boss3 = GetCurrentScriptDirectory ~ ".enm1imgChimei00d.png";
let Boss4 = GetCurrentScriptDirectory ~ ".enm1imgChimei00e.png";

let White = GetCurrentScriptDirectory ~ ".enm1imgwhite.png";
let BGM = GetCurrentScriptDirectory ~ ".enm1bgm2.mp3";
I don't believe the "." is needed when assigning file paths to a variable like that.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 03, 2013, 06:43:51 PM
I don't believe the "." is needed when assigning file paths to a variable like that.

It shouldn't affect the script though. That's probably not the cause of the bug. Are the directories navigated to correctly?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: TheTeff007 on March 03, 2013, 07:03:00 PM
Yes, they are. The Cut In for the Spellcard Declaration works just fine, as demostrated on the attachment. And they are on the very same directory.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 04, 2013, 01:22:30 AM
Why it's all sparse dots is beyond me because I don't know what your graphics look like. I'm going to guess that white.png has a single white pixel and maybe other things, in which case it will show in the bottom-left corner in the first bit of dialogue. Then it gets pushed back, then its rect gets set to 384x512, which would wrap the graphic until it fills that area. There's a definite pattern going horizontally, even if the brightness changes a bit (there are 6 lines of white-ish lines, then it wraps).

Anyways, a major error is probably just your assignment of (LEFT, 0, 0, 384, 512). I have no idea what the heck you're doing besides that.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on March 04, 2013, 01:56:22 AM
I have another stage problem.
So, I have enemies in my stage that shoot bullets. And the main bullets spawn other bullets.
These other bullets start with a velocity of 0 and increase little by little after waiting 120 frames.
So basically
Code: [Select]
task Bullet(Parameters){
      ...
      wait(120); // waiting 120 frames
      loop(#){
            Obj_SetSpeed(obj, Obj_GetSpeed(obj) + 0.05); // Twenty times to get the next whole number
            yield;
      }
My question is:
When the enemy gets killed/vanished. The bullets that don't have a speed are just stuck on the screen until you die.
How do you prevent this?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 04, 2013, 02:00:22 AM
I have another stage problem.
So, I have enemies in my stage that shoot bullets. And the main bullets spawn other bullets.
These other bullets start with a velocity of 0 and increase little by little after waiting 120 frames.
So basically
Code: [Select]
task Bullet(Parameters){
      ...
      wait(120); // waiting 120 frames
      loop(#){
            Obj_SetSpeed(obj, Obj_GetSpeed(obj) + 0.05); // Twenty times to get the next whole number
            yield;
      }
My question is:
When the enemy gets killed/vanished. The bullets that don't have a speed are just stuck on the screen until you die.
How do you prevent this?

Please elaborate on the issue and what kind of enemy you are using. Also, are both the main bullet and the child bullets objects?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on March 04, 2013, 02:26:43 AM
Please elaborate on the issue and what kind of enemy you are using. Also, are both the main bullet and the child bullets objects?
I'm using basic enemies. The fairies that appear and can be killed easily. They don't have a lifebar visible.
Both of the bullets are object bullets.
The issue is that the objects don't gain speed after the fairy is killed, so they are stuck on the screen.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on March 04, 2013, 02:58:39 AM
I'm using basic enemies. The fairies that appear and can be killed easily. They don't have a lifebar visible.
Both of the bullets are object bullets.
The issue is that the objects don't gain speed after the fairy is killed, so they are stuck on the screen.
This is because the script increasing the speed of the bullets ended when the fairy died. The easiest solution to this would be to delete the bullets when the fairies die. If that doesn't work for you, then you may want to instead of deleting the enemies, make them "vanish" by setting their coordinates offscreen when they take enough damage. This will make them appear to be killed without actually killing them, Thus the script increasing the bullets' speed will still work. Just be sure to kill them off for real soon after that or lag will eventually build up. Note that this method will cause the enemy to lack the automatic death graphic animation that displays when stage enemies are destroyed. A workaround to this problem would perhaps be to spawn another "dummy" enemy at the same coordinates and instantly kill it on the same frame to produce the death effect.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 04, 2013, 05:59:22 AM
See this is why 0.12 can get really retarded. As far as I can tell there's no workaround besides having the enemy not really die. Having extra management systems can work for things like explosion effects and whatnot (with heavy use of CommonData lololololol gross.), but when it comes to things that were already working before the enemy was killed, it suddenly becomes impossible.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on March 04, 2013, 06:38:50 AM
Wouldn't scripting the object bullet outside of the enemy file and including it inside the stage script fix this issue? I remember I had the same problem with [P] items which stopped falling down when the fairy died.

Not quite sure any more.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on March 04, 2013, 06:43:27 AM
Wouldn't scripting the object bullet outside of the enemy file and including it inside the stage script fix this issue? I remember I had the same problem with [P] items which stopped falling down when the fairy died.

Not quite sure any more.
I'm pretty sure stage scripts cannot spawn bullets, if that's what you are suggesting.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on March 04, 2013, 07:01:15 AM
Indeed I was. That is a shame. Thought that if Effect Obj can be spawned so could Obj bullets but I guess not.

Damn you danmakufu. Why do you have to be so annoying.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on March 04, 2013, 07:02:52 AM
The nice thing about Ph3 is that you can have enemy scripts continue to run even after the enemy's death. So, it WAS fixed, just not in this version.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on March 04, 2013, 07:36:19 AM
The nice thing about Ph3 is that you can have enemy scripts continue to run even after the enemy's death. So, it WAS fixed, just not in this version.
I am still extremely fighting within my mind whether I should port my game fully to PH3 Beta6 or stick with 0.12M.

Cannot seem to decide because last time (Beta something) half of the functions did not work, especially the ones I needed (volume control for sound files for example).

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on March 04, 2013, 08:38:13 PM
I am still extremely fighting within my mind whether I should port my game fully to PH3 Beta6 or stick with 0.12M.

Cannot seem to decide because last time (Beta something) half of the functions did not work, especially the ones I needed (volume control for sound files for example).
Ph3 has been significantly updated since then. The aforementioned sound volume control function now DOES work.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on March 05, 2013, 12:07:47 AM
I found a solution to my own problem just now.
During finalize, I had the script vanish the fairies hitbox, make the image disappear with
Code: [Select]
let die = 0;And
Code: [Select]
if(die==1){ SetGraphicRect(Set a pixel of graphic to a blank spot);Then deleted SE's (The other fairy still has working SE's)
Then I had it wait 130 frames. (The object bullet that were just spawned only needs 120 to get to the ObjShot_FadeDelete).
After the wait. The fairy officially get defeated.
It works, but it is very sloppy.  :3
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 05, 2013, 12:11:27 AM
I found a solution to my own problem just now.
During finalize, I had the script vanish the fairies hitbox, make the image disappear with
Code: [Select]
let die = 0;And
Code: [Select]
if(die==1){ SetGraphicRect(Set a pixel of graphic to a blank spot);Then deleted SE's (The other fairy still has working SE's)
Then I had it wait 130 frames. (The object bullet that were just spawned only needs 120 to get to the ObjShot_FadeDelete).
After the wait. The fairy officially get defeated.
It works, but it is very sloppy.  :3

Well, it seems that this information will be helpful in the future.

P.S. Does anyone know the source code CreateShotA? If it's an object bullet, then that may give leads to how this problem can be circumvented, since CreateShotA's commands work even after the enemy has died.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 05, 2013, 01:06:27 AM
Hardcoded functions are bound to work differently than user-defined-in-script ones. Danmakufu's object manipulation is "fake"; while certain predefined functions might directly map to some engine code, these functions are not written in script themselves, and would be impossible to copy by design. Shots created using the predefined functions are definitely objects, but you aren't given any sort of object-like control over them (not that you are with shot objects either), and the functions such as CreateShot01 probably map directly to some basic bullet creating code. Seeing as you "build" bullets with CreateShotA using distinct functions, you would not be able to do the same with the given shot object functions, since you'd either have to make some convoluted event-based system that would wait some amount of frames for flags or whatever, or have something like using arrays for parameters. The latter is "more" viable but I still would never suggest it since it removes the point of "building" the bullet to begin with. Making shot scripts would work better than both of these, and that's still a terrible option. No matter how you look at it, it all comes down to really awful convoluted workarounds.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: JCTechnic on March 05, 2013, 02:22:36 PM
Everyone was talking about the PH3, it seems to be the new danmakufu engine, but can I ask what are the main diferences between the 0.12 and the PH3?

I think i can ask this here because of how the conversation was going, if not I'll go to the other thread and post my question over there.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on March 05, 2013, 02:32:04 PM
Everyone was talking about the PH3, it seems to be the new danmakufu engine, but can I ask what are the main diferences between the 0.12 and the PH3?

I think i can ask this here because of how the conversation was going, if not I'll go to the other thread and post my question over there.
PH3 is the next version for the danmaku maker (Danmakufu). The developer stopped the old one (which is currently at 0.12m, hence we call it 0.12). He started a beta version called Ph3(number).

Major differences are the stability, expanded functionality (too much to name) and more flexible and efficient programming with objects. Just to give you an idea, you can define your playfield size now and use shaking bullets/camera.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: JCTechnic on March 05, 2013, 02:34:37 PM
PH3 is the next version for the danmaku maker (Danmakufu). The developer stopped the old one (which is currently at 0.12m, hence we call it 0.12). He started a beta version called Ph3(number).

Major differences are the stability, expanded functionality (too much to name) and more flexible and efficient programming with objects. Just to give you an idea, you can define your playfield size now and use shaking bullets/camera.

So would it be better if I started learning PH3? Or would that depend on what I wan't to make with danmakufu?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on March 05, 2013, 03:20:40 PM
Difficult to say: If you're completely new to Danmakufu, I would suggest to pick up ph3 since you'll be immediately up to date with the newest engine.

Pretty much everything which was possible in 0.12m is possible in ph3. The new features are just a bonus on top of it (keep in mind that not all new functions work yet, but hey it is a beta).

So yea, the choice is up to you.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: gtbot on March 05, 2013, 04:06:01 PM
As Helepolis said, it's entirely up to you. But I strongly suggest updating to ph3 mainly because it has more features over 0.12m, is constantly updated (as of now), and, my biggest and strongest reason, it's a lot easier to do things in ph3. No needlessly mundane tasks like having a stage for a plural script just for the 3D background, recreating enemies for visual effects, having to set up an entire system of CommonData to have your own custom UI (or have a strange block cover the old UI), or even using vertices and atrocious math for a simple four point square image. Another thing is none of the effects in ph3 are hard coded, so you can put your own effects and they won't be overlapping with Danmakufu's default effects. There's also 100 layers that you can put objects into.

I can go on with this list for a bit longer, though I may be biased to ph3 because that's when I was able to make scripts (http://youtu.be/c0lcuN0jmto) that aren't about my selfinserted overpowered omnipotent deity cat (http://youtu.be/MvzwELweQr4). I'd also still like to reinstate that it's still entirely up to your preference, since 0.12m can still be a powerful tool.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on March 05, 2013, 07:13:59 PM
To add to this discussion, I've been planning to make a basics tutorial for ph3 to help make ph3 less scary for both new and experienced danmakufu users to get into. Since video tutorials seem to be the ones that most people (beginners at least) prefer, I'm going to try my hand at a video tutorial.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Zoriri on March 05, 2013, 08:04:49 PM
Hi, I'm fairly new to programming in danmakufu, but i have absolutly no idea were to even start trying to learn anything. Where do you guys think i should start?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: fondue on March 05, 2013, 08:49:31 PM
http://www.shrinemaiden.org/forum/index.php/topic,6181.0.html
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Zoriri on March 05, 2013, 09:34:52 PM
And now i feel stupid :blush: I'l be sure to keep these in mind in the future.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on March 05, 2013, 09:41:54 PM
And now i feel stupid :blush: I'l be sure to keep these in mind in the future.

Taking a good cup of tea/coffee and reading the "Great information" sticky thread is quite useful as well for new comers. You'll find a lot of things in there.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 06, 2013, 01:40:21 AM
New Q regarding player spell cards:

Is it possible to have a common task that is called from within each spell card? include_function doesn't work, and copying a ridiculously long task for each individual spell takes up too much space and makes debugging a royal pain.

If I define the task outside the script_spell_main, Danmakufu won't pick up on it and will ignore it, so that's why I ask.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on March 06, 2013, 05:27:40 AM
New Q regarding player spell cards:

Is it possible to have a common task that is called from within each spell card? include_function doesn't work, and copying a ridiculously long task for each individual spell takes up too much space and makes debugging a royal pain.

If I define the task outside the script_spell_main, Danmakufu won't pick up on it and will ignore it, so that's why I ask.
Include_function should work, since it's a common task. Are you sure you didn't define the include_function part wrong?
If you didn't, what kind of task is it? (Cutin, Image loading/drawing, Etc.)

And if I'm not wrong, I've been wondering, is a task and a function basically the same thing?
Except tasks don't need you to go through the whole task to continue on after the task calling, while functions do.
Like:
Code: [Select]
fire;
move;
If the "fire" is a task, move would also start when the fire task starts.
But if it is a function, fire will have to  finish before move starts.
Am I right?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 06, 2013, 06:37:18 AM
No. It may seem a bit like that, but that is not technically the case.

A subroutine simply runs a particular section of code. A function runs a section of code, but can take parameters to use as local variables within the code block. A function may also return a value when called, which makes it much more than simply calling some code.

A task creates a new microthread within the engine (it also doesn't return a value). This has a bunch of extra processing consequences, but most notably it gets a turn in the running queue. Because of this, if you yield() inside of a task's microthread, it will pass the processing over to the next microthread in queue, or the microthread that started the task if it hasn't yielded before. If you don't yield during a task, the microthread will still be created, it will just end once you reach the end of the task and return to whatever started it. If you yield during a subroutine, or a function, they have not created a separate microthread, and so yield() will yield whatever microthread called said subroutine or function. This is why the often-used wait() function works; it simply puts a bunch of extra yields whereever you call it. Once all of the running microthreads have yielded, the engine runs the rest of the processing required for that frame, updates drawing and the frame counter, and begins the next frame. Now, when the microthread queue starts again, processing will pick back up wherever each microthread yielded before.

It isn't that you "don't need to" go through the whole task at once, nor do you have to go through a whole function at once, since you can easily have a function like
function bla{ doop; yield; doop; } that will run doop(), yield to "wait a frame", then the next frame run doop() again.
Yes, in that example fire() will have to complete before move() starts if fire() is a function since both run in the same microthread, but if fire() is a task then you would have to yield off in order for move() to run before fire() finishes. Also, in both cases fire() and move() will run, or at least begin, on the same frame.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on March 06, 2013, 06:41:43 AM
That is not true. Fire and move in this case will be executed at the same time, no matter they are functions or tasks.

Also Include function does work. I've been like non-stop scripting tasks/functions outside the spell card files to call things like SpellCircles and other custom effects.

Code: [Select]
Customeffect.txt >>

task fire { CreateShot01(); }

Inside a spell card.txt >>
#include_function "script\customeffect.txt"

fire;

Pretty much is the idea.

Edit: Drake beat me to it with the task/function thing.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 07, 2013, 02:30:16 AM
That is not true. Fire and move in this case will be executed at the same time, no matter they are functions or tasks.

Also Include function does work. I've been like non-stop scripting tasks/functions outside the spell card files to call things like SpellCircles and other custom effects.

Code: [Select]
Customeffect.txt >>

task fire { CreateShot01(); }

Inside a spell card.txt >>
#include_function "script\customeffect.txt"

fire;

Pretty much is the idea.

Edit: Drake beat me to it with the task/function thing.

In other words, you can actually call it from with script_spell? Wow. I should have just tried it. That makes things much easier. Now I need those Okuu player sprites.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on March 09, 2013, 04:25:16 PM
Hmmm I have been thinking about the following mechanics for setting a menu. Want to double check if I am on the right track or perhaps could approach it differently?

For implementing a character selection, I probably have to script a dummy character including all the player scripts in one (or multi files for the overview). Assuming that from my own menu, depending on the set parameters (selected character) that part of the player script should be loaded right? I.e:
- Playerscript.txt contains texture/anim/shot data for  Marisa/Reimu.
- Upon selecting Reimu, her part part in playerscript.txt gets called and basically the player plays as Reimu (Dummy char becomes Reimu)

Second question is regarding Spell Card practise. I assume that they are simply called within the stage file just like as stages would be called? Except is it possible to call 1 specific spell? As far as I know, there is CreateEnemyFromFile for this function. Except the entire game has to understand this specific called enemy is a practise script. So I am guessing I need to implement a parameter inside each boss spell card, listening to whether it is being called as a regular game play or practise mode? Because after Finalize the game has to return back to my "main menu". I.e:
- Somespell01.txt -> has commondata/parameter checking isPractise true/false(?)
- If true -> Return to "main menu"
- If false -> Ignore returning to main menu (most likely it will continue its plural script structure?)



Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on March 09, 2013, 05:27:06 PM
Hmmm I have been thinking about the following mechanics for setting a menu. Want to double check if I am on the right track or perhaps could approach it differently?

For implementing a character selection, I probably have to script a dummy character including all the player scripts in one (or multi files for the overview). Assuming that from my own menu, depending on the set parameters (selected character) that part of the player script should be loaded right? I.e:
- Playerscript.txt contains texture/anim/shot data for  Marisa/Reimu.
- Upon selecting Reimu, her part part in playerscript.txt gets called and basically the player plays as Reimu (Dummy char becomes Reimu)

Second question is regarding Spell Card practise. I assume that they are simply called within the stage file just like as stages would be called? Except is it possible to call 1 specific spell? As far as I know, there is CreateEnemyFromFile for this function. Except the entire game has to understand this specific called enemy is a practise script. So I am guessing I need to implement a parameter inside each boss spell card, listening to whether it is being called as a regular game play or practise mode? Because after Finalize the game has to return back to my "main menu". I.e:
- Somespell01.txt -> has commondata/parameter checking isPractise true/false(?)
- If true -> Return to "main menu"
- If false -> Ignore returning to main menu (most likely it will continue its plural script structure?)
You're pretty much correct on all of those. However, you shouldn't have to put the code for returning to the main menu in the spell's finalize. You can just CreateEnemyFromFile the spell and simply wait for the spell enemy to be deleted before either returning to the main menu or asking whether the player want's to try again or something like that. Unfortunately, the biggest problem with this sort of spell practice within 0.12m is that replays will not work well with this at all.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on March 09, 2013, 09:23:08 PM
I haven't scripted it yet, thought I would first plan out and verify my thoughts. I guess in terms of replay it isn't anything dramatic, just wondering how CtC did it. Vaguely remember some old posts regarding it.

Right, I guess I'll start out implementing character select screen with simple variables and work the graphics later around it.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 10, 2013, 09:30:38 PM
Code: [Select]
   task lolfireg{
      let x = 0;
      let dir = 0;
      let ang = 0;
      let ang2 = 0;
      wait(120);
      wait(3940);
      loop{
         while(x<16){
            CreateShotA(1,GetPlayerX+100*cos(ang),GetPlayerY+100*sin(ang),20);
            SetShotDataA(1,0,3,dir,0,0,0,GREEN05);
            FireShot(1);
            CreateShotA(2,GetPlayerX+100*cos(ang2),GetPlayerY+100*sin(ang2),20);
            SetShotDataA(2,0,3,dir,0,0,0,GREEN05);
            FireShot(2);
            dir+=22.5;
            ang += 22.5;
            ang2 += 22.5;
            x++;
         }
         x = 0;
         dir = 0;
         ang += 1;
         ang2 -= 1;
         wait(1);
         yield;
      }   }
How do I get it to not close in on the player?
Edit: And how to I make the player invincible during the SetEffectForZeroLife?
Edit: How do I make fog?
lol questions
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 10, 2013, 10:15:00 PM
Code: [Select]
   task lolfireg{
      let x = 0;
      let dir = 0;
      let ang = 0;
      let ang2 = 0;
      wait(120);
      wait(3940);
      loop{
         while(x<16){
            CreateShotA(1,GetPlayerX+100*cos(ang),GetPlayerY+100*sin(ang),20);
            SetShotDataA(1,0,3,dir,0,0,0,GREEN05);
            FireShot(1);
            CreateShotA(2,GetPlayerX+100*cos(ang2),GetPlayerY+100*sin(ang2),20);
            SetShotDataA(2,0,3,dir,0,0,0,GREEN05);
            FireShot(2);
            dir+=22.5;
            ang += 22.5;
            ang2 += 22.5;
            x++;
         }
         x = 0;
         dir = 0;
         ang += 1;
         ang2 -= 1;
         wait(1);
         yield;
      }   }
How do I get it to not close in on the player?
Edit: And how to I make the player invincible during the SetEffectForZeroLife?
Edit: How do I make fog?
lol questions

1) Explain in more detail please. If you're referring to shots being created on top of the player, then it has to do with your trig. From what I see, you create two rings of 16 create shots every frame after 4060 frames that fly away from the player, like IN Stage 6 Midboss Eirin.
2) You can't unless you program a new method for doing it. The boss is technically still 'alive'. because the Finalize loop has not been run.
3) Read Nuclear Cheese's tutorial.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 10, 2013, 10:38:42 PM
1) Explain in more detail please. If you're referring to shots being created on top of the player, then it has to do with your trig. From what I see, you create two rings of 16 create shots every frame after 4060 frames that fly away from the player, like IN Stage 6 Midboss Eirin.
2) You can't unless you program a new method for doing it. The boss is technically still 'alive'. because the Finalize loop has not been run.
3) Read Nuclear Cheese's tutorial.
1. The shots close in and kill the player? I want it to stay as a ring that size.
2. What if I create a task that after the amount of frames the spell is, I make the player invincible for the rest of it? (I dunno how to make the player invincible still though). (And I don't know how i'd do that for spells that aren't timeout cards, would I say, if GetLife = 0?)
3. mkay
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 10, 2013, 11:00:54 PM
1. The shots close in and kill the player? I want it to stay as a ring that size.
2. What if I create a task that after the amount of frames the spell is, I make the player invincible for the rest of it? (I dunno how to make the player invincible still though). (And I don't know how i'd do that for spells that aren't timeout cards, would I say, if GetLife = 0?)
3. mkay

if(GetLife==0){SetPlayerInvincibility(60);}

I don't know if it'd work. On a side note, you can also go without the effect.
Please explain exactly what you are trying to do for the ring of bullets. Then post a screenshot of what is happening.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 11, 2013, 12:35:29 AM
if(GetLife==0){SetPlayerInvincibility(60);}

I don't know if it'd work. On a side note, you can also go without the effect.
Please explain exactly what you are trying to do for the ring of bullets. Then post a screenshot of what is happening.
Thanks!
and...
Sorry for late stuff:
http://postimage.org/image/6qlfvzcih/f980574f/ (http://postimage.org/image/6qlfvzcih/f980574f/)
i dont want it closing in and killing the player

edit: why doesnt this work?
Code: [Select]
if(timer==0){SetPlayerInvincibility(320);}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 11, 2013, 12:48:51 AM
Thanks!
and...

Sorry for late stuff:
http://postimage.org/image/6qlfvzcih/f980574f/
i dont want it closing in and killing the player

If the player has been killed by it, then post the scripts and then it can be tested and debugged. If it's working fine, then don't bother.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 11, 2013, 12:52:25 AM
If the player has been killed by it, then post the scripts and then it can be tested and debugged. If it's working fine, then don't bother.
its so long eoiuhgweos8
http://pastebin.com/JdbdD9qA (http://pastebin.com/JdbdD9qA)
and did you read the edit part of my post?
edit to this: just // the wait(3940); in lolfireg
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 11, 2013, 01:24:45 AM
its so long eoiuhgweos8
http://pastebin.com/JdbdD9qA (http://pastebin.com/JdbdD9qA)
and did you read the edit part of my post?
edit to this: just // the wait(3940); in lolfireg

Task Fire

...loop(35.6) Is that legal?

loop(1800){
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+90,BLUE21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+180,YELLOW21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+270,RED21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+45,BLUE21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer-45,GREEN21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+135,YELLOW21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+225,RED21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+315,GREEN21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+100,BLUE21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+190,YELLOW21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+280,RED21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+55,BLUE21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer-55,GREEN21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+145,YELLOW21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+235,RED21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+110,BLUE21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+200,YELLOW21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+290,RED21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+65,BLUE21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer-65,GREEN21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+155,YELLOW21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+245,RED21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+120,BLUE21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+210,YELLOW21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+300,RED21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+75,BLUE21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer-75,GREEN21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+165,YELLOW21,0);
                        CreateShot01(GetX,GetY,7,GetAngleToPlayer+255,RED21,0);
                        wait(1);
                }

Seriously, I suggest grouping colors together and using ascent(i in 0..#) to make it understandable.
FireC: Learn to use ascent/descent. This is really confusing without it.
The following code should do the EXACT same thing as firec.
Code: [Select]
task firec{
angle = 0;
angle2 = 0;
wait(4000);
loop{
  ascent(i in 0..4){
    CreateShot01(GetCenterX, GetCenterY, 3, angle+i*90, GREEN04,0);
    CreateShot01(GetCenterX, GetCenterY, 3, angle2+i*90, GREEN04,0);
  }
  angle+=10;
  angle2-=10;
  wait(16);
}}
Learn to use ascent and descent.
http://www.shrinemaiden.org/forum/index.php/topic,12397.msg904609.html#msg904609 (http://www.shrinemaiden.org/forum/index.php/topic,12397.msg904609.html#msg904609)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 11, 2013, 01:32:56 AM
Learn to use ascent and descent.
well that made the code shorter, but didn't fix my problem...
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 11, 2013, 01:59:53 AM
well that made the code shorter, but didn't fix my problem...

I can't even see the problem because your code is extremely long and unclear at certain points. I suggest cleaning up your code so that it's readable, and perhaps add comments to state which each fire task does.

The more disorganized or unclear the code, the harder it will be for you to get feedback on it. Also, I still don't understand your problem. Do the bullets suddenly face the player? If so, then don't adjust the angle of the bullets towards the player.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 11, 2013, 02:05:23 AM
I can't even see the problem because your code is extremely long and unclear at certain points. I suggest cleaning up your code so that it's readable, and perhaps add comments to state which each fire task does.

The more disorganized or unclear the code, the harder it will be for you to get feedback on it. Also, I still don't understand your problem. Do the bullets suddenly face the player? If so, then don't adjust the angle of the bullets towards the player.
well the problem is at: lolfireg.
Did you test it in the game? If you do then it happens when there is 18 seconds left.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 11, 2013, 02:15:16 AM
well the problem is at: lolfireg.
Did you test it in the game? If you do then it happens when there is 18 seconds left.

Code: [Select]
task lolfireg{
   let ang = 0;
   let ang2 = 0;
   wait(4060);
   loop{
       loop(16){
           CreateShotA(1,GetPlayerX+100*cos(ang),GetPlayerY+100*sin(ang),20);
           SetShotDataA(1,0,3,ang,0,0,0,GREEN05);
           FireShot(1);
           CreateShotA(2,GetPlayerX+100*cos(ang2),GetPlayerY+100*sin(ang2),20);
           SetShotDataA(2,0,3,ang2,2,0,0,0,GREEN05);
           //SetShotDataA(2,0,3,ang,2,0,0,0,GREEN05); What it is based on orig. code
           FireShot(2);
           ang += 22.5;
           ang2 += 22.5;
      }
      ang += 1;
      ang2 -= 1;
      wait(2);
    }
}

Try this. I can't guarantee anything, but it might work.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 11, 2013, 03:08:30 AM
Just use ang and ang2 as the shooting angles instead of dir. If you fire in the same angle from a spawning point that goes around in a circle, you bet it's going to aim inside the circle at some point.
Yeah Sparen has it.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 11, 2013, 07:42:31 PM
Question 1:
How do I do something like this?
Code: [Select]
if(timer==0){SetPlayerInvincibility(320);
Question 2:
Whats wrong with this: http://pastebin.com/uNCma5Di (http://pastebin.com/uNCma5Di)
It goes BOOM but then says Danmakufu.exe has stopped working. ???
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 12, 2013, 11:23:35 PM
Question 2:
Whats wrong with this: http://pastebin.com/uNCma5Di (http://pastebin.com/uNCma5Di)
It goes BOOM but then says Danmakufu.exe has stopped working. ???

I have no clue what you're trying to say. Please speak in English, not slang. Does it crash? Freeze? Or does it give an error?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 12, 2013, 11:41:01 PM
I have no clue what you're trying to say. Please speak in English, not slang. Does it crash? Freeze? Or does it give an error?
It starts the spellcard, but then says "Danmakufu.exe has stopped working."
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 13, 2013, 12:31:45 AM
You are yielding all over in @Initialize and even outside the script boundaries. Why.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 13, 2013, 12:58:12 AM
Also, Qwerty: wait(5); yield; is the same thing as wait(6). You're going to confuse yourself when it comes to timing things correctly.

Instead of waiting in Initialize, add those waits to the start of each task. You shouldn't be yielding like that in @Initialize. Follow what Drake said.

Oh yeah, and you have some serious white space and }} issues. Work on organization. I also see the wall of individual bullet creates.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 13, 2013, 09:24:04 PM
whoops...sorry, I was thinking about mainTask...
But thanks! me so stupid lol  :V
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 14, 2013, 02:04:54 AM
I have a request.

I would like to know about the specific way Danmakufu reads music files and executes the following commands:

LoadMusic, PlayMusic, and FadeOutMusic, and DeleteMusic.

I got my PDD Stage 1 to run with its music track by editing the tempo of the track and resaving it. Adding the boss music failed to work. I would like to know if there are any specific requirements Danmakufu has for music in both .mp3 and .wav form.

I do not know if the problem is reproducible, but I do not believe that it is a problem with the music itself, seeing that Qwertyzxcv has successfully created .wav tracks on his own.

.wav forms of Green Sanatorium and The Barrier or Ame-no-Torifune Shrine work flawlessly. My new Stage 1 theme (same one, with a 1% increase in speed), works flawlessly. However, loading the second track is what causes the issue. I will experiment more and see if it truly is a problem with the music file, because this is a problem that needs to be resolved in order for PDD's progress to continue.

When the time comes, if the problem has not been solved, I will release both an unstable and a stable release of Stage 1.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 14, 2013, 02:12:59 AM
(http://upload.wikimedia.org/wikipedia/commons/4/4c/Itisamystery.gif)

(seriously)

I'm not sure why you in particular seem to be having so much trouble though. I've never had a music file not work, even if looping is still a great mystery of the universe (http://www.shrinemaiden.org/forum/index.php/topic,7401.0.html).
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 14, 2013, 02:30:01 AM
(http://upload.wikimedia.org/wikipedia/commons/4/4c/Itisamystery.gif)

(seriously)

I'm not sure why you in particular seem to be having so much trouble though. I've never had a music file not work, even if looping is still a great mystery of the universe (http://www.shrinemaiden.org/forum/index.php/topic,7401.0.html).

Basically, I call this in script_stage_main:
Code: [Select]
  let music1 = GetCurrentScriptDirectory~".\music\Stg1.wav";
  let music2 = GetCurrentScriptDirectory~".\music\Boss1.wav";
this in @Initialize
Code: [Select]
    LoadMusic(music1);
    LoadMusic(music2);
this in the stage task (if that's the problem I'll be damned)
Code: [Select]
wait(1);
    PlayMusic(music1);
    //BOSS
    FadeOutMusic(music1, 30);
    CreateEnemyBossFromFile(boss1, GetCenterX-30, 0, 1, 0, 0);
    PlayMusic(music2);
    WaitForZeroEnemy;
    FadeOutMusic(music2, 30);
    wait(120);
    Clear;
and in @Finalize,
Code: [Select]
    DeleteMusic(music1);
    DeleteMusic(music2);
Main Loop contains yield; and nothing else. When all of the music2 references are commented out, the script works 100% fine.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 14, 2013, 04:26:56 AM
I never said you were doing anything wrong. The problem has come up several times, but there has never been a concrete solution or any reason as to why it doesn't work. It's just weird that you've complained about it happening multiple times already since it doesn't usually show up that often.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on March 14, 2013, 07:08:49 AM
I can't believe you're still stuck on the music file issue when I told you several posts ago that you need to trial & error on your music file. You're already giving the answer to your problem your self: "When all of the music2 references are commented out, the script works 100% fine." Are you even reading what we are suggesting / advising you? Start focussing on music2.

- Let and load the music only, don't play use PlayMusic yet. Does your script load?
- If PlayMusic(music2) crashes, go compare the song to another song that is working (like your Music1). Is it same format for file, khz, bitrate ? ? ? If not, try to make them similar.
- Maybe the selected song is too big in filesize/quality? Have you tried like only cutting 10 seconds of track in Audacity, and trying to play that?

I can come up with dozen more types of tests but you seriously executed none of them so far because I haven't seen you attempting it when I told you it was your music file. You only commented it out. Well, that is only step 1, where the rest?

You're giving us the feeling that you are blatantly ignoring us and continue to post your own issues (Even Drake issued it that it is your music file for an unknown reason). I hope this is not the case because that would be simply rude for people who try to help out.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 14, 2013, 08:58:04 PM
I can't believe you're still stuck on the music file issue when I told you several posts ago that you need to trial & error on your music file. You're already giving the answer to your problem your self: "When all of the music2 references are commented out, the script works 100% fine." Are you even reading what we are suggesting / advising you? Start focussing on music2.

- Let and load the music only, don't play use PlayMusic yet. Does your script load?
- If PlayMusic(music2) crashes, go compare the song to another song that is working (like your Music1). Is it same format for file, khz, bitrate ? ? ? If not, try to make them similar.
- Maybe the selected song is too big in filesize/quality? Have you tried like only cutting 10 seconds of track in Audacity, and trying to play that?

I can come up with dozen more types of tests but you seriously executed none of them so far because I haven't seen you attempting it when I told you it was your music file. You only commented it out. Well, that is only step 1, where the rest?

The file size is not too big; I have already proven that with my other script. I have used audacity to cut length, and that did not work for the boss track. For the stage track, a few minor tweaks allowed it to run. All of my music tracks have the same file format (.wav), same bitrate, and same KHz. I have tweaked the second file a number of times, so I'm more worried about the problem being the way I called the music tracks.

Loading the second music track causes the massive delay at the start, but does not cause the temporary freeze at the boss battle.
Swapping the two tracks freezes Danmakufu at the very start.

I understand that the problem is in regards to the second track. Both have 2 audio channels, 1411200 bit rate, are .wav, have the same privileges, etc. The latter has been edited multiple times, and that was why I asked about any specific audio restrictions on Danmakufu.
Loading a .mp3 export does not lag at the start. Playing it DOES WORK.

The issue I have is that although a .mp3 may work for most people, it does not work for me, and I cannot test it properly as a result.

I'm going to close the question for now and just release it with .mp3 files. If that works better, then so be it.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on March 15, 2013, 06:59:59 AM
Quote from: Sparen
Loading the second music track causes the massive delay at the start, but does not cause the temporary freeze at the boss battle.
Well there you have it for once. Danmakufu doesn't seem to like the song at all but I am sure we knew that.

Quote from: Sparen
I understand that the problem is in regards to the second track. Both have 2 audio channels, 1411200 bit rate, are .wav, have the same privileges, etc. The latter has been edited multiple times, and that was why I asked about any specific audio restrictions on Danmakufu.
Loading a .mp3 export does not lag at the start. Playing it DOES WORK.

The issue I have is that although a .mp3 may work for most people, it does not work for me, and I cannot test it properly as a result.
I don't understand this part. You're saying MP3 does work but then then it doesn't work? And you cannot test it properly? What the hell is that suppose to mean?


FYI: OGG is the filetype that causes the crash for people and should be possibly avoided in 0.12m. MP3 not being played is majority caused due to incorrect/bad format and re-exporting it in Audacity with lame-mp3 codec as (if I am not mistaking 44khz, 32bit float) should solve it. Danmakufu had a memory limit for loading music files, I forgot where the thread and cannot find it through search. Which is mostly why WAV should be carefully used.

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Blargel on March 16, 2013, 02:00:00 AM
I should probably mention that the reason for the delay when loading wavs is due to the file size of wavs. You can expect to load like 20 MB in the same time it takes 2 MB can you?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 16, 2013, 03:26:06 PM
Question 1:
http://pastebin.com/18n0gzy8 (http://pastebin.com/18n0gzy8)
When it ends, it shoots a circle of RED03s, but I don't have any RED03s in it...
WTF

Question 2:
I have a stage with a mid-boss, so I use CreateEnemyBossFromFile, but when the non-spell ends, it makes the sound effect you hear when a familiar goes away?

Question 3:
How do I make a circle come from a CreateLaser01, starting at the tip to the base?

Question 4:
This might be my stupidest question ever but:
if(GetPoint == 50){ExtendPlayer(1); PlaySE(ext); SetNormPoint(100);}
nothing happens...and I put it in MainLoop right?

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 16, 2013, 09:47:53 PM
1) If the ring of bullets is firing right after the spell ends, then it's the next pattern that's firing them.

2) ...Yes?

3) You can either use some geometry and trig, or use AddShot.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 16, 2013, 09:56:12 PM
1) If the ring of bullets is firing right after the spell ends, then it's the next pattern that's firing them.

2) ...Yes?

3) You can either use some geometry and trig, or use AddShot.
1) Hm ok. But im pretty sure nothing in the stage does that...
2) xD I'm an idiot. Sorry about wording that stupidly:
I have a stage with a mid-boss, so I use CreateEnemyBossFromFile. But when the non-spell ends, it makes the sound effect you hear when a familiar goes away, but I don't want it to.
3) Thanks...
Edit: I added a fourth question.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 16, 2013, 10:34:44 PM
1) I won't be able to tell you anything without the other scripts, but you should be able to just search them all for RED03 and you'll find it eventually.

2) If it's a default sound effect then you can use DeleteSE to unload it, but there's probably a better way. I don't recall if you can just disable it.

4) If you mean point items then I think that should work. If you mean score then use GetScore, but otherwise it should work?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 16, 2013, 10:59:21 PM
1) Found RED03, but its not the next pattern, and its not in a circle. Did I mention this is a stage?
2) Ok, I should probably add a different sound effect.
4) i dunno why but it works now...
5) I might as well ask another question...can I have an example of include function?
6) i forgot NOOOO
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 17, 2013, 12:07:43 AM
Code: (lib.txt) [Select]
function dist(x1, y1, x2, y2){
return ((x1-x2)^2 + (y1-y2)^2)^0.5;
}

function wait(n){
loop(n){ yield; }
}
Code: [Select]
script_enemy_main{
   #include_function ".\lib.txt"
   @Initialize{
      main;
   }

   task main{
      wait(60);
      //something that uses dist()
   }
}

Essentially what happens is everything in lib.txt gets plopped into the other script right where the #include was called.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 17, 2013, 12:17:54 AM
CODE
MOAR CODE
Essentially what happens is everything in lib.txt gets plopped into the other script right where the #include was called.
So I can turn a script into a function? :D
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 17, 2013, 12:37:34 AM
No. You can use #include_script if you want to put a script_enemy or whatever in another stage or enemy script (except doing so is pointless since usually you can use CreateEnemyFromFile anyways), but that isn't "making it a function". Turning a script into a function doesn't make any sense. #include_function is for taking functions commonly used throughout multiple scripts and loading them into each using a single line rather than defining them over and over again.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 17, 2013, 12:50:59 AM
No. You can use #include_script if you want to put a script_enemy or whatever in another stage or enemy script (except doing so is pointless since usually you can use CreateEnemyFromFile anyways), but that isn't "making it a function". Turning a script into a function doesn't make any sense. #include_function is for taking functions commonly used throughout multiple scripts and loading them into each using a single line rather than defining them over and over again.
I guess I don't didn't know anyhing about include function.
Quote
Create the stage, then copy it and rename that one as a function. Then, in your master script, use #include_function and execute the function.
What is he saying here?
I'm clueless ;_;  :persona:
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 17, 2013, 01:42:52 AM
It's about game structure. That strategy is to create one "core" stage script, where you #include the rest of the stages that are defined in their own files. In each stage file, it would contain things like the overall stage procedure or background drawing, defined as tasks or functions. It would also contain declaration of variables used in the stage. Then to run each stage you would call the appropriate functions from the core stage script.

Whoever said that worded it really weirdly. In a usual stage script you already have the one stage task that you start from @Initialize, the only difference is that you won't necessarily be executing it on @Initialize. For example, you might run a stage2() task at the end of a stage1() task that you called in @Initialize. Similarly, the background will be its own function or task, rather than being typed directly in @BackGround.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 17, 2013, 03:23:26 AM
Thanks! :D

And I have another question:
Code: [Select]
    if(GetPoint == 50){ExtendPlayer(1); PlaySE(ext); SetNormPoint(100);}
  if(GetPoint == 100){ExtendPlayer(1); PlaySE(ext); SetNormPoint(250);}
  if(GetPoint == 250){ExtendPlayer(1); PlaySE(ext); SetNormPoint(500);}
  if(GetPoint == 500){ExtendPlayer(1); PlaySE(ext); SetNormPoint(800);}
  if(GetPoint == 800){ExtendPlayer(1); PlaySE(ext); SetNormPoint(1100);}
  if(GetPoint == 1100){ExtendPlayer(1); PlaySE(ext); SetNormPoint(1500);}
  if(GetPoint == 1500){ExtendPlayer(1); PlaySE(ext); SetNormPoint(2000);}
  if(GetPoint == 2000){ExtendPlayer(1); PlaySE(ext); SetNormPoint(0);}
  if(GetPoint > 50){ExtendPlayer(1); PlaySE(ext); SetNormPoint(100);}
  if(GetPoint > 100){ExtendPlayer(1); PlaySE(ext); SetNormPoint(250);}
  if(GetPoint > 250){ExtendPlayer(1); PlaySE(ext); SetNormPoint(500);}
  if(GetPoint > 500){ExtendPlayer(1); PlaySE(ext); SetNormPoint(800);}
  if(GetPoint > 800){ExtendPlayer(1); PlaySE(ext); SetNormPoint(1100);}
  if(GetPoint > 1100){ExtendPlayer(1); PlaySE(ext); SetNormPoint(1500);}
  if(GetPoint > 1500){ExtendPlayer(1); PlaySE(ext); SetNormPoint(2000);}
  if(GetPoint > 2000){ExtendPlayer(1); PlaySE(ext); SetNormPoint(0);}
Why does it give the player infinite lives?? And is there an easier way to write it?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 17, 2013, 02:41:08 PM
Thanks! :D

And I have another question:
Code: [Select]
    if(GetPoint == 50){ExtendPlayer(1); PlaySE(ext); SetNormPoint(100);}
  if(GetPoint == 100){ExtendPlayer(1); PlaySE(ext); SetNormPoint(250);}
  if(GetPoint == 250){ExtendPlayer(1); PlaySE(ext); SetNormPoint(500);}
  if(GetPoint == 500){ExtendPlayer(1); PlaySE(ext); SetNormPoint(800);}
  if(GetPoint == 800){ExtendPlayer(1); PlaySE(ext); SetNormPoint(1100);}
  if(GetPoint == 1100){ExtendPlayer(1); PlaySE(ext); SetNormPoint(1500);}
  if(GetPoint == 1500){ExtendPlayer(1); PlaySE(ext); SetNormPoint(2000);}
  if(GetPoint == 2000){ExtendPlayer(1); PlaySE(ext); SetNormPoint(0);}
  if(GetPoint > 50){ExtendPlayer(1); PlaySE(ext); SetNormPoint(100);}
  if(GetPoint > 100){ExtendPlayer(1); PlaySE(ext); SetNormPoint(250);}
  if(GetPoint > 250){ExtendPlayer(1); PlaySE(ext); SetNormPoint(500);}
  if(GetPoint > 500){ExtendPlayer(1); PlaySE(ext); SetNormPoint(800);}
  if(GetPoint > 800){ExtendPlayer(1); PlaySE(ext); SetNormPoint(1100);}
  if(GetPoint > 1100){ExtendPlayer(1); PlaySE(ext); SetNormPoint(1500);}
  if(GetPoint > 1500){ExtendPlayer(1); PlaySE(ext); SetNormPoint(2000);}
  if(GetPoint > 2000){ExtendPlayer(1); PlaySE(ext); SetNormPoint(0);}
Why does it give the player infinite lives?? And is there an easier way to write it?

It gives infinite lives because if GetPoint > 50, you're getting 8 lives per frame. That entire second half seems to be an entire chunk of counterintuitive code.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 17, 2013, 03:37:56 PM
It gives infinite lives because if GetPoint > 50, you're getting 8 lives per frame. That entire second half seems to be an entire chunk of counterintuitive code.
How do I fix it? Do I just take out the entire second half?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 17, 2013, 03:53:08 PM
How do I fix it? Do I just take out the entire second half?

I think that might work. But you should test it and experiment a bit. SetNormPoint only sets the display, as you've probably heard.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 17, 2013, 04:03:58 PM
I think that might work. But you should test it and experiment a bit. SetNormPoint only sets the display, as you've probably heard.
When I only keep the ==, nothing happens. ???
And I put ExtendPlayer(1); for an extra life.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 17, 2013, 04:12:00 PM
...I think it's an issue with the execution order of Danmakufu. If it registers multiple points as being collected on one frame, then it might skip the extend check. I can't do much more to help right now because my usual BS method is to make a variable that checks to see whether you have hit the point count. Always a sloppy way.

Code: [Select]
if(GetPoint == 50){Extendstate = 1; SetNormPoint(100);}
if(GetPoint == 100){Extendstate = 1; SetNormPoint(250);} //etc.
if(Extendstate = 1){ExtendPlayer(1); PlaySE(ext); Extendstate = 0;}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 17, 2013, 04:17:30 PM
...I think it's an issue with the execution order of Danmakufu. If it registers multiple points as being collected on one frame, then it might skip the extend check. I can't do much more to help right now because my usual BS method is to make a variable that checks to see whether you have hit the point count. Always a sloppy way.
Aww...but that means if I kept the second part it wont skip the extend? It would still give me infinite lives...;_; I kind of want to see your method, do any of your projects have it?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 17, 2013, 04:51:19 PM
Aww...but that means if I kept the second part it wont skip the extend? It would still give me infinite lives...;_; I kind of want to see your method, do any of your projects have it?

I've never used the system before, so I don't even know if it works. It probably does, but it's bad code, and is just an excuse to bypass something. You can try it, but... if you give me a sec, I'll test it out.

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 17, 2013, 04:56:33 PM
I've never used the system before, so I don't even know if it works. It probably does, but it's bad code, and is just an excuse to bypass something. You can try it, but... if you give me a sec, I'll test it out.
So...how exactly do I do it?  :derp:
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 17, 2013, 05:00:15 PM
I've never used the system before, so I don't even know if it works. It probably does, but it's bad code, and is just an excuse to bypass something. You can try it, but... if you give me a sec, I'll test it out.

Oops. My code didn't work. Let me try again. I'm going to try with arrays.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 17, 2013, 05:06:33 PM
Oops. My code didn't work. Let me try again. I'm going to try with arrays.
Ok, how long is it anyway? I don't want to bother you by making you write an insane amount of code...
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 17, 2013, 05:13:26 PM
Code: [Select]
  @MainLoop{
    /*if(GetPoint != 100 && GetPoint != 250 && GetPoint != 500 && GetPoint != 1000 && GetPoint != 1500 && GetPoint != 2500 && GetPoint != 5000 && GetPoint != 7500){extendstate[0] = 0;}
    if(extendstate[0] == 0){ //[Is checking?, is extending?]
      if(GetPoint == 0){SetNormPoint(100);}
      if(extendstate[1] == 1){ExtendPlayer(1); PlaySE(ext); extendstate = [1,0];}
      if(GetPoint == 100){extendstate[1] = 1; SetNormPoint(250);}
      if(GetPoint == 250){extendstate[1] = 1; SetNormPoint(500);}
      if(GetPoint == 500){extendstate[1] = 1; SetNormPoint(1000);}
      if(GetPoint == 1000){extendstate[1] = 1; SetNormPoint(1500);}
      if(GetPoint == 1500){extendstate[1] = 1; SetNormPoint(2500);}
      if(GetPoint == 2500){extendstate[1] = 1; SetNormPoint(5000);}
      if(GetPoint == 5000){extendstate[1] = 1; SetNormPoint(7500);}
      if(GetPoint == 7500){extendstate[1] = 1; SetNormPoint(9999);}
      //if(extendstate[1] == 1){ExtendPlayer(1); PlaySE(ext); extendstate = [1,0];}
    }*/
    yield; 
  }

The following gave two lives each time. If the // were swapped from top check to bottom check, then it still remained the same. I ran it through a check, but something must be wrong with the code. I can't answer the question given my unfamiliarity with stage scripts.

[Technically, I'm so generous with goodies in my Suiroga stage that I really don't need this system, but I went and removed lives anyway. If you're still having trouble, I can test more, but I'm too tired to do it right now.]
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 17, 2013, 06:05:41 PM
CODE

The following gave two lives each time. If the // were swapped from top check to bottom check, then it still remained the same. I ran it through a check, but something must be wrong with the code. I can't answer the question given my unfamiliarity with stage scripts.

[Technically, I'm so generous with goodies in my Suiroga stage that I really don't need this system, but I went and removed lives anyway. If you're still having trouble, I can test more, but I'm too tired to do it right now.]
So the error says it has to do with extendstate...?
Ok, I wont bother you right now.  :)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 17, 2013, 06:54:46 PM
So the error says it has to do with extendstate...?
Ok, I wont bother you right now.  :)

It's fine. Just remember that my code doesn't work correctly.

Also, I suggest learning the following: http://www.omniglot.com/writing/japanese_katakana.htm (http://www.omniglot.com/writing/japanese_katakana.htm)

If you can read katakana, things like 'script' will become much easier to understand when you get error messages.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 17, 2013, 07:40:20 PM
It's fine. Just remember that my code doesn't work correctly.

Also, I suggest learning the following: http://www.omniglot.com/writing/japanese_katakana.htm (http://www.omniglot.com/writing/japanese_katakana.htm)

If you can read katakana, things like 'script' will become much easier to understand when you get error messages.
I knew katakana like 6 months ago D:<
This should be easy then :D
But can't I just look at the error message troubleshooting thingy?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 17, 2013, 09:23:42 PM
I knew katakana like 6 months ago D:<
This should be easy then :D
But can't I just look at the error message troubleshooting thingy?

...If you can't understand what's wrong by looking at the error message, you should learn some Japanese... Or at least know what each error message means. Use the thread if you want to, but it's not being moderated now (as far as I know) and there are some weird and uncommon error messages that aren't on the list.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 17, 2013, 09:44:50 PM
...If you can't understand what's wrong by looking at the error message, you should learn some Japanese... Or at least know what each error message means. Use the thread if you want to, but it's not being moderated now (as far as I know) and there are some weird and uncommon error messages that aren't on the list.
Found it!!

Quote

[extendstate]わ未定義の識別子 - [extendstate] is not defined.
Check your spelling on the variable/function and make sure it was defined somewhere. Just so you know, functions also have scope similar to how variables do. If you define a function in a task, only that task can use that function.
I think this is it. :D
So what now?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 17, 2013, 10:31:13 PM
Code: [Select]
task extends{
   let extendlist = [50, 100, 250, 500, 800, 1100, 1500, 2000];
   let index = 0;
   while(index<8){
      if(GetPoint > extendlist[index]){
            ExtendPlayer(1);
            index++;
      }
      yield;
   }
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 18, 2013, 01:11:52 AM
Code: [Select]
task extends{
   let extendlist = [50, 100, 250, 500, 800, 1100, 1500, 2000];
   let index = 0;
   while(index<8){
      if(GetPoint > extendlist[index]){
            ExtendPlayer(1);
            index++;
      }
      yield;
   }
}
So I change extends to extendstate?
And it crashes, but im probably doing something stupid...
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 18, 2013, 01:12:43 AM
So I change extends to extendstate?
And it crashes, but im probably doing something stupid...

Did you call it in Initialize? Before you called the stage?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 18, 2013, 09:38:33 PM
Did you call it in Initialize? Before you called the stage?
yup
It says "Danmakufu.exe has stahped working"
Code: http://pastebin.com/Ah1AfAys
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 18, 2013, 09:58:04 PM
Well notably, you now have two things called extendstate. My snippet was supposed to be a replacement for whatever you were trying to do before.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 18, 2013, 11:37:07 PM
Well notably, you now have two things called extendstate. My snippet was supposed to be a replacement for whatever you were trying to do before.
OH i see
I don't think it worked though.
And how can I link SetNormPoint into it?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on March 23, 2013, 12:25:32 AM
I have player script questions.  :3
Question 1
How do I make Reimu's Orbs spin. (When I try, the orbs fly off the screen.)
I use:
Code: [Select]
let spin = 0;

ObjEffect_SetAngle(objoption,0,0,spin);

spin++;
Variable naming is global, The Angle setting is inside a loop, and spin++ is inside @Mainloop

Question 2
Another problem with the orbs. I'm making a player script kind of like IN where you switch off.
How do I make Reimu's orbs vanish when player presses the shift button. (Changes to Sakuya)

Question 3
This is relevant to the second question, I think.
How do I make a little effect happen when the player switches characters. Like a flash or warp, so the switch-off isn't sketchy, you could say. Or look weird.

Much help is appreciated.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 23, 2013, 12:36:38 AM
I have player script questions.  :3
Question 1
How do I make Reimu's Orbs spin. (When I try, the orbs fly off the screen.)
I use:
Code: [Select]
let spin = 0;

ObjEffect_SetAngle(objoption,0,0,spin);

spin++;
Variable naming is global, The Angle setting is inside a loop, and spin++ is inside @Mainloop

Question 2
Another problem with the orbs. I'm making a player script kind of like IN where you switch off.
How do I make Reimu's orbs vanish when player presses the shift button. (Changes to Sakuya)

Question 3
This is relevant to the second question, I think.
How do I make a little effect happen when the player switches characters. Like a flash or warp, so the switch-off isn't sketchy, you could say. Or look weird.

Much help is appreciated.

Q1: If they're flying off the screen, the main problem isn't with SetAngle.
Q2: if(GetKeyState(VK_SLOWMOVE) == KEY_PUSH || GetKeyState(VK_SLOWMOVE) == KEY_HOLD){ //Sakuyaoptions}else{Reimuoptions}
Q3: I don't know how to do this, so I can't help with this one. All I know is that you'll call a task that creates object effects which later die.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 23, 2013, 01:26:43 AM
1. I'm going to guess your object is actually at some arbitrary position and instead you're "positioning" your orbs by moving its vertices instead. Because of this, your render spinning around its center (the object position) causes the drawn orbs to fly around.

2. Delete them? Fade them out by altering the alpha levels? It depends a bit on how you made the options to begin with, but really it's just a matter of doing something when shift is pressed.

3. That's more a matter of "what do you want to do". I mean generally you might have an effect pop up or something but that's just creating an effect, doing something to it and deleting it.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on March 23, 2013, 01:56:23 AM
1: I got the problem. I just don't know how to make the orbs spin.
I looked in LD, and saw that I had to make the vertices spin using trigonometry functions.
But it was really comfusing with it's variable and multiple subtraction and addition equations.

2: I've tried:
Code: [Select]
let alp = 200;Inside the loop where the objects shoot bullets:
Code: [Select]
Obj_SetAlpha(objoption, alp);In main loop:
Code: [Select]
if( [Insert stuff about if pressing shift key] ){
   ...
   if(alp>0){ alp-=20; }
}else{
   ...
   if(alp<200){ alp+=20; }
}
But it wouldn't fade.

3. I asked the question wrong.
I meant, how do I make it inside a loop, without having it repeat every frame. (Just the first time around.)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 23, 2013, 04:38:08 AM
1. If you got the problem then the solution is just to stop moving the image around by modifying its vertices and instead do the sensible thing of actually just moving the object around. Use Obj_SetPosition(). ObjEffect_SetVertexXY is there to map the source image to a renderable image, not to actually move it around. Once you do this ObjEffect_SetAngle(0,0,z) will spin the image in place as it should.
If your orb image is 32x32 your XY vertices will be like (-16,-16), (16,-16), (-16,16), (16,16); that will plop the rendered image's center on the object position.

2. Obj_SetAlpha doesn't work on effect objects. Loop through its vertices and use SetVertexColor like this:
ascent(i in 0..4){ ObjEffect_SetVertexColor(obj, i, alp, 255, 255, 255); }

3. I don't know what you mean. Can you give an example of how you would try and do this yourself (flaws and all)?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on March 23, 2013, 05:13:11 AM
1: I'm still confused on how I should use SetPosition. I've tried but I noticed all points to to the given position resulting in nothingness.

3: Like IN, where you would switch characters, and a little zoom out thing happens to the player to make it transitional.
There you go, transition effect.
I would just use the simple, but messy variable naming thing.
Code: [Select]
let switch = 0;
let switch2 = 0; // for no crashing reasons
Then I put the following in the drawloop.
Code: [Select]
if(shift...blah blah is held){
   if(switch==0){
      Insert effect task;
      switch2=1;
   }
   -Rest of the drawloop stuff-
}else{
   if(switch==1){
      Insert effect task;
      switch2=0;
   }
   -Rest of the drawloop stuff-
}
//still in drawloop, forgot indentation.
if(switch2==1){ switch=1; }
if(switch2==0){ switch=0; }
//end of drawloop
Messy, but I think it works. Reason for 2 variables is because if or while statements seem to crash when I change a varable and it doesn't fit the statement anymore, while still processing the task.
Like:
Code: [Select]
if(variable==0){
   variable=1;
   wait(?);
   blah
}
I don't know why.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 23, 2013, 06:07:48 AM
That might crash in DrawLoop for whatever odd reason; you shouldn't really put logic like this in the DrawLoop. You also don't want to be starting any tasks from DrawLoop nor do you want to be using wait() or yield in DrawLoop, in general. I think part of the misunderstanding here is that you're trying to work in the DrawLoop which you really shouldn't be doing.

That basic idea could work if you're insistent on using the loops though, like
Code: [Select]
let lastfocusstate = KEY_FREE;
@MainLoop{
   if(GetKeyState(VK_SLOWMOVE) == KEY_PUSH || GetKeyState(VK_SLOWMOVE) == KEY_HOLD){
      if(lastfocusstate == KEY_FREE){
         effectthing();
         lastfocusstate = KEY_HOLD;
      }
   }else if(GetKeyState(VK_SLOWMOVE) == KEY_PULL || GetKeyState(VK_SLOWMOVE) == KEY_FREE){
      if(lastfocusstate == KEY_HOLD){
         effectthing();
         lastfocusstate = KEY_FREE;
      }
   }
}

As for the SetPosition, just do something like this
Code: [Select]
let obj = Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(obj, thing);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetVertexUV(obj, 0, 0, 0);
ObjEffect_SetVertexUV(obj, 1, 0, 32);
ObjEffect_SetVertexUV(obj, 2, 32, 0);
ObjEffect_SetVertexUV(obj, 3, 32, 32);
ObjEffect_SetVertexXY(obj, 0, -16, -16);
ObjEffect_SetVertexXY(obj, 1, -16, 16);
ObjEffect_SetVertexXY(obj, 2, 16, -16);
ObjEffect_SetVertexXY(obj, 3, 16, 16);
let spin = 0;

loop{
Obj_SetPosition(obj, GetPlayerX - 20, GetPlayerY);
ObjEffect_SetAngle(obj, 0, 0, spin);
spin += 2;
yield;
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on March 23, 2013, 08:51:32 AM
1. If you got the problem then the solution is just to stop moving the image around by modifying its vertices and instead do the sensible thing of actually just moving the object around. Use Obj_SetPosition(). ObjEffect_SetVertexXY is there to map the source image to a renderable image, not to actually move it around. Once you do this ObjEffect_SetAngle(0,0,z) will spin the image in place as it should.
If your orb image is 32x32 your XY vertices will be like (-16,-16), (16,-16), (-16,16), (16,16); that will plop the rendered image's center on the object position.

To visualise Drake's explanation as well ( I think it is a good reminder ). Here from my video tutorial the example image on how to set the Vertices for SetPosition control.

Left to right:  Vertex 0, 1, 2 ,3
(http://i46.tinypic.com/67nzic.jpg)

Additionally like Drake also said: The only thing you want in the DrawLoop are Draw Related things for the player / boss. Logically in Ph3 this is entirely different but 0.12m you should really stick to basics in the DrawLoop and for complex effect objects or any other tasks / advanced drawing you should either use the MainLoop or task based scripting.

For my Magic Team I used only the appearance of Marisa & Alice in @DrawLoop, their bombing, familiars and so on are all outside of it.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on March 23, 2013, 06:49:51 PM
Wow, thanks, I'm 50% done with my player script now.
I just have this little problem this time.
Homing shots for Reimu:
This doesn't work. (http://pastebin.com/s7dyp8BY) <-- Link
It basically just keeps spinning counter-clockwise. It doesn't stop when it goes in the direction, the enemy is. I don't know what's happening.
This is what is supposed to happen:
1) Right bullets aim 300, left aim 240. (30 from going directly up.)
2) It goes out a little, before turning inwards, or towards the enemy. (I don't want it to directly home once at the very beginning. (Like the tutorial Sakuya script) )
3) It keeps going towards the enemy, and it keeps homing.

Much help is also appreciated. (This is my first player script, I've looked everywhere for an easy Reimu Homing Bullets.)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Nuclear Cheese on March 23, 2013, 10:09:48 PM
Wow, thanks, I'm 50% done with my player script now.
I just have this little problem this time.
Homing shots for Reimu:
This doesn't work. (http://pastebin.com/s7dyp8BY) <-- Link
It basically just keeps spinning counter-clockwise. It doesn't stop when it goes in the direction, the enemy is. I don't know what's happening.
This is what is supposed to happen:
1) Right bullets aim 300, left aim 240. (30 from going directly up.)
2) It goes out a little, before turning inwards, or towards the enemy. (I don't want it to directly home once at the very beginning. (Like the tutorial Sakuya script) )
3) It keeps going towards the enemy, and it keeps homing.

Much help is also appreciated. (This is my first player script, I've looked everywhere for an easy Reimu Homing Bullets.)

Looks like you never update your x and y variables within your while loop.  You'll need to get your shot's current position before calculating the new angle with atan2 - otherwise it'll always calculate the angle from the shot's original position, not the current one.

In your while loop near the end of the task, add the following to the top:
Code: [Select]
x = Obj_GetX(obj);
y = Obj_GetY(obj);
(disclaimer: I'm going off of memory, so I might have the function names wrong.)

Hopefully that helps.



Also - hi everyone, been a while.  Started lurking around here again recently when I saw the new fighting game.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on March 23, 2013, 11:59:27 PM
Also - hi everyone, been a while.  Started lurking around here again recently when I saw the new fighting game.
OT: I was about to say, suddenly a Nuclear Cheese back on the forums. Welcome back? I guess :V
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 24, 2013, 02:35:07 AM
1:  How do I change the sidebars?
2: I still am not sure how to make a full game.
4: How do I make endings/credits?
5: How do I create a score screen thing after the stage like older Touhou games?
6: How do I change built in sound effects? (1ups and familiar dead)
7: DAMN FORGOT. OH YEAH :derp: How do I make the point items go to the player like newer touhou games?
8: How do I do an extra stage, thats only unlocked when you 1cc the game?
⑨: How do I change continue menu text?
so many questions :I

 :persona:
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 24, 2013, 02:48:21 PM
1:  How do I change the sidebars?
2: I still am not sure how to make a full game.
3: The extend state thing crashes.
4: How do I make endings/credits?
5: How do I create a score screen thing after the stage like older Touhou games?
6: How do I change built in sound effects? (1ups and familiar dead)
7: DAMN FORGOT. OH YEAH :derp: How do I make the point items go to the player like newer touhou games?
8: How do I do an extra stage, thats only unlocked when you 1cc the game?
⑨: How do I change continue menu text?
so many questions :I

1) What sidebars?
2) Look at Luminous Dream. You... will have a lot of issues.
3) ...
4) ... This is one of the things that Danmakufu 0.12m doesn't like.
5) See Luminous Dream or CtC (although CtC's is probably too hard to understand)
6) The same way you change the default Reimu/Marisa images, I think. Not sure though.
7) There's a function for this. Look for it in the function list.
8) Once again, you have something extremely infuriating to deal with. I don't think many people have gotten this right, and I doubt you can do it without making a long list of functions and stuff to help you work around the issues
9) You can't.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on March 24, 2013, 03:46:18 PM
1:  How do I change the sidebars?
2: I still am not sure how to make a full game.
3: The extend state thing crashes.
4: How do I make endings/credits?
5: How do I create a score screen thing after the stage like older Touhou games?
6: How do I change built in sound effects? (1ups and familiar dead)
7: DAMN FORGOT. OH YEAH :derp: How do I make the point items go to the player like newer touhou games?
8: How do I do an extra stage, thats only unlocked when you 1cc the game?
⑨: How do I change continue menu text?
so many questions :I
You are trying too many things with too little experience. You should take things step for step and not go like: How I do make everything.

I am going to refer you to the tutorials, wiki and search function because it is impossible for us to explain it all. Drake already helped you out with the extend thing, yet you seem to ignore that.

Highly suggesting you to first fix your errors then go for cosmetics.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 24, 2013, 05:51:43 PM

You are trying too many things with too little experience. You should take things step for step and not go like: How I do make everything.

I am going to refer you to the tutorials, wiki and search function because it is impossible for us to explain it all. Drake already helped you out with the extend thing, yet you seem to ignore that.

Highly suggesting you to first fix your errors then go for cosmetics.
oh.
ok, I understand.
I tried to do what he told me to fix, but it still doesn't work.
I will now :D
Sorry for buggin' everyone...
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on March 24, 2013, 10:03:00 PM
I tried to do what he told me to fix, but it still doesn't work.
Post full code in pastebin. Saying: "It crashes" and not showing code/error message we cannot help.

Example of to give you an idea on how to advance step by step. You said you want to make a full game. To make a full game you have to:
1) - Understand how to make a spell card
2) - Understand how to make a plural script for a boss fight
3) - Understand how to make a simple stage
4) - Understand how to call a boss inside the stage
5) - Understand how to call the next boss when the previous died (boss rush)
6) - Understand how to manipulate the stage script in order to make it look as if you are playing different stages.

This is just for making a "full game". No textures, no fancy things nothing just the core (notice there aren't even enemies/midbosses here, those are side-jobs, not crucial). Where are you? Judging from your experience I would guess you're at #2.

Always script core mechanics before going into fancy graphics. Yes, core scripting looks ugly and dull but once you got that in place you can wrap it up with effect objects and fancy music/sounds.

Edit:
Actually scrap that. I am confused. You have accordingly your own dnh game with 6 stages yet you are asking us how to make a full game. I don't understand, unless you mean how to make a full game like menu / options. You need to make them all yourself with effect objects, smart scripting and lots of patience. Danmakufu offers you nothing to instantly use, you need to do it your self.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 24, 2013, 10:32:40 PM
Oh uh. I didn't realize it didn't work for you because you originally posted "OH i see", and then edited in that it didn't work.
Please, when somebody posts a suggestion or solution for you, don't bother thanking them or commenting on it until you've tried it out and it works or doesn't work. I, personally, do not look at this thread unless a new reply is posted, because I get notifications for new replies. So I see your post saying only "oh", but I don't see your edits until you later mention it.

That being said, if somebody asks you to pastebin your code and post it, then suggests a solution that doesn't work, the general response is to post your new code even if nobody asks you to. You should figure that I'm just going to ask you to post it anyways. I know that my code block works because I tested it, so the problem is likely that you implemented it wrong. Don't just post saying "it didn't work"; it would be much easier to suggest how to fix your problem if you just posted your code to begin with, rather than having me ask you to post your code and then you posting it and then me answering.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 24, 2013, 11:05:22 PM
Oh uh. I didn't realize it didn't work for you because you originally posted "OH i see", and then edited in that it didn't work.
Please, when somebody posts a suggestion or solution for you, don't bother thanking them or commenting on it until you've tried it out and it works or doesn't work. I, personally, do not look at this thread unless a new reply is posted, because I get notifications for new replies. So I see your post saying only "oh", but I don't see your edits until you later mention it.

That being said, if somebody asks you to pastebin your code and post it, then suggests a solution that doesn't work, the general response is to post your new code even if nobody asks you to. You should figure that I'm just going to ask you to post it anyways. I know that my code block works because I tested it,
so the problem is likely that you implemented it wrong. Don't just post saying "it didn't work"; it would be much easier to suggest how to fix your problem if you just posted your code to begin with, rather than having me ask you to post your code and then you posting it and then me answering.
Ok, I didnt feel like double posting, and I dint realize the stupidity of myself until after I posted that.
So basically, I only have Danmakufu on one computer, and I have time limits on it...so I cant submit te code until tommorow or somtin. Thats usually why I dont have the code.
PS: I realize i'm annoying you, so im going to use this thread less. :3
@Helopolis: I meant linking stages together, ive already asked that, but im still confused on that. Although, I really dont need to know right now, because im waiting til I have a game all planned out with everthing.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on March 25, 2013, 04:39:37 AM
So I'm back with the same problem.
Nuclear Cheese's solution didn't exactly fix the problem.
Now it stays in an infinite loop going count clockwise. (It used to go one full circle, then go towards the boss.)
I tried fixing it myself. And it got worst.  :3
Anyone able to help me?
This is a very insistent problem.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on March 25, 2013, 06:48:17 AM
PS: I realize i'm annoying you, so im going to use this thread less. :3
Actually, by saying these kind of things it becomes annoying. Because it defeats the purpose of Q&A.

@Helopolis: I meant linking stages together, ive already asked that, but im still confused on that. Although, I really dont need to know right now, because im waiting til I have a game all planned out with everthing.
I quickly downloaded your Danmakufu game 0.2 to view your code. And I see what is going on. You have multiple stage files you want to turn into linked full game. Let unfortunately answer that: "You can't." 0.12m offers no CallStageFromScript or any thing (like enemies/boss) so the only method is to have 1 stage.txt which contains all stages. Do you understand this or is it still too confusing?

Also (not sure if it was mentioned before, probably was in the original thread), you release each stage with the same SFX and PNG files. You know that you could have 1 SFX/PNG folder and use that for your scripts? It would reduce download size.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 25, 2013, 07:40:09 PM
Actually, by saying these kind of things it becomes annoying. Because it defeats the purpose of Q&A.
oh
I quickly downloaded your Danmakufu game 0.2 to view your code. And I see what is going on. You have multiple stage files you want to turn into linked full game. Let unfortunately answer that: "You can't." 0.12m offers no CallStageFromScript or any thing (like enemies/boss) so the only method is to have 1 stage.txt which contains all stages. Do you understand this or is it still too confusing?

Also (not sure if it was mentioned before, probably was in the original thread), you release each stage with the same SFX and PNG files. You know that you could have 1 SFX/PNG folder and use that for your scripts? It would reduce download size.
Wow, that sounds like a long code, but it seems that it would work :D
Good advice, thank you!

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on March 25, 2013, 10:48:18 PM
ohWow, that sounds like a long code
Indeed, but thankfully for long codes we have #Include script function for like handy things. I hope you know how the Include works, because you are going to need it if you really want to make that full game. Quick example: You got three files,  game.txt, stage1.txt and stage2.txt

Code: [Select]
------ Game.txt -------

script_stage_main {

// include your stage scripts
#include_function stage1.txt
#include_function stage2.txt

@Initialize {
startGame;
}

@DrawLoop, @BackGround etc.

// your game begins here
task startGame {
Stage 1;
< function to scan for enemies/boss, if none -> continue.
Stage 2;
}
}

----- stage1.txt -------

task Stage1 {
// your fairy waves
CreateEnemyFromFile....

// your boss
CreateBossFromFile....
}

If you look at this code. What do you think I did with the stage files?  I'll first leave you to guess it before spoiling. I am sure you would understand it
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 25, 2013, 11:21:46 PM
From the code you posted, I personally understand what's going on. However, how do you implement DrawLoop and Background in this case? Since you're calling a task stage, I'm also assuming that it won't pick up @Initialize or @Finalize either. I made variables have different names for Stage 2 just in case I end up with a same-variable-name issue, but It'd be helpful if I knew more about #include_script. Can you explain how #include_script works? Since #include_function appends all the rest of the includes to the first, does the same hold true for #include_script?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on March 26, 2013, 06:59:06 AM
Hmmm? There is no include_script function, not quite sure where you picked that up. Oh, I see. Maybe cause of my way of writing the post, I should edit that correctly to avoid confusion.

You cannot omit @DrawLoop or @BackGround themselves but you can call tasks / functions inside the DrawLoop and BackGround. Technically, everything can be done in the script_main_stage, you just need to use tricks and workarounds.

Code: [Select]
script_enemy_main {

< bla bla vars >

#Include_function somescript.txt

@Initialize {
load stuff
}

@DrawLoop {
drawBoss;
}
}

---- somescript.txt ----

task drawBoss {
SetTexture(boss);
SetAlpha(255);
SetGraphicAngle(0,0,0);
SetGraphicScale(1,1);
SetRenderState(ALPHA);
SetGraphicRect(0,0,82,112);
DrawGraphic(GetX, GetY);
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Marisa Kirisame on March 26, 2013, 02:52:33 PM
Hello to the the leads of the help thread for Danmakufu.

I began using this a couple of days ago and have had the most fun time bringing ideas to life like this. I am having a problem though.

I want to make a pre combat event for talking (ya know, like you usually do with a boss before the fight). I already have it scripted and such and ready to go but I would like help with where I should put it to where the boss doesn't begin fighting you yet, but you can hurt her yet either.

thanks ahead of time. and thank you for the tutorials, they have been really helpful for me in learning this stuff. =)

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on March 26, 2013, 04:45:38 PM
I want to make a pre combat event for talking (ya know, like you usually do with a boss before the fight). I already have it scripted and such and ready to go but I would like help with where I should put it to where the boss doesn't begin fighting you yet, but you can hurt her yet either.
You mean like in the clich? animes where the boss launches several things at you / shows off but then the talk begins? Though I am confused about one thing because of your wording.

1) Do you want a regular Touhou-look-alike dialogue where the boss is in the screen and you too?
or
2) do you want the boss to appear, attacking you then after some period of time the dialogue begins?

Obligatory, post script of what you currently have (in mind)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Marisa Kirisame on March 26, 2013, 05:25:06 PM


1) Do you want a regular Touhou-look-alike dialogue where the boss is in the screen and you too?


Obligatory, post script of what you currently have (in mind)

regular Touhou look-alike please.

Code: [Select]
script_event name{



let CSD = GetCurrentScriptDirectory;
let saku2 = CSD ~ "img\saku2.png";
let mari = CSD ~ "img\mari.png";

@Initialize{

LoadGraphic(mari);
LoadGraphic(saku2);

 

}

@MainLoop{
SetChar(LEFT, mari);                 //Set the player's character on the left side, with the graphic you've told it to display.
  SetGraphicRect(LEFT, 350, 0, 200, 0);           //The region you're displaying of the graphic for the player character, just like SetGraphicRect.
  MoveChar(LEFT, BACK);                             //Move the player's character into the background, to show she is not speaking.
  SetChar(RIGHT, saku2);                //Set the boss' picture on the right side of the screen.
  SetGraphicRect(RIGHT, 0, 0, 200, 350);           //Set the boundry of the picture you want displayed.
MoveChar(RIGHT, FRONT);                          //Move the boss' image to the front to show that she is speaking.
TextOutA("Why are you here?");           //Self explanatory. Danmakufu will not pass this function until a certain amount of time has passed, or the player clicks the shot button.
MoveChar(RIGHT, BACK);                           //Move the boss to the background, then...
MoveChar(LEFT, FRONT);                           //Move the player forward, to show that she will now speak.
TextOutA("I'm just here to borrow some books, ya know?");                     //What the player will be speaking.
End;           //This ends the event.
}

@Finalize{
  DeleteGraphic(mari);
DeleteGraphic(saku2);
}
}

Not the entire conversation, but I wanna make sure everything is working before I write out the rest of the dialogue
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on March 26, 2013, 06:23:48 PM
A method I mostly use of my own (it isn't always the best, remember.) Create a dummy spell card and put it in your plural.

Dialogue01  <--- your dummy card
NonSpell01.txt
CardSpell01.txt
etc...

Code: [Select]
-----------  Dialogue01.txt --------------
script_enemy_main {
    @Initialize{
SetLife(1);
SetDamageRate(1,1);
CreateEventFromScript("dialogue1");
    }

    @MainLoop{
if(GetEventStep==1){ AddLife(-10); }
    }

}

script_event dialogue1 {

    < vars and stuff >

    @Initialize { etc }

    @MainLoop {
< talk talk talk talk > // dialogue
SetStep(1); // set step to 1. Triggers if statement of @mainloop in enemy_main
    }
}

Explaining the code. The boss has 1 Life but because this is a dialogue (event is being called) nobody can shoot / attack. When SetStep is set to 1 at the end of the dialogue, it will deduct the life of the event "killing the boss". The next card in the plural will be loaded, which is the actual fight.

The trick to remember here is SetStep and GetEventStep functions.

Edit: You are using End; function, which is also workable. Then you shouldn't be needing the whole SetStep thing AFAIK.  In both conditions make sure you call the event in @initialize
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Marisa Kirisame on March 26, 2013, 06:36:12 PM
Thanks Helepolis, that was most helpful.

Now for a big reason why I came here. I am working on an EX Sakuya fight and know what I want to do for her time out card.There a couple of things I would greatly appreciate help with:

  1) how to do Sakuya's time stop and knife spawn while in said time stop
 
  2) How to make a stationary laser that rotates a certain distance every 60 frames

 any help would be appreciated.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 26, 2013, 06:40:36 PM
Thanks Helepolis, that was most helpful.

Now for a big reason why I came here. I am working on an EX Sakuya fight and know what I want to do for her time out card.There a couple of things I would greatly appreciate help with:

  1) how to do Sakuya's time stop and knife spawn while in said time stop
 
  2) How to make a stationary laser that rotates a certain distance every 60 frames

 any help would be appreciated.
1) Do you know about object bullets?
2) CreateLaserA, http://www.shrinemaiden.org/forum/index.php/topic,30.0.html In the laser section
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Marisa Kirisame on March 26, 2013, 06:43:20 PM
1) Do you know about object bullets?
2) CreateLaserA, http://www.shrinemaiden.org/forum/index.php/topic,30.0.html In the laser section

1) Sadly I can not say I do

2) so it's like the CreateShotA in that regard? hmmm ok.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 26, 2013, 06:55:56 PM
1) Sadly I can not say I do

2) so it's like the CreateShotA in that regard? hmmm ok.
1) Well, you should learn about them and thats how you can do that. You can set the speed different anytime you want! :D
2) I guess...just a bit different :)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Marisa Kirisame on March 26, 2013, 07:03:06 PM
1) Well, you should learn about them and thats how you can do that. You can set the speed different anytime you want! :D
2) I guess...just a bit different :)

1) hmm didn't think Sakuya's time stop would be something that high level. I'll go look thanks.

2) I'll explore that option a little more than. What I need i to do is spawn that laser with hitbox, but not fire it off (THe laser will be a knife) (unsure if I worded that right)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 26, 2013, 07:39:06 PM
1) hmm didn't think Sakuya's time stop would be something that high level. I'll go look thanks.

2) I'll explore that option a little more than. What I need i to do is spawn that laser with hitbox, but not fire it off (THe laser will be a knife) (unsure if I worded that right)
1) You can wait, set the speed to zero, wait, change the angle, and set the speed to anything again. I think it would work well :D
2) Then put the speed at 0, and the moving speed of the base at something more than 0. Then the graphic to COLOR32. :D If you want it to be attached to the boss, so when the boss moves, the laser goes with her, use CreateLaserB.
If you want any example codes just tell me :3
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Marisa Kirisame on March 26, 2013, 10:35:11 PM
1) You can wait, set the speed to zero, wait, change the angle, and set the speed to anything again. I think it would work well :D
2) Then put the speed at 0, and the moving speed of the base at something more than 0. Then the graphic to COLOR32. :D If you want it to be attached to the boss, so when the boss moves, the laser goes with her, use CreateLaserB.
If you want any example codes just tell me :3

1) hmm I'll have to try that.

2) Would be very greatly appreciated. This time out spell is going to be the most complex thing in this fight
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Nuclear Cheese on March 27, 2013, 01:14:27 AM
OT: I was about to say, suddenly a Nuclear Cheese back on the forums. Welcome back? I guess :V

OT: Well, glad to be back, for whatever capacity of 'back' it'll end up being.  Unfortunately I've had not nearly enough time to pay attention to Touhou things lately.
Also, I should probably apologize to everyone with regard to Musuu no Danmaku, but that's getting seriously off topic here so I'll save it for now ...

So I'm back with the same problem.
Nuclear Cheese's solution didn't exactly fix the problem.
Now it stays in an infinite loop going count clockwise. (It used to go one full circle, then go towards the boss.)
I tried fixing it myself. And it got worst.  :3
Anyone able to help me?
This is a very insistent problem.

I'm assuming the rest of your code is still the same as you posted in the pastebin.  I took another look, and noticed this little item that will also be a problem:
Code: [Select]
let target_angle=atan2(GetEnemyInfo(enemy_target,ENEMY_Y)-y, GetEnemyInfo(enemy_target,ENEMY_X-x));
... specifically, when you're getting the ENEMY_X, you misplaced your first closing parenthesis - it should be before the "- x" (like when getting ENEMY_Y), not after.  Because ENEMY_X is just some value that tells Danmakufu what information you're trying to get, subtracting x doesn't immediately cause it to yell at you (although I'd have no guess as to what it's going to return in this case).
It probably should look like this:

Code: [Select]
let target_angle=atan2(GetEnemyInfo(enemy_target,ENEMY_Y)-y, GetEnemyInfo(enemy_target,ENEMY_X)-x);
I was never too well versed with player scripts; if I was (or if I had more free time  :V) I'd throw together a quick one to try this out myself.  Unfortunately I'm stuck with just looking at your posted stuff and trying to figure it out from there.


Another thing to keep in mind: if I remember correctly, Danmakufu's angles returned by atan2 are fixed in a certain range (I forget if it's 0 to 360 or -180 to +180).  Because of how your formula is set up, it's possible that certain conditions may yield unusual results.  I can't say this is an issue, but at some angle this value will wrap around, causing a seemingly large jump in the angle despite the graphic only rotating a tiny bit more.  For instance:

Let's say the current direction is 10, and we calculate the angle to the target as 350. (assuming it returns angles in the range 0-360)
By your script, your shot will try rotating in the positive direction, even though the negative direction is obviously quicker.

A more robust angle comparison code will take this into account, something like this:

Code: [Select]
// Part 1 - get angles
let my_angle = Obj_GetAngle(obj);
let angle_to_target = atan2(ydiff, xdiff);

// Part 2 - find the angular difference
let angle_difference = angle_to_target - my_angle;

// Part 3 - normalize the angular difference
if (angle_difference > 180)
{
  angle_difference -= 360;
}
else if (angle_difference < -180)
{
  angle_difference += 360;
}

// Part 4 - rotate
if (angle_difference < 0)
{
  my_angle -= 5;
}
else if (angle_difference > 0)
{
  my_angle += 5;
}
Obj_SetAngle(obj, my_angle);
(usual disclaimer: pseudo code done from memory, may not be perfect)

In part 3, if the angle is beyond +/- 180, it's really the same as a smaller rotation of the opposite sign (e.g. a 270 degree rotation left is the same as a 90 degree rotation right).  By normalizing the difference into this range, we ensure that we're looking at the smaller turn to get to the target angle.  This also handles the odd cases caused by the Danmakufu's angle wrapping.  Given the same example from above:

my_angle = 10;
angle_to_target = 350;
angle_difference = 340, but is > 180 so it is then normalized to -20
Since the angle difference is now negative, we will rotate in the negative direction.



Also, I'm a bit curious - is there a reason you're looping over all of the enemy IDs?  As-is, it's just going to end up taking the last one in the list; are you planning on adding in some conditions to select what enemy to seek later?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 27, 2013, 01:21:19 AM
Oh uh. I didn't realize it didn't work for you because you originally posted "OH i see", and then edited in that it didn't work.
Please, when somebody posts a suggestion or solution for you, don't bother thanking them or commenting on it until you've tried it out and it works or doesn't work. I, personally, do not look at this thread unless a new reply is posted, because I get notifications for new replies. So I see your post saying only "oh", but I don't see your edits until you later mention it.

That being said, if somebody asks you to pastebin your code and post it, then suggests a solution that doesn't work, the general response is to post your new code even if nobody asks you to. You should figure that I'm just going to ask you to post it anyways. I know that my code block works because I tested it, so the problem is likely that you implemented it wrong. Don't just post saying "it didn't work"; it would be much easier to suggest how to fix your problem if you just posted your code to begin with, rather than having me ask you to post your code and then you posting it and then me answering.
http://pastebin.com/eD6uC83L (http://pastebin.com/eD6uC83L)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 27, 2013, 03:41:10 AM
Sorry, that's definitely my bad. index is a keyword in DNH where index(x,y) does the same as x[y]. I switched around my tested variable names for clarity and forgot about it.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on March 27, 2013, 01:42:15 PM
I'm trying to recreate Satori's Return Inanimate explosions from SA using effect objects but it doesn't turn out quite right.

ZUN explosion: http://img526.imageshack.us/img526/9066/th008.png (http://img526.imageshack.us/img526/9066/th008.png)

My attempt: http://img715.imageshack.us/img715/9858/testdi.png (http://img715.imageshack.us/img715/9858/testdi.png)

Resources used: http://img812.imageshack.us/img812/1176/exp1.png (http://img812.imageshack.us/img812/1176/exp1.png)
                                 http://img138.imageshack.us/img138/5346/exp2j.png (http://img138.imageshack.us/img138/5346/exp2j.png)

Example of code used for my explosions: http://pastebin.com/wwQAqmiQ (http://pastebin.com/wwQAqmiQ)

I guess the heat field should fade out to 0 at the outer part of the explosion, but how would I do that? Will I have to use TRIANGLEFAN?
If it's not too much, can someone enlighten me on what I'm missing (primarily how the vertices work together with the primitive types which I haven't fully realized yet). I have checked some tutorials like Helepolis and Nuclear Cheese ones, but I guess that didn't help me too much, or I just didn't go through them well enough.

Hope it doesn't look too much like I have no idea what I'm doing here  :(.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 27, 2013, 01:56:57 PM
I'm trying to recreate Satori's Return Inanimate explosions from SA using effect objects but it doesn't turn out quite right.

I've already gotten Okuu's suns. The issue is, I used the red orbs from The Last Comer, so there might be some differences. If you have The Last Comer, this might be an options, but I'm not sure.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on March 27, 2013, 02:37:34 PM
I've already gotten Okuu's suns. The issue is, I used the red orbs from The Last Comer, so there might be some differences. If you have The Last Comer, this might be an options, but I'm not sure.

I don't. Also, if it is very similair to Okuu's suns, it may not be right either, cause the explosions looks a bit different than Okuu's suns (in SA).
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 27, 2013, 05:12:29 PM
I don't. Also, if it is very similair to Okuu's suns, it may not be right either, cause the explosions looks a bit different than Okuu's suns (in SA).

Are you using ADD and not ALPHA?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on March 27, 2013, 05:28:39 PM
Are you using ADD and not ALPHA?

I'm using ADD, but for both layers. I posted the code in the first post.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 27, 2013, 05:34:58 PM
You have to make the backdrop of the image black. It's a quirk with danmakufu rendering add-blend funny when the original image has transparency, so you have to make sure every pixel has a 255 alpha value. When add-blending, this means using a black background, since 0 + anything = anything and the image will come out as intended.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Marisa Kirisame on March 27, 2013, 06:07:45 PM
I have a spellcard I've been working on (Blood Sign: Hellsing's Shotgun") that releases waves based on he enemy health. I don't know how to make it release them anyway near time out if the player tries to. can I have some assistance please? =)

http://pastebin.com/0gbdYCmk
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 27, 2013, 06:19:18 PM
if(GetTimer < something){ do things }

In this case your conditions would be like if(GetEnemyLife < 1500 || GetTimer < something) { do things }

EDIT: sparen did you even read the question or look at the script
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 27, 2013, 06:20:20 PM
I have a spellcard I've been working on (Blood Sign: Hellsing's Shotgun") that releases waves based on he enemy health. I don't know how to make it release them anyway near time out if the player tries to. can I have some assistance please? =)

http://pastebin.com/0gbdYCmk

If it's based on enemy health, there's a GetLife function. That might help.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Marisa Kirisame on March 27, 2013, 06:23:46 PM
if(GetTimer < something){ do things }

In this case your conditions would be like if(GetEnemyLife < 1500 || GetTimer < something) { do things }

EDIT: sparen did you even read the question or look at the script

I tired that at first but then I get a error when I try and play it.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 27, 2013, 06:26:44 PM
What error? Can you post a screenshot? Does your script work as intended as long as you don't have the extra condition? Is the script you're trying exactly the same as the one you just posted but with || GetTimer < number added to each condition?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Marisa Kirisame on March 27, 2013, 06:40:57 PM
What error? Can you post a screenshot? Does your script work as intended as long as you don't have the extra condition? Is the script you're trying exactly the same as the one you just posted but with || GetTimer < number added to each condition?


*head desk* oh sure now it wants to work. lols

Anyway on to a bigger problem I have. I don't know how to make somehting like Sakuya's time stop in her cards on EoSD. How would someone go about that?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: gtbot on March 27, 2013, 07:47:17 PM
Sakuya's time stop
TimeStop(lengthinframes, 1, 1, 1) (http://dmf.shrinemaiden.org/wiki/Enemy_Script_Functions_%280.12m%29#TimeStop)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Marisa Kirisame on March 27, 2013, 08:07:26 PM
TimeStop(lengthinframes, 1, 1, 1) (http://dmf.shrinemaiden.org/wiki/Enemy_Script_Functions_%280.12m%29#TimeStop)


...how the hell did I miss that? lols thx now I can pretty much finish my timeout. =)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on March 27, 2013, 08:55:34 PM
Sorry, that's definitely my bad. index is a keyword in DNH where index(x,y) does the same as x[y]. I switched around my tested variable names for clarity and forgot about it.
So, how do I fix it?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: gtbot on March 27, 2013, 10:06:30 PM
Change index to a different variable name.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Marisa Kirisame on March 27, 2013, 10:22:17 PM
working on non spells. I have the shots bouncing off the left and right walls but can't seem to figure out how to get them to bounce off  of the Min Y. Any help would be appreciated. =D


EDIT: also having this problem:

Code: [Select]

if(Obj_GetX(obj)>GetClipMaxX) {
                     Obj_SetAngle(obj, atan2(GetPlayerY - Obj_GetY(OBJ_SHOT), GetPlayerX - Obj_GetX(OBJ_SHOT));
                     Obj_SetX(obj,  Obj_GetX(obj) - 0.1);
              }


I am wanting to have my bullets aim towards the player after bouncing off the side walls but it is giving me an error as I try to test it. an ideas?


EDIT EDIT: nvm...I feel bad for missing what I did wrong but I still need help boundcing them off the ceiling.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Maths ~Angelic Version~ on March 28, 2013, 12:22:24 AM
If you want the bullets to bounce off the ceiling "normally" (mimicking a reflection), the new angle has to be -Obj_GetAngle(obj), not 180-Obj_GetAngle(obj).
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: PhantomSong on March 28, 2013, 02:33:37 AM
ER... I can't pay attention... But uhm when I use Laser C the curving looks bad... is there anyway to fix that?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 28, 2013, 02:52:20 AM
ER... I can't pay attention... But uhm when I use Laser C the curving looks bad... is there anyway to fix that?

Please elaborate on 'looks bad.' Are you referring to it thinning out to the point you can't see it until you've been speared? Pixel issues where it's not smooth?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on March 28, 2013, 06:06:40 AM
ER... I can't pay attention... But uhm when I use Laser C the curving looks bad... is there anyway to fix that?

Some people here on MoTK has made shotsheets containing "better" curving laser graphics, if that would help.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Marisa Kirisame on March 28, 2013, 12:36:27 PM
ok something weird's going on. I was finishing up a spell and it was testing ok until I added the 8th wave to it. now it won't play at all and Iam getting this:

[attach=1]

can someone help me figure out what's going on?

The code is here (I know it's long)

http://pastebin.com/VhA4jGdR
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: gtbot on March 28, 2013, 12:40:31 PM
You're missing a closing bracket for @MainLoop.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Marisa Kirisame on March 28, 2013, 12:45:15 PM
You're missing a closing bracket for @MainLoop.

*tries*

*head hits wall*

Thanks. I looked it over about 90 times and I guess somehow missed it.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on March 28, 2013, 03:46:08 PM
Better to keep it in mind for everybody,  script_enemy_main errors are 99% of the time {  }  related errors.

Blargel and I even made a flow chart for it. http://www.shrinemaiden.org/forum/index.php/topic,4155.msg186037.html#msg186037

Try to first check that next time. Helps one also improve in backtracking errors. Of course if you really don't know what the hell is going on feel free to post :V
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on March 28, 2013, 10:33:47 PM
This might seem not relevant. But...
What exactly is SetCommonData and GetCommonData?
I have been wondering this question. I've even tried to search it up.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Nuclear Cheese on March 28, 2013, 11:13:10 PM
script_enemy_main errors are 99% of the time {  }  related errors.

This is not limited to script_enemy_main.  Or Danmakufu, really - the only reason it's worse for us in Danmakufu is because we (mostly) can't understand the error messages it pops up.


This might seem not relevant. But...
What exactly is SetCommonData and GetCommonData?
I have been wondering this question. I've even tried to search it up.

CommonData allows you to set up named values that are shared between all scripts currently running in Danmakufu.  SetCommonData defines one of these (giving it a name and a value), whereas GetCommonData retrieves the value of one given its name.
GetCommonDataDefault is pretty useful too, since it allows you to specify a default value that will be returned if the specified name has yet to be defined.
This can be used to pass values, say, from a stage script to the enemies spawned by the stage, allowing it to tell them certain parameters for their behavior (such as a difficulty level, for instance).  Another possible use would be to coordinate multiple objects to have them all act at the same moment (at that moment, set a common data to a certain value - the other objects will then read this value and act on when it updates).

Another awesome thing that can be done with these is via SaveCommonData and LoadCommonData - these allow you to save off and then later reload persistent values in between play sessions.  This can be used to store things like unlocks, spellcard attempt and capture counts, etc.

Disclaimer: I don't remember ever trying it, but I'm a bit suspicious about how common data might interact with replays.  Tread lightly (at the least, you may want to check if you're in a replay, and not call SaveCommonData in that case).


On an unrelated note - did my more recent post help you out with your player script?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on March 28, 2013, 11:40:38 PM
Ahh that helped.
The player script homing bullets are function well.
Only problem is that if you stay to the top left of the boss.
The right homing bullets would turn right, it doesn't hit the boss,when it is bigger than 0, it will start to turn left. It looks really weird.
It kind of looks like an infinity sign.
Otherwise, I can start making the bombs. And hopefully the rest of the game.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on March 29, 2013, 06:45:36 AM
This is not limited to script_enemy_main.  Or Danmakufu, really - the only reason it's worse for us in Danmakufu is because we (mostly) can't understand the error messages it pops up.
Mostly you don't need to in order to hunt down the basic errors. A line number is often given or the part of the code where it breaks down. I am sure you don't need to read any of the Japanese error message to figure out where it went wrong. Of course, what went wrong, is reported in the JP text and probably makes your life easier if you know/can read.

The real danger with line numbers is when #Include_function is used. You will be returned line numbers which aren't in the original file where #include is called. This is also one of the reasons to program step by step. After writing a new object bullet or part of code -> Test. Many new people try to script 5000000 lines and then test it out, running into thousands of errors. That just doesn't work.

And afaik we also even got a translated error message thread. No idea where that one is. Edit: It is in the same thread I linked :V
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Marisa Kirisame on March 29, 2013, 05:20:58 PM
Ok i have pretty much everything worked out for my time out. I just need help making two large stationary knives the rotate on command. Any assistance would be appreciated.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 29, 2013, 09:27:51 PM
...Yet another object effect question.

Code: [Select]
  task Option(ID){
    let objoption=Obj_Create(OBJ_EFFECT);
    let optionx = 30;
    let optiony = 15;
    Obj_SetAlpha(objoption,200);
    ObjEffect_SetTexture(objoption,img_kogasa);
    ObjEffect_SetRenderState(objoption,ALPHA);
    ObjEffect_SetPrimitiveType(objoption,PRIMITIVE_TRIANGLEFAN);
    ObjEffect_CreateVertex(objoption,4);       
    ObjEffect_SetVertexUV(objoption,0,210,162);    // four coordinates of orb on spritesheet
    ObjEffect_SetVertexUV(objoption,1,226,162);    //Assuming 0:LXTY, 1:RXTY, 2:RXBY, 3:LXBY
    ObjEffect_SetVertexUV(objoption,2,226,178);   //L,eft R,ight T,op B,ottom. Hope correct.
    ObjEffect_SetVertexUV(objoption,3,210,178);//DONE
    while(!Obj_BeDeleted(objoption)){
      optionx = GetPlayerX+optionxrad*cos(optioncount+90*ID);
      optiony = GetPlayerY+optionyrad*sin(optioncount+90*ID);
      /*ObjEffect_SetVertexXY(objoption,0,Obj_GetX(objoption)-8,Obj_GetY(objoption)-8);
      ObjEffect_SetVertexXY(objoption,1,Obj_GetX(objoption)+8,Obj_GetY(objoption)-8);
      ObjEffect_SetVertexXY(objoption,2,Obj_GetX(objoption)+8,Obj_GetY(objoption)+8);
      ObjEffect_SetVertexXY(objoption,3,Obj_GetX(objoption)-8,Obj_GetY(objoption)+8);*/
      ObjEffect_SetVertexXY(objoption,0,optionx-8,optiony-8);
      ObjEffect_SetVertexXY(objoption,1,optionx+8,optiony-8);
      ObjEffect_SetVertexXY(objoption,2,optionx+8,optiony+8);
      ObjEffect_SetVertexXY(objoption,3,optionx-8,optiony+8);
      Obj_SetPosition(objoption, optionx, optiony);
      ObjEffect_SetAngle(objoption, 0, 0, Obj_GetAngle(objoption)+1);
      if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
        //Focused option shot below
        if(count%6 == 3){
          CreatePlayerShot01(Obj_GetX(objoption), Obj_GetY(objoption), 15, 270, 2, 1, 18);
          CreatePlayerShot01(Obj_GetX(objoption), Obj_GetY(objoption), 8, 270, 2, 3, 23);
}
      }else{
        if(count%8 == 4){
          CreatePlayerShot01(Obj_GetX(objoption), Obj_GetY(objoption), 15, 270, 2, 1, 18);
          CreatePlayerShot01(Obj_GetX(objoption), Obj_GetY(objoption), 8, 270, 2, 3, 23);
        }
      } //closes the if else
      yield;
    }
  }

Basically, I have four options that are *supposed* to rotate around the player in an elliptical path. The positioning is correct, since the shots were created at the correct location, but the graphics float towards the lower left corner, and are only close to the player when in the top left corner of the screen.

This ObjEffect_SetVertexXY problem has probably been answered before. However, I've tweaked it many times and it refuses to work correctly.

If anyone can provide an answer, I'd be truly grateful.

Sorry for posting something that has probably been answered already.

Edit: If the problem has to do with the ID, then I can fix that when it comes to the XY coordinates. However, everywhere I look, there's a different way to use XY.

I'm going to dig around for Drake's last answer to my questions and see if that answers it.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 29, 2013, 10:12:04 PM
Ok i have pretty much everything worked out for my time out. I just need help making two large stationary knives the rotate on command. Any assistance would be appreciated.
Shot objects, learn them. Read the intermediate tutorial. You cannot accomplish this without manipulating objects.


Quote
However, everywhere I look, there's a different way to use XY
No there isn't. If it's doing anything other than creating the basic structure of the rendered effect, they're doing it wrong. The solution to the problem is the same I've given to you twice before. Your XYs should be set once, before the running loop, at (-8, -8), (8, -8), (8, 8), (-8, 8). That's it.

- Obj_SetAlpha() doesn't work for effect objects. Loop through the vertices and use SetVertexColor.
- The order of coordinates of your UV vertices, when using FAN and STRIP with 4 vertices, don't matter as long as they match the order of your XYs. You can make your second vertex the 0th vertex and as long as it's the same in your XYs it won't change the image.
- ObjEffect_SetAngle(objoption, 0, 0, Obj_GetAngle(objoption)+1) shouldn't work because ObjEffect_SetAngle refers to the image's rotation while Obj_Get/SetAngle refers to the object's angle of velocity.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 29, 2013, 11:43:18 PM
Thanks. Now a stupid question.

Obj_SetSpeed doesn't seem to work on Object Lasers. Is there any way to get around this and get lasers to move? Besides SetPosition, etc.

Code: [Select]
  task Laser(OrigX,OrigY,angle,ID){
    let obj_bluelaser = Obj_Create(OBJ_LASER);
    Obj_SetSpeed(obj_bluelaser, 5);
    ObjShot_SetGraphic(obj_bluelaser, ID);
    ObjShot_SetDamage(obj_bluelaser, 1.5);
    ObjShot_SetPenetration(obj_bluelaser, 2);
    ObjLaser_SetWidth(obj_bluelaser, 6);
    ObjLaser_SetLength(obj_bluelaser, 30);
    ObjLaser_SetSource(obj_bluelaser, false);
    Obj_SetPosition(obj_bluelaser, OrigX, OrigY);
    Obj_SetAlpha(obj_bluelaser, 130);
    Obj_SetAngle(obj_bluelaser, angle);
  }

Basically, it's not working correctly. The Obj_Set (Width/Length/Angle/Graphic/Position) works, but Obj_Set (Speed) doesn't. I think that Damage and Penetration work.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 30, 2013, 12:48:54 AM
Is there a particular reason you need an object laser? Your current code doesn't do anything that requires a laser object as long as you have a longer more laserlike graphic. For that matter it doesn't seem to do anything that you couldn't do with CreatePlayerShot01.

I mean you could use SetPosition, but object lasers expand from 0 to full width. It's primarily meant for installation lasers, hence why SetSpeed doesn't work.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on March 30, 2013, 01:17:53 AM
Is there a particular reason you need an object laser? Your current code doesn't do anything that requires a laser object as long as you have a longer more laserlike graphic. For that matter it doesn't seem to do anything that you couldn't do with CreatePlayerShot01.

I mean you could use SetPosition, but object lasers expand from 0 to full width. It's primarily meant for installation lasers, hence why SetSpeed doesn't work.

OK. Yeah, it's just for stretching the graphic, mostly. However, I want the width to be different, and that's the issue. I mean, I could try using an effect object, but that's probably going to mess up.

Edit: The shots work when I used effect objects. Question closed.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Marisa Kirisame on March 30, 2013, 05:13:41 AM
Shot objects, learn them. Read the intermediate tutorial. You cannot accomplish this without manipulating objects.


I know how to make and control with a shot object, my problem becomes making knives bigger than normal. the Laser objects don't have a graphic setting and the shot objects (at least from what I have read) can't change size form the original graphic.

That is where I need help. A laser object would be most ideal but I need to know how to set its graphic
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 30, 2013, 06:23:59 AM
Exactly as you would a shot object. Laser objects are subclasses of shot objects. Sparen just posted an example of a setup.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Marisa Kirisame on March 30, 2013, 08:58:32 PM
Exactly as you would a shot object. Laser objects are subclasses of shot objects. Sparen just posted an example of a setup.

Thanks I finally have them made. I wasn't aware they could crossover like that for Laser object. Now if my rotation function would decide to work, I'd be happy. =)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on March 30, 2013, 10:24:30 PM
Thanks I finally have them made. I wasn't aware they could crossover like that for Laser object. Now if my rotation function would decide to work, I'd be happy. =)

If you say work on command, do you mean something like this?

Code: [Select]
script_enemy_main{
let callrotate = false;

//If using tasks and got a wait function ready

task maintask{
loop{

wait(200);
callrotate = true;
wait( x ) // How long rotation lasts?
callrotate = false;

}}

//(Inside the object)
while(!Obj_BeDeleted(ID)){

if(callrotate == true){
// Insert rotation code
}

yield;
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on March 30, 2013, 10:39:00 PM
Settings flags like that would be actually useful in some contexts if you didn't end up setting callrotate at predetermined intervals. At that point you might as well just have
while(!Obj_BeDeleted(ID)){
   loop(x){ yield; }
   loop(200){
      // Insert rotation code
      yield;
   }
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Marisa Kirisame on March 31, 2013, 06:43:03 AM
ok I got it fixed (I wanted it to move like a ticking clock) The guys on the IRC channel helped but Drake's Idea is pretty close to that. =)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on March 31, 2013, 09:23:16 PM
I'm so close to finishing my player script.
http://pastebin.com/fUN8fyYa (http://pastebin.com/fUN8fyYa)
I don't know what's the problem. I want the bullet to expand when it reaches the oldest enemy. Then, I want the bullet to fade, before I delete it to make it less sketchy.
The expanding and fading part never happens.
What's the problem?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: gtbot on March 31, 2013, 11:13:50 PM
You are checking if the object x/y is equal to the enemy x/y, and in most cases this is not desirable since the movement of both can be unreliable for them to fall right on each other. Alternatively, you can check if the distance between both if smaller than, say 16 or whatever value you'd like. Here is a function that returns distance:
Code: [Select]
function GetDistance(x1,y1,x2,y2){
return (((x2-x1)^2+(y2-y1)^2)^(1/2))
}
Also, I'm not sure if it's your intention, but in your code, your object will only grow when the condition is met, and so if, say the enemy dies, it will stop growing and set a new angle (though there's no movement in the code you gave either so it probably won't regrow either). Do you want it like this (but add some movement) or do you want it to keep increasing once it hits the enemy initially?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on March 31, 2013, 11:20:24 PM
I want it to hit the enemy, and keep growing.  The bullet is basically Reimu's Spell.
And for the function, is x1 the Object's x or the enemy's? Same with y1.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: gtbot on March 31, 2013, 11:38:23 PM
As long as you keep the x and y consistent with the 1 or 2, it doesn't matter the order. (so if you want then objectx, objecty, enemyx, enemyy then that works)

As for the the bullet, it'd be easier to have them do separate yields in that case, and I edited it together for you. I haven't tested it but it should work in the same manner as your current one: http://pastebin.com/XS7qVib7 (http://pastebin.com/XS7qVib7) (not sure why pastebin formatted the first few lines very oddly)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on April 01, 2013, 02:28:31 AM
Thanks, it actually helped, now the problem is that alpha won't respond to me. It's still on 255 alpha and I only want about 150 alpha. I even used:
ObjEffect_SetVertexColor(obj,i,150,255,255,255); // I is for the vertexes
It won't set the alpha to 150.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on April 01, 2013, 04:50:07 AM
Personally I'm wondering why you're increasing the XYs to expand the graphic. You can you just as well with SetScale.

So where are you putting this transparency line, and when do you want it to be active? If you want the alpha value to start at 150 then disappear when it hits the enemy, you'll have to put it before the stuff you pastebinned, and change the descent(k in 0..20) to descent(k in 0..15), since 15*10 has it start the loop at 150.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Natmaz on April 01, 2013, 08:50:58 PM
Um, i have an error that makes my Okuu texture tiled  :ohdear:

it looks like that:

http://img593.imageshack.us/img593/3708/whatee.png

http://pastebin.com/VqdXbVtr

i have no clue if that's the right place to post this here, but here's the code > . <

I guess it collides with the @BackGround , but I'm not entirely sure  :ohdear:

Large code goes in pastebin. Large images not in full img tags please. -Hele
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on April 01, 2013, 09:46:09 PM
http://pastebin.com/537Pqycd (http://pastebin.com/537Pqycd) Here is my new task. (Edit: I changd the texture midway through, doesn't interfere with anything though.)
It won't fade out. It just completely disappears. It isn't skipping over the fading out part either.
I'm not too fluent in object effect making.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: gtbot on April 02, 2013, 12:06:20 AM
Change descent(k in 0..100) to count from 100, descent(k in 100..0)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: The Noodles Guy on April 02, 2013, 08:16:10 AM
My code.

http://pastebin.com/vXUJptwv (http://pastebin.com/vXUJptwv)

It gives me an error about frames.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: gtbot on April 02, 2013, 03:36:00 PM
You never defined the variable frame.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on April 02, 2013, 03:48:41 PM
Also, if the C++ highlighting did anything, you're also missing a " in your Cutin.

It should be

CutIn(YOUMU,"Power Sign "\""Chaotic Spin""\", imgCutIn, 0, 0, 380, 600);

Also, you never increment either f or frame, so frame will never hit 60.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: The Noodles Guy on April 02, 2013, 07:03:41 PM
silly me, I missed the frame++; thing :derp:

thanks
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: PhantomSong on April 04, 2013, 11:02:50 PM
Hm... So I'm making a Yuyuko boss fight and was wondering how to give her fan that folding out effect like in TD...
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on April 05, 2013, 12:36:35 AM
Hm... So I'm making a Yuyuko boss fight and was wondering how to give her fan that folding out effect like in TD...
In ObjEffect_SetVertexXY, Make the Y start really close together or just at the same Y. The X is the same.
Then you can slowly widen the Y to its original size. (Not that slow though.)
If it were me, I'd do this:
Code: [Select]
let v = 0;
loop(20){
   ObjEffect_SetVertexXY(obj,0,GetEnemyX-150,GetEnemyY-v);
   ObjEffect_SetVertexXY(obj,1,GetEnemyX+150,GetEnemyY-v);
   ObjEffect_SetVertexXY(obj,2,GetEnemyX+150,GetEnemyY+v);
   ObjEffect_SetVertexXY(obj,3,GetEnemyX-150,GetEnemyY+v);
   v+=5;
   yield;
}
This is if my picture is 300 by 100 pixels.
This should work.

I was also wondering, how does one use a custom font in danmakufu?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on April 05, 2013, 05:23:20 AM
PhantomSong: ascent(t in 0..max){ ObjEffect_SetScale(obj, 0, t/max); } or something similar (actually this won't reach max size, make sure it does)

Lavalake: You can't in 0.12. At best you recreate a font effect from scratch.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on April 05, 2013, 11:47:40 PM
I would create a font effect from scratch, I just don't know how to implement it so that whenever I call the function, the parameter will be where is is located on the screen and the length/letters.
For example:
CreateCustomText(GetClipMinX+50,GetClipMaxY-100,Power){
And then insert some effect stuff.
}
How do I create a system that doesn't know the length of the word or what letters there are. But the parameters tell them.
Juuni Jumon game has a very complex custom font system.
This question might not belong here but, does PH3 let you have custom fonts?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: gtbot on April 06, 2013, 03:10:53 AM
This question might not belong here but, does PH3 let you have custom fonts?
I'm not sure how you'd go about making a font system in 0.12m, but ph3 does have a way to install  (http://dmf.shrinemaiden.org/wiki/Text_Functions#InstallFont)and use a font within its own text objects. You could also technically use a sprite list (http://dmf.shrinemaiden.org/wiki/2D_Sprite_List_Object_Functions) to create a 'font' as well if it's in an image format.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on April 06, 2013, 04:01:37 AM
How do I create a system that doesn't know the length of the word or what letters there are. But the parameters tell them.
font systems are complex
Essentially you're passing in text, each character is read and it's assigned a rect based on the character. You can assign rects manually based on the character, but you can also use ascii numerical representation if need be to just calculate the rects of a character's image. The length of the string would determine how long the final rendered image would be.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: fondue on April 07, 2013, 03:29:09 PM
     
Hm... So I'm making a Yuyuko boss fight and was wondering how to give her fan that folding out effect like in TD...
In ObjEffect_SetVertexXY, Make the Y start really close together or just at the same Y. The X is the same.
Then you can slowly widen the Y to its original size. (Not that slow though.)
If it were me, I'd do this:
Code: [Select]
let v = 0;
loop(20){
   ObjEffect_SetVertexXY(obj,0,GetEnemyX-150,GetEnemyY-v);
   ObjEffect_SetVertexXY(obj,1,GetEnemyX+150,GetEnemyY-v);
   ObjEffect_SetVertexXY(obj,2,GetEnemyX+150,GetEnemyY+v);
   ObjEffect_SetVertexXY(obj,3,GetEnemyX-150,GetEnemyY+v);
     yield;
}
This is if my picture is 300 by 100 pixels.
This should work.

Or, if you want the fan to shoot out and slowly stop you could use descent.
Code: [Select]
let n=*number*;
let t=*number*;
   descent(i in 0..n){
   ObjEffect_SetVertexXY(obj,0,GetEnemyX-150,GetEnemyY-(i/n*t));
   ObjEffect_SetVertexXY(obj,1,GetEnemyX+150,GetEnemyY-(i/n*t));
   ObjEffect_SetVertexXY(obj,2,GetEnemyX+150,GetEnemyY+(i/n*t));
   ObjEffect_SetVertexXY(obj,3,GetEnemyX-150,GetEnemyY+(i/n*t));
     yield;
   }
Change 't' to the desired result.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on April 07, 2013, 05:57:16 PM
I have a question.  :V
http://pastebin.com/VRLpNvVd (http://pastebin.com/VRLpNvVd)
This crashes Danmakufu, does anyone know why?
I think it has to do with the effect object, and the familiars.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on April 07, 2013, 06:49:22 PM
I have a question.  :V
http://pastebin.com/VRLpNvVd (http://pastebin.com/VRLpNvVd)
This crashes Danmakufu, does anyone know why?
I think it has to do with the effect object, and the familiars.

The only thing I notice is:
Code: [Select]
function Wait(let frames){loop(frames){yield;}}
let frames == frames?

Don't know if that is the cause, but...
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on April 07, 2013, 06:53:59 PM
The only thing I notice is:
Code: [Select]
function Wait(let frames){loop(frames){yield;}}
let frames == frames?

Don't know if that is the cause, but...

Probably is. Wait takes one argument, let frames. So it should be either
Code: [Select]
function Wait(let frames){loop(let frames){yield;}}or
Code: [Select]
function Wait(frames){loop(frames){yield;}}The latter, of course, is what you should be doing.

[On a seperate note, I feel like I really shouldn't be helping him with a troll script, but whatever.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on April 07, 2013, 06:57:26 PM
Probably is. Wait takes one argument, let frames. So it should be either
Code: [Select]
function Wait(let frames){loop(let frames){yield;}}or
Code: [Select]
function Wait(frames){loop(frames){yield;}}The latter, of course, is what you should be doing.

[On a seperate note, I feel like I really shouldn't be helping him with a troll script, but whatever.
I was using that in other stage scripts. So I dont know why it wouldnt work now.
What? Why not? D:
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on April 07, 2013, 07:00:03 PM
Probably is. Wait takes one argument, let frames. So it should be either
Code: [Select]
function Wait(let frames){loop(let frames){yield;}}or
Code: [Select]
function Wait(frames){loop(frames){yield;}}The latter, of course, is what you should be doing.

Depends on if he got another problem in his script or not, but I didn't see anything special by myself.
Also, using wait as the function name is preferable to Wait, because If I remember correctly, It may clash with an event function named Wait.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on April 07, 2013, 07:07:01 PM
Depends on if he got another problem in his script or not, but I didn't see anything special by myself.
Also, using wait as the function name is preferable to Wait, because If I remember correctly, It may clash with an event function named Wait.
Well I got that directly from the intermediate tutorial, it worked in every other stage script I made though.
Edit: It crashes as in it says, "Danmakufu.exe has stahped working". No error
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: gtbot on April 07, 2013, 07:12:06 PM
This crashes Danmakufu, does anyone know why?
From what you've pasted, your script looks fine, but given this, you likely have a pathing error from when you are trying to create an enemy since that can cause a crash.

let frames == frames?
Doing it by either func(let argument) or func(argument) should have no difference.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on April 07, 2013, 07:20:09 PM
Doing it by either func(let argument) or func(argument) should have no difference.

Ok, never knew one could use combinations like that when using functions. Excuse my lack of knowledge :|
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on April 07, 2013, 07:58:25 PM
That's going in the tutorial~~~

Qwertyxcv, you realize that it's a troll script, right? Maybe it's crashing because of the reason why you want it to.

  CreateEnemyFromFile(GetCurrentScriptDirectory~"fiynull spppppelkard 3.txt",0, 0, 0, 0, 0);
  Wait(60);
  CreateEnemyFromFile(GetCurrentScriptDirectory~"fiynull spppppelkard 2.txt", GetCenterX-200, GetCenterY-50, 1.8, 0, 0);
  Wait(60);
  CreateEnemyFromFile(GetCurrentScriptDirectory~"fiynull spppppelkard 2.txt", GetCenterX-200, GetCenterY-50, 1.8, 0, 0);
  Wait(60);
  CreateEnemyFromFile(GetCurrentScriptDirectory~"fiynull spppppelkard 2.txt", GetCenterX-200, GetCenterY-50, 1.8, 0, 0);
  Wait(60);
  CreateEnemyFromFile(GetCurrentScriptDirectory~"fiynull spppppelkard 2.txt", GetCenterX-200, GetCenterY-50, 1.8, 0, 0);
  CreateEnemyFromFile(GetCurrentScriptDirectory~"fiynull spppppelkard 3.txt", 0, 0, 0, 0, 0);
  CreateEnemyFromFile(GetCurrentScriptDirectory~"fiynull spppppelkard 2.txt", GetCenterX-200, GetCenterY-50, 1.8, 0, 0);
  Wait(60);
  CreateEnemyFromFile(GetCurrentScriptDirectory~"fiynull spppppelkard 2.txt", GetCenterX-200, GetCenterY-50, 1.8, 0, 0);
  Wait(60);
  CreateEnemyFromFile(GetCurrentScriptDirectory~"fiynull spppppelkard 2.txt", GetCenterX-200, GetCenterY-50, 1.8, 0, 0);
  Wait(30);
  CreateEnemyFromFile(GetCurrentScriptDirectory~"fiynull spppppelkard 2.txt", GetCenterX-200, GetCenterY-50, 1.8, 0, 0);
  Wait(30);
  CreateEnemyFromFile(GetCurrentScriptDirectory~"fiynull spppppelkard 2.txt", GetCenterX-200, GetCenterY-50, 1.8, 0, 0);
  Wait(30);
  CreateEnemyFromFile(GetCurrentScriptDirectory~"fiynull spppppelkard 2.txt", GetCenterX-200, GetCenterY-50, 1.8, 0, 0);
  Wait(30);
  CreateEnemyFromFile(GetCurrentScriptDirectory~"fiynull spppppelkard 2.txt", GetCenterX-200, GetCenterY-50, 1.8, 0, 0);
  Wait(10);
  CreateEnemyFromFile(GetCurrentScriptDirectory~"fiynull spppppelkard 2.txt", GetCenterX-200, GetCenterY-50, 1.8, 0, 0);
  Wait(10);
  CreateEnemyFromFile(GetCurrentScriptDirectory~"fiynull spppppelkard 2.txt", GetCenterX-200, GetCenterY-50, 1.8, 0, 0);
  Wait(10);
  CreateEnemyFromFile(GetCurrentScriptDirectory~"fiynull spppppelkard 2.txt", GetCenterX-200, GetCenterY-50, 1.8, 0, 0);
  Wait(10);
  CreateEnemyFromFile(GetCurrentScriptDirectory~"fiynull spppppelkard 2.txt", GetCenterX-200, GetCenterY-50, 1.8, 0, 0);
  Wait(10);
  CreateEnemyFromFile(GetCurrentScriptDirectory~"fiynull spppppelkard 2.txt", GetCenterX-200, GetCenterY-50, 1.8, 0, 0);
  Wait(10);
  CreateEnemyFromFile(GetCurrentScriptDirectory~"fiynull spppppelkard 2.txt", GetCenterX-200, GetCenterY-50, 1.8, 0, 0);
  Wait(10);
  CreateEnemyFromFile(GetCurrentScriptDirectory~"fiynull spppppelkard 2.txt", GetCenterX-200, GetCenterY-50, 1.8, 0, 0);
  Wait(10);
  CreateEnemyFromFile(GetCurrentScriptDirectory~"fiynull spppppelkard 2.txt", GetCenterX-200, GetCenterY-50, 1.8, 0, 0);
  Wait(10);
  CreateEnemyFromFile(GetCurrentScriptDirectory~"fiynull spppppelkard 2.txt", GetCenterX-200, GetCenterY-50, 1.8, 0, 0);
  Wait(10);
  CreateEnemyFromFile(GetCurrentScriptDirectory~"fiynull spppppelkard 2.txt", GetCenterX-200, GetCenterY-50, 1.8, 0, 0);
  Wait(10);


+ the sheer amount of bullets you create is obviously going to crash Danmakufu.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on April 07, 2013, 09:09:22 PM
It crashes before the script starts tho.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on April 07, 2013, 09:13:00 PM
Also, using wait as the function name is preferable to Wait, because If I remember correctly, It may clash with an event function named Wait.
Correct. Wait with a capital W is a function used in dialogue events.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on April 07, 2013, 09:20:24 PM
Correct. Wait with a capital W is a function used in dialogue events.
But I don't have diologue...im getting it to work though. I have many different problems :D
Edit: I fixed it!,!!!!,!!!,!,
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on April 13, 2013, 02:45:42 PM
New Question:

How can you allow grazing during player bombs? Is it just that having invincibility turns off grazing? If so, what ways are possible to obtain supergrazing effects?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on April 13, 2013, 07:23:41 PM
Invincibility turns off grazebox, yes.

GetEnemyShotCountEx(x, y, radius, type) can "work". type would likely be ALL. However, since there's no way to retrieve the individual bullet ids to compare for the next frame, this method basically grazes every possible bullet on every frame, creating a situation of absurd grazing that doesn't work the same as usual. ph3 fixes this lol
There was probably a better way, but I can't recall.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on April 13, 2013, 08:20:22 PM
One way could be to have invisible object bullets with no hitbox that activated a graze effect depending on how close the player is to it. You know, manual hitbox via:
Code: [Select]
if(GetPlayerX<Obj_GetX(ID)+(size) && GetPlayerX>Obj_GetX(ID)-(size) && GetPlayerY<Obj_GetY(ID)+(size)  && GetPlayerY>Obj_GetY(ID)-(size)){Do stuff;}
where Do stuff; could be something like:
Code: [Select]
if(counter==0){
AddGraze(1);
Spawn_GrazeEffectObject;
counter++;}

This way would probably create lots of lag though and is probably not the best way either, just the only thing I can come up with. (The biggest problem would probably be that the bullets had to have the exact same movement pattern as it's parent bullet, unless it is the "death bullet/laser" itself that uses this code.)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on April 13, 2013, 08:48:24 PM
One way could be to have invisible object bullets
hf with that

You can't even script up your own collision for graze because you can't get bullet object IDs. You could technically get around that by having all bullets within your pseudo-graze collision area increase your graze and then delete all the bullets within the same area, but that's a really dumb method and doesn't make much sense.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on April 13, 2013, 11:12:28 PM
hf with that

You can't even script up your own collision for graze because you can't get bullet object IDs. You could technically get around that by having all bullets within your pseudo-graze collision area increase your graze and then delete all the bullets within the same area, but that's a really dumb method and doesn't make much sense.

...Looks like I'll give up on this one then. Unless... a manual invincibility function? Something that replaces SetInvincibility?

Edit: Another question: If I want to make a frame for Danmakufu, how should I make it so that score data, bomb count, etc. are still going to show? The only examples I know where it's worked the way I wanted are Victini's script, Shockman's Mima, and Puremrz's Juuni Jumon. Mima and Juuni Jumon... are indecipherable to me. I wouldn't mind doing something similar to CtC or Phantasm Romance, but how exactly would it be done? A 640 x 480 frame, I mean.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on April 14, 2013, 08:05:23 AM
Edit: Another question: If I want to make a frame for Danmakufu, how should I make it so that score data, bomb count, etc. are still going to show? The only examples I know where it's worked the way I wanted are Victini's script, Shockman's Mima, and Puremrz's Juuni Jumon. Mima and Juuni Jumon... are indecipherable to me. I wouldn't mind doing something similar to CtC or Phantasm Romance, but how exactly would it be done? A 640 x 480 frame, I mean.

To make your own frame, just put your image in a folder named "img" next to your danmakufu exe. If you don't have one, create one. It's kind of a way to replace the graphics danmakufu uses (In my thread I for example put a download link for new player character graphics using the "img" folder :3 ).

I'm trying myself to make custom frame texts/numbers/lives/bombs and in v0.12m, you basically just does this:
Code: [Select]
SetDefaultStatusVisible(false); //Deletes the original frame objects in v0.12m
FrameEffectObject1;
FrameEffectObject2;
FrameEffectObject3;
etc.

Just use layer 8 for the effect objects for them to show up.

EDIT: Frame I use added, which comes from the CtC files.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: SusiKette on April 14, 2013, 01:04:22 PM
Is it possible to make enemy scripts to not to be listed in the "Single" script menu? It's kind of annoying (especially when you can't "play them", you just get an error message)
Also, does anyone know if there are any custom Reimu/Marisa players for danmakufu that has different sprites than the default players, but has same fire power, moving speed, bombs etc.?

EDIT: Since it has been so long that I have made enemy scripts I have forgotten how to make them (the stage script that had those enemies doesn't exist anymore) and I can't find enemy scripting tutorials at all.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on April 14, 2013, 01:53:16 PM
Quote
Is it possible to make enemy scripts to not to be listed in the "Single" script menu?
I guess it would be to use .dnh files instead of .exe files?

Quote
Also, does anyone know if there are any custom Reimu/Marisa players for danmakufu that has different sprites than the default players, but has same fire power, moving speed, bombs etc.?
You could try checking my thread :3. It is no custom players tho, but a fix that changes the sprites for the danmakufu players to ZUN sprites. Look at this for an example: http://www.youtube.com/watch?v=kNjaA9w_UUw (http://www.youtube.com/watch?v=kNjaA9w_UUw)

Quote
and I can't find enemy scripting tutorials at all.
Really? It can be found easily in the sticky. Look here: http://www.shrinemaiden.org/forum/index.php/topic,865.0.html  ~Go to "How to make Familiars!"

EDIT: my own question here now. How do I create common data storage files for Highscore? How would I use them properly? fixed
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on April 14, 2013, 02:15:01 PM
Is it possible to make enemy scripts to not to be listed in the "Single" script menu? It's kind of annoying (especially when you can't "play them", you just get an error message)
Also, does anyone know if there are any custom Reimu/Marisa players for danmakufu that has different sprites than the default players, but has same fire power, moving speed, bombs etc.?

EDIT: Since it has been so long that I have made enemy scripts I have forgotten how to make them (the stage script that had those enemies doesn't exist anymore) and I can't find enemy scripting tutorials at all.

1) Don't put 'Single' or simple don't put the header. the latter is used very often for non spells
2) Darkness1 posted new skins, like... yesterday.
3) There are two places: http://www.shrinemaiden.org/forum/index.php/topic,6181.msg345023.html#msg345023
https://sites.google.com/site/sparensdanmakufututorials/other-dnh-tutorials

The first is located in a sticky here on RaNGE. So... yeah. The latter is a list I compiled.

To make your own frame, just put your image in a folder named "img" next to your danmakufu exe. If you don't have one, create one. It's kind of a way to replace the graphics danmakufu uses (In my thread I for example put a download link for new player character graphics using the "img" folder :3 ).

I'm trying myself to make custom frame texts/numbers/lives/bombs and in v0.12m, you basically just does this:
Code: [Select]
SetDefaultStatusVisible(false); //Deletes the original frame objects in v0.12m
FrameEffectObject1;
FrameEffectObject2;
FrameEffectObject3;
etc.

Just use layer 8 for the effect objects for them to show up.

EDIT: Frame I use added, which comes from the CtC files.

I got it  to work correctly with the .img folder, but it seems that if I want it to work with individual scripts, I'll have to do it the long way with effect objects. Thanks (spent an hour learning Victini's stage frame code~)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on April 17, 2013, 02:53:15 AM
So, I have so many projects in mind. But I have a problem.
How, do I make the default lifebar for bosses to disappear. I know how to make a lifebar, I just don't know how to replace the default one.
Also, how do I implement a function that will let me do what
Code: [Select]
#ScriptNextStepdoes, except to the new lifebar. I've seems many examples but I just can't comprehend without explanation.
Examples include:
Juuni Jumon
Grovyle script
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on April 17, 2013, 08:41:57 PM
So, I have so many projects in mind. But I have a problem.
How, do I make the default lifebar for bosses to disappear. I know how to make a lifebar, I just don't know how to replace the default one.
Also, how do I implement a function that will let me do what
Code: [Select]
#ScriptNextStepdoes, except to the new lifebar. I've seems many examples but I just can't comprehend without explanation.
Examples include:
Juuni Jumon
Grovyle script

Victini (Grovyle Script), doesn't use plural scripts at all. All of his bosses are actually enemy scripts. That explains Victini. I can't say anything more since I don't know any more.


Edit:

I have a question about difficult selection in an event script.

Select takes only two parameters. Is there a way to have multiple choices for selection (without being like Nuclear Cheese and making a wall of code to accomplish the task)?

Basically, I have six difficulties, and it'd make debugging MUCH easier if I could just set difficulty Common Data at the start of the script and call the stages that way.

Also, on a semi-related note, how does #include_script work, and if calling stages as tasks, what is the best way to get @Background to run differently for each stage?

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on April 21, 2013, 07:07:08 AM
Edit:

I have a question about difficult selection in an event script.

Select takes only two parameters. Is there a way to have multiple choices for selection (without being like Nuclear Cheese and making a wall of code to accomplish the task)?

Basically, I have six difficulties, and it'd make debugging MUCH easier if I could just set difficulty Common Data at the start of the script and call the stages that way.
That is indeed the method you could use. Though CommonData is only required if you're using variables which need to communicate between files or local functions/code blocks or for persistence. Otherwise global vars would work out well too. (afaik)

Also, on a semi-related note, how does #include_script work,
You have asked this question before several pages ago. http://www.shrinemaiden.org/forum/index.php/topic,12397.msg959489.html#msg959489


and if calling stages as tasks, what is the best way to get @Background to run differently for each stage?
None. A game of more than one stage still remains 1 stage script, thus 1 @BackGround. You need to script in a code where the background is mutated when the player enters the next stage. Example: changing background through if statements.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on April 21, 2013, 12:59:45 PM
That is indeed the method you could use. Though CommonData is only required if you're using variables which need to communicate between files or local functions/code blocks or for persistence. Otherwise global vars would work out well too. (afaik)
You have asked this question before several pages ago. http://www.shrinemaiden.org/forum/index.php/topic,12397.msg959489.html#msg959489

None. A game of more than one stage still remains 1 stage script, thus 1 @BackGround. You need to script in a code where the background is mutated when the player enters the next stage. Example: changing background through if statements.

Common Data: OK. However, how would the player be able to choose the difficulty then if I only had one script? Would making a menu be the best option? Select only allows for two difficulties, so I'm unsure of what to do (my default is to make six different full game files, which is obviously going to be extremely difficult to debug).

#include_script: I was more concerned about how variables defined in the included script were handled. Do they only exist in the include or are they treated as part of the first script? Also, if you use #include_function to the same function in different #include_scripts, then will there be an error since two functions with the same name have been loaded?

Backgrounds: So I should have a CommonData called "Stage" and alter the background accordingly in the full game script?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: gtbot on April 21, 2013, 04:47:20 PM
1. I'm a little confused as to what you mean by Select, but if you want 1 attack file regardless the difficulty, one way to go about this is to use a number that you incorporate in a variety of different ways to balance things (loops, bullet speeds, bullet number, bullet delay, time between each bullet barrage, etc.). You would set up a number for each of the difficulties in whichever way you prefer, then pass it to your attacks. Making an in-game menu would be the best user friendly option for this method.
Example of how the difficulty number would work:
Code: [Select]
// 'difficulty' is the difficulty level; here, it ranges from 12, 36, 48, 72, 96, 120
let lovp = difficulty/4+7;
ascent(i in 0..lovp){
CreateShot01(x, y, difficulty/52+1.5, GetAngleToPlayer+(360/lovp)*i, RED03, 12);
}

2. I'm not familiar with #include_script, so I can't answer this with 100% certainty, though #include_function does make the variables defined there as part of the first script (along with all the other tasks/functions/subs)

3. Not necessarily with common data (you can just use a variable), but yes that's the idea.

Edit: Just realized there's a function called Select; this wouldn't be a good choice for the difficulty select; you'd have to make your own menu.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on April 21, 2013, 05:04:52 PM
1. I'm a little confused as to what you mean by Select, but if you want 1 attack file regardless the difficulty, one way to go about this is to use a number that you incorporate in a variety of different ways to balance things (loops, bullet speeds, bullet number, bullet delay, time between each bullet barrage, etc.). You would set up a number for each of the difficulties in whichever way you prefer, then pass it to your attacks. Making an in-game menu would be the best user friendly option for this method.
Example of how the difficulty number would work:
Code: [Select]

2. I'm not familiar with #include_script, so I can't answer this with 100% certainty, though #include_function does make the variables defined there as part of the first script (along with all the other tasks/functions/subs)

3. Not necessarily with common data (you can just use a variable), but yes that's the idea.

1) Now my question has to do with difficulty selection. Would the most effective method be to use a combination of DrawText and GetKeyState?

2) I understand #include_function

Thanks.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: gtbot on April 21, 2013, 05:16:27 PM
While not the most visually prettiest, DrawText certainly works. Effect objects would probably be preferred since those can generally look a lot better.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on April 21, 2013, 05:18:24 PM
While not the most visually prettiest, DrawText certainly works. Effect objects would probably be preferred since those can generally look a lot better.

Is the preferable way to do this in an event script or in a task that is called at the start of a stage script?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: gtbot on April 21, 2013, 06:50:49 PM
It would probably be preferable to do it with a task/function, since it'd be easier to manage.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Zoriri on April 25, 2013, 01:16:40 AM
How exactly do you create a stage script? I know how to create enemies for stages, i just don't know how to combine them into a stage, and i cant find a tutorial on how to do so.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on April 25, 2013, 01:39:03 AM
How exactly do you create a stage script? I know how to create enemies for stages, i just don't know how to combine them into a stage, and i cant find a tutorial on how to do so.
http://www.shrinemaiden.org/forum/index.php/topic,865.msg31785.html#msg31785 (http://www.shrinemaiden.org/forum/index.php/topic,865.msg31785.html#msg31785) This is a tutorial for making a stage.
http://dmf.shrinemaiden.org/wiki/Stage_Script_Functions_(0.12m) (http://dmf.shrinemaiden.org/wiki/Stage_Script_Functions_(0.12m)) Function list.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Zoriri on April 25, 2013, 02:00:30 AM
http://www.shrinemaiden.org/forum/index.php/topic,865.msg31785.html#msg31785 (http://www.shrinemaiden.org/forum/index.php/topic,865.msg31785.html#msg31785) This is a tutorial for making a stage.
http://dmf.shrinemaiden.org/wiki/Stage_Script_Functions_(0.12m) (http://dmf.shrinemaiden.org/wiki/Stage_Script_Functions_(0.12m)) Function list.

Thank you, this tutorial really helped alot.   :D
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: The Noodles Guy on April 26, 2013, 03:16:56 PM
Ok. The script
http://pastebin.com/W0595NAB (http://pastebin.com/W0595NAB)

The screenshot.
(http://i44.tinypic.com/6zqwsk.png)

The weird part:
Code: [Select]
CreateShot01(GetX, GetY, 2, 80, RED01, 10);
CreateShot01(GetX, GetY, 2, 90, RED01, 10);

CreateShot01(GetX, GetY, 2, 80, RED01, 10);
I didn't mean CreateShot01(GetX, GetY, 2, 100, RED01, 10);

What happens?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on April 26, 2013, 07:46:26 PM
Ok. The script
http://pastebin.com/W0595NAB (http://pastebin.com/W0595NAB)

The screenshot.
(http://i44.tinypic.com/6zqwsk.png)

The weird part:
Code: [Select]
CreateShot01(GetX, GetY, 2, 80, RED01, 10);
CreateShot01(GetX, GetY, 2, 90, RED01, 10);

CreateShot01(GetX, GetY, 2, 80, RED01, 10);
I didn't mean CreateShot01(GetX, GetY, 2, 100, RED01, 10);

What happens?
That is 80,  100 would be to the left of the 90 bullets...I think
The higher the number, the further clockwise it goes...
And the lower the number, the further counter clockwise it goes.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: PhantomSong on April 26, 2013, 07:58:35 PM
That is 80,  100 would be to the left of the 90 bullets...I think
The higher the number, the further clockwise it goes...
And the lower the number, the further counter clockwise it goes.
Or a better way to rephrase it:

Shooting right is 0, shooting down is 90, shooting left is 180, shooting up is 270

So lets say I wanted it to shoot in the bottom right corner I'd put in 45.

Corner shot for reference:
Bottom Right: 45
Bottom Left: 135
Top Left: 225
Top Right:  315
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on April 26, 2013, 08:41:23 PM
Also a good tip for beginners: using ascent/descent is a really fast way to make bullet patterns/streams easily. For example, a fan with 3 bullets like the one used in the script above  would be:
Code: [Select]
ascent(i in -1..2){
CreateShot01(GetX, GetY, 2, 80 + i*10, RED01, 10);}

Basically: i is a value saved inside the ascent loop which uses each number it loops through. In this example, they are -1, 0 and 1, because the last value is always the last number (2) - 1. For more information, you should probably check the danmakufu basic tutorial :V.

Second tip: Start using custom shotsheets. They look better, are easier to use (with this I mean, calling them for use, since they only use pure numbers instead of the "RED01" and such)  and more flexible overall. Download them here: http://www.shrinemaiden.org/forum/index.php/topic,1050.0.html  (http://www.shrinemaiden.org/forum/index.php/topic,1050.0.html)
And insert them into your script by using this function:
Code: [Select]
LoadUserShotData("Directory of the shotsheet definition file");
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: The Noodles Guy on April 26, 2013, 09:06:38 PM
I've got the CtC replace :V

PS: Nevermind, I though it was weird, but I saw the angle directions at Touhou Wiki and it wasn't that weird.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on April 27, 2013, 10:00:04 AM
Now I don't understand what the heck is going on in my script :/.

Using AnimationLib for fairies where the "turntomove" and "turntoidle" animations takes 9 frames: http://pastebin.com/LiYXAKnA (http://pastebin.com/LiYXAKnA)

Code used to spawn fairies in the stage file:   
Code: [Select]
task fairies{
  wait(200);
  loop{
 
  CreateEnemyFromFile(smallfairy1,GetClipMinX,120+rand(-100,100),0,0,1);  //fairy spawn test
 
  wait(10);
  }}

Code used for the fairies movement: 
Code: [Select]
task movement{
  SetAngle(rand(-20,20));
SetSpeed(1+rand(1,2));
 }

It first seems to be working, but then alot of the spawned fairies gets stuck with the idle animation, even while moving sideways and I can't find the problem.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on April 27, 2013, 01:20:41 PM
It first seems to be working, but then alot of the spawned fairies gets stuck with the idle animation, even while moving sideways and I can't find the problem.
I have so many problems with this that it's not funny. My issue is this: SetMovePosition doesn't work correctly with GetAngle. And so half of the animations I use are botched up.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on April 27, 2013, 04:20:10 PM
I have so many problems with this that it's not funny. My issue is this: SetMovePosition doesn't work correctly with GetAngle. And so half of the animations I use are botched up.

When I use SetMovePosition it actually seems to work. I guess it's just a conflict of sorts between using SetAngle and SetSpeed inside the enemy script while defining the speed and angle in CreateEnemyFromFile; as well, since they were set as 0 and 0 inside the function.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on April 28, 2013, 12:10:02 AM
If that were the case then all of the fairies would be stuck at idle.

if(GetSpeedX==0 && counter3==0){
  Animate("fairy","idle",true);
  counter3=10;
Is the first problem.

If you change that to 1, we get these frames, given (GetSpeedX==0):
1:
Animate("fairy","idle",true);
counter3=1;
turnframe2++; (now =1)
2:
turnframe2++; (now =2)
Animate("fairy","turntoidle",false);
counter3++; (now =2)
At then it gets stuck at frame 3. If you changed it to counter3=0 then it would animate idle until you move so I guess that's what you want?

Really though the flow and decision structure of your DrawLoop is absurdly difficult to comprehend.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on April 28, 2013, 09:38:39 AM
I guess it was dumb to not comment more, but this version with more comments should make everything more clear. Also, yes, some of my if statements were kind of uneccessary to use. http://pastebin.com/MavWd64x (http://pastebin.com/MavWd64x) (I don't think I changed it since last time, except for the comments of course.)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: snowflake247 on April 28, 2013, 06:23:47 PM
My arrow keys on the numpad aren't working in Danmakufu, and I have been using them in all my Touhou games because the regular ones don't work side-to-side. I don't want to have to try to beat everything using only vertical movement; I kind of suck at Touhou. I'm using a laptop in case that helps.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: PhantomSong on April 28, 2013, 10:56:24 PM
My arrow keys on the numpad aren't working in Danmakufu, and I have been using them in all my Touhou games because the regular ones don't work side-to-side. I don't want to have to try to beat everything using only vertical movement; I kind of suck at Touhou. I'm using a laptop in case that helps.
You'll just have to use your normal arrow keys then... Unless I'm not understanding this correctly.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: snowflake247 on April 28, 2013, 11:14:43 PM
Well, my left and right normal arrow keys don't work in any program. Only the up and down ones do. It isn't much fun to play shmups without horizontal movement.
(With the regular Touhou games I don't have this problem and the numpad keys work fine; I use them since the regular left and right keys don't work.)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on April 29, 2013, 12:09:16 AM
If DNH doesn't support numpad then you'll have to remap keys using an AHK script or something like that. It's pretty easy to use, but it becomes a bit cumbersome enabling and disabling the key map every time you want to play.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: The Noodles Guy on April 29, 2013, 08:04:43 PM
OK.

How can I make my boss immune to bombs? Like Flan-Chan and every EX-Boss.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on April 29, 2013, 08:25:21 PM
SetDamageRate(shot, bomb) sets the rate of damage the boss receives, out of 100. So you can set the second parameter to 0 to give bomb immunity.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on April 29, 2013, 08:47:09 PM
OK.

How can I make my boss immune to bombs? Like Flan-Chan and every EX-Boss.

Also, remember that the tutorials explain most of this.

Tutorial List on stickied thread (http://www.shrinemaiden.org/forum/index.php/topic,6181.msg345023.html#msg345023)
My compilation of Tutorials from the wikis and MotK (https://sites.google.com/site/sparensdanmakufututorials/other-dnh-tutorials)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on April 29, 2013, 10:49:02 PM
SetDamageRate(shot, bomb) sets the rate of damage the boss receives, out of 100. So you can set the second parameter to 0 to give bomb immunity.
One thing about that is that this solution will only make the boss immune to damage from the bomb itself. The boss CAN however still be damaged by normal shots during the duration of the bomb. If you're looking for something like what extra bosses do, you want to do something like this in @MainLoop:
Code: [Select]
if(OnBomb==true) { SetDamageRate(##,##); } else { SetDamageRate(0,0); }That will make the boss immune to all damage during the duration of a bomb, which is probably what you're looking for. Alternatively, you could also remove the boss's hitbox (SetCollisionA) during a bomb with a similar method.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on April 29, 2013, 11:00:53 PM
Code: [Select]
if(OnBomb==true) { SetDamageRate(##,##); } else { SetDamageRate(0,0); }That will make the boss immune to all damage during the duration of a bomb, which is probably what you're looking for. Alternatively, you could also remove the boss's hitbox (SetCollisionA) during a bomb with a similar method.

Shouldn't it be
Code: [Select]
if(OnBomb==true) { SetDamageRate(0,0); } else { SetDamageRate(##,##); }?


Edit: Also, most people will shy away against removing the hitbox. It messes up players with honing bullets, since the bullets will collect and then deal their damage afterwards. Also, if it's used during a survival... it'll lag Danmakufu if your player uses honing bullets.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: ExPorygon on April 29, 2013, 11:52:33 PM
Shouldn't it be
Code: [Select]
if(OnBomb==true) { SetDamageRate(0,0); } else { SetDamageRate(##,##); }?
Oops.

Edit: Also, most people will shy away against removing the hitbox. It messes up players with honing bullets, since the bullets will collect and then deal their damage afterwards.
I've never had that problem myself (my homing shots just go through the boss and keep turning) but I'll take your word for it.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on April 30, 2013, 05:33:22 AM
Edit: Also, most people will shy away against removing the hitbox. It messes up players with honing bullets, since the bullets will collect and then deal their damage afterwards. Also, if it's used during a survival... it'll lag Danmakufu if your player uses honing bullets.

That's weird, I never noticed anything like that, but well, I only use the homing player that comes with danmakufu anyways. But it has one thing that stacks if you remove the hitbox, and that is her focused bombs, so I made the damage resistance last abit longer than the bombs instead.

Something like this:
Code: [Select]
     if(OnBomb && antibombtimer==0){
     shield=true; //Draws bomb-graphic
     hitbox=false; //Turns off hitbox
     antibombtimer=60;}

     if(!OnBomb && antibombtimer==0){
     shield=false;
     hitbox=true;}

     if(!OnBomb && antibombtimer>0){
     shield=true;
     hitbox=false;
     antibombtimer-=1;}
Yes, I know I wrote alot of uneccessary code, just an example of mine :V.
Also, for SetDamageRate, the bomb percentual damage might aswell be at 0 at all time since the boss is bomb immune and hence will never take damage from them.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on May 04, 2013, 12:32:59 AM
How do i make a bullet bounce off a circle? Like one slightly above the player.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on May 04, 2013, 12:38:08 AM
How do i make a bullet bounce off a circle? Like one slightly above the player.

Please explain what you are trying to do. What you just said makes no sense whatsoever.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on May 04, 2013, 12:41:43 AM
Please explain what you are trying to do. What you just said makes no sense whatsoever.
so...
like a safety bubble somewhere on the screen.
i heard it requires ascent but I read an explanation that I didn't understand... :derp:
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on May 04, 2013, 12:43:20 AM
so...
like a safety bubble somewhere on the screen.
i heard it requires ascent but I read an explanation that I didn't understand... :derp:

Are you referring to a task in a player script that makes all bullets bounce off of a bubble surrounding the player?

If so... that'a a problem in 0.12m...
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on May 04, 2013, 01:03:27 AM
If you're saying that you want a bullet to bounce in a circle, like in Luminous Dream's Stage 5 boss.
I don't really know how to make it bounce the right way.

I think you make an object bullet.
Have the bullet make a loop that works if the bullet is on screen.
Code: [Select]
while(!Obj_BeDeleted(obj)){ yield; }Make a, if statement stating that if the bullet is beyond this circle, then bounce.
If you want to put it in the middle, you say:
Code: [Select]
let distance = (Obj_GetX(obj)-GetCenterX)^2+(Obj_GetY(obj)-GetCenterY)^2And then you would make another statement:
Code: [Select]
if(distance>How big you want your circle^2){ Bouncing effect }Of course, if you want it in front of the player, change the GetCenterX and GetCenterY to GetPlayerX and GetPlayerY-How far you want the circle to be.

Or you're talking about something else.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on May 04, 2013, 01:59:25 AM
I have no idea what you want done either.

(http://i.imgur.com/4bmxoko.png)

This? If so, as an ability of the player script, or something particular that the enemy/pattern does? The former is impossible in 0.12, the latter you can do.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on May 04, 2013, 07:40:05 AM
You could use:
- Collision_Line_Circle.
- Collision_Obj_Obj.
- If you use like an effect object, you could save it's X and Y position every frame (if it's moving around) and make your own collision hitbox using if statements inside the object bullet code. I probably can't call this the most optimal solution. (Reason is, as I know getting a circular hitbox using this method is more difficult.)

I don't think ascent/arrays are needed here, unless you're going to use multiple circles.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on May 04, 2013, 01:07:39 PM
I have no idea what you want done either.

(http://i.imgur.com/4bmxoko.png)

This? If so, as an ability of the player script, or something particular that the enemy/pattern does? The former is impossible in 0.12, the latter you can do.
Yes, not in a player script though, in a boss script.
@Darkness1 im trying to do the if statements, but im confused about how to make a circle. I will look up your other methods.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on May 04, 2013, 01:09:51 PM
Yes, not in a player script though, in a boss script.

That's simple then. You'll use object bullets that will reflect away if they enter a certain radius of the player. You'll need to do the angle work yourself though.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on May 04, 2013, 02:35:41 PM
Ok, i'm sorry, but I think i'm going to change the question.
How do I make a bullet bounce when hits another bullet?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on May 04, 2013, 03:24:29 PM
You could use:
- Collision_Line_Circle.
- Collision_Obj_Obj.
- If you use like an effect object, you could save it's X and Y position every frame (if it's moving around) and make your own collision hitbox using if statements inside the object bullet code. I probably can't call this the most optimal solution. (Reason is, as I know getting a circular hitbox using this method is more difficult.)

I don't think ascent/arrays are needed here, unless you're going to use multiple circles.

Qwerty: The question is already answered for you. Collision_Obj_Obj solves that for you.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on May 04, 2013, 04:40:27 PM
Qwerty: The question is already answered for you. Collision_Obj_Obj solves that for you.

Exactly. But I guess Obj_Obj gives a specific collision defined of the bullets own hitbox. This works perfectly, unless you somehow want a specific hitbox.

If you use only one bullet to collide with, it shouldn't be hard, but since you often want to spawn more than one of those bullets on the screen at once, you have to use ascent and array coding. Basically, you want to create a bullet array, store all the ID's of the bullets (only one of them) once they are created and later delete those ID's out of the array once the bullets are deleted. In the other object bullet, you just have to ascent loop through all the ID's in your array and check the collision between this bullets ID and all other ID's saved in your bullet-ID-array, and it should work.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on May 04, 2013, 05:36:32 PM
A script I need some assistance with. First a picture:

[attach=1]

Imagine the left image to be a simple square texture placed in 3D Drawing. What I want to do is emit some "light rays" from the checker locations. However, the light rays have to be randomized in each square with a total of X beams (where X is my maximum desired number). The 2nd picture (on the right) shows the example of a randomized pattern. To give elaborate my intention, my true "checker board" is 8x8 squares. I already used this code to spawn a beam in every square:

ascent(i in 0..8) {
   ascent(i2 in 0..8) { makelichtbundel(256,768-(i2*+128),-2560+(i*128),96,25,96); }
}

"makelichtbundel" is a function name that spawns the lightbeam in 3D drawing. To explain the parameters:  makelichtbundel( Xlocation, Ylocation, Zlocation, Red, Green, Blue );

Xlocation is static because it is against the wall of my stage. Logically I need a vertical/distance placement for each beams, hence Y and Z. The +128 is offset to centre the beam correctly. Don't worry too much about the offset.

Right, so as I said I was successful with the 8x8 beams, but I don't want this as it makes the effects look fake and blinding your eyes. For a more natural feeling, I want to randomize the rays in this 8x8 field. Just as shown in the picture, I want to spawn randomized rays with each cycle (this cycle I will eventually tie to a fade in/out effect (alpha reduction) so when the ray is "invisible" it will respawn with a different pattern.

Edit: To be more precise, I want to distribute the rays somewhat evenly. Spread out. Roughly guessing the maximum rays occurring in one row = 2. If a row doesn't summon any rays, that is fine as well now and then. After all, this is 8x8 so like 10 rays criss-cross placed will give the satisfying result (I hope).

How can I approach this effectively?

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on May 04, 2013, 08:03:14 PM
Like I said in IRC, it might just be fine if you define a 3D array of sets of coordinates to pick from.
let lichtcoords = [
   [[x,y],[,],[,],[,],[,],[,],[,],[,]],   [[,],[,],[,],[,],[,],[,],[,],[,]],
   [[,],[,],[,],[,],[,],[,],[,],[,]],   [[,],[,],[,],[,],[,],[,],[,],[,]],
   [[,],[,],[,],[,],[,],[,],[,],[,]],   [[,],[,],[,],[,],[,],[,],[,],[,]],
   [[,],[,],[,],[,],[,],[,],[,],[,]],   [[,],[,],[,],[,],[,],[,],[,],[,]],
   [[,],[,],[,],[,],[,],[,],[,],[,]],   [[,],[,],[,],[,],[,],[,],[,],[,]],
   [[,],[,],[,],[,],[,],[,],[,],[,]],   [[,],[,],[,],[,],[,],[,],[,],[,]]
];
let bundel = lichtcoords[rand_int(0,12)];
ascent(i in 0..8) {
   makelichtbundel(256,768-(bundel[i][0]*+128),-2560+(bundel[i][1]*128),96,25,96);
}

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Zoriri on May 04, 2013, 09:05:41 PM
OK, I've been making a spell card for a while now, and i just got it to work in danmakufu, but the boss dies the second the script starts, and I have no idea why.

Code: [Select]
script_enemy_main {

let CSD = GetCurrentScriptDirectory;
let shot = CSD ~ "ZUNAST.txt";
let frame = 0;
let angle = 0;

                            }
@Initialize {
SetLife(1500);
SetDamageRate(100, 100)
SetTimer(45);
SetInvincibility(30);
SetScore(20000)
SetMovePosition02(GetCenterX, GetCenterY - 100, 120);
}

@MainLoop {
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
frame++

if(frame==120)

          loop(36){
      CreateShot01(Get X, Get Y, 2, GetAngleToPlayer, 28, 0);
      angle += 360/36;
}

angle = 0;
frame = 60;

@DrawLoop {
}

@Finalize {
}
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on May 04, 2013, 09:30:49 PM
Like I said in IRC, it might just be fine if you define a 3D array of sets of coordinates to pick from.
let lichtcoords = [
   << ARRAYS >>
];
let bundel = lichtcoords[rand_int(0,12)];
ascent(i in 0..8) {
   makelichtbundel(256,768-(bundel[i][0]*+128),-2560+(bundel[i][1]*128),96,25,96);
}
Manual labour but what the heck! I am grateful for the simple solution.

So I worked it out and yes, it works as intended except for the spazzing part because the rand_int being in @BackGround. Need to write this outside the loop in a separate task.

I guess I'll finish that up tomorrow. For now, thanks and bed++
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Qwertyzxcv on May 04, 2013, 09:59:57 PM
Exactly. But I guess Obj_Obj gives a specific collision defined of the bullets own hitbox. This works perfectly, unless you somehow want a specific hitbox.

If you use only one bullet to collide with, it shouldn't be hard, but since you often want to spawn more than one of those bullets on the screen at once, you have to use ascent and array coding. Basically, you want to create a bullet array, store all the ID's of the bullets (only one of them) once they are created and later delete those ID's out of the array once the bullets are deleted. In the other object bullet, you just have to ascent loop through all the ID's in your array and check the collision between this bullets ID and all other ID's saved in your bullet-ID-array, and it should work.
Oops, forgot to look it up...teehee  :derp: 
Thanks
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: fondue on May 04, 2013, 10:01:41 PM
OK, I've been making a spell card for a while now, and i just got it to work in danmakufu, but the boss dies the second the script starts, and I have no idea why.

Code: [Select]
snip
oh hello there extra bracket
Code: [Select]
script_enemy_main {

   let CSD = GetCurrentScriptDirectory;
   let shot = CSD ~ "ZUNAST.txt";
   let frame = 0;
   let angle = 0;
   
   @Initialize {
      SetLife(1500);
      SetDamageRate(100, 100)
      SetTimer(45);
      SetInvincibility(30);
      SetScore(20000)
      SetMovePosition02(GetCenterX, GetCenterY - 100, 120);
   }

   @MainLoop {
   SetCollisionA(GetX, GetY, 32);
   SetCollisionB(GetX, GetY, 16);
   frame++

   if(frame==120)
     
             loop(36){
            CreateShot01(Get X, Get Y, 2, GetAngleToPlayer, 28, 0);
            angle += 360/36;
   }

   angle = 0;
   frame = 60;

   @DrawLoop {
   }

   @Finalize {
   }
}
}
Fixed~ (I hope, I can't Dnh old verison)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on May 04, 2013, 10:07:11 PM
Always check brackets and ; if your script doesn't work. Then check to see if you have the correct function arguments.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on May 04, 2013, 10:11:14 PM
And that is why Notepad++ is great to use for this :3.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Maths ~Angelic Version~ on May 04, 2013, 10:11:37 PM
This should work:

Code: [Select]
script_enemy_main {

let CSD = GetCurrentScriptDirectory;
let shot = CSD ~ "ZUNAST.txt";
let frame = 0;
let angle = 0;

@Initialize {
SetLife(1500);
SetDamageRate(100, 100);
SetTimer(45);
SetInvincibility(30);
SetScore(20000);
SetMovePosition02(GetCenterX, GetCenterY - 100, 120);
}

@MainLoop {
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
frame++;

if(frame==120)
{
          loop(36){
      CreateShot01(GetX, GetY, 2, GetAngleToPlayer, 28, 0);
      angle += 360/36;
}
angle = 0;
frame = 60;
}

}

@DrawLoop {
}

@Finalize {
}
}
As Sparen said, always check your brackets and semicolons.
Also, the functions "GetX" and "GetY" don't work if you write them as "Get X" and "Get Y" (notice the space).
Edit: Fixed the changing of the variables "angle" and "frame".
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: PhantomSong on May 04, 2013, 10:17:36 PM
OK, I've been making a spell card for a while now, and i just got it to work in danmakufu, but the boss dies the second the script starts, and I have no idea why.

Code: [Select]
snip
Kinda out out of place... but are you using the shotsheet from my PoFV Boss Rush? I know this because ZUN Aya, Shiki, and Tewi = ZUNAST  :derp:
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on May 04, 2013, 10:44:07 PM
Kinda out out of place... but are you using the shotsheet from my PoFV Boss Rush? I know this because ZUN Aya, Shiki, and Tewi = ZUNAST  :derp:

@PhantomSong: Please collapse that block of code. You're only interested in one line. Quoting becomes a problem like this...
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Zoriri on May 04, 2013, 10:45:08 PM
Wow, all because of a missing bracket. Well, at least i didn't post here because of a spelling error (which were most of the problems with this).

Kinda out out of place... but are you using the shotsheet from my PoFV Boss Rush? I know this because ZUN Aya, Shiki, and Tewi = ZUNAST  :derp:

Yeah, I was, since it's the only shotsheet I could find with TD arrows. Sorry, should I have asked for permission first? I thought it was one of those shotsheets anyone could use.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: PhantomSong on May 04, 2013, 11:12:48 PM
Wow, all because of a missing bracket. Well, at least i didn't post here because of a spelling error (which were most of the problems with this).

Yeah, I was, since it's the only shotsheet I could find with TD arrows. Sorry, should I have asked for permission first? I thought it was one of those shotsheets anyone could use.
It is~  It doesn't belong to me... I just thought you should rename it... XD Being your script most likely doesn't have Aya, Tewi and Shiki
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Zoriri on May 05, 2013, 12:09:18 AM
It is~  It doesn't belong to me... I just thought you should rename it... XD Being your script most likely doesn't have Aya, Tewi and Shiki

Oh, alright. ^^ Also, how do you use the shotsheet? When I use the defualt graphics, it works fine, but using the shotsheet graphics causes no bullets to appear.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on May 05, 2013, 12:25:32 AM
Oh, alright. ^^ Also, how do you use the shotsheet? When I use the defualt graphics, it works fine, but using the shotsheet graphics causes no bullets to appear.

Post code, explain how you called the shotsheet, and check your directories.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Zoriri on May 05, 2013, 01:22:28 AM
Post code, explain how you called the shotsheet, and check your directories.

Code: [Select]
script_enemy_main {

let CSD = GetCurrentScriptDirectory;
let shot = CSD ~ "ZUNAST.txt";
let frame = 0;
let angle = 0;

@Initialize {
SetLife(1500);
SetDamageRate(100, 100);
SetTimer(45);
SetInvincibility(30);
SetScore(20000);
SetMovePosition02(GetCenterX, GetCenterY - 100, 120);

LoadUserShotData(shot);
Concentration02(60)
}

@MainLoop {
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
frame++;

if(frame==120)
{
           loop(36){
            CreateShot01(GetX, GetY, 2, GetAngleToPlayer, 28, 0);
            angle += 360/36;
               }

          angle = 0;
          frame = 60;
}

}

@DrawLoop {
}

@Finalize {
}
}

I called the shotsheet before @Initialize with "let shot = CSD ~ "ZUNAST.txt";". Then in @Initialize, I called it useing "LoadUserShotData(shot);" Lastly in CreateShot01, I called the bullet id from the shotsheet, 28, in the part where you put the bullet graphic. I looked at scripts that used the same shotsheet for reference, and this is pretty much how they did it.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: PhantomSong on May 05, 2013, 02:08:14 AM
Code: [Select]
snip
I called the shotsheet before @Initialize with "let shot = CSD ~ "ZUNAST.txt";". Then in @Initialize, I called it useing "LoadUserShotData(shot);" Lastly in CreateShot01, I called the bullet id from the shotsheet, 28, in the part where you put the bullet graphic. I looked at scripts that used the same shotsheet for reference, and this is pretty much how they did it.

I think the best thing to note is that the shot sheet had some numbers slashed off and such, but I think 28 were bubbles...?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on May 05, 2013, 03:05:13 AM
@Zoriri
Does the shot sheet have this at the beginning:
Code: [Select]
ShotImage = ".\ZUNAST"Or what the shot image is called.
I know that some shot sheets don't have that exactly. They have something link "shot_image" which won't make the bullet appear.
Also, have you tried any other bullets, 28 might just be blocked off.
If any of these don't work, can you post the Shot data onto pastebin and link it to us.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: PhantomSong on May 05, 2013, 03:08:40 AM
@Zoriri
Does the shot sheet have this at the beginning:
Code: [Select]
ShotImage = ".\ZUNAST"Or what the shot image is called.
I know that some shot sheets don't have that exactly. They have something link "shot_image" which won't make the bullet appear.
Also, have you tried any other bullets, 28 might just be blocked off.
If any of these don't work, can you post the Shot data onto pastebin and link it to us.

Considering he took it straight from my script, it should be working just fine o-o
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on May 05, 2013, 08:44:53 AM
Since no error came up with danmakufu, with the only problem being no graphics appearing, it's obviously a problem with the directories. I see nothing wrong with the script, so you must have either:
Putting it in a folder is convenient, but needs you to link through the folder first like this:
Code: [Select]
let niceshot = CSD~"\ZUNASTfolder\ZUNAST.txt";Because CSD/GetCurrentScriptDirectory stands for looking in the same folder as your script for the file. So this code would first look in the same folder as your script after the folder named ZUNASTfolder and then find the file named ZUNAST.txt inside the folder.
Also:
Code: [Select]
           loop(36){
            CreateShot01(GetX, GetY, 2, GetAngleToPlayer, 28, 0);
            angle += 360/36;
               }
This doesn't seem like such a good idea.
I would reccomend  using ascents/descents instead of loops for this kind of thing, but use whatever you prefer really.
:P
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Maths ~Angelic Version~ on May 05, 2013, 09:11:33 AM
An unrelated problem:
Code: [Select]
           loop(36){
            CreateShot01(GetX, GetY, 2, GetAngleToPlayer, 28, 0);
            angle += 360/36;
               }
This will just spawn 36 bullets that are aimed directly at the player. If you want one of the bullets in a 36-bullet circle to be aimed at the player, you may use this:
Code: [Select]

if(frame==120)
{
         angle=GetAngleToPlayer;

           loop(36){
            CreateShot01(GetX, GetY, 2, angle, 28, 0);
            angle += 360/36;
               }
          frame = 60;
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on May 05, 2013, 09:23:25 AM
My version then. :P

Code: [Select]
if(frame==120)
{

           ascent(i in 0..36){
            CreateShot01(GetX, GetY, 2, GetAngleToPlayer+i*360/36, 28, 0);
               }
          frame = 60;
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Zoriri on May 05, 2013, 12:13:35 PM
Thanks guys for the help, I got it to work.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on May 05, 2013, 02:22:33 PM
Manual labour but what the heck! I am grateful for the simple solution.

So I worked it out and yes, it works as intended except for the spazzing part because the rand_int being in @BackGround. Need to write this outside the loop in a separate task.

I guess I'll finish that up tomorrow. For now, thanks and bed++
I fixed the spazzing. Rays are fading / in out. Except now I am stuck in a logic process which is grinding my mind but nothing useful is coming out of it. Not sure if the Engine is limiting me or I am missing something.

Code da ze: http://pastebin.com/EBsk2yZn

I am spawning the 3D rays inside the @Background. They work. Except to give a more natural feeling, I want to spawn the different rays (in this case three of them) in some kind of delayed / randomized order. Yielding / delaying the @Background is AFAIK not the solution. I tried and the script speeds up. Taking the spawn function outside the @Background isn't an option either. Because DrawGraphic3D must be called in @Background.

I was thinking of spawning all three first then use a rand_int to decide which ray may light up. But since the rays share the same function and handler task, I am clueless and extremely confused. In worst case scenario I have to manually handle each ray separate with alpha values / functions. But that would be overkill unless last resolve.

Edit

Problem solved. Found a workaround in a slightly less efficient way and succeeded.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on May 05, 2013, 02:29:50 PM
EDIT: This question has been put aside by creator. It is CLOSED

I have an object effect question.

I want a lifebar, basically. It works in all cases EXCEPT for cases where SetMovePosition is used. GetAngle for the incorrect render is -172 degrees. For graphics in DrawLoop, I use (GetAngle+360)%360 to control the images.

I used the exact same strategy for the lifebar, but it seems that it refuses to work the way it should (the other enemies going at 188 degrees have correct lifebars).

Is this a problem with when tasks are executed in relation to @MainLoop, or is the problem with me?

Normal DrawLoop Code (which works)
Code: [Select]
    SetGraphicRect(19, 17, 41, 41); //Down. Default
    if((GetAngle+360)%360>315||(GetAngle+360)%360<=45){SetGraphicRect(64, 16, 82, 42);} //Rt
    if((GetAngle+720)%360>135&&(GetAngle+720)%360<=225){SetGraphicRect(84, 16, 102, 42);}//Left
    if((GetAngle+360)%360>225&&(GetAngle+360)%360<=315){SetGraphicRect(40, 16, 61, 44);}//Up
The Lifebar task code, which works when SetMovePosition02 is not used but fouls up when it is used.
Code: [Select]
  if((GetAngle+360)%360>135&&(GetAngle+360)%360<=225){
    ObjEffect_SetVertexXY(life,0,(-dimensions[0]-7)*(GetLife/startHP),-3);
            ObjEffect_SetVertexXY(life,1,(dimensions[1]-7)*(GetLife/startHP),-3);
            ObjEffect_SetVertexXY(life,2,(dimensions[1]-7)*(GetLife/startHP),3);
            ObjEffect_SetVertexXY(life,3,(-dimensions[0]-7)*(GetLife/startHP),3);
  }
I already tried substituting +720 degrees instead of +360, and that made no difference.

Edit:

OK. I am using graphics for enemies that are controlled by the stuff in the first box of code. This normalized stuff is what sets the enemy graphics.

I want a lifebar that is centered above the enemies that decreases from both sides as the enemy's health is depleted. That pat is done. However, I have problems trying to center it above the enemy graphics, since using SetMovePosition02, for some inexplicable reason, does not give the same lifebar position. It is either a problem with my code, or something more fundamental with Danmakufu. Worse case scenario, I replace my SetMovePosition02s wit SetSpeed and SetAngle so that I can actually control the stuff.

Currently, the left moving graphic when using SetMovePosition 02 results in a lifebar that is 6 pixels to the left of where it is supposed to be. The problem does not occur with SetAngle.

Using GetAngle on the enemy provided an angle of -172. When normalized with my formula, it should be the same as if I had used SetAngle(188). But it isn't. That's the problem.

EDIT: This question has been put aside by creator. It is CLOSED

@Ozzy: Thanks for all of the attempts to try and fix this, but I think it looks reasonably acceptable now. I'm content with where it is, although some of the lifebars are assymetrical in regards to enemy graphics.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Flan27 on May 08, 2013, 09:39:19 AM
I've just started getting acquainted with effect objects, and I have a question.  Reading through Nuclear Cheese's tutorial, it talks a lot about 3d, but do you have to code it in 3d even if you only want a 2d object?  I tried making an effect object simply with ObjEffect_SetTexture, but it didn't display anything so I assume something more is necessary.  Do I need to learn about vertices and everything?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on May 08, 2013, 12:13:59 PM
I've just started getting acquainted with effect objects, and I have a question.  Reading through Nuclear Cheese's tutorial, it talks a lot about 3d, but do you have to code it in 3d even if you only want a 2d object?  I tried making an effect object simply with ObjEffect_SetTexture, but it didn't display anything so I assume something more is necessary.  Do I need to learn about vertices and everything?
You are mixing 3D drawing and Effect Objects. Effect Objects are used in regular scripts and are 2D drawings. 3D drawing is used for stage construction which only function in Stage scripts inside the @Background loop. Effect Objects are programmed like Object bullets and have their own tasks. Effect objects can be called in stages, so they can be somewhat mixed/combined. Though must be strictly scripted according to their rules.

Effect objects are basically  2D drawn images using vertexes forming triangles and eventually patterns/shapes. So if you simply want a square/rectangular texture, you need to set 4 vertexes (0 to 3)  and define the positioning and their UV for the textures.

Alternatively, if you need more visual example / guidance, I would suggest you my video tutorial (http://www.youtube.com/watch?v=EMw7DOWYMkw)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Flan27 on May 10, 2013, 02:52:07 AM
Wow, thank you so much!  This all seemed complicated and convoluted at first, but after I watched your video I was actually able to work with it.  These effect objects seem like they can be used in lots of different ways.  I'll have to think some more about how I want to implement them.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Flan27 on May 12, 2013, 11:34:35 AM
(Um, sorry for the double post, but) I'm having problems with a couple more things.  I'm trying to make effect objects that stick around even after an enemy or boss disappears.  I've made explosion effects, and also some custom items, but they get deleted along with the boss.  I'm pretty sure I have to have the stage make those effect objects for them to last, but I don't know how to tell the stage when to create them.  How do you go about telling it to create things when a boss or enemy dies?  Or is there something else I'm missing?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on May 12, 2013, 02:44:40 PM
That is a quite tricky one, unless I'm also missing something here :/. I couldn't get it right, so I got around it by delaying the enemies deaths, deleting graphic/hitbox/etc. when they are at, say GetEnemyLife<80. Then start a counter in the mainloop which uses VanishEnemy on the enemy after a certain time has passed. (NOTE: with delete graphic, I may mean in this case; SetAlpha to 0.)

For bosses, you could probably do the same as above (which looks far worse than using this strategy on simple enemies) or you could probably use commondata for storing the boss(es) position, then at the stage use GetEnemyNum to wait until there are no enemies existing and then create it in the stage at the stored X and Y position.


Nevermind that, Helepolis solution is better. For stage enemies Enemy Enumeration should work (if I just knew how to make different enemies spawn different items using this) and with bosses what Hele said (or commondata, which would work if you are using a stage script).
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on May 14, 2013, 06:58:47 AM
I think that is way too complicated Darkness1 and also not required. No idea why you're suggesting GetEnemyNum here since that is commonly used to hold the stage script, like during boss fights. I wouldn't fool too much around in the MainLoop nor even try to delay the original scripts since dummy scripts are more flexible and reuse-able when summoned in masses.

Flan27, for bosses what you need to do is create a dummy spell card in the plural. Give it no collisionbox so it cannot get hit. Script your custom explosion effect either in here or as a library included (#include). When the boss "dies" this dummy script will simply show the explosion and finish it off with a VanishEnemy; So it should look like this:

Code: [Select]
@Initialize {
SetLife(1);
finishHer;
}

@MainLoop { yield; }

@DrawLoop { //empty, since the boss is already dead so you dont need to show anything }

function wait(w) { loop(w) { yield; } }

function customExplosion { Effect script } // or outside the script

task finishHer {
yield; // you want to yield once here because dnh doesn't like drawing Effect objects upon Initialize
customExplosion;
wait(80); // just enough to let te explosion effect finish.
VanishEnemy; // done
}

For enemies, script your effect object inside the stage script (or as library called here) and simply parse the X Y position to the custom task/function/effect as parameters. While bosses there is an easy approach as you noticed, for enemies and items being spawned you need to script everything outside the enemy script.

If you want the typical "boss is sliding diagonally" upon death, simply put a SetMovePosition01 before the customExplosion and put another wait(w) as long as you desire. However, you'll need to draw the boss and then perform a DeleteGraphic to make the boss invisible. Or you could warp the boss after the explosion outside the field boundaries. Plenty of simple yet effective solutions available.

Danmakufu 0.12m is all about workarounds.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Mr. Hlaaluington on May 20, 2013, 09:02:10 PM
I am a beginner at danmakufu and don't know much. I am also a bit too lazy to look at the other 30 or so pages so don't attack me if this has been mentioned, but:
How do I use custom lasers? I am only guessing my way through and it's not working...

Script: http://www.mediafire.com/download/p6v4gtuynzb7pwb/Sariel.rar

(If you click on the download, the script you should be looking at is "0Aa.txt")
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on May 20, 2013, 09:34:17 PM
By custom lasers, do you mean Object Lasers or CreateLasers? I haven't checked the code yet, but it's always helpful to know the details about what exactly you are trying to do.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Mr. Hlaaluington on May 20, 2013, 09:40:51 PM
By custom lasers, do you mean Object Lasers or CreateLasers? I haven't checked the code yet, but it's always helpful to know the details about what exactly you are trying to do.
I mean that I'm trying to use the "CreateLaser01" code but using custom bullets that I created as the graphic.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on May 20, 2013, 11:40:07 PM
Then all you need to do is call LoadUserShotData(file path to a .txt file)

The .txt file should be structured as follows:

#UserShotData

ShotImage = ".\nameofimage.png"

ShotData{ id = 1 rect=(Left, Top, Right, Bottom) render=ADD/ALPHA (you choose) angular_velocity = # delay_color= (###,###,###) }

Ex: ShotData{ id=1 rect=(1,0,16,14) render=ALPHA angular_velocity = 0 delay_color= (128,128,128) }

The Left, top, right, bottom are the pixel boundaries for the graphic.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Mr. Hlaaluington on May 20, 2013, 11:50:51 PM
 :( I've done that and it didn't work...

Just please view the code and please tell me what's wrong (and maybe even correct it).
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on May 21, 2013, 12:49:45 AM
Code: [Select]
#UserShotData

ShotImage = ".\img\laser.png"
should be
Code: [Select]
#UserShotData

ShotImage = ".\laser.png"
Basically, since the image file is in the same folder as the .txt, you just link directly. ".\" refers to the current directory that the file is in.

ALSO:
Code: [Select]
task fire{
wait(60);
let x = 0;
let dir = 0;

loop{
while(x<5){

CreateLaser01(GetEnemyX,GetEnemyY,5,(GetAngleToPlayer+rand(-45,45)),200,10,PURPLE11,0);

dir+=90/2;

x++;

}

x = 0;
dir = 0;
wait(7);
yield;

}

}


function wait(w){
loop(w){yield;}
}
Your use of White Space is extremely inefficient. I suggest pressing the space bar four times for each indent instead of spamming the tab key. I can't read your code at all. On a side note, since you're using your own shotsheet, you shouldn't use Purple11 in one script and your own shot in another. Sometimes things become problematic when you do this. Just to let you know.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Mr. Hlaaluington on May 21, 2013, 01:56:20 AM
Haha thanks. What a stupid mistake I made.

EDIT:
On a side note, since you're using your own shotsheet, you shouldn't use Purple11 in one script and your own shot in another. Sometimes things become problematic when you do this. Just to let you know.
I know. I just started this script yesterday, so I still have to iron out mistakes. Besides, I was keeping it that way just in case there wasn't a way to do what I wanted. I can't wait until I finish Sariel.

EDIT EDIT:
Oh pooie, I seem to need help again. Sariel's animation won't work.

http://pastebin.com/p2QqRv2v

Updated MediaFire link for the entire character: http://www.mediafire.com/download/cmhlsciqszfacfu/Sariel.rar

Please post large code like this in pastebin.com --Hele
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on May 21, 2013, 08:05:00 AM
Code: [Select]
//GIGANTIC AMOUNT OF DRAWING CODE.
Is it really needed to use int for GetSpeedX?

Also, that lump of code looks really messy and somewhat confusing because of it. I would reccomend to either use ascent loops (with linear graphic placement in the graphic file (if it isn't already) to loop through it all with just one if function) or to just use Blargels animation library which is simple and really useful.
link: http://www.shrinemaiden.org/forum/index.php?topic=4711.0 (http://www.shrinemaiden.org/forum/index.php?topic=4711.0)

Example of ascent loop for this task:
Code: [Select]
if(GetSpeedX==0){
ascent(anim in 0..36){
if(f>=(anim*10) && f<((anim*10)+10) ){ SetGraphicRect(0+(anim*77), 0, 77+(anim*77), 64);}
 //In case each graphic is inside a square of width 77 next to each other.
 //And of course, each graphics height is supposed to be 64.
}}

Another error seems to appear, looking at your drawing code.

if(f>=40 && f<50){ SetGraphicRect(64,0,77,64); }
if(f>=50 && f<60){ SetGraphicRect(64,77,77,64); }

(( SetGraphicRect(First X coordinate, First Y coordinate, Second X coordinate, Second Y coordinate); ))

Which means that first Y1 first is above Y2, which later changes to Y2 being above Y1. This will probably shrink and/or invert the graphic, since all graphicrects are not of the same scale/angle.
The same thing happens later to your x coordinates as well. I assume you forgot to increase the second X and Y values as well?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Mr. Hlaaluington on May 22, 2013, 12:42:07 AM
Another error seems to appear, looking at your drawing code.

if(f>=40 && f<50){ SetGraphicRect(64,0,77,64); }
if(f>=50 && f<60){ SetGraphicRect(64,77,77,64); }

(( SetGraphicRect(First X coordinate, First Y coordinate, Second X coordinate, Second Y coordinate); ))

Which means that first Y1 first is above Y2, which later changes to Y2 being above Y1. This will probably shrink and/or invert the graphic, since all graphicrects are not of the same scale/angle.
The same thing happens later to your x coordinates as well. I assume you forgot to increase the second X and Y values as well?

I did forget to do that, I'll go see if it works.

EDIT: I finally got it to work using ascent. Thanks for your help. Now I am finally done with 2 attacks.

EDIT EDIT:

Fudgelcakes, my familiar won't spawn (gawd I suck at this).

http://pastebin.com/mwKah5Mj

This is the second time I have to edit your post to put it in paste.bin. -Hele
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on May 23, 2013, 06:29:33 AM
Mr. Hlaaluington, please keep in mind that posting blocks of code like that will cause immense number of scrolling for just 1 post. Please be sure to put those next time in Pastebin.com.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on May 23, 2013, 10:11:45 AM
Maybe you should try finding errors using danmakufus own error messages sometimes. Just saying, it is helpful for the less complicated errors.
Anyways:
* DrawGraphicRect(imgDerp); //This seems strange.
* Looking at your graphic ascent loop this time, it doesn't seem wrong and I don't know how your graphic file looks, but when you increase both the x and the y coordinates per loop, it makes me wonder if your graphics are lined diagonally.
* In maintask, it looks like you are calling the task fire one frame before you are creating it, since the task is inside maintask. Not only that, maintask covers all the other tasks after it, which is also wrong.
* This is not a real error, but it seems unneccesary to use a while loop for the bullets, since you might as well use the loop/ascent/descent functions. Using ascent/descent, you even get a value for each loop which can be used for making angle patterns.
* There needs to be yield; in your mainloop to run tasks.
* Why are there so many brackets at the end?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Shadow on May 24, 2013, 05:23:52 AM
This is probably an incredibly silly question, but is there any functional difference between "loop" and "times"? Thanks in advance~
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on May 24, 2013, 05:41:56 AM
Literally no difference. It's just equivalent syntax, except loop can be done indefinitely while times requires a count.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: The Noodles Guy on May 25, 2013, 11:01:48 AM
How do I use loops? :V
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: PhantomSong on May 25, 2013, 02:32:38 PM
How do I use loops? :V
Well loops will repeat things over and over, and are pretty standard.

Code: [Select]
//This'll loop everything in here and "loop de loop(20)"
loop{
        //This will loop whatever is in this bracket 20 times.
        loop(20){

    yield;
      }
yield;
}
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Maths ~Angelic Version~ on May 25, 2013, 02:34:48 PM
@Berthold: What do you mean with that? A short explanation:
Code: [Select]
loop(n){stuff;} does "stuff" n times. Example:
Code: [Select]
loop(8){CreateShot01(GetX,GetY,3,rand(0,360),BLUE12,0);}spawns eight BLUE12 bullets from the boss's location at speed 3, no delay, and at random angles.
You may change variables in a loop. A basic example:
Code: [Select]
let angle=rand(0,360);
loop(15)
{
CreateShot01(GetX,GetY,3,angle,BLUE12,0);
angle+=360/15;
}
This spawns a circle of 15 blue bullets. The bullets are equal except for the fact that they're fired at different angles.
Code: [Select]
loop{stuff;} is an infinite loop. It will crash Danmakufu unless you use it in a task and put at least one yield in it. If you use tasks, don't forget to put at least one yield in your @MainLoop!
Anyway, read the tutorials (http://www.shrinemaiden.org/forum/index.php/topic,6181.msg345023.html#msg345023) for more and better information about loops.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: The Noodles Guy on May 25, 2013, 03:14:49 PM
Thanks Maths and Phantom :3
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on May 25, 2013, 06:41:28 PM
I hope I'm not getting annoying with my abuse of ascent, but to explain, there are three other types of loops which are useful in their own circumstances.
Code: [Select]
ascent( [name of variable saved with each loop] in [startingvalue of loop]..[lastvalue of loop] ){ dostuff; }
descent( [name of variable saved with each loop] in [startingvalue of loop]..[lastvalue of loop] ){ dostuff; }
while( [something] ){ dostuff; }

Basically, ascent and descent goes through set values as it loops, except that ascent is supposed to go up upwards and descent downwards. Example usage is something like this:
Code: [Select]
ascent(angletime in 0..15){ CreateShot(); }Which will create 15 bullets, where each bullet gets a stored value of 0 up to 14. The stored number can then be called by using "angletime" inside the ascent loop. If you want a simple ring pattern of 15 bullets, you can put the bullets angle as angletime*360/15.

While should be obvious how to use, as it simply does an infinite loop as long as the statement in the parentheses are true. Using infinite loops like "while" or "loop", you can then use the break; function to exit the loop. An example of mine: 
Code: [Select]
let randangle=270;
loop{randangle=rand(220,320);
if(randangle!=270){break;}}
Which would infinitely loop to give randangle a random value between 220 and 320 until the value randangle is not equal to 270.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Maths ~Angelic Version~ on May 25, 2013, 09:28:08 PM
No, Dark, you're not getting annoying. It's great that you point out the other types of loop  :D Personally, I don't use ascent/descent loops much, but I understand why you find them practical.
Berthold, feel free to test them. It's not that hard and you may find it practical. Also, I highly recommend looking at while loops. They're useful in different circumstances than loop/ascent/descent, so they're nice to know about.
Oh, and regarding the previous post: You're welcome :)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Drake on May 25, 2013, 11:44:48 PM
yield
You don't need to yield in loops. It's only necessary if you're buffering each loop over a period of frames. This is standard with "run-per-frame" loops but isn't necessary in general. I'm sure you know that but pointing it out anyway.

Using infinite loops like "while" or "loop", you can then use the break; function to exit the loop.
Nooooo. If you're using a while loop to conditionally run some looping statements, you don't break unless for some reason you have to exit the loop before hitting the next iteration. Otherwise whatever condition that you're using to break should be going in the while condition. Likewise, if you need to use a break for a loop, you better have a good reason for doing it and not just using a while loop under your break condition.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on May 28, 2013, 09:25:35 AM
Nooooo. If you're using a while loop to conditionally run some looping statements, you don't break unless for some reason you have to exit the loop before hitting the next iteration. Otherwise whatever condition that you're using to break should be going in the while condition. Likewise, if you need to use a break for a loop, you better have a good reason for doing it and not just using a while loop under your break condition.
I realise my use of break there was unneccesary, when I could aswell have used the while function, but atleast I could use it to show how break works. I could have made a better example, but still.

Now for something I have thought about for a while, how do you bend graphics into circles using effect objects, to make effects like ZUNs spellcard circles or the healthbar/circle from TD?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on May 28, 2013, 09:58:30 AM
Triangle strip where each "piece" (Vertexes) of the strip is placed in a circular shape using trig. The more pieces, the smoother the circle becomes. Then you apply the texture over the pieces. Currently I don't have access to my project where I could show an example, because I have implemented this in my game, with some additional effects.

Isn't also the circular lifebar made by someone on bulletforge? You might want to download that and study the code if you don't wish to wait.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on May 28, 2013, 04:33:29 PM
Triangle strip where each "piece" (Vertexes) of the strip is placed in a circular shape using trig. The more pieces, the smoother the circle becomes. Then you apply the texture over the pieces. Currently I don't have access to my project where I could show an example, because I have implemented this in my game, with some additional effects.

Isn't also the circular lifebar made by someone on bulletforge? You might want to download that and study the code if you don't wish to wait.
I don't know about the circular lifebar, I looked at shockmans code for the mima script but it was quite different from an effect object.

I did follow your hint and tried to make something: http://pastebin.com/fV9Qj5e2

It does make a circle, but the circle shrinks at the start and at 180 degrees from the start of the circle. There seems to be something weird with vertex 0 and 1 aswell.
It is very possible that I don't understand the way vertexes go together here.
(http://img825.imageshack.us/img825/5719/lifebar.png)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on May 28, 2013, 11:40:43 PM
I don't know about the circular lifebar, I looked at shockmans code for the mima script but it was quite different from an effect object.

I did follow your hint and tried to make something: http://pastebin.com/fV9Qj5e2

It does make a circle, but the circle shrinks at the start and at 180 degrees from the start of the circle. There seems to be something weird with vertex 0 and 1 aswell.
It is very possible that I don't understand the way vertexes go together here.
(http://img825.imageshack.us/img825/5719/lifebar.png)

Shockman's Mima uses a circular lifebar. I have altered it and found it to be quite useful. It's in PDD v0.50, I think. Go to Data=>Stgenemy=>stgenemy.txt. It's the second function there. The first one is my own lifebar, which is just a plain old Marine Benefit-esque lifebar with ZUNgraphics.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on May 29, 2013, 05:22:10 AM
Shockman's Mima uses a circular lifebar. I have altered it and found it to be quite useful. It's in PDD v0.50, I think. Go to Data=>Stgenemy=>stgenemy.txt. It's the second function there. The first one is my own lifebar, which is just a plain old Marine Benefit-esque lifebar with ZUNgraphics.
I did check shockmans script for it first, but it put me off a bit how it was a big bunch a drawn images. I wanted to see if it could be made purely with vertexes (I'm not sure, but does it cause less lag in this case?) since I also wanted to use the code later for spellcard circles. As I said, my code seems to make a circle, but since the vertexes with the graphic doesn't bend, the circle effect object gets thinner and thinner the more the circle curves away from the current angle of the graphic. Right now, I suppose it is to find a way to make the ingame drawn width/length be dependant on it's position on the circle. That is, if my idea for scripting the vertexes together really works.

EDIT: looked at Onthenets script a bit and it works alot better now. Just have to figure out the life code.
EDIT2: It became something like this. Unfortunately, this doesn't work too well. http://pastebin.com/MrJPi680 (http://pastebin.com/MrJPi680) A vertex seems to behave strangely.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Lavalake on May 30, 2013, 03:09:21 AM
I'm stuck on a piece of coding that would have been easy to make.
So, I'm trying to make the boss have a fast bullet streams on her left and right.
I want the right stream to start at 180 and add angle until it gets to 90. That part I got, but then, I also need it to accelerate the distance between each bullet at the beginning, keep a regular interval in the middle, and decrease distance at the end.
http://pastebin.com/zy8kZuxi (http://pastebin.com/zy8kZuxi)
This was my attempt with very specific variable changing and "If" statements.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Zoriri on June 04, 2013, 12:06:37 AM
I have a couple of questions about the graphical side of danmakufu.
1.) How do you change the graphic for concentrations?
2.) Do boss portraits need to be a specific file type? I'm using a .PNG file, but it appears as a white block.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on June 04, 2013, 12:10:18 AM
I have a couple of questions about the graphical side of danmakufu.
1.) How do you change the graphic for concentrations?
2.) Do boss portraits need to be a specific file type? I'm using a .PNG file, but it appears as a white block.

1) Either override using an img folder with a corresponding file OR use object effects and recreate the effect
2) Incorrect dimensions, most likely. Check your dimensions and make sure that you've a) Loaded the graphic and b) used the correct filepath.

For help on Filepaths: Helepolis's Paths and Directories Tutorial (http://www.shrinemaiden.org/forum/index.php/topic,4752.0.html)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on June 04, 2013, 02:10:13 PM
Additional info on the concentration: http://www.shrinemaiden.org/forum/index.php/topic,3167.0.html   This thread explains what the names are of the image files inside dnh. You need to create the same folder in the root of Danmakufu.

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Zoriri on June 04, 2013, 10:12:25 PM

1) Either override using an img folder with a corresponding file OR use object effects and recreate the effect
Additional info on the concentration: http://www.shrinemaiden.org/forum/index.php/topic,3167.0.html   This thread explains what the names are of the image files inside dnh. You need to create the same folder in the root of Danmakufu.

So to change the concentration effect, I put the graphic i want into the img. folder, and then call it in the script?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: PhantomSong on June 04, 2013, 10:36:56 PM
So to change the concentration effect, I put the graphic i want into the img. folder, and then call it in the script?
Precisely!
So let say you wanted to  change the snowflake one into cherry blossoms. Change the graphic and call "Concetration02(##)" where you want it.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on June 04, 2013, 10:39:47 PM
The coordinates of the graphic need to match up though. Keep that in mind, since replacing Danmakufu's native files can be problematic sometimes.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Zoriri on June 05, 2013, 11:46:59 PM
Sorry for already asking another question, but now I'm having trouble with movment.

I'm using SetMovePositionRandom01 to move my boss, but it isn't moving from the X an Y coordinates i used.
Code: [Select]
SetMovePositionRandom01(20, 20, 2, 50, 50, 50, 50);
Also, what are the dimension of the playing field in Danmakufu?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on June 06, 2013, 12:41:51 AM
Sorry for already asking another question, but now I'm having trouble with movment.

I'm using SetMovePositionRandom01 to move my boss, but it isn't moving from the X an Y coordinates i used.
Code: [Select]
SetMovePositionRandom01(20, 20, 2, 50, 50, 50, 50);
Also, what are the dimension of the playing field in Danmakufu?
SetMovePositionRandom01(X-distance, Y-distance, speed, left boundary, top boundary, right boundary, bottom boundary)

Well... first off, your boundary #s are the same. Basically, you're allowing the boss to move within one point. Use the following data to help yourself.

Code: [Select]
DNH

MinX: 0
MaxX: 448
GetCenterX: 224
GetClipMinX: 32
GetClipMaxX: 416

MinY: 0
MaxY: 480
GetCenterY: 240
GetClipMinY: 16
GetClipMaxY: 464

MinX/MaxX/etc. are not functions, by the way. GetCLipMin/MaxX/Y state the boundaries of the playing field (i.e. where the player can move). The boss and bullets can move out of this range.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Zoriri on June 06, 2013, 01:18:10 AM
SetMovePositionRandom01(X-distance, Y-distance, speed, left boundary, top boundary, right boundary, bottom boundary)

Well... first off, your boundary #s are the same. Basically, you're allowing the boss to move within one point. Use the following data to help yourself.

Code: [Select]
DNH

MinX: 0
MaxX: 448
GetCenterX: 224
GetClipMinX: 32
GetClipMaxX: 416

MinY: 0
MaxY: 480
GetCenterY: 240
GetClipMinY: 16
GetClipMaxY: 464

MinX/MaxX/etc. are not functions, by the way. GetCLipMin/MaxX/Y state the boundaries of the playing field (i.e. where the player can move). The boss and bullets can move out of this range.

Ah, that... kinda helps.(In all honesty I have no idea how to use the info you gave me). What i was trying to do was have the boss move randomly in only the upper half of the screen.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on June 06, 2013, 02:04:23 AM
SetMovePosition01(rand(GetClipMinX, GetClipMaxX), rand(GetClipMinY, GetCenterY), 2);

That's all. But remember: The boss will move to the walls, and players hate it when bosses suddenly move to the other side of the screen. I suggest limiting the xcor values to rand(GetCenterX-80,GetCenterX+80) or something around that.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on June 06, 2013, 07:44:09 AM
Actually Sparen, you're making two mistakes here. First: Rand is a floating number. Or in simple terms it will randomize a number between 32 and 416, including all decimals. So the boss can decide to move 32,00400000 and 300,4395000. Which might sometimes look very bad.

Second mistake, related to the first, is the movement distance. Random is random, but there is no guarantee the random will be always a greater number than the previous which might result in the boss not moving at all. We definitely do not want this. So how?

@ Zoriri & Sparen
SetMovePositionRandom01 is your friend here. It comes with a secure random movement ability. This function creates a bounding box where the boss will move inside. It will never leave the boundaries. The wiki isn't really clear about this function so I'll explain it here.
Code: [Select]
1) x-distance the static distance the boss will move on the X
2) y-distance the static distance the boss will move on the Y
3) velocity speed at the boss moves
4) left bound
5) top bound
6) right bound
7) bottom bound

SetMovePositionRandom01( 60, 60, 2, GetClipMinX, GetClipMinY, GetClipMaxX, GetCenterY );
This will move the boss randomly inside the "boundary box" defined by you at exactly 60 pixels on the X and Y coordinates. But there are some faults to this, since the boss can clip outside the field making him half off the screen which looks ugly. Additionally we don't want too much static 60 movement, but perhaps variation between 60-100 for the X and 30-60 for the Y to increase dynamics. Now we are allowed to apply Sparen's previous suggestion, but with a different rand function: rand_int. Rand_int randomizes the number you give it, but rounds it up/down into an integer.
Code: [Select]
SetMovePositionRandom01( rand_int(60,100), rand_int(30,60), 2, GetClipMinX+16, GetClipMinY+16, GetClipMaxX-16, GetCenterY );
Since GetClipMinY = 0 (top side of the field) you want to add 16 to not make the boss headless (Unless she is Sekibanki). Same goes for the ClipMinX and MaxX, to avoid the boss half off the screen add or subtract to "decrease the boundary" of the field.

To finish up, an awesome MS Paint to show what is going on.
(http://i40.tinypic.com/2vil4sj.png)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on June 06, 2013, 12:59:12 PM
Yes, setmovepositionrandom is alot better, but I always used move position with randomized coordinates, specifically to get the weight effect of SetMovePosition3 which I always preferred. I realize this is a dumb solution and I could probably get a better one by using randomized variables with control functions. (?)
Code: [Select]
function SetMovePositionRandom03(X-distance, Y-distance, weight, maxspeed, left bound, top bound, right bound, bottom bound){
let setrand = rand(0,360);
let Xdir = GetX+cos(setrand)*(X-distance);
let Ydir = GetY+sin(setrand)*(Y-distance);

if(Xdir>right bound){Xdir = right bound;}
if(Xdir<left bound){Xdir = left bound;}
if(Ydir>bottom bound){Ydir = bottom bound;}
if(Ydir<top bound){Ydir = top bound;}

SetMovePosition03(Xdir, Ydir, weight, maxspeed);}
Would something like this work in that case?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on June 06, 2013, 02:34:25 PM
You're using rand as well for randomizing the degree for trigonometry. Your results could be 4.00000 4.149300 (ry. Might want to rand_int that? Well unless you want a floating variable, fine with me.

As far as I can look at your code, you're using trigonometry to define a location at the edge of virtual circle which is the bounding field? Except for that you need to use GetX+X-distance*cos(setrand) (or does your example works as well? I guess it works both day I could be wrong as well?)

However, I don't see how setrand is going to exceed the boundaries of the playfield when it is 448 and 480 at max. This would probably work out if you make the radius of the virtual circle smaller.

I am not quite sure (needs confirming) but your code is wrong? Drake? Someone?
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Zoriri on June 06, 2013, 03:08:19 PM
Ok, i got the boss to move, but it moves so fast that it looks more like it's having a seizure than firing danmaku. How could i have it pause for a couple of seconds before it moves again?

The code is pretty much the same thing Helepolis had.
Code: [Select]
SetMovePositionRandom01(rand_int(60,100), rand_int(30,60), 2, GetClipMinX+16, GetClipMinY+16, GetClipMaxX-16, GetCenterY);
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Darkness1 on June 06, 2013, 04:12:14 PM
Ok, i got the boss to move, but it moves so fast that it looks more like it's having a seizure than firing danmaku. How could i have it pause for a couple of seconds before it moves again?
Assuming you're using the function wait here. If not:
Code: [Select]
function wait(t){loop(t){yield;}}(In case you're also using tasks.)

If you want it to move, pause for a moment and then move again, this code should work fine:
Code: [Select]
//after the movement code
while(GetSpeed>0){yield;}
wait(120); //pauses for 2 seconds before moving again.
//resumes the loop
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on June 06, 2013, 04:24:00 PM
Remember Zoriri that you dont need to stick to the rand_int numbers we gave you. Try to fiddle around to see how far/close you want to move the boss and apply some personal changes. You'll understand things better that way.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: K+ ~ Bake-Danuki on June 06, 2013, 05:34:54 PM
Could someone help me with modifying this code?
Code: [Select]
   
      task QED(x, y, speed, angle, graphic, delay, num, Bombres) {
      let obj=Obj_Create(OBJ_SHOT);
      let bouncecount = num;
      Obj_SetPosition(obj, x, y);
      Obj_SetAngle(obj, angle);
      Obj_SetSpeed(obj, speed);
      ObjShot_SetGraphic(obj, graphic);
      ObjShot_SetDelay(obj, 0);
      ObjShot_SetBombResist (obj, Bombres);
      while(Obj_BeDeleted(obj)==false && bouncecount > 0) {
        if(Obj_GetX(obj)<GetClipMinX) {
          Obj_SetAngle(obj, 180 - Obj_GetAngle(obj) );
          Obj_SetX(obj,  Obj_GetX(obj) + 0.1);
          bouncecount -= 1;
        }
        if(Obj_GetX(obj)>GetClipMaxX) {
          Obj_SetAngle(obj, 180 - Obj_GetAngle(obj) );
          Obj_SetX(obj,  Obj_GetX(obj) - 0.1);
          bouncecount -= 1;
        }
        if(Obj_GetY(obj)<GetClipMinY) {
          //Obj_SetAngle(obj, Obj_GetAngle(obj) + (2 * (180 - Obj_GetAngle(obj))) ); //Original NetLogo code
          Obj_SetAngle(obj, -1*Obj_GetAngle(obj)); //Equally correct code for Danmakufu
          Obj_SetY(obj,  Obj_GetY(obj) + 0.1);
          bouncecount -= 1;
        }
        yield;
      }
    }

I'm trying to make an edit to this code with causes reflection to allow it to double the reflected bullets in an exponential way (1, 2, 4, 8, 16, ...) and reflect up to 10x (512 bullets I think) and then dissapear if they hit the walls again

And happy reply 1000 (me)
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on June 06, 2013, 05:49:52 PM
I hope you're realising that nothing is being doubled or multiplied here. The object behaviour code makes it reflect/bounce of the field and that is it.

If you want to multiply the bullets, you need to summon the bullets inside the bounce detection code. You can do this two ways, since I am not quite sure about the "disappear" you mention.
1) Summon more bullets upon reflection by simple using CreateShot or CreateShotA and delete the original obj bullet.
2) Script a secondary object bullet with no reflection code but disappearing effect (if that is what you seek)

Code: [Select]
if(Obj_GetX(obj)<GetClipMinX) {
ascent(i in 0..4) { CreateShot or NewObjBulletWithDissapearingEffect...... }
Obj_Delete(obj);
}

Decide which one works better for you. No idea how exactly you plan on reflecting or which direction and which speeds, but I assume you know that already.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: K+ ~ Bake-Danuki on June 06, 2013, 05:55:49 PM
I actually am a noob at this stuff.
The way I was going to see about making them disappear is like normal bullets, where they just drift outside of the boundary of the HUD.
And I was hoping like if a bullet goes and hits a wall at 90 degrees, it would reflect at 45 and 135 degrees causing a split and probably the default velocity.
And I have honestly no idea which on of those I would use.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on June 06, 2013, 05:59:45 PM
Ah I see. In that case things change.

Have you ever scripted Object bullets from scratch? Such as understand how they are build up and what they are capable of? If not, I would first read upon the tutorials about them. Otherwise you're just going to copy/paste code and try to spaghetti-code it.

It won't take you long to grasp, within several minutes most likely. From there on you can mutate/modify the script yourself to your desired. But start out with some tutorials please.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: K+ ~ Bake-Danuki on June 06, 2013, 06:02:49 PM
Oh, sorry.  I'll go read up on these and learn.
Although, I have figured out like how to make a circle of bullets but that's about it.  I haven't been using tutorials, just a template plus source material from scripts to make my own ones.
Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Helepolis on June 06, 2013, 06:20:59 PM
While that method works, I would however heavily encourage to learn. Mainly as eventually, somewhere you're not going to be able to get those desired ideas from your mind onto your notepad/script and enjoy the results if you don't know how to transfer them. (Like right now).

So if my response to your initial question is already a question mark, it means you're not ready for Object bullets yet. Go and read/watch tutorials.

(This suddenly sounds like some movie dialogue :V) ((Though seriously, so many resources available to learn))

Title: Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
Post by: Sparen on June 07, 2013, 01:07:48 AM
[The 7th thread has been started by Drake.]