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

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #690 on: July 05, 2017, 10:40:19 PM »

I took a brief look at some of your code - note that this is not a thorough code review. I'll just dump what I found here:

Plural.txt
-SetPlayerRebirthLossFrame() is usually used in Player Scripts, and is generally not done in single/plural/stage scripts.
-CloseStgScene() is generally not used in Plural Scripts. If you had placed it anywhere other than the very last line of execution, things may have gone horribly wrong (then again, don't know, don't exactly need to know).
-SetCommonData("scene",obj); - Get rid of this. You can get the boss scene using a function - GetEnemyBossSceneObjectID();
-Your #Background script #Background["./system/Background_Stars.txt"] does not exist

Resources.txt
-SetScore, etc. confuse the heck out of me. I have no idea what you're trying to do.

Start.dnh
-You run ObjSound_Load(music,CSD ~ "./bgm.ogg") outside of a routine. Since loading the resource should be blocking, I suggest placing the loading in a routine, preferably @Loading.
-You register new boss objects twice in the same script - once in @Initialize and once in @MainLoop at frame 0. Given that you are only supposed to be able to have one in existence at any given time, this may cause problems (then again, never tested so don't know the repercussions, if there are any to begin with)
-Your entire frame = 0 block makes no sense given that @Initialize runs immediately before the first run of @MainLoop. DRY - Don't Repeat Yourself
-Honestly, just terminate the script when the frame >= 90 instead of doing a workaround of using the boss's health.
-Your @MainLoop is not yielded. Literally everything in this script will crash and burn.

In general:
-None of your wait scripts are properly yield;ed so all of them will suffer from the same problems as the Start script.
-In all of your attack singles, your including of Resources.txt followed by blatant DRY violation with the definition of the same functions over and over again in your MainLoops worries me. Functions are limited by scope, but if you are using the same functions over and over again, just put them in your function library once and include the library. This will make your code cleaner and easier to read.
-Your redeclaration of the global constants cx and cy as local variables everywhere in your code only impedes readability.

I'm not meaning to be harsh, but if you do some code cleanup, it will be MUCH easier to find the actual errors in your script. Since the wiki is down, I suggest looking at other starter scripts (scripts where it was the second or third time someone made a proper script) - these will provide a good reference without being too bogged down in custom systems. Choose ones that are simple in scope, like some of the former contest entries that scored in the upper two-thirds.

Hope this helps.

Jimmy

  • Shameless spender
  • gaining big pounds
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #691 on: July 05, 2017, 10:48:08 PM »
Back here with a somewhat complicated issue I'm trying to deal with:

So, what I've been wanting to make is: spawning multiple familiars on the boss and them have them move in a circular path around her while they keep going outward and then stop at a certain distance from her. At that moment, they should start shooting bullets towards the boss.

I'm using two while-loops, one in another, with the inner one to control the familiars' movement before they reach the specified distance from the boss, and the outer (main) one to control their movement once they reached the specified distance until the script closes. Both loops are being yielded. The familiars should remain idle before reaching that distance and only start shooting once the inner loop is completed. I've inserted the task for shooting these bullets within the outer loop, so it could keep track of the exact distance between the familiars and the boss, because: once the bullets traversed that distance, they should each spawn a new bullet with the same movement angle as its parents, with the latter being deleted immediately after the spawning.

The problem I have herewith is, when the familiars reach the firstly mentioned distance from the boss, only one of the familiars starts shooting, no matter how many I spawn. On top of that, I somehow can't influence the delay between the shots. The parent bullets do spawn the child bullets at the desired location.

No error messages, freezes, and crashes.

Here's the script and a screencap for closer looks since my description could be inaccurate.

[attach=1]


Any idea where I could've flopped?
Normal 1cc: EoSD, PCB, IN, PoFV, MoF, UFO, TD, DDC, LoLK Legacy, HSiFS, WBaWC
Hard 1cc: IN, DDC, HSiFS
Extra clears: MoF, DDC, HSiFS, WBaWC

Goals: Going Extra Hard!

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #692 on: July 06, 2017, 12:17:23 AM »

I personally have tasks for each familiar. Each gets passed an ID (so if there are 6 familiars, the IDs are 0..5). That ID determines their angle offset.

Start with radius 0. In the main familiar loop, while radius < x, radius ++. Also give the familiar task a counter, which goes up each frame.

If radius > x && objcount % number == 0, fire bullet at boss (which will be at angle ID * 360/numinring + 180 + objcount*rotation, probably). Something like that.

EX:

Code: [Select]
task Familiar(ID, numinring, targetradius, timetotargetradius, rotation) {
    let objcount = 0;
    let radius = 0;
    //Create the familiar
    ObjMove_SetPosition(obj, ObjMove_GetX(objBoss), ObjMove_GetY(objBoss));
    while (!Obj_IsDeleted(objBoss)) {
        if (radius < targetradius) {radius += targetradius/timetotargetradius;}
        let ang = ID * 360/numinring + objcount * rotation;
        ObjMove_SetPosition(obj, ObjMove_GetX(objBoss) + radius*cos(ang), ObjMove_GetY(objBoss) + radius*sin(ang));
        if (radius >= targetradius && objcount % 6 == 0) {
            //Bullets.
        }
        objcount += 1;
        yield;
    }
}

This assumes rotating familiars. I haven't actually run it, so it might be buggy.

Andi

  • World's Gayest Danmaku
  • PlaySE("./se/Nyaa.wav");
    • 2hu blog
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #693 on: July 06, 2017, 12:46:56 AM »
-Your #Background script #Background["./system/Background_Stars.txt"] does not exist

Well, it's been working, so I'm fairly sure it exists. You might have been looking in default_system instead of system.

-SetScore, etc. confuse the heck out of me. I have no idea what you're trying to do.
Yeah, I have no idea how those are supposed to work either, they're from the script I started working from (Junko teaches Danmakufu). At first glance they look like they're intended to replace some of the cases in @Event, but then you look closer and it doesn't make any sense.

-You run ObjSound_Load(music,CSD ~ "./bgm.ogg") outside of a routine. Since loading the resource should be blocking, I suggest placing the loading in a routine, preferably @Loading.

Is there documentation on these routines anywhere? I haven't been able to find any.

-You register new boss objects twice in the same script - once in @Initialize and once in @MainLoop at frame 0. Given that you are only supposed to be able to have one in existence at any given time, this may cause problems (then again, never tested so don't know the repercussions, if there are any to begin with)
That was a janky attempt to make sure it was definitely defined. The function checks if there's already a boss before making a new one, so it wasn't causing extra problems, but it didn't work so I was going to remove it later anyway.

-Your entire frame = 0 block makes no sense given that @Initialize runs immediately before the first run of @MainLoop. DRY - Don't Repeat Yourself
I thought that seemed weird, but some tutorial or other had it that way and mentioned that tasks execute parallel with what called them, so I shrugged and did it that way, since I couldn't find documentation on exactly how those routines work.

-Your @MainLoop is not yielded. Literally everything in this script will crash and burn.

WOW okay when did that happen. There definitely used to be a yield there. I'm not sure what specifically I was doing at the time but I'm guessing it got removed at some point when I was replacing some unnecessary thing or other down there from a bunch of singles. Now that that's fixed I'm back to getting a nice, friendly "you are using a variable that has not been set yet".

-In all of your attack singles, your including of Resources.txt followed by blatant DRY violation with the definition of the same functions over and over again in your MainLoops worries me. Functions are limited by scope, but if you are using the same functions over and over again, just put them in your function library once and include the library. This will make your code cleaner and easier to read.
-Your redeclaration of the global constants cx and cy as local variables everywhere in your code only impedes readability.
If you do some code cleanup, it will be MUCH easier to find the actual errors in your script.

Yeah, I've been in the bad habit of making a copy of another single and working from that, which has led to "some" redundancy. Don't worry, I know how awful it is, that's a large part of the overhauls I mentioned.

Since the wiki is down, I suggest looking at other starter scripts (scripts where it was the second or third time someone made a proper script) - these will provide a good reference without being too bogged down in custom systems. Choose ones that are simple in scope, like some of the former contest entries that scored in the upper two-thirds.
I've just been using the archived version of the wiki. I have been working off of a few such scripts, but I'll look into some more. Where would I go to find former contest entries like you mentioned?

Random question - where do I edit my signature on this site? "Literally everything in this script will crash and burn" seems like a very appropriate sig.
Literally everything in this script will crash and burn.
1CC tracker

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #694 on: July 06, 2017, 07:12:56 AM »
Back here with a somewhat complicated issue I'm trying to deal with:

So, what I've been wanting to make is: spawning multiple familiars on the boss and them have them move in a circular path around her while they keep going outward and then stop at a certain distance from her. At that moment, they should start shooting bullets towards the boss.

I'm using two while-loops, one in another, with the inner one to control the familiars' movement before they reach the specified distance from the boss, and the outer (main) one to control their movement once they reached the specified distance until the script closes. Both loops are being yielded. The familiars should remain idle before reaching that distance and only start shooting once the inner loop is completed. I've inserted the task for shooting these bullets within the outer loop, so it could keep track of the exact distance between the familiars and the boss, because: once the bullets traversed that distance, they should each spawn a new bullet with the same movement angle as its parents, with the latter being deleted immediately after the spawning.

The problem I have herewith is, when the familiars reach the firstly mentioned distance from the boss, only one of the familiars starts shooting, no matter how many I spawn. On top of that, I somehow can't influence the delay between the shots. The parent bullets do spawn the child bullets at the desired location.
First thing, you shouldn't model this as a nested while loop. The whole point of what you're trying to do is have [some behaviour] until a condition, then maybe some transition, then [some other behaviour]. All you need is one while loop and then the other; the way it is now isn't immediately breaking anything, but it easily could.

The cause of the problem is likely due to the GetObjDistance and CoordToBoss functions, along with the object type RenderFamiliar returns. If GetObjDistance fails, dist is set oddly which means sdelay is also. Relatedly, if your fam objects are Render-only objects (like 2D Sprites), using functions such as ObjMove_GetX will fail, and so things in FShot that do this (such as CoordToBoss) will definitely behave wrong. Basically I wager that these sorts of things are what's screwing your idea up.

Whatever the issue is, you have clearly written too much in a short span of time without properly testing. In the future please try to test changes whenever possible so things don't end up "not working" after a slew of additions that you can't possibly keep track of.

Side note, you can avoid using Common Data to store boss crap by simply using GetEnemyBossObjectID in the necessary scripts and keep things clean.

[...] mentioned that tasks execute parallel with what called them, so I shrugged and did it that way, since I couldn't find documentation on exactly how those routines work.
Here's a post I wrote a few pages back trying to precisely (yet not formally) summarize the flow of a script:

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

This won't necessarily tell you exactly what each routine does, but knowing when they're called is more relevant since they all do basically the same thing but are used in different contexts.
« Last Edit: July 06, 2017, 07:36:41 AM by Drake »

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

Jimmy

  • Shameless spender
  • gaining big pounds
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #695 on: July 06, 2017, 09:29:18 AM »
I personally have tasks for each familiar. Each gets passed an ID (so if there are 6 familiars, the IDs are 0..5). That ID determines their angle offset.

Start with radius 0. In the main familiar loop, while radius < x, radius ++. Also give the familiar task a counter, which goes up each frame.

If radius > x && objcount % number == 0, fire bullet at boss (which will be at angle ID * 360/numinring + 180 + objcount*rotation, probably). Something like that.

EX:

...

This assumes rotating familiars. I haven't actually run it, so it might be buggy.
First thing, you shouldn't model this as a nested while loop. The whole point of what you're trying to do is have [some behaviour] until a condition, then maybe some transition, then [some other behaviour]. All you need is one while loop and then the other; the way it is now isn't immediately breaking anything, but it easily could.

The cause of the problem is likely due to the GetObjDistance and CoordToBoss functions, along with the object type RenderFamiliar returns. If GetObjDistance fails, dist is set oddly which means sdelay is also. Relatedly, if your fam objects are Render-only objects (like 2D Sprites), using functions such as ObjMove_GetX will fail, and so things in FShot that do this (such as CoordToBoss) will definitely behave wrong. Basically I wager that these sorts of things are what's screwing your idea up.

I've originally declared/registered the familiars as enemy objects, so the mixed use between the ObjMove and ObjRender functions both for the familiar object are most likely the cause of the issue. Changed ObjRender_SetPosition to ObjMove_SetPosition inside the main loop and replaced the nested loop with two if-conditions. With the counter Sparen suggested, manually setting the delay between each shot now works too.

Code: [Select]
task FamiliarControl(type,angle,dir) {
let dist = 0;
let cdist = 0;
let fdist = 160;
let pdist = 0.7;
let speed = 2.5;
let sspeed = 2;
let count = 0;
let pos = [ObjMove_GetX(Boss),ObjMove_GetY(Boss)];
let fam = RenderFamiliar(Boss,type,pos[0],pos[1],120,[0,0],true,1);

while(!Obj_IsDeleted(Boss)){
if(cdist<fdist){
cdist += pdist;
}
if(cdist >= fdist && speed > 1.25 && pdist > 0.01){
speed -= 1.25/30;
pdist -= 0.69/30;
}
if(cdist >= fdist && count%16==0){
dist = GetObjDistance(fam,Boss);
FShot(fam,dir,sspeed,(dist/sspeed));
}
count++;
cdist += pdist;
angle += speed*dir;
ObjMove_SetPosition(fam,pos[0]+cdist*cos(angle),pos[1]+cdist*sin(angle));

yield;
}
}

Thanks a bunch!
« Last Edit: July 06, 2017, 09:36:09 AM by Jimmy »
Normal 1cc: EoSD, PCB, IN, PoFV, MoF, UFO, TD, DDC, LoLK Legacy, HSiFS, WBaWC
Hard 1cc: IN, DDC, HSiFS
Extra clears: MoF, DDC, HSiFS, WBaWC

Goals: Going Extra Hard!

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #696 on: July 06, 2017, 01:22:36 PM »
Well, it's been working, so I'm fairly sure it exists. You might have been looking in default_system instead of system.
Oh, sorry. Yeah, I looked in default_system instead.

Where would I go to find former contest entries like you mentioned?
They're all on Bulletforge, for the most part. All of the "Official Thread" links on http://sparen.github.io/projects/contestdatabase.html will point to the MotK thread for each contest. All MotK contests require submitting via post in the contest thread.

Random question - where do I edit my signature on this site? "Literally everything in this script will crash and burn" seems like a very appropriate sig.
It should be in Profile, at the top of each page. You MAY need a certain number of posts to unlock the feature but I do not know the specifics.

Andi

  • World's Gayest Danmaku
  • PlaySE("./se/Nyaa.wav");
    • 2hu blog
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #697 on: July 06, 2017, 05:06:27 PM »
You MAY need a certain number of posts to unlock the feature but I do not know the specifics.
Ah, that would be it. Looked through the rules thread and it's ten, so I'll probably hit that after the next round of crashing and burning.

...Well, technically I still haven't stopped crashing and burning. It seems like something in Peaches6, the one with the janky nested orreries, was somehow responsible for the boss not being defined, no idea how, but although the game does run now, the boss just vanishes after Start without moving on to the next single. But that's a much less serious issue - probably something to do with how I moved the stuff from the boss life check to the frame==90. The other waits work fine, so worst case I can just copy one of them and strip out the spell break SE again.

Edit: Another random question, how do I get the ID of the primitive used in player scripts to draw the player? I've been playing with a card that intermittently turns everything black and white, but setting the color, blend mode, etc. of the player does nothing because that's not the object being rendered.
« Last Edit: July 06, 2017, 07:32:31 PM by gameboy17 »
Literally everything in this script will crash and burn.
1CC tracker

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #698 on: July 06, 2017, 08:09:21 PM »
Edit: Another random question, how do I get the ID of the primitive used in player scripts to draw the player? I've been playing with a card that intermittently turns everything black and white, but setting the color, blend mode, etc. of the player does nothing because that's not the object being rendered.

GetPlayerObjectID() returns the player object. Use ObjRender functions on it.

Andi

  • World's Gayest Danmaku
  • PlaySE("./se/Nyaa.wav");
    • 2hu blog
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #699 on: July 06, 2017, 09:27:04 PM »
GetPlayerObjectID() returns the player object. Use ObjRender functions on it.
That's what I've been doing, so I think it's a problem with the player script (I've been using the Mokou player from here). Tested it with some others and it works with some but not all.

Another random question - I've been meaning to start using SetAutoDeleteObject, but whenever I add it the music stops playing after the first single. Presumably this is because it's deleting the sound object, but I was under the impression that it would only delete objects created in that single, rather than in the plural. How does that work/how do I stop it?
Literally everything in this script will crash and burn.
1CC tracker

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #700 on: July 07, 2017, 05:19:17 AM »
You can't really rely on every player being drawn with only the Player object. Some scripts will just have other drawn parts and you won't be able to get those. In Python's case he seems to have created a different 2D Sprite object and draws the player using that rather than the actual Player object, for no obvious reason, but it means what you want to do is impossible.

You can accomplish the grayscale effect using shaders, but that's getting complicated.

I've been meaning to start using SetAutoDeleteObject, but whenever I add it the music stops playing after the first single.
That shouldn't happen, as long as you're not uh handling the music inside the Single.
« Last Edit: July 07, 2017, 05:24:24 AM by Drake »

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

Andi

  • World's Gayest Danmaku
  • PlaySE("./se/Nyaa.wav");
    • 2hu blog
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #701 on: July 07, 2017, 06:01:22 PM »
That shouldn't happen, as long as you're not uh handling the music inside the Single.
I've been doing it in both the single and the plural, so I don't get treated to silence whenever I'm testing a new single. Is there really no way to have it both ways?
Literally everything in this script will crash and burn.
1CC tracker

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #702 on: July 07, 2017, 07:05:00 PM »
I've been doing it in both the single and the plural, so I don't get treated to silence whenever I'm testing a new single. Is there really no way to have it both ways?

My workaround is to use #BGM for Singles and have the music play properly with Sound Objects, etc. in the Stage.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #703 on: July 07, 2017, 07:25:00 PM »
This isn't quite a problem with Danmakufu itself, but rather the dmf wiki (I hope I'm posting this in the right place)
Basically I'm getting this whenever I try to go to the wiki: https://puu.sh/wE2Hs/34731e8785.png

Am I the only one getting this?
I was looking up what this php mbstring stuff was, and it all looks like server-side issues (correct me if I'm wrong). Do I just need to wait for the people who run the servers to fix the issue?

Lollipop

  • stay woke
  • literally and figuratively dying
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #704 on: July 07, 2017, 08:09:10 PM »
This isn't quite a problem with Danmakufu itself, but rather the dmf wiki (I hope I'm posting this in the right place)
Basically I'm getting this whenever I try to go to the wiki: https://puu.sh/wE2Hs/34731e8785.png

Am I the only one getting this?
I was looking up what this php mbstring stuff was, and it all looks like server-side issues (correct me if I'm wrong). Do I just need to wait for the people who run the servers to fix the issue?

I'm fairly sure the wiki itself is down. Wait until someone fixes it, i guess  :V
Touhou 1CCS:
Hard: LLS, EoSD(NB), PCB(NB), IN, MoF, TD, DDC(NB), LoLK
Lunatic: EoSD, PCB, DDC, LoLK
Extra: LLS, EoSD, PCB(Extra&Phantasm), IN, MoF, SA, DDC, LoLK
Current Focus: 1cc SA Hard, or an Extra

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #705 on: July 07, 2017, 08:44:03 PM »
I'm fairly sure the wiki itself is down. Wait until someone fixes it, i guess  :V

Figured as such. Was just a bit confusing because it seemed like it wanted me to install those things lol. I was trying to do that and I found a rabbit hole of server gibberish...

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #706 on: July 08, 2017, 03:31:57 AM »
So I have a question in regards to loose laser hitboxes and the 'correct' way to change the direction of a loose laser.

I have observed that using ObjMove_SetAngle on a loose laser does not correctly configure the hitbox - after using the function, you can and will get hit by parts of the laser that are, well, not a part of the laser. More correctly, it would seem that the laser graphic does not match up with the hitbox.

So my question is, what is the proper way to change the angle of a loose laser in order to preserve the integrity of the hitbox as to realign with the new angle of the laser? Or is the only option to create a new laser at the point where the angle change is needed?

CrestedPeak9

  • Fangame Advocate
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #707 on: July 08, 2017, 04:03:06 AM »
So I have a question in regards to loose laser hitboxes and the 'correct' way to change the direction of a loose laser.

I have observed that using ObjMove_SetAngle on a loose laser does not correctly configure the hitbox - after using the function, you can and will get hit by parts of the laser that are, well, not a part of the laser. More correctly, it would seem that the laser graphic does not match up with the hitbox.

So my question is, what is the proper way to change the angle of a loose laser in order to preserve the integrity of the hitbox as to realign with the new angle of the laser? Or is the only option to create a new laser at the point where the angle change is needed?

I don't have an answer to this, but in the same vein, how would I spin the laser but not change its movement?
Lunatic 1cc: EoSD, PCB, IN, MoF, TD, DDC, LoLK, HSiFS, WBaWC

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #708 on: July 08, 2017, 04:25:58 AM »
I don't have an answer to this, but in the same vein, how would I spin the laser but not change its movement?

Firstly, what kind of laser (loose, straight, curve), and secondly, what do you mean by 'not change its movement'? Do you mean static base straight lasers rotating around their base?

Andi

  • World's Gayest Danmaku
  • PlaySE("./se/Nyaa.wav");
    • 2hu blog
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #709 on: July 08, 2017, 04:48:58 AM »
Basically I'm getting this whenever I try to go to the wiki
Until it's fixed, you can use an archived version of the wiki.
Literally everything in this script will crash and burn.
1CC tracker

CrestedPeak9

  • Fangame Advocate
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #710 on: July 08, 2017, 07:11:51 AM »
Firstly, what kind of laser (loose, straight, curve), and secondly, what do you mean by 'not change its movement'? Do you mean static base straight lasers rotating around their base?

I'm making a loose laser that acts like Sese's bones in Lenen: they spin about their center, but their movement isn't dependent on the 'angle' of the laser.
Lunatic 1cc: EoSD, PCB, IN, MoF, TD, DDC, LoLK, HSiFS, WBaWC

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #711 on: July 08, 2017, 07:19:53 AM »
So I have a question in regards to loose laser hitboxes and the 'correct' way to change the direction of a loose laser.

I have observed that using ObjMove_SetAngle on a loose laser does not correctly configure the hitbox - after using the function, you can and will get hit by parts of the laser that are, well, not a part of the laser. More correctly, it would seem that the laser graphic does not match up with the hitbox.

So my question is, what is the proper way to change the angle of a loose laser in order to preserve the integrity of the hitbox as to realign with the new angle of the laser? Or is the only option to create a new laser at the point where the angle change is needed?
Do you have a minimal working example? I'm not really sure what the problem is since I've never really run into this.

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #712 on: July 08, 2017, 09:58:25 AM »
My my.... this is very anooying......
I am creating some curve lasers in this script     :     https://pastebin.com/HMqXPpbr
So i'm using this shot sheet     :    Expanded shotdata ZUN style PH3, by Ozzy (ZUN original sprites)
but it didn't even looked like a curvy laser ! It's only straight ones, looked like half transparent.
But if i used all the README said the directory of #include, the script will won't appear.
I can't use the curvy laser  :( :( any help ? :)
« Last Edit: July 08, 2017, 10:16:41 AM by BananaCupcakey »
Just keep it neutral :3

Jimmy

  • Shameless spender
  • gaining big pounds
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #713 on: July 08, 2017, 11:06:05 AM »
My my.... this is very anooying......
I am creating some curve lasers in this script     :     https://pastebin.com/HMqXPpbr
So i'm using this shot sheet     :    Expanded shotdata ZUN style PH3, by Ozzy (ZUN original sprites)
but it didn't even looked like a curvy laser ! It's only straight ones, looked like half transparent.
But if i used all the README said the directory of #include, the script will won't appear.
I can't use the curvy laser  :( :( any help ? :)
You need to use ObjMove_SetAngularVelocity(obj, agv) on the curvy laser object, otherwise it will just behave like an ordinary loose laser.
The second parameter is what makes that laser curve. I'd recommend you to use values between -0.5 and 0.5 if you don't want the laser to curve too much, but this of course is entirely up to you to decide.

Also, yielding a loop (the while-loop in your MainTask here) with an implemented delay (the wait-function) can mess up the timing of when a laser is shot. If you remove the yield there, your boss will fire a curved laser every 80 frames. Removing the wait, however, would cause Danmakufu to crash, because with the yield, your boss will fire a laser every single frame which just overloads the program (that was my experience, at least). It's better to remove the yield and use wait to set the delay between each laser.
Normal 1cc: EoSD, PCB, IN, PoFV, MoF, UFO, TD, DDC, LoLK Legacy, HSiFS, WBaWC
Hard 1cc: IN, DDC, HSiFS
Extra clears: MoF, DDC, HSiFS, WBaWC

Goals: Going Extra Hard!

CrestedPeak9

  • Fangame Advocate
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #714 on: July 08, 2017, 11:12:48 AM »
My my.... this is very anooying......
I am creating some curve lasers in this script     :     https://pastebin.com/HMqXPpbr
So i'm using this shot sheet     :    Expanded shotdata ZUN style PH3, by Ozzy (ZUN original sprites)
but it didn't even looked like a curvy laser ! It's only straight ones, looked like half transparent.
But if i used all the README said the directory of #include, the script will won't appear.
I can't use the curvy laser  :( :( any help ? :)

Also for the half-transparency you can solve it by setting ObjCrLaser_SetTipDecrement(laser,0.1).
In future, maybe refer to Sparen's tutorials and the danmakufu wiki before asking here.
Lunatic 1cc: EoSD, PCB, IN, MoF, TD, DDC, LoLK, HSiFS, WBaWC

Andi

  • World's Gayest Danmaku
  • PlaySE("./se/Nyaa.wav");
    • 2hu blog
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #715 on: July 08, 2017, 01:21:22 PM »
I'm making a loose laser that acts like Sese's bones in Lenen: they spin about their center, but their movement isn't dependent on the 'angle' of the laser.
One possibility might be to define it in your shotsheet. For example, Marisa's stars spin like you described. Their definition looks like this:
Code: [Select]
ShotData{ id=661 rect=(240,153,255,168) render=ADD_ARGB fixed_angle=false angular_velocity = 2 delay_color= (255,255,255) }The relevant bits being the "fixed_angle=false" and "angular_velocity = 2".
Literally everything in this script will crash and burn.
1CC tracker

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #716 on: July 08, 2017, 02:29:25 PM »
Do you have a minimal working example? I'm not really sure what the problem is since I've never really run into this.

I ended up just creating new lasers. I was having loose lasers bounce off of the edges - I am under the assumption that upon direction change, the alignment of the hitbox remained the same (IE the vector representing the hitbox did not rotate, only the graphic), or that there was some other issue when they bounced off the sides. The workaround I used seems to look fine.

The code was essentially:
wait until you hit an edge
change your x coordinate
change angle of laser

Also for the half-transparency you can solve it by setting ObjCrLaser_SetTipDecrement(laser,0.1).
In future, maybe refer to Sparen's tutorials and the danmakufu wiki before asking here.

In general, most people choose to set the tip decrement to 0, but it's up to the scripter.

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #717 on: July 09, 2017, 02:39:57 AM »
I ended up just creating new lasers. I was having loose lasers bounce off of the edges - I am under the assumption that upon direction change, the alignment of the hitbox remained the same (IE the vector representing the hitbox did not rotate, only the graphic), or that there was some other issue when they bounced off the sides. The workaround I used seems to look fine.
That's sort of why I'm confused because that shouldn't happen unless maybe you accidentally use ObjRender_SetAngle instead. If you have a solution then whatever though.

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

Trung0246

  • Gaming, coding, drawing, composing, ... for fun
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #718 on: July 12, 2017, 06:11:23 AM »
How to get delay cloud color? ...
My workbench & codedump
Gallery & album (WIP)

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #719 on: July 12, 2017, 08:27:25 AM »
GetShotDataInfoA1(shot_id, TARGET_ENEMY, INFO_DELAY_COLOR)
Returns color as an array [r, g, b]

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