Author Topic: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)  (Read 140424 times)

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #570 on: November 01, 2011, 08:42:28 PM »
I think you should just be able to replace GetCommonData("Score"); with GetCommonDataDefault("Score",GetScore); and it will work fine.

Arcorann

  • hey catgirl
  • Surprisingly unkempt
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #571 on: November 02, 2011, 01:30:05 AM »
It's not the player script that has these variables, but actually Phantasmagoria Trues that uses "Score" and "SubRate" common data.

Trying the quick fix (in this case GetCommonData("Score"); --> GetCommonDataDefault("Score",0);) reveals further problems, namely that none of the bosses appear during gameplay. I think some of the common data commands related to the CtC player are interfering with the script's common data, however more investigation is needed.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #572 on: November 02, 2011, 01:34:50 AM »
Oooh okay... I wonder if I can download CtC Marisa somewhere else, maybe it'd work... Sorry I'm a huge noob when it comes to scripting ^^; Thanks a ton~

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #573 on: November 05, 2011, 01:41:07 AM »
Hey, I'm trying my hand at devising player scripts and I'm trying to make a bomb that creates a green circle as an object spell around the player. After x frames, I want all of the bullets inside the circle (the spell doesn't delete them, but does give the player invincibility) to be counted, and then have the spell circle expand and deal damage enemies proportional to the number of bullets inside the circle at that moment.

I thought I could use GetEnemyShotCountEx for this, but whenever I try to store it in a variable or call it inside a function, danmakufu raises an error and I can't figure out why. I've double checked the function parameters, and tested the same line elsewhere in the script. Am I doing something wrong? And it GetEnemyShotCountEx doesnt work, is there another way for my idea to work? Here's the while loop inside of the object spell task:

Code: [Select]
                while(!Obj_BeDeleted(obj)) {
ObjEffect_SetScale(obj,scale,scale);
Obj_SetPosition(obj,GetPlayerX,GetPlayerY);
ObjSpell_SetIntersecrionCircle(obj,Obj_GetX(obj),Obj_GetY(obj),96*scale,1,false);
if(count<=240) { scale+=0.005 }
if(count>240) {
scale+=0.05

ObjSpell_SetIntersecrionCircle(obj,Obj_GetX(obj),Obj_GetY(obj),96*scale,2*GetEnemyShotCountEx(GetPlayerX, GetPlayerY, 96*scale, ALL),true);
}
if(count==300) { Slow(0); Obj_Delete(obj); }
count++;
yield;
}

Thanks in advance.

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #574 on: November 05, 2011, 02:16:47 AM »
scale+=0.005 and scale+=0.05 have no semicolon

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

TheTeff007

  • Best Touhou 2015!
  • So much cuteness...!
    • Youtube Channel
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #575 on: November 05, 2011, 04:22:02 AM »
How does "SaveCommonData" and "LoadCommonData" work? I've heard they behave way different from their Ex Versions... neither I don't know how to test it exactly.
Small Teaser of my upcoming project~

No need to call me Teff007. Teff will do just as well~

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #576 on: November 05, 2011, 04:37:01 AM »
scale+=0.005 and scale+=0.05 have no semicolon

Why does this always happen to me? Seriously it seems to be happening a lot more lately than usual. Sorry for cluttering the thread with my retarded questions.

Trickysticks

  • What am I? TRICKYSTEAKS I AM!
  • A stick of the tricky variety.
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #577 on: November 05, 2011, 04:15:15 PM »
Why does this always happen to me? Seriously it seems to be happening a lot more lately than usual. Sorry for cluttering the thread with my retarded questions.

I just write a semicolon after every chunk of code that needs one. Even if it's the only thing inside {}'s.
Interested in playing some boss fights I made? Have Danmakufu? Then check out my Danmakufu creations!

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #578 on: November 05, 2011, 05:35:02 PM »
That's just it, I usually do too, but lately I've been forgetting to put them there and I'm surprised when I get unexpected errors. Oh well, I'll get back in my good habit sometime.

In the meantime, I've got another question: Is it possible for an effect object to act as a color filter? For example, is it possible to get my aforementioned green circle bomb to actually alter the colors of bullets that are inside of it?

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #579 on: November 05, 2011, 06:10:30 PM »
You should put the object effect on a high layer so it's over the bullets (although I think it's like that by default?), and then you can set the blending mode to SUBTRACT, which would be the closest thing to what you're looking for. If the image was purple (255,0,255), it would subtract all red and blue from the image, leaving only green, which is pretty neat.

On a side note, your logic is wrong for setting the damage - it counts all bullets in the radius every frame, even once it expands to a huge size to damage enemies. You probably want to store the shot count on frame 240 and then just read the stored value from then on.

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #580 on: November 05, 2011, 06:50:17 PM »
You should put the object effect on a high layer so it's over the bullets (although I think it's like that by default?), and then you can set the blending mode to SUBTRACT, which would be the closest thing to what you're looking for. If the image was purple (255,0,255), it would subtract all red and blue from the image, leaving only green, which is pretty neat.

On a side note, your logic is wrong for setting the damage - it counts all bullets in the radius every frame, even once it expands to a huge size to damage enemies. You probably want to store the shot count on frame 240 and then just read the stored value from then on.

Oh derp, I actually had that stored in a variable before but changed it for some reason, thanks for catching that. I WAS wondering why the bomb was ridiculously powerful. Also thanks for the tip, this should make the bomb all the more interesting and easier to understand.

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #581 on: November 05, 2011, 09:31:10 PM »
However, I'm going to add that creating one mask will not work well if you only want to mask bullets. If you subtract 255,0,255, it will remove all red and blue of the bullets yeah, but it'll also darken every color that's lighter than 0,x,0 to a maximum of 0,255,0, which you might not like. It'll also affect every other layer underneath, including the background, enemy sprites, various other effects put on layer 2, etc. You can't really make an adjustment layer unless you want to fiddle with render targets, which is unintuitive for bullets. Tread carefully, I suppose.

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

Yusukeisbestpairing

  • Cookie-liker of all Humankind
  • I like cookies. No seriously.
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #582 on: November 14, 2011, 01:59:40 PM »
http://www.shrinemaiden.org/forum/index.php/topic,865.msg31781.html#msg31781

Similar to this, I'd assume.

I think i have an idea to solve this.

Would this work? :
I am making an variable that determines the angle (it starts with zero) and every frame the angle goes up (6 -> 7, 180 -> 181).

Would that work?

TraceTheKriken

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #583 on: November 14, 2011, 02:28:08 PM »
So, now i've gotten through some of the problems I had with danmakufu earlier. I also learned to read the error messages (just enough to know where the problem is)
But now I get error from the wait function, and I have no idea what's the problem with it...
I wrote the wait function like this:
wait(30);

Also for some reason danmakufu crashes when stage ends. It's not a big problem now, but I just want to know that is it normal and is there possible way to fix it.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #584 on: November 14, 2011, 06:03:23 PM »
So, now i've gotten through some of the problems I had with danmakufu earlier. I also learned to read the error messages (just enough to know where the problem is)
But now I get error from the wait function, and I have no idea what's the problem with it...
I wrote the wait function like this:
wait(30);

Also for some reason danmakufu crashes when stage ends. It's not a big problem now, but I just want to know that is it normal and is there possible way to fix it.
Greetings Trace,

First of all, please make sure you read the stickies before you continue to work with in our garage. Nitori and Rika do not appreciate co-mechanics who don't follow the union rules. I merged your post before they would throw danmaku.

Second, your problem is hard to figure if you don't show us some code. Please post your script in pastebin to us.

Formless God

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #585 on: November 16, 2011, 07:21:21 AM »
Sorry if this is too engine-related, but can anyone explain how the collision checking for curvy lasers and oval bullets work ?

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #586 on: November 16, 2011, 08:13:16 AM »
Collision checking for oval bullets is simple - they're checked as circles. The shorter side (multiplied by some decimal) is used as the radius for the circle.
For curvy lasers, they are divided into lots of little segments (one segment is created per frame, and if it reaches the maximum size specified, erases the oldest segment). This is how they are drawn, and why they take so much processing power. For collision checking, I'm betting that line segment collision (the same as for normal lasers) is performed with each individual segment of the laser.

Formless God

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #587 on: November 16, 2011, 08:31:38 AM »
I see, thanks for the quick reply. I assume circle checking is also used for circular objects ? Is it more expensive than rectangle checking ?

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #588 on: November 16, 2011, 11:43:27 AM »
As far as I know, the only things with non-circular collision are lasers. Circles are faster to calculate (it's just Pythagorean theorem - 3 multiplications, 2 additions, and a single comparison) instead of rotating rectangles (which is, uh... much more than that, as a quick Google search shows code for).

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #589 on: November 16, 2011, 05:06:44 PM »
I see, thanks for the quick reply. I assume circle checking is also used for circular objects ? Is it more expensive than rectangle checking ?

This is the code for checking if two arbitrarily rotated rectangles are colliding:
http://www.shrinemaiden.org/forum/index.php/topic,5164.msg586604.html#msg586604

This is the code for checking if two circles (rotation obviously doesn't matter) are colliding:
Code: [Select]
function Collision_Circle_Circle(x1, y1, r1, x2, y2, r2){
    let distance = ((x1-x2)^2+(y1-y2)^2)^0.5
    return distance < r1+r2
}

Take a guess which is more expensive. :V
« Last Edit: November 18, 2011, 12:43:38 AM by Blargel »
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #590 on: November 17, 2011, 02:08:08 AM »
Rectangular collision checking is lighter if you don't rotate the rectangles. When you're dealing with really small hitboxes, the rotation is pretty much irrelevant. Many bullet hells use rectangle collision checking for most bullets afaik, including Touhou.


Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #591 on: November 17, 2011, 04:27:01 AM »
blargel's missing the squares, also square root processing yumyumyum

if(|px-ox|< pw+ow && |py-oy| < ph+oh ) is the lightest thing i can think of

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

Formless God

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #592 on: November 17, 2011, 05:08:26 AM »
Well ... yeah, I meant non-rotated rectangles :V Anyway, thanks a lot for the help, guys.
Spoiler:
Btw Naut, what was Reimu's hitbox size and the boolets' general hitbox:sprite ratio ?

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #593 on: November 18, 2011, 12:44:40 AM »
blargel's missing the squares, also square root processing yumyumyum

if(|px-ox|< pw+ow && |py-oy| < ph+oh ) is the lightest thing i can think of

Damnit, corrected. Also, really? They use rectangles? That's surprising to me.  :wat:
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

MMX

  • In Soviet Gensokyo...
  • ...bullets dodge you.
    • LiveJournal blog
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #594 on: November 18, 2011, 01:01:25 AM »
I'm learning scripting a stage for testing stuff. I've read Naut's tutorial. According to him...

For enemies, you won't want them to have too much health, so you can kill them quickly. Typically have them spawn a really basic flurry of bullets, and just continue off in one direction (they will be destroyed upon leaving the game screen).

And i have a problem that if i leave some enemies to fly beyond the screen, they seem not been destroyed automatically, cause my wait-for-zero-enemy function doesnt proceed as if i've shot them onscreen. So do i need to control enemy for leaving the screen myself, or it's processed automatically and i'm doing something wrong?

Here's the enemy script: http://pastebin.com/WgHmAJ8M
And here's the stage: http://pastebin.com/5vVPnLJ6
My danmakufu thread Most recent - "Kappa Mechanics" (Nitori fight)   My youtube channel Latest update - EoSD extra no bombs clear


Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #595 on: November 18, 2011, 01:15:04 AM »
Spoiler:
Btw Naut, what was Reimu's hitbox size and the boolets' general hitbox:sprite ratio ?

In UFO, Reimu's hitbox is 2 pixels square (compare with Sanae's 3 and Marisa's 3.5). Reimu's hitbox is the same size for MoF and SA afaik, but it is slightly smaller in TD (1.5 iirc). Bullet hitboxes are usually about half the visible sprite size, but the way danmakufu calculates them seems to be very slightly bigger. I don't think anybody knows for sure.

And i have a problem that if i leave some enemies to fly beyond the screen, they seem not been destroyed automatically, cause my wait-for-zero-enemy function doesnt proceed as if i've shot them onscreen. So do i need to control enemy for leaving the screen myself, or it's processed automatically and i'm doing something wrong?

Could've sworn they were auto deleted. Oh well, simple fix. In @MainLoop:

if(GetX<GetClipMinX - 32 || GetX>GetClipMaxX + 32 || GetY<GetClipMinY - 32 || GetY>GetClipMaxY +32){
   AddLife(-GetLife);
}

MMX

  • In Soviet Gensokyo...
  • ...bullets dodge you.
    • LiveJournal blog
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #596 on: November 18, 2011, 02:24:09 AM »
Just as i thought. Thanks for advice. Edit: but i used not AddLife(-GetLife) but VanishEnemy, and added && !BeVanished to @Finalize. Otherwise there're point items collecting from outtascreen lol.

And i've got 2 more questions:

1. Is there a way to change default enemy explosion (or just disable it so i could script my own)?

2. How to change background in stage? I've tried it like in boss scripts by loading texture and drawing it in @Background section, but it doesnt work like
Spoiler:
no spellcard - no bg
« Last Edit: November 18, 2011, 02:29:32 AM by themmx »
My danmakufu thread Most recent - "Kappa Mechanics" (Nitori fight)   My youtube channel Latest update - EoSD extra no bombs clear


Schezo

  • en-counse
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #597 on: November 18, 2011, 03:23:58 AM »
I don't remember 1 off hand but there is a way to delete the SFX that pops when enemies die.  Is that what you mean?

For number two, you're going to have to make a stage script and draw the background for nonspells with the stage script itself.  Plural scripts won't let you do that and you won't be able to do it from the nonspell.

MMX

  • In Soviet Gensokyo...
  • ...bullets dodge you.
    • LiveJournal blog
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #598 on: November 18, 2011, 09:31:56 AM »
For number two, you're going to have to make a stage script and draw the background for nonspells with the stage script itself.  Plural scripts won't let you do that and you won't be able to do it from the nonspell.
what do you mean? Of course i'm doing a stage script, but i still cant change the default running background of it.

That's how it looks now:
Code: [Select]
.
.
script_stage_main{
let CSD = GetCurrentScriptDirectory;
let bg = CSD ~ "\img\starbg.png";
let bgshift = -300;
.
.
.
@Initialize{
LoadGraphic(bg);
SetRateScoreSystemEnable(false);
stage;
}

@Background{
SetTexture(bg);
SetAlpha(255);
        SetGraphicRect(0, 0, 600, 1200);
DrawGraphic(GetCenterX,GetCenterY+bgshift);
bgshift++;
if (bgshift>300){bgshift=-300};
}
.
.
.
My danmakufu thread Most recent - "Kappa Mechanics" (Nitori fight)   My youtube channel Latest update - EoSD extra no bombs clear


Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #599 on: November 18, 2011, 06:03:29 PM »
@BackGround, not @Background. Yay, capitalization.
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.