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

Pruns

  • Dearest wish, hide this stupid nickname set below
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #210 on: June 08, 2016, 08:56:35 PM »
You forgot to yield in your @MainLoop.

Wait ... really !?
Now it works !
I've never included any   "yield" in my mainloop scripts. I'm going to correct that.
Thanks you very much !

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #211 on: June 09, 2016, 04:28:04 AM »
Wait ... really !?
Now it works !
I've never included any   "yield" in my mainloop scripts. I'm going to correct that.
Thanks you very much !

We all probably forgot to place a yield; in our @MainLoop at least once.
Lunatic 1CCs: PCB, IN, PoFV, HSiFS
Extra: All except PC-98.

Oh hey look I can do DNH scrips.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #212 on: June 09, 2016, 05:20:56 AM »
I've never included any   "yield" in my mainloop scripts. I'm going to correct that.
That is because as soon as you're using tasking and threading, you always need to. In your script, you're using a combination of mainloop and tasking, so you need to yield your mainloop.

To explain more precisely:
At #161 you're invoking a while loop which is a way of tasking/threading. That section will never get a chance to run. The MainLoop is the first thread being launched when your script loads. Yielding MainLoop allows the engine check for any other tasks/threads to run/execute.

task TEnd at #130 is not a thread as it contains no loop. It is more like a method with a plain if-statement. And that method is called within the MainLoop, so it will execute.

task change(papilion) is called from Bullet in #153 and Bullet is again called from the MainLoop. The bullet will appear fine. Each bullet will also successfully call its change(papilion) task, but none of these will ever run/execute because the MainLoop doesn't allow it.

Not sure if this is a good way to say it but the @MainLoop is very greedy. Unless yielded once, it will remain greedy the entire time.

Edit2
Each individual's own choice, however the confusion and incoherence MainLoop-style scripting brings along makes it not advisable to use as a scripting style. There are simply no advantages. Only confusion and awkward timing code with statements and such.
« Last Edit: June 09, 2016, 10:24:49 AM by Helepolis »

Pruns

  • Dearest wish, hide this stupid nickname set below
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #213 on: June 09, 2016, 11:45:18 AM »

To explain more precisely:
At #161 you're invoking a while loop which is a way of tasking/threading. That section will never get a chance to run. The MainLoop is the first thread being launched when your script loads. Yielding MainLoop allows the engine check for any other tasks/threads to run/execute.

task TEnd at #130 is not a thread as it contains no loop. It is more like a method with a plain if-statement. And that method is called within the MainLoop, so it will execute.

task change(papilion) is called from Bullet in #153 and Bullet is again called from the MainLoop. The bullet will appear fine. Each bullet will also successfully call its change(papilion) task, but none of these will ever run/execute because the MainLoop doesn't allow it.


I see...
I understand now why my previous scripts worked without any yield in their mainloop.
it is way clearer in my mind.
Thank you for your explanations

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #214 on: June 23, 2016, 12:30:36 AM »
Hello!

I wasn't sure if this merited a new thread or not, so I apologize if I've put this in the wrong place... what are some good example scripts a beginner can look at to see certain patterns and techniques in action?  I'm particularly interested in seeing spell cards or full bosses with cut-ins and text because I haven't really seen how to do those (I've checked a few tutorials and it's slowly coming together for me, but I'm still really weak on scripting). Thanks!

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #215 on: June 23, 2016, 03:12:11 PM »
Hello!

I wasn't sure if this merited a new thread or not, so I apologize if I've put this in the wrong place... what are some good example scripts a beginner can look at to see certain patterns and techniques in action?  I'm particularly interested in seeing spell cards or full bosses with cut-ins and text because I haven't really seen how to do those (I've checked a few tutorials and it's slowly coming together for me, but I'm still really weak on scripting). Thanks!

If you want script recommendations, the question is whether you want visuals or code. If you are more interested in seeing the danmaku, the gold standard is the official Touhou games, but there are many Youtube channels out there (mine, ExPorygon/Ozzie840's, AJS's, etc.) that feature danmakufu scripts.

If you're looking for actual code, then it gets harder to recommend scripts simply because everyone has a different coding style and not everyone adheres to recommended guidelines (e.g. effective use of whitespace, logical variable names, etc.). That said, I would suggest the more recent scripts of experienced danmakufu scripters. The issue there is that they may have custom systems that may obscure what is being written, but the danmaku itself should be relatively easy to decode.

Pruns

  • Dearest wish, hide this stupid nickname set below
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #216 on: June 30, 2016, 09:12:01 PM »
Hello everyone !

I would like to use the function : "SetScriptArgument" in order to transfer some variables from a script to another, but due to my bad english, I have a lot of troubles for understanding how it works.

I've loaded my script, used setScriptArgument and then startScript like the wiki says :

Code: [Select]
let idScript = LoadScript (pathToScript);
SetScriptArgument(idScript, 2, var);
StartScript(idScript,var);

// But since StartScript has only 1 argument, I've also tried

let idScript = LoadScript (pathToScript);
SetScriptArgument(idScript, 2, var);
StartScript(2);

But nothing work, I tried other combinations and I've looked up for more explanations about this function but I didn't found anything else than danmakufu wiki.
If someone can explain me how this function works, I would be grateful.

Edit : I mean, this argument is a bgm, otherwise, I would have used commondata

Thanks in advance !
« Last Edit: June 30, 2016, 10:35:14 PM by Pruns »

FlareDragon

  • Gensokyo's Infernal Hellstorm
  • When will you come to Gensokyo, Satsuki Rin?
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #217 on: June 30, 2016, 11:42:11 PM »
Hello everyone !

I would like to use the function : "SetScriptArgument" in order to transfer some variables from a script to another, but due to my bad english, I have a lot of troubles for understanding how it works.

I've loaded my script, used setScriptArgument and then startScript like the wiki says :

Code: [Select]
let idScript = LoadScript (pathToScript);
SetScriptArgument(idScript, 2, var);
StartScript(idScript,var);

// But since StartScript has only 1 argument, I've also tried

let idScript = LoadScript (pathToScript);
SetScriptArgument(idScript, 2, var);
StartScript(2);

But nothing work, I tried other combinations and I've looked up for more explanations about this function but I didn't found anything else than danmakufu wiki.
If someone can explain me how this function works, I would be grateful.

Edit : I mean, this argument is a bgm, otherwise, I would have used commondata

Thanks in advance !
The way that SetScriptArgument works is:
-You give the script the value using SetScriptArgument
-You start the script as normal
-You then retrieve the variable in the started script
That is:
Code: [Select]
//First script
let idScript = LoadScript (pathToScript);
SetScriptArgument(idScript, 2, var);
StartScript(idScript);

//Second script (the one you just started)
let newvar = GetScriptArgument(2);
//Then you can just use it as normal
PlayBGM(newvar);
As you can see, the new script is passed the variable which you can access using GetScriptArgument.
Hope this helps
Normal 1CC's: SoEW, LLS, MS, EoSD, PCB, IN, PoFV, MoF, SA, UFO, GFW, TD, HM, DDC, ULiL, LoLK(PD), CtC |IaMP|
Hard 1CC's: EoSD, PCB, MoF, IN(B), TD, LoLK(PD), |???|
Lunatic 1CC's: None
Extra 1CC's: SoEW, MS, EoSD, PCB, IN, PoFV, MoF(NB), SA, UFO, GFW, TD, DDC, CtC, LoLK, |???|

Pruns

  • Dearest wish, hide this stupid nickname set below
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #218 on: July 01, 2016, 01:02:45 PM »
The way that SetScriptArgument works is:
-You give the script the value using SetScriptArgument
-You start the script as normal
-You then retrieve the variable in the started script
That is:
Code: [Select]
//First script
let idScript = LoadScript (pathToScript);
SetScriptArgument(idScript, 2, var);
StartScript(idScript);

//Second script (the one you just started)
let newvar = GetScriptArgument(2);
//Then you can just use it as normal
PlayBGM(newvar);
As you can see, the new script is passed the variable which you can access using GetScriptArgument.
Hope this helps

It works perfectly, thanks for your help !

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #219 on: July 03, 2016, 03:44:57 AM »
How can I correctly display multiply shaders in a single scene?
http://imgur.com/A4UIXEC

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #220 on: July 03, 2016, 04:00:33 AM »
To begin with, shaders cannot overlap on a particular pixel on a particular priority.

In my version of the inversion shader (link), I just stored a ton of variables inside the same HLSL file and checked if the distance between the given pixel was inside the certain of each point. In the example I only have 2 points being checked.

If you wanted to be really inefficient, you'd probably render to one render target, render the shaded stuff to another render target, shade that render target, and so on for each shader, but of course that would be way too much on the engine now, wouldn't it.

I think the best way would be to store points and radii into an array, checking for the distance between each point, but I had a couple problems with that for some unknown reason. It's as if some of the values just simply were not stored (they seemed to reset to zero mysteriously). If you can get this method to work properly, let me know.
« Last Edit: July 03, 2016, 04:07:55 AM by Chronojet ⚙ Dragon »

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #221 on: July 04, 2016, 03:59:41 AM »
Hello!
I'm a beginner in danmakufu and I have a problem. I'm getting the error "@ cannot use in inner function and task." This error has something to do with the @Finalize part. However, I do not know what to fix about it or how to fix this error. This is my script:
http://pastebin.com/MZwYfjHW

(I have put your large paste in pastebin --Hele)
« Last Edit: July 04, 2016, 05:47:33 AM by Helepolis »

Uruwi

  • Nightmare of Torrential Precipitation
  • 478 million goober
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #222 on: July 04, 2016, 05:00:59 AM »
You missed the brace that was supposed to close TaskA.
foo = foldl $ flip ($)
Highest difficulty 1CCed for each game, by shot type in the original order. (-: never 1CCed on any difficulty, or never used; E: easy, N: normal, H: hard, L / U: lunatic / unreal.)
EoSD [NNNE] PCB [EE--N-] IN [NEEE + Ex Border] PoFV [Mystia N, Mystia E no charge] MoF [EN--H- + Ex Marisa B] SA [N-----] UFO [----EN] TD [NENE] DDC [EE-EHE + Ex Marisa B & Sakuya A] LoLK [PD --N- Legacy ---N] EE [N- + Ex Yabusame] EMS [N-- + Ex Yabusame] RMI [NHN + Ex YaoSuku]
Avelantis (demo) Easy YuukiB 426,077,200

FlareDragon

  • Gensokyo's Infernal Hellstorm
  • When will you come to Gensokyo, Satsuki Rin?
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #223 on: July 04, 2016, 05:21:46 AM »
^^^^

Okay. What's immediately wrong is you're missing a few "}" at the end of TaskA. However, there's something more glaring:
--Your MainLoop is starting a loop (MainLoop --> MainTask --> TaskA (which has a loop)). Not bad on its own, but TaskA's loop goes on while the boss is alive. This creates a HUGE number of loops
--The "while" loop in TaskA doesn't yield (though it looks like you were intending for it to). If you have a loop that doesn't yield, Danmakufu freezes. Every loop either needs to loop a specified number of times or yield

I will give you some suggestions, but I would like to know what your intentions were.
Code: [Select]
...
...
@Initialize{
   objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
   ObjEnemy_Regist(objBoss);
   ObjEnemyBossScene_StartSpell(objScene);
   ObjPrim_SetTexture(objBoss, imgExRumia);
   ObjSprite2D_SetSourceRect(objBoss, 64, 1, 127, 64);
       ObjSprite2D_SetDestCenter(objBoss);
   ObjMove_SetDestAtSpeed(objBoss, 82, 100, 100);
   
   //Instead of starting your MainTask in @MainLoop, you should start it in @Initialize and make MainTask loop
   MainTask;
}   
@MainLoop{
   bossX = ObjMove_GetX(objBoss);
   bossY = ObjMove_GetY(objBoss);
   yield;
} <--- Insert here

task MainTask{
   //Rather than looping in fireA, you shoudl loop here and have MainTask call fireA each time
   while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){ <---Move from "fireA"
      let wait = 120;  //What is this for? For now, let's make it loop "wait" amount of frames with the next line:
      loop(wait){yield;}  //One of the greatest bits of code you'll use in Danmakufu. Remember it
      fireA;
   }

   task fireA{
      let angleT = 0;
      loop(30){
         CreateShotA1(bossX + 90*cos(angleT), bossY + 90*sin(angleT), 2, angleT, 1, 0);
         angleT += 360/30;
      }
   }
} <---Insert here
...
...

If you have any questions about this, go right ahead and ask
Normal 1CC's: SoEW, LLS, MS, EoSD, PCB, IN, PoFV, MoF, SA, UFO, GFW, TD, HM, DDC, ULiL, LoLK(PD), CtC |IaMP|
Hard 1CC's: EoSD, PCB, MoF, IN(B), TD, LoLK(PD), |???|
Lunatic 1CC's: None
Extra 1CC's: SoEW, MS, EoSD, PCB, IN, PoFV, MoF(NB), SA, UFO, GFW, TD, DDC, CtC, LoLK, |???|

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #224 on: July 04, 2016, 10:19:26 PM »
Thank you everyone and especially to you, Flare Dragon! To be honest, I'm not sure what my intentions are because I have limited ideas about while loops. I was just doing a tutorial from Sparen's Danmakufu ph3 site. The reason I put the while loop in is because it's something common on all of Sparen's tutorials.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #225 on: July 06, 2016, 06:52:00 AM »
Even though, you should understand why or when a while-loop is used. Don't use it because it is common appearance or not. This is also a major problem with people trying to combine tasking method with the MainLoop and such.

A while-loop is the same as a regular loop { } except you must give it a condition. As in: "While this condition is true, keep looping my piece of code between the { }"

Code: [Select]
// Plain loop which runs as long as the script is active. Delay is 1 frame at the end of the loop.
loop {
CreateShotA1(....);
yield;
}

// Plain loop which runs 10 times. Delay is 1 frame at the end of the loop.
loop(10) {
CreateShotA1(....);
yield;
}

// A while loop which will execute as long as the bossObj is NOT deleted (alive). Delay is 1 frame at the end of the loop.
while(!Obj_IsDeleted(bossObj)) {
CreateShotA1(....);
yield;
}

// A while loop which will execute as long as 'counter' is smaller than 10. Each loop, 'counter' is increased by 1. Delay is 1 frame at the end of the loop.
let counter = 0;
while(counter < 10) {
CreateShotA1(....);
counter++;
yield;
}

About yielding loops
As FlareDragon mentioned, a yield; at least once is mandatory for most conditional loops or plain loop to avoid freezing. A loop(10) { }  or while(counter < 10) { } will NOT freeze your danmakufu if you don't yield it. If you don't yield, it means both loops will immediately execute 10x within the same frame. Or in other words: It will fire 10 bullets on top of each other, making it look as if 1 bullet got fired.

If you don't use a yield here, you must increment counter within the loop. If you remove counter++ from the loop, and it has no yield, it will freeze dnh.

About the @MainLoop
The @MainLoop won't cause freezing if not yielded. However, when you want to use tasking and multi-threading method, you must yield the @MainLoop. The reason for this I have explained it few posts above.
« Last Edit: July 06, 2016, 06:48:53 PM by Helepolis »

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #226 on: July 13, 2016, 07:06:13 PM »
Hello again!
How can I make sure all my fonts are installed correctly at the start of my script?
Lunatic 1CCs: PCB, IN, PoFV, HSiFS
Extra: All except PC-98.

Oh hey look I can do DNH scrips.

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #227 on: July 13, 2016, 08:19:12 PM »
Hello again!
How can I make sure all my fonts are installed correctly at the start of my script?

Say you had an array of paths to your font files.
Code: [Select]
let fontstoload = ["path1", "path2", "etc"];
What you'd want to do is check while loading each font, and use a flag to indicate the failure of any font loading.
Code: [Select]
let checkloadedfont = true;
ascent(nF in 0..length(fontstoload)) {
    if(! InstallFont(fontstoload[nF])) {
        checkloadedfont = false;
        // do other things here as well, for example, giving a visual notification that a particular font failed.
    }
}

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #228 on: July 13, 2016, 08:45:00 PM »
Just to clarify, InstallFont itself returns true/false depending on if the font actually loaded properly.

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #229 on: July 13, 2016, 10:35:55 PM »
I'm trying to make my own point item from scratch, I can draw the sprite, but I can't get the object to move at all or set it's position.

Code: [Select]

task MagicPoints(x,y){

// Randomly chooses one of the four sprites form the sprite sheet.
let ex = rand2(128,128+32);
let ey = rand2(0,32);

let path = GetCurrentScriptDirectory() ~ "img/sprite/items.png";
let obj = ObjPrim_Create(OBJ_SPRITE_2D);
ObjPrim_SetTexture(obj, path);
ObjMove_SetPosition(obj,x,y);  // Doesn't work
Obj_SetRenderPriority(obj, 100);
ObjSprite2D_SetSourceRect(obj, ex, ey, ex+32, ey+32);
ObjSprite2D_SetDestRect(obj, ObjMove_GetX(obj), ObjMove_GetY(obj), ObjMove_GetX(obj)+32, ObjMove_GetY(obj)+32);

ObjMove_SetSpeed(obj,2); // Doesn't work
ObjMove_SetAngle(obj,90); // Doesn't work

loop{

// When the player gets close to the item it's deleted and the item count is updated.
if(ObjecttoPlayer(obj) <= 4){
//PlaySound(shot1);
Scores += 1;
Obj_Delete(obj);
}
yield;
}
}

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #230 on: July 13, 2016, 10:37:52 PM »
I'm trying to make my own point item from scratch, I can draw the sprite, but I can't get the object to move at all or set it's position.

Code: [Select]


You cannot use ObjMove functions on a Render object. Consider using ObjRender functions to set the position or use a custom item script instead.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #231 on: July 13, 2016, 11:23:12 PM »
I'm having this issue where my laptop can't read(?) player scripts that I download. Not sure if this is for any custom player script or just certain ones, since the default Rumia player script works just fine. These player scripts work on my desktop however, and both have their system locale set to Japanese. They simply don't show up on the list of player scripts when I open up the Danmakufu program, and when I use the DnhViewer, I can't interact with anything and I'm forced to close it and move my custom player scripts elsewhere and stick with the Rumia script when I work on my laptop. My Danmakufu folder is kept on a flashdrive so it's gotta be the computer's fault. I haven't made my own player script yet, as I'm just playing around with the engine, getting a feel for it, so I'm temporarily using this Mountain of Faith Reimu script someone made ( http://www.bulletforge.org/u/frenticpony/p/player-re-creation-project-mof-reimu ).
I haven't tried using AppLocale, just changed the system locale, but I don't see how that'd make a difference since I do the same on my desktop. Both are Windows 7.
UPDATE: Maybe related to the files in the player script folder? Found out that an .ogg file in my own script folder was causing DNHViewer to freeze up just like with the player scripts. Still can't quite narrow it down myself. I tried removing the sound library and SE folder for the Reimu script and that didn't work, so I dunno.
« Last Edit: July 13, 2016, 11:40:35 PM by netugi »

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #232 on: July 13, 2016, 11:41:09 PM »


object hierarchy for reference

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #233 on: July 14, 2016, 12:55:52 AM »
Thank you all! I didn't know InstallFont returns a boolean.  (Thay may or may not actually be basic programming knowledge :V)
Lunatic 1CCs: PCB, IN, PoFV, HSiFS
Extra: All except PC-98.

Oh hey look I can do DNH scrips.

Uruwi

  • Nightmare of Torrential Precipitation
  • 478 million goober
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #234 on: July 14, 2016, 04:11:51 AM »
I'm having this issue where my laptop can't read(?) player scripts that I download. Not sure if this is for any custom player script or just certain ones, since the default Rumia player script works just fine. These player scripts work on my desktop however, and both have their system locale set to Japanese. They simply don't show up on the list of player scripts when I open up the Danmakufu program, and when I use the DnhViewer, I can't interact with anything and I'm forced to close it and move my custom player scripts elsewhere and stick with the Rumia script when I work on my laptop. My Danmakufu folder is kept on a flashdrive so it's gotta be the computer's fault. I haven't made my own player script yet, as I'm just playing around with the engine, getting a feel for it, so I'm temporarily using this Mountain of Faith Reimu script someone made ( http://www.bulletforge.org/u/frenticpony/p/player-re-creation-project-mof-reimu ).
I haven't tried using AppLocale, just changed the system locale, but I don't see how that'd make a difference since I do the same on my desktop. Both are Windows 7.
UPDATE: Maybe related to the files in the player script folder? Found out that an .ogg file in my own script folder was causing DNHViewer to freeze up just like with the player scripts. Still can't quite narrow it down myself. I tried removing the sound library and SE folder for the Reimu script and that didn't work, so I dunno.

Make sure you have ph3 .1 [pre6a] instead of ph3 .0.
foo = foldl $ flip ($)
Highest difficulty 1CCed for each game, by shot type in the original order. (-: never 1CCed on any difficulty, or never used; E: easy, N: normal, H: hard, L / U: lunatic / unreal.)
EoSD [NNNE] PCB [EE--N-] IN [NEEE + Ex Border] PoFV [Mystia N, Mystia E no charge] MoF [EN--H- + Ex Marisa B] SA [N-----] UFO [----EN] TD [NENE] DDC [EE-EHE + Ex Marisa B & Sakuya A] LoLK [PD --N- Legacy ---N] EE [N- + Ex Yabusame] EMS [N-- + Ex Yabusame] RMI [NHN + Ex YaoSuku]
Avelantis (demo) Easy YuukiB 426,077,200

Junky

  • Just Another Scripter
  • *external screams*
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #235 on: July 16, 2016, 04:10:04 PM »
I'm trying to work on a player with Youmu's option style from Ten Desires or Marisa's type A from Mountain of Faith. I have no clue how to get them to move like they do in the games. Any help? q-q
Anyone can be amazing at danmakufu. I believe in you! Push yourself to become the greatest!

(One day I'll become the greatest danmakufu scripter that there ever was.
...
...Got a LOOOOOOOOOOOOOOOOOONG way to go.)

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #236 on: July 17, 2016, 12:46:46 AM »
I actually did exactly this a few pages back for somebody else. Cheers.

https://www.shrinemaiden.org/forum/index.php/topic,19249.msg1246153.html#msg1246153

EDIT: um hello?
« Last Edit: July 22, 2016, 01:32:02 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 #237 on: July 22, 2016, 01:13:12 AM »
Hello again! I'm trying to create a circle of bullets that, after traveling forward for a number of frames, reverses direction and keeps going in the reversed direction. However, what I'm getting is more like a spiral due to how it forms and also how one side of bullets reverses before the other. Here's my code (it's supposed to be based on the bullet command tasks Sparen uses in the tutorial):

Code: [Select]
task OscReverse(obj){
wait(80);
ObjMove_SetSpeed(obj, -2);
}


task OscillateA{
while(ObjEnemy_GetInfo(objBoss,INFO_LIFE) > 0){
let angleT = GetAngleToPlayer(objBoss);
loop(13){
ascent(i in 0..3){
let obj = CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 1.5 - i/6, angleT, DS_BUTTERFLY_RED + i, 5);
OscReverse(obj)
}
angleT += 360/13;
yield;
}
wait(120);
}
}

How can I fix this to make it more circle and less spiral?

Thank you!

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #238 on: July 22, 2016, 01:37:10 AM »
Don't yield between the angle changes. That waits a frame between each three bullet group and so bullets around the circle will spawn (and reverse) later.

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #239 on: July 23, 2016, 08:50:08 AM »
I'm working on a custom pause menu, but there are two things I can't get working.
  • Including a file of standard tasks and functions, I get an error saying ObjMove_GetX is not defined in the file I'm trying to have included.
  • Trying to get the player's current life, I get GetPlayerLife is not defined.

GetPlayerLife and ObjMove_GetX are both standard functions, so I don't understand why having them called in menu script is causing problems.



Also I've got a simple item that can execute some commands when you collect it, but since it only checks if the item is deleted the same event will happen if it falls off-screen. How can I check if the item has been collected by the player?

Code: [Select]
task LifeItem(x,y){
let obj = CreateItemU1(1,x,y,0);
while(!Obj_IsDeleted(obj)){yield;}
PlaySE(shot1);
LifeFragment += 3;
}
« Last Edit: July 23, 2016, 10:44:19 AM by arch »