Author Topic: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m [Closed, read last post!]  (Read 184019 times)

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #30 on: June 19, 2013, 08:11:57 PM »
You're very welcome.

Also: Drake, you may want to directly link the list of tutorials to the first post.

Drake

  • *
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #31 on: June 20, 2013, 01:19:07 AM »
good idea

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

KuroArashi100

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #32 on: June 25, 2013, 11:08:21 AM »
I was following Helepolis tutorial on animating bosses, and I think that I copied everything correctly.
However, everytime Cirno moves, the picture duplicates over the whole screen.
What causes this? And in his tutorial, he remedied this by changing a few lines.
However, when I change these lines, it keeps happening.
I posted it on pastebin so if anyone wants to look at it and tell me what I'm doing wrong, I would be very grateful.
http://pastebin.com/3b2JLug1

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #33 on: June 25, 2013, 12:52:11 PM »
I was following Helepolis tutorial on animating bosses, and I think that I copied everything correctly.
However, everytime Cirno moves, the picture duplicates over the whole screen.
What causes this? And in his tutorial, he remedied this by changing a few lines.
However, when I change these lines, it keeps happening.
I posted it on pastebin so if anyone wants to look at it and tell me what I'm doing wrong, I would be very grateful.
http://pastebin.com/3b2JLug1

First, set a default SetGraphicRect. I had this problem before.

I don't actually know if it'll work, but adding a default SetGraphicRect outside the if statements makes it easier to debug anyway.

KuroArashi100

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #34 on: June 25, 2013, 02:16:27 PM »
That made it work correctly.
Thanks a lot!

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #35 on: June 25, 2013, 02:47:13 PM »
You're welcome.

Qwertyzxcv

  • yas
  • k!
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #36 on: June 26, 2013, 11:35:35 PM »
http://pastebin.com/FTLerGzr
This code gives me an error message that says: "wait,(Japanese stuff)"

Shadow

  • Forever waiting for tomorrow
  • ...
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #37 on: June 26, 2013, 11:52:42 PM »
http://pastebin.com/FTLerGzr
This code gives me an error message that says: "wait,(Japanese stuff)"

Your code was very messy so I had to spend a few minutes tabbing everything properly... ^^; You had several mismatched brackets throughout the script, one of them which actually closed script_enemy_main after a wait call, which caused the wait function to appear as undefined for Danmakufu. Either way, this should work: http://pastebin.com/GXvLUa0B

Qwertyzxcv

  • yas
  • k!
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #38 on: June 27, 2013, 12:01:05 AM »
Your code was very messy so I had to spend a few minutes tabbing everything properly... ^^; You had several mismatched brackets throughout the script, one of them which actually closed script_enemy_main after a wait call, which caused the wait function to appear as undefined for Danmakufu. Either way, this should work: http://pastebin.com/GXvLUa0B
Oops, thank you! C:


Qwertyzxcv

  • yas
  • k!
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #40 on: June 27, 2013, 02:33:32 AM »
Qwerty: This exists for a reason: https://sites.google.com/site/sparensdanmakufututorials/dnh-0-12m-tutorials-part-3/014-intro-to-danmakufu-part-4
I knew what the error meant, and I checked it over but could'nt find where the extra bracket was

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #41 on: June 27, 2013, 05:47:45 AM »
I knew what the error meant, and I checked it over but could'nt find where the extra bracket was
Is there a line message? Usually you get a line message when it throws you an error with ) or }. (Unless it is a Script_enemy_main) . Try to keep that in mind when you run into such errors again.

KuroArashi100

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #42 on: June 27, 2013, 08:34:26 AM »
How do I make CreateLaserA shots disappear?
I was making a spellcard with bullets coming in from the side using CreateShot01, which works like I wanted to,
and a with a laser fired every 1.5 second to force people to move instead of only dodging up/down.
However, currently I'm getting sniped by lasers that won't disappear trapping me.
The code for @MainLoop currently looks like this:
Code: [Select]
@MainLoop{
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,16);


if(time==90){
CreateLaserA(1,GetEnemyX,GetEnemyY,500,20,BLUE01,60);
SetLaserDataA(1,0,GetAngleToPlayer,0,0,0,0);
FireShot(1);
time = 0;
yield;
}

time++;

yield;
}

So how do I make it disappear after a while?
I've already tried making it shrink, but then it appears on the other side, which looks pretty ugly.

Shadow

  • Forever waiting for tomorrow
  • ...
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #43 on: June 27, 2013, 09:12:09 AM »
Ah, you have to use SetShotKillTime for that (if I am not mistaken)~

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #44 on: June 27, 2013, 09:23:36 AM »
Warning - while you were reading a new reply has been posted. You may wish to review your post.

Shadow is correct.

Mandatory, It is all written on the wiki as well you know, for controlling most things. http://dmf.shrinemaiden.org/wiki/Bullet_Control_Functions_%280.12m%29#SetShotKillTime




KuroArashi100

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #45 on: June 27, 2013, 11:14:38 AM »

Ah, you have to use SetShotKillTime for that (if I am not mistaken)~

Thanks for helping! It works now.


Mandatory, It is all written on the wiki as well you know, for controlling most things. http://dmf.shrinemaiden.org/wiki/Bullet_Control_Functions_%280.12m%29#SetShotKillTime


I am currently still figuring out how exactly Danmakufu works. (If I spawn a circle of bullets with CreateShotA what happens if I put a yield; at different places? etc.)
Because the bullets always left the screen , I didn't use it, and I didn't remember it.
When I looked at the wiki, I kept looking at the Create- and SetShotData parts, and there being another function made for that completely slipped my mind.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #46 on: June 27, 2013, 01:00:32 PM »
In that case welcome :)

In that case, keep in mind that Yield won't stop your bullets. Actually it has nothing to do with the bullets. Yield is used when you're using tasks and functions. You can read about these more in the tutorials in the great information thread: http://www.shrinemaiden.org/forum/index.php/topic,6181.0.html

Lots of useful info in there from tutorials to explanations to examples. Logically, if you have questions: feel free to ask them here.

KuroArashi100

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #47 on: June 29, 2013, 02:49:59 PM »

In that case, keep in mind that Yield won't stop your bullets. Actually it has nothing to do with the bullets. Yield is used when you're using tasks and functions.


In this example, I was using the script you made in the video tutorial about CreateShotA bullets, where putting Yield in different places would spawn the bullets all at once or one by one.

Also I have another question:
I was trying to make a lookalike spellcard to Yamame's Miasma Sign "Filled Miasma".
I made a spiral that expands slowly like in her spellcard, and it stops once it has reached a certain size, but my question is:
How do I delay the bullets from firing so I can fire them closer to each other?
My current code is the following:
Code: [Select]
task fire{
let dir = 0;

loop{
dir+=360/rand(20,50);
radius+=0.15;
CreateShotA(1,GetEnemyX+radius*cos(dir),GetEnemyY+radius*sin(dir),30);
SetShotDataA(1,0,0,dir,0,0,0,BLUE12);
SetShotDataA(1,270,3,dir,0,0,2,BLUE12);
FireShot(1);
yield;

}

}
radius is defined at the start of the script, because it is reset in @MainLoop.
So is there any way to delay the earlier created shots from firing until the later ones are created?
EDIT: Other than making two different CreateShotA's which start moving at different times?
« Last Edit: June 29, 2013, 02:54:21 PM by KuroArashi100 »

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #48 on: June 29, 2013, 05:19:46 PM »
I usually like to create a variable called delay.
The delay should start at the very high number, and should decrease by the value of the waits. Since you seem to only have a yield, it should decrease by one after each loop.
But the variable should only have about 30~60 frames left after spawning the last bullet.
The variable should be placed in the second SetPositionA, on the frames to activate.
And shouldn't you stop the spawning at one point, they look like it goes on forever with the infinite loop.
Currently a normal player

KuroArashi100

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #49 on: June 29, 2013, 09:11:11 PM »
So this delay variable should be equal to something like spawning time+some extra time?
I haven't read/watched more than some of Helepolis's videos and the basic tutorial.
Tasks weren't featured in them, but I did notice, that if I put a number in the loop, it would only execute once.
And since I currently don't know enough about writing scripts to change this, I just keep it like this because it works.

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #50 on: June 29, 2013, 09:23:57 PM »
The delay variable should be this:
(Bullets*[Value of the waiting])+(30~60) = Delay value
It basically is like a formula.
So, if I had 20 bullets with a 5 frame waiting in between each bullet, and I want to wait 30 frames after the last bullet is spawned, before making them move, the formula is now:
(20*5)+30=130 frames

Putting a number in parentheses after a loop makes that loop activate that number of times.
Code: [Select]
loop(20){Loops the code inside 20 times, before moving on.
Code: [Select]
loop{This makes the loop infinite and it will never move on unless the script has ended.
Currently a normal player

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #51 on: June 30, 2013, 03:16:58 PM »
So this delay variable should be equal to something like spawning time+some extra time?
I haven't read/watched more than some of Helepolis's videos and the basic tutorial.
Tasks weren't featured in them, but I did notice, that if I put a number in the loop, it would only execute once.
And since I currently don't know enough about writing scripts to change this, I just keep it like this because it works.
You should remember that the @MainLoop style scripting and task-based scripting are two different things. My video tutorials specifically approach the task-based method. From your first post on this page, I assumed you were @MainLoop style scripting.

You should first decide for yourself which method you want to apply because based on that we can easier help you out achieving things. Right now it looks like you're a bouncing ball, approaching things randomly.

Edit:
Example of showing two styles roughly. I know there are better examples for MainLoop but this is at most basic beginner level.
Code: [Select]
let frame = 0;

@MainLoop {
if(frame == 60) { CreateShot01(etc...); } // if frame has reached 60, fire.
frame++; // keep increasing frame by 1 each loop
if(frame == 60) { frame = 0; } // if frame has reached 60, reset it to 0.
}

MainLoop style scripting
-------------------------------------------------------------------------------------------
Task-based scripting

@Initialize {
fire; // launch task fire.
}

@MainLoop {
yield; // required to make the engine "look for" other tasks to perform
}

function wait(w) { loop(w) { yield; } } // a function to "hold" the task/action.

task fire {
loop {
CreateShot01(etc...); // fire
wait(60); // "hold" for 60 frames (1second) before looping.
}
}

The above does require "sense" of understanding what is going on. Just adapting a style isn't enough if you don't understand why you would pick or do it like this. While tasking method looks overwhelming, personally, I find it more flexible and keeping the overview.

Function wait is nothing more than a "tool" to provide a number for the number of frames you want to "delay/hold" something. You're telling the engine to stop that specific task/action for x-number of frames. 60 frames equals 1 second if your game runs stable. You could do wait(120); for shooting every 2 seconds. You could do wait(30); for firing every 0.5 seconds.

You spoke of "firing everything at once" and "firing one by one". Let me show you simple example of this in tasking method.

Code: [Select]
task fire {
loop(10) {
CreateShot01(etc...);
}
}

task fire {
loop(10) {
CreateShot01(etc...);
wait(10);
}
}

See the difference? In the first one all bullets are fire immediately, making it look as if it is only one bullet. False, there are 10 bullets but just on top of each other because we provided no delay. Second one, however, has wait(10) added, meaning it will play the loop 10x with with a 10-frame delay. Now we can clearly note the loop being executed 10x.
« Last Edit: June 30, 2013, 03:51:41 PM by Helepolis »

Darkness1

  • Nothing to see here.
  • Enigmatic, isn't it?
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #52 on: June 30, 2013, 05:57:52 PM »
Pretty much what Hele said and personally, tasking is most flexible.

To do the delay for setshotdata, you would either use a variable for the bullet loop which resets once the loop ends or, as I would do, utilize the variable that comes with using ascent loops. For the delay value, a set value decreasing after each shot would do the trick. If the decreasing value is equal to the delay between each shot, they would all activate at once. Example:
Code: [Select]
task fire{
loop{
wait(200);
ascent(var in 0..20){
wait(3);
ascent(i in 0..4){
//setshotdata code using something like;
//100-var*3 for the activation time
}}

}}

KuroArashi100

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #53 on: June 30, 2013, 07:47:31 PM »
Thanks for the help with the bullet delaying!
I'm still trying to get used to Danmakufu, (and I have, except for some very simple  visual basic scripts, no experience with programming languages)
so every bit of help is greatly appreciated.
In the same way, I'm still trying out both methods of scripting, and I haven't really chosen for one of them yet.
For instance, the only spellcard I have currently tried to make, uses both methods:

http://pastebin.com/CegDWB41

For some reason, when I wanted to change something, the bullets that should show up at the sides didn't appear.(These where scripted in the fire task)
I wasn't able of making a spellcard from scratch, so a lot of the code is copied from Helepolis's video tutorials.
I cannot figure out what causes the bullets not to appear, so could anyone help me with this?
Also I'm sorry for asking so many questions, of which at least one could have been solved with a little more thinking from me instead of asking for help relatively quickly.

Shadow

  • Forever waiting for tomorrow
  • ...
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #54 on: June 30, 2013, 08:15:30 PM »
That would be because there is no yield in your MainLoop, there. Remember that tasking requires for a yield to exist there, otherwise nothing will work correctly~

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #55 on: June 30, 2013, 08:16:01 PM »
That would be because there is no yield in your MainLoop, there. Remember that tasking requires for a yield to exist there, otherwise nothing will work correctly~

More specifically, no tasks will work if there is no yield; in @MainLoop

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #56 on: July 12, 2013, 01:54:57 AM »
http://pastebin.com/b8dshugx

based on that script, after the bullet make a rotation and go in again.. how to make the bullet multiplicate itself ?

Thank You

Validon98

  • Deathguard Night Sparrow
  • *
  • Harbingers, yo.
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #57 on: July 12, 2013, 03:18:14 AM »
I'm not a mod or anything, but, uh, wrong subforum. You'd want to ask in Rika and Nitori's Garage Experiments. They have a thread for questions on Danmakufu.
Derping at Touhou since June 2012, derping at RPing Touhou since Feburary 2013.

Devil of Decline Partial English Gameplay Patch!
Let's Play Nightmare of Rebellion!

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #58 on: July 12, 2013, 07:16:47 PM »
Hi. I'm Tres.

I can load danmakufu and play scripts without problems, but whenever I complete a script the system will crash. I've never used v 0.12 very extensively, but I'm pretty sure this isn't supposed to happen. The system will crash after I beat a spell card, die, or whenever a coding error occurs. Any time I would normally be redirected to the script choice page (at least, I assume that's where I'd be redirected. That's how it works in ph3 ^^). I'm running the latest version of 0.12 (東方弾幕風 v0.12m(約4000kB)) using Applocale. The problem occurs with every script I've tried, including the built in ones (Ex Rumia). With plural scripts, I can complete individual spellcards but the system crashes once the entire script is complete. I've tried re-downloading danmakufu from a different source, but that doesn't seem to help either.

Any help would be much appreciated. Thank you in advance.
My name is Tres. It sounds like "Tray". Tressert is "Tray-zurt"; like Tres dessert.
I've cleared every touhou game on Lunatic, and beaten every extra except SoEW.
NMNB: MoF Hard, SA Extra, UFO Extra

Darkness1

  • Nothing to see here.
  • Enigmatic, isn't it?
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #59 on: July 12, 2013, 08:19:30 PM »
http://pastebin.com/b8dshugx

based on that script, after the bullet make a rotation and go in again.. how to make the bullet multiplicate itself ?

Thank You

Short answer: create another ID bullet with CreateShotA and then use AddShot to fire it with the ID1 bullet.

Yes, this should be moved to the danmakufu 0.12m ask thread on rika nitoris. Answers won't really be found here, but in the ask thread there's lots of people willing to help with questions about scripting.
« Last Edit: July 14, 2013, 01:58:50 AM by Helepolis »