Author Topic: ※ Danmakufu Q&A/Problem thread 3 ※  (Read 468799 times)

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #300 on: September 16, 2016, 01:36:20 AM »
My stage isn't closing properly for some reason.
I use tasking and have SetAutoDeleteObject(true); in TFinalize, which is called at the end of TMain, which is called somewhere in @Initialize.
The music stops and the background disappears confirming the script has closed, yet the end menu doesn't pop up. Normally it just waits a few seconds but here it seems to be stuck. I can continue to move around and do whatever (so the player script is still running).
What could I have possibly done wrong?

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #301 on: September 16, 2016, 04:33:31 AM »
My stage isn't closing properly for some reason.
I use tasking and have SetAutoDeleteObject(true); in TFinalize, which is called at the end of TMain, which is called somewhere in @Initialize.
The music stops and the background disappears confirming the script has closed, yet the end menu doesn't pop up. Normally it just waits a few seconds but here it seems to be stuck. I can continue to move around and do whatever (so the player script is still running).
What could I have possibly done wrong?
Since you're not showing any code, I have to ask first: Are you actually closing the stage with CloseStgScene?

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #302 on: September 16, 2016, 05:43:05 PM »
So, I've been trying out stuff...
http://pastebin.com/UfnW7Dpc
(I don't know the function to shoot a circle so i just copy pasted CreateShotA1 with every angle needed :d, if anyone knows that btw)
I kind of broke my script : the boss isn't shooting at all anymore...
Also the code i had before some changes was supposed to spawn bullets on him, but it worked only once over 2 times, the second time always popped on a random point (i changed the X movement value for the boss so it kind of fixed it but he couldn't move)...
Where did it all go wrong ?
http://pastebin.com/UfnW7Dpc

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #303 on: September 16, 2016, 06:11:04 PM »
Where did it all go wrong ?

 CreateShotA1(192,-100,5,365,172,15);

Your bullet is spawning 100 pixels offscreen. All of them are.

For information on shooting circles, please refer to:
https://sparen.github.io/ph3tutorials/ph3u1l7.html#sub3

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #304 on: September 16, 2016, 06:19:33 PM »
You're shooting the bullets from out of the game field.  :D

Remember that the most top-left corner of your field is X = 0, Y = 0. Meaning if you shoot something at Y = -100, it will be fired outside the field and instant deleted.

That is fine if you wish to shoot things from the boundaries of the field into the field, but then beware of the Auto Delete boundary, which is by default 16 pixels on each side. So you can maximum fire at maximum 16 pixels on each side out of bounds.

Now, since you probably want to fire from your boss, why don't you use bossX and bossY? You are tracking those in the MainLoop, which updates those two variables. So your shot should be:

Code: [Select]
CreateShotA1(bossX,bossY,5,10,12,30);
Of course, you don't want to do that tedious copy-paste of each angle. So let us introduce trigonometry (often here called trig). To spare the math details, this approach allows you to spawn circular patterns for example. Here it how it goes:
Code: [Select]
task fire {
let radius = 32;
let direction = 0;
let numberOfBullets = 36;

loop(numberOfBullets) {
CreateShotA1(bossX+radius*cos(direction),bossY+radius*sin(direction),5,direction,12,0);
direction += 360/numberOfBullets;
}

loop(60) { yield; }
}

Before you're scared what is happening. Here is the thing.
Code: [Select]
radius = how far the bullets spawn from the location (in this case, the boss). 0 = in the middle of the boss.
direction = starting direction of the first bullet (before the circle is made)
numberOfBullets = how many bullets you wish to fit into this circle.
cos and sin = math. I am bad at explaining this.

The direction += 360/<variable> part tells the script which direction and location on the "circle" to place the bullet. For example, if we had 10 bullets. 360 / 10 would be 36. So each bullet would be 36 pixels away from the previous one forming a nice circle. If you would have 36 bullets, then each bullet would be 10 pixels away. Meaning they are closer together and thus a more dense circle.

You want the circle to start tight or already expanded? Just increase/decrease the radius variable. You can also instantly fill in bossX+64 and bossY+32 for example to get an oval shape. Experiment with it.

Notice how the "Angle/direction"  parameter (4th in CreateShotA1) is the same variable as the direction variable. This is required so the bullet flies into the right direction. But if you replace it with a number you wish, the whole circle will be flying towards that direction. Just like Suwako's Rings for example. Try it out for sure!

Remember, this loop of bullets (or circle of bullets) is instantly created. Because the loop has no yield in it. Just go ahead and add 1 single yield after the direction += part. You'll see that suddenly the circle isn't made instantly, but like a spiral.

Hope this gives you more insight in circular patterns.

Edit I see Sparen went with the brief explanation while I was typing this wall-o-text :V . Definitely would adsvise check out his link to get even more insight in circular patterns.
« Last Edit: September 16, 2016, 06:28:16 PM by Helepolis »

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #305 on: September 16, 2016, 06:30:01 PM »
It all makes sense now lol. I tried inputting the 192/-100 thing because it was what was the boss' position but i had the problem i told you about before when i did it with bossX/Y so i kinda tried stuff on my own...
Thanks a lot  :)

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #306 on: September 16, 2016, 06:46:48 PM »
Aye, but it fully functions as I copy-pasted your entire script into my own ph3 and made the changes. This is why it is quite handy when people post their code in pastebin.

Good luck.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #307 on: September 16, 2016, 07:36:12 PM »
Quote
That is fine if you wish to shoot things from the boundaries of the field into the field, but then beware of the Auto Delete boundary, which is by default 16 pixels on each side. So you can maximum fire at maximum 16 pixels on each side out of bounds.
According to the wiki, it's not 16 pixels but 64.

@Jojo: Note that you also can change theses values by using
Code: [Select]
SetShotAutoDeleteClip (more informations here: http://dmf.shrinemaiden.org/wiki/Shot_Functions#SetShotAutoDeleteClip)



And when we are on shooting circles of bullets, I have a question.
On danmakufu, in term of math, performance and frame rate, is it better to do circle of bullets like that:
Code: [Select]
let A = 0;
let N = 64;
loop(N){
    CreateShotA1(bossX, bossY, speed, A, graphic, delay);
    A += 360/N;
}

or

Code: [Select]
let N = 64;
ascent(i n 0..N){
   CreateShotA1(bossX, boss Y, speed, i*360/N, graphic, delay);
}

?
« Last Edit: September 16, 2016, 07:39:53 PM by Lefkada »

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #308 on: September 16, 2016, 08:07:29 PM »
Since you're not showing any code, I have to ask first: Are you actually closing the stage with CloseStgScene?
It works! Doesn't look like the objects are getting deleted but the stage ends right on cue.
I've always relied on putting CloseScript(GetOwnScriptID()); at the very end, and I've never had a problem with it.
So I'm going with the assumption that CloseStgScene() is just a way to force any script to end.
If I'm making a full game I guess I'll have to switch back to CloseScript(GetOwnScriptID()); and put CloseStgScene(); somewhere in the package?

Anyways thanks a lot!

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #309 on: September 16, 2016, 08:58:54 PM »
@Lefkada, ah right. 64 pixels. Thanks for clearing that up.

It works! Doesn't look like the objects are getting deleted but the stage ends right on cue.
I've always relied on putting CloseScript(GetOwnScriptID()); at the very end, and I've never had a problem with it.
So I'm going with the assumption that CloseStgScene() is just a way to force any script to end.
If I'm making a full game I guess I'll have to switch back to CloseScript(GetOwnScriptID()); and put CloseStgScene(); somewhere in the package?
Actually, CloseStgScene is not a way to force any script end. It only closes the Stage Scene. It will tell the engine that the stage has actually ended and thus will process it all. In ph3, boss fights and stages are actually 'scenes'. You will run into these more when use plural scripts.

Don't trust auto deletion of objects. Exact reasons are unknown (at least, not known to me). But it is better to clean up all objects yourself before calling the CloseScript or CloseStgScene.

The CloseScript only closes the script which is called from. However, it seems the Stage it self uses a different thread/routine to process.

Pruns

  • Dearest wish, hide this stupid nickname set below
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #310 on: September 18, 2016, 09:51:04 PM »
Hello,
I have a little problem about creating a "distorsion field" around the boss,
You know ? like the sample PS03 in the danmakufu folder.
These kind of things are made with the HLSL, but all the documentation and stuffs to learn are too much for me compared to what I want to do with that.

Initially, The sample PS03 code is clearly enough for my use, so I just copy-pasted in my script,
the task TwaveCircle() of the first file
and the whole file " SamplePS03_HLSL.txt "

I just changed few things like putting ( baseEffectRadius etc... ) in parameters.

The problem is that when I face up the boss who contains the "distorsion field",  when I back to the title screen, everything is black, my screen is not loaded correctly.
But I still can select and restart the game / options / quit
It can also happen that some background elements don't appear when I start the game again. ( even before modifying the original code ).

Beside this, the distorsion field itself works perfectly

I absolutly don't see how to fix this bug since I don't have any knowledge about HLSL.
I wish I could have time then I could try to understand how it works
Someone has a solution here or maybe just know why it doesn't work ??
Any help is welcomed
Thanks in advance !

This is the original task TWavecircle
http://pastebin.com/Rw6KrFpp

This one is the file which contains HLSL
http://pastebin.com/ABX58fJT
« Last Edit: September 18, 2016, 09:53:28 PM by Pruns »

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #311 on: September 19, 2016, 08:07:01 PM »
Hey, it's me again ! So this time I have a problem with a different script (yeah i know writing several scripts at the same time as a beginner is bad but it's like just a troll script with just a non spell so whatevs) and it's pretty weird. Basically i copy pasted my first script and edited the values (just the values, the number of values is the same). But it keeps giving me random errors like "movement is not defined" while the exact same thing works in the first script. I couldn't spot errors like missing semi colons and stuff like that so i don't really know where it's coming from and the weird error alert system of danmakufu isn't helping :s
http://pastebin.com/LfgeDASq
This script isn't that important but i suppose knowing what caused it could be useful later so yeah.

Also, concerning my main script, it works fine, but i'd like to change the attack a bit and i don't know how to do it :

Code: [Select]
task fire {
let radius = 32;
let direction = 0;
let numberOfBullets = 36;
loop(numberOfBullets) {
CreateShotA1(bossX+radius*cos(direction),bossY+radius*sin(direction),5,direction,54,0);
CreateShotA1(bossX+radius*cos(direction),bossY+radius*sin(direction),5,direction,156,30);
direction += 360/numberOfBullets;
}

loop(60) { yield; }
}

Right now the two waves overlap each other. I would like to set in a way where the second wave would fire in the gap left by the first one. I tried setting direction+5 instead of just direction to try to change the angle but it didn't work i think so i don't really know how to do this.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #312 on: September 19, 2016, 08:43:35 PM »
But it keeps giving me random errors like "movement is not defined" while the exact same thing works in the first script. I couldn't spot errors like missing semi colons and stuff like that so i don't really know where it's coming from and the weird error alert system of danmakufu isn't helping :s
http://pastebin.com/LfgeDASq

Hint: Do your braces { and } match up? I think you'll find your answer around Line 93. :)

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #313 on: September 20, 2016, 03:32:19 PM »
Quote
Right now the two waves overlap each other. I would like to set in a way where the second wave would fire in the gap left by the first one. I tried setting direction+5 instead of just direction to try to change the angle but it didn't work i think so i don't really know how to do this
Try direction+360/(2*numberOfBullets) insted of direction for one of the bullets  ;)


Anyway, I found a strange.. glitch? Or I don't really know what is it.
When  I work on my package script, I can't see any CommonData in the LogWindow. Even in I create them in an active task of the package script it just don't appears. It's still existing since I can use it for condition or other stuff but it is just totally invisible on the LogWindow.
Someone have an idea about that?
« Last Edit: September 20, 2016, 03:35:46 PM by Lefkada »

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #314 on: September 20, 2016, 05:58:42 PM »
Thanks a lot Sparen !  :D

I've been adding stuff to my pattern but i'm having trouble with the distance between bullets.

Code: [Select]
task fire {

let dir = AngleToPlayer;
let radius = 32;
let direction = 0;
let numberOfBullets = 36;
loop(numberOfBullets) {
CreateShotA1(bossX+radius*cos(direction+360/(2*numberOfBullets)),bossY+radius*sin(direction+360/(2*numberOfBullets)),2,direction+360/(2*numberOfBullets),54,0);
CreateShotA1(bossX+radius*cos(direction),bossY+radius*sin(direction),2,direction,156,15);

direction += 360/numberOfBullets;
}

CreateShotA1(GetPlayerX-160,GetPlayerY,3,360,318,120);
wait(60);
CreateShotA1(GetPlayerX+160,GetPlayerY,3,180,318,120);
wait(60);
CreateShotA1(bossX,bossY,3,dir,328,30);
wait(120);

loop(120) { yield; }
}

Right now the code works without problems but i can't find how to increase distance between the aimed bullets : increasing delay just makes the loop start later but then it stays a line of close bullets. Increasing the speed does increase the distance but of course i don't want to increase the speed.
http://puu.sh/rhWZJ/91c3afb3be.jpg
That's kinda how i want it to be but without the bonus speed.
Also, not as important but how do I set the boss name ? (Like how it shows "Yukari Yakumo" on top left corner or like any boss in Touhou, you know). It would be way nicer with the boss name and i suppose it's not too hard to set ? I looked by myself in the function list but i didn't find any that looked like the one i needed.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #315 on: September 20, 2016, 08:31:57 PM »
You can increase delay to increase the distance. Or increase the number of frame between two fired bullets. ActuallyI don't really understand your problem and which bullet is in cause (butterflies? amulets? arrowhead??). It's not really clear.
You can try to fire your two patterns in two tasks. With that you can do whant you want with one of them wihtout changing the behavior of the other.

To make your boss name you can uses various things.
You can use a picture of the boss name and dosplay it by using the ObjectRender functions or you can use directly texts.
Try this (it's the text method):

Code: [Select]
let bossname = ObjText_Create;
ObjText_SetText(bossname, "NameOfTheBoss");
ObjRender_SetPosition(bossname, 16, 12, 0);
If I do this right, it will display it in the top left corner.

You can also use other text object functions to change color, size, order, etc.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #316 on: September 20, 2016, 08:40:25 PM »
Rather than doing complex explainations i'll just let you play it :
 https://www.mediafire.com/folder/b8yl6mymvc0t4/JoJo&#39;s_Bizarre_Adventure
The bullets in cause here are the aimed ones : meaning the red stars and green hearts.
You can try changing their delay and you'll see that it just makes the loop start later, so it doesn't actually impact the distance between bullets. I've already tried increasing the number of frames for the wait function but it doesn't do anything either. 
By the way i suggest you use a Reimu player script to play it or something with a small hitbox because it's a pretty tight pattern.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #317 on: September 21, 2016, 02:27:51 AM »
You know, all this stuff can be a lot simpler if you use ascent loops and extra tasks. Trust me, it makes things way easier.
Example (uses x and y as boss x and y):
Code: [Select]
task spiral(offset){//Individual spiral
    ascent(i in 0..30){
        CreateShotA1(x,y,1.5,i*12+offset,DS_SCALE_S_WHITE,15);
        yield;
    }
}
task attack1{//Composite attack
    ascent(i in 0..6){
        spiral(i*60);
        wait(15);
    }
}
This would create 6 spirals beginning at different angles.
Not too hard to integrate
Code: [Select]
GetAngleToPlayer(). Just remember though, it's not easy on the engine, save it once to a variable called
Code: [Select]
angleT or something, recalculate it once a frame if you need to. It's much easier to fetch the value of
Code: [Select]
angleT than to recalculate using
Code: [Select]
GetAngleToPlayer().
On another note, I didn't see you use
Code: [Select]
dir (which was set to
Code: [Select]
GetAngleToPlayer()) anywhere. If you want to aim it at the player change it to
Code: [Select]
let direction = GetAngleToPlayer().
Also,
Code: [Select]
360/(2*direction) is redundant when you can save yourself a calculation with
Code: [Select]
180/direction.

If you want to create delays, it's pretty easy to just use the delay value at the end of
Code: [Select]
CreateShotA1() or any of the other shot functions. However, this can create a coloured cloud, which can fill up the entire screen. Instead you might want to create something like this:
Code: [Select]
task delayBullet(x,y,s,r,g,d){//Waits before spawning a bullet with 15 frame delay, change all mentions of "15" for a different delay value
    let count = 15;
    if(d<15){count=d;}else{wait(d-15);}
    CreateShotA1(x,y,s,r,g,15);
}
That way you don't end up with a messy cloud.
Alternatively you can use timing, like so:
Code: [Select]
let tick = 0;
while(!Obj_IsDeleted(objBoss)){
    alternative(tick%180)
    case(60){attack1;}
    case(120){attack2;}
    tick++;
    yield;
}//This triggers tasks attack1 and attack2 on a 3 second cycle
I personally use timing because it keeps things more organized, but you can do the same thing in many ways.
Remember, it is possible to pass as many parameters as you want to tasks. Most commonly I just use it for position, angles, offsets, delays, etc. but I also recommend using
Code: [Select]
tick or whatever you named it as a seed for pseudo-randomness. I don't know anything about the randomness but I like my attacks to be completely deterministic and consistent between runs.
Also try and keep the angles between 0 and 360. If it can get large (ex.
Code: [Select]
x^y+y^x as a seed) add brackets and put
Code: [Select]
%360 at the end.

Hope this helps to some extent.
Have a look at Not My Spellcard, it's my most recent completed script. It's far from perfect but it's optimized to some extent and uses these techniques.
(where are the spoiler blocks on this forum, this post is going to be huge)

halp plz
Can anyone explain the 3D camera? I spent more than an hour trying to figure it out, it's confusing because (0,0,0) is not at a corner or centered, x does not correspond to horizontal, y does not correspond to vertical, and z does not correspond to depth. Also the rotation is confusing. I was trying to create a scrolling background at an angle, I had all the math worked out and it would have worked perfectly, and it ended up being a mess. I changed some constants and made the angle (0,0,0) and it worked, but I may as well have been using the 2D sprites since it would be more intuitive. I'm sticking to 2D until someone can explain the 3D.

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #318 on: September 21, 2016, 09:46:27 AM »
Here's a primer on how the camera system works:
https://www.shrinemaiden.org/forum/index.php/topic,16584.msg1190637.html#msg1190637

Helepolis also has three videos that are more hands-on and have relatable visuals:
https://www.youtube.com/watch?v=kEM1LUTrur4&index=6&list=PLsqimF6_OUHBNeOrp_k2t9bPk5Q6PsB_P

Both of these together should be good for understanding how the systems work and how to implement what you want. I would suggest reading my post first even if you don't get it entirely, then watching the videos, then rereading the writeup. But that's up to you.



Tutorials aside, one likely reason you're having trouble is because the default camera position/orientation is not very obvious (radius: 500, elevation: 55, azimuth: 15), and when coming from 2D graphics you tend to ignore the camera at the beginning, which is actually the most important part. The other part is that even if you're working with the camera, the engine's camera is set up in a non-intuitive way, because at 0 elevation and 0 azimuth it doesn't correlate the X/Y axes the same way as they work on the 2D plane. Instead its 3D axes are based on a convention where the X axis increases southwards, the Y axis increases upwards, and the Z axis increases eastwards. For the most part it's suggested to rotate azimuth by default to -90 and use that as a "canonical zero", since that sets the camera up in the way that typically makes sense to most people.
« Last Edit: September 21, 2016, 10:02:18 AM by Drake »

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #319 on: September 21, 2016, 12:00:04 PM »
Hi all,
I'm working on a stage script and have encountered an issue.
I have a Midboss and Boss plurals, both of which seem to close without issue.

I have the following code in my Stage Script.
Code: [Select]
task AliceMidBoss{
  let path = dir ~ "AliceBossPlural.dnh";
  let scriptID = LoadScriptInThread(path);
  StartScript(scriptID);
  while(!IsCloseScript(scriptID)){
    yield;
  }
  MarisaBoss;
}

task MarisaBoss{
  let path = dir ~ "MarisaBossPlural.dnh";
  let scriptID = LoadScriptInThread(path);
  StartScript(scriptID);
  while(!IsCloseScript(scriptID)){
    yield;
  }
}

Which in theory, should work without issue.
However, when I beat the midboss, the boss doesn't start up?
I tested further and am now very confused.
This code:
Code: [Select]
task AliceMidBoss{
  let path = dir ~ "AliceBossPlural.dnh";
  let scriptID = LoadScriptInThread(path);
  StartScript(scriptID);
  while(!IsCloseScript(scriptID)){
    MarisaBoss;
    yield;
  }
}

Crashes with an error about EnemyBossScene (presumably that it can't be created twice), which makes perfect sense.
This Code:
Code: [Select]
task AliceMidBoss{
  let path = dir ~ "AliceBossPlural.dnh";
  let scriptID = LoadScriptInThread(path);
  StartScript(scriptID);
  while(!IsCloseScript(scriptID)){
    yield;
    MarisaBoss;
  }
}

Runs like the frst block?
Even though it should crash like the second block?
All of this is based on looking at other stage scripts (Mainly Aldryn's) which are structured very similarly, and work fine.
Any ideas?

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #320 on: September 21, 2016, 12:44:28 PM »
Hi all,
I'm working on a stage script and have encountered an issue.
I have a Midboss and Boss plurals, both of which seem to close without issue
Please show us an example of a plural script as well. Plural scripts should run CloseScript(GetOwnScriptID()); once they have finished to notify the stage that it's OK to move on to the next one.

I tested further and am now very confused.
This code:
Code: [Select]
task AliceMidBoss{
  let path = dir ~ "AliceBossPlural.dnh";
  let scriptID = LoadScriptInThread(path);
  StartScript(scriptID);
  while(!IsCloseScript(scriptID)){
    MarisaBoss;
    yield;
  }
}

Crashes with an error about EnemyBossScene (presumably that it can't be created twice), which makes perfect sense.

Calling MarisaBoss every single frame means that Danmakufu will not work in general. As to why switching the yield; and MarisaBoss calls works, I personally cannot explain it.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #321 on: September 21, 2016, 01:14:56 PM »
I just pulled the aimed bullet function (with the angleToPlayer part) from one of the first tutorial videos of Helepolis because i remembered it had aimed bullets, and i just copied the whole function without changing anything because safer is better. About the whole delay and distance between bullets, i already explained the problem : increasing delay started the loop later, but didn't affect the actual distance between bullets for whatever reason. I'm gonna look some more into it, thanks for all the info though :)
I'll edit this post later if i run into trouble or have a question

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #322 on: September 21, 2016, 02:06:22 PM »
Please show us an example of a plural script as well. Plural scripts should run CloseScript(GetOwnScriptID()); once they have finished to notify the stage that it's OK to move on to the next one.

This  is one of the two plurals.
The other is the same (except for having different singles).

Calling MarisaBoss every single frame means that Danmakufu will not work in general. As to why switching the yield; and MarisaBoss calls works, I personally cannot explain it.

I get that calling MarisaBoss should stop danmakufu from working, I was focusing specifically on the switch between yield and MarisaBoss.

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #323 on: September 22, 2016, 02:39:04 AM »
Right now the two waves overlap each other. I would like to set in a way where the second wave would fire in the gap left by the first one. I tried setting direction+5 instead of just direction to try to change the angle but it didn't work i think so i don't really know how to do this.
The way you had set it up originally is correct. What you want is making the displacement in spawn position (bossX + bla, bossY + bla) at angles offset from the first wave. Also, instead of using delay to time bullets, you should explicitly code the timing. Bullet delay should just be effect.
Code: [Select]
task fire {
    let radius = 32;
    let direction = 0;
    let numberOfBullets = 36;
    loop(numberOfBullets) {
        CreateShotA1(bossX+radius*cos(direction),bossY+radius*sin(direction),5,direction,54,10);
        direction += 360/numberOfBullets;
    }
    loop(30) { yield; }
    direction = 360/(numberOfBullets*2); // or just 5
    loop(numberOfBullets) {
        CreateShotA1(bossX+radius*cos(direction),bossY+radius*sin(direction),5,direction,156,10);
        direction += 360/numberOfBullets;
    }
}

Anyway, I found a strange.. glitch? Or I don't really know what is it.
When  I work on my package script, I can't see any CommonData in the LogWindow. Even in I create them in an active task of the package script it just don't appears. It's still existing since I can use it for condition or other stuff but it is just totally invisible on the LogWindow.
Someone have an idea about that?
You probably know Common Data is divided into Areas. When you work just using SetCommonData it uses a default Area, which is empty string. If you click on the first row in the log, the data should show up.

This  is one of the two plurals.
The other is the same (except for having different singles).
What you've posted shouldn't give you the errors you describe (besides the tests that should obviously error). I can copypaste code and have it run smoothly, so something else is going on. Please zip up your project and post it.
« Last Edit: September 22, 2016, 03:40:17 AM by Drake »

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #324 on: September 22, 2016, 05:58:11 AM »
Here is the zipped folder containing all the files in the project.
It also contains a non-standard th_dnh.def because of a changed window size.

Any help is appreciated.

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #325 on: September 22, 2016, 07:43:26 AM »
Code: [Select]
// StgTest.dnh

@MainLoop{}

:|

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #326 on: September 22, 2016, 07:49:30 AM »
Quote
You probably know Common Data is divided into Areas. When you work just using SetCommonData it uses a default Area, which is empty string. If you click on the first row in the log, the data should show up.
Yes I know this. But... no. The first row is empty even if I click on it and there is no common data in the default area according the LogWindow (but actually they exist for danmakufu and they can be used).
It's not really an issue for the game itself but it is for debug.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #327 on: September 22, 2016, 07:59:06 AM »
Code: [Select]
// StgTest.dnh

@MainLoop{}

:|

Wow. Wow.
Lesson learned: MainLoop doesn't crash danmakufu if it isn't yielded.
Sorry if I wasted anyone's time.
Thanks for the help.

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #328 on: September 22, 2016, 08:02:34 AM »
Yes I know this. But... no. The first row is empty even if I click on it and there is no common data in the default area according the LogWindow (but actually they exist for danmakufu and they can be used).
It's not really an issue for the game itself but it is for debug.
Can you create an Area and see it? Do other packages (e.g. full games) also not log any CommonData?

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #329 on: September 23, 2016, 02:37:21 PM »
I have created Area Common Data in my package and now i can see all the common data, even thoses in the default area. I d'ont really know if it was just a random bug or if it'simpossible to see common data if there is no area common data created/loaded but anyway, it seems to work now. Thanks.