Author Topic: Danmakufu Q&A/Problem Thread v3  (Read 213428 times)

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #600 on: April 19, 2010, 10:00:06 AM »
After some testing I have com to the conclusion that the problem lies in these lines of code:

Code: [Select]
let distmax = (leafbullets/2)*distinc;
Code: [Select]
if(dist>=distmax){
dec=true;
}
Code: [Select]
if(dec==false){
dist+=distinc;
}
if(dec==true){
dist-=distinc;
}

What happens is the following: If the expression (leafbullets/2) is not an integer, then the code that changes the dist variable can not reach the points at which the direction changes without overshooting the mark. To overshoot, it needs an additional run of the loop. That means that the dist variable will "lag" behind the other parts of the script that forms a blossom, and the amount by which it lags behind increases with each additional leaf. When the blossom comes full circle, the accumulated difference in distance becomes clearly visible.

The solution:
Make shure that (leafbullets/2) is always an integer.  ;)
« Last Edit: April 19, 2010, 11:53:53 AM by Iryan »
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

Elementoid

  • Having a heated affair with feux-familiars
Re: Danmakufu Q&A/Problem Thread v3
« Reply #601 on: April 19, 2010, 10:13:45 PM »
So I suppose there's really no way of fixing it aside from permanently defining something so that it always came out as an integer. Oh well.

Thanks for helping me figure it out, anyways.

Fetch()tirade

  • serial time-waster
Re: Danmakufu Q&A/Problem Thread v3
« Reply #602 on: April 19, 2010, 10:37:03 PM »
There are other options to make integer values, you know.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #603 on: April 19, 2010, 10:49:56 PM »
Well, changing the code to round(leafbullets/2) will minimize the difference, but it won't remove it.
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

Elementoid

  • Having a heated affair with feux-familiars
Re: Danmakufu Q&A/Problem Thread v3
« Reply #604 on: April 19, 2010, 10:54:40 PM »
I didn't even know any of those functions existed. Clearly I need to spend more time lurking on the function pages. *newbnewbnewb*

Thanks for the help.

Bitz

  • So Moe!
  • *heart attack*
Re: Danmakufu Q&A/Problem Thread v3
« Reply #605 on: April 21, 2010, 12:25:10 AM »
What determines the hitbox size of a non-script bullet / object, and is there any way to set it?

Re: Danmakufu Q&A/Problem Thread v3
« Reply #606 on: April 21, 2010, 12:34:21 AM »
Half the size of the circle contained by the average of the horizontal and vertical graphic rects of your bullet image. For example, if your graphic has a rect of (0, 0, 64, 64), the hitbox would be a circle at the center of the bullet with a radius of 16. If your rect was (0, 0, 32, 64), the circle would have a radius of 12. Or at least, this is a good approximation :V

And no, you cannot set it unless it's an object or script bullet.

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread v3
« Reply #607 on: April 21, 2010, 12:53:56 AM »
I'm pretty sure it takes half of width or height (whatever is smaller), rather than the average. If you want to set it manually, either make the graphic rect bigger/smaller, or make an object bullet, turn off collision (Obj_SetCollisionToPlayer(false); I think), and manually check distance from the bullet to the player - make sure you also check if they're invincible or not if you do that, though.

Drake

  • *
Re: Danmakufu Q&A/Problem Thread v3
« Reply #608 on: April 21, 2010, 01:00:53 AM »
I'm going to note that deathbombing will not work if you use ShootDownPlayer with that method (which is pretty much the only way to able to use it), so I wouldn't really suggest it.

If you really wanted to, you could check the custom radius, play the sound effect and wait a frame before killing the player.

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

Re: Danmakufu Q&A/Problem Thread v3
« Reply #609 on: April 21, 2010, 01:12:36 AM »
I'm pretty sure it takes half of width or height (whatever is smaller), rather than the average.

I originally thought that was well, but then I thought about more rectangular bullets like the knives (or Johnny Walker's Tenshi rocks), which have a really large hitbox for their estimated width. It's like that for any rectangular bullet actually, as long as it isn't a laser.

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread v3
« Reply #610 on: April 21, 2010, 03:37:03 AM »
I originally thought that was well, but then I thought about more rectangular bullets like the knives (or Johnny Walker's Tenshi rocks), which have a really large hitbox for their estimated width. It's like that for any rectangular bullet actually, as long as it isn't a laser.

I had a 128 by 16 bullet once (don't ask why), and only the center had collision - no hitbox outside the graphic, either. Maybe those rectangular bullets have square graphic rects (extending past the actual sides of the bullet), so that makes the hitbox bigger?

Re: Danmakufu Q&A/Problem Thread v3
« Reply #611 on: April 21, 2010, 04:42:05 AM »
I suppose that is a possibility :< Makes sense. Would be nice to set custom hitboxes, though.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #612 on: April 21, 2010, 08:45:50 AM »
If you feel like using Bullet Scripts, you can manually set the collision size, but that's a pretty big pain in my opinion.
<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: Danmakufu Q&A/Problem Thread v3
« Reply #613 on: April 21, 2010, 06:44:27 PM »
They're also incredibly slow. It's like spawning an individual enemy every bullet you fire.

KrackoCloud

  • I don't mean to be greedy...
  • ... but white rice is my favorite food.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #614 on: April 22, 2010, 08:07:39 PM »
Code: [Select]
#TouhouDanmakufu
#Title[Spell Template]
#Text[]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {

let BossImage="script\ExRumia\img\ExRumia.png";
let BossCutIn="";

#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
function wait(let frames){ loop(frames){yield;} }

//////////

@Initialize {
LoadGraphic(BossImage);

shotinit;

SetLife(5000);
SetDamageRate(100,100);
SetTimer(60);
SetInvincibility(120);
SetScore(500000);
SetEnemyMarker(true);

CutIn(YOUMU, "x"\""x"\", BossCutIn, 0, 0, 0, 0);

SetMovePosition03(GetCenterX, GetCenterY-100, 20, 20);

Shot2;
}

//////////

@MainLoop {
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 24);
yield;
}

//////////

@DrawLoop {     
SetColor(255,255,255);
SetRenderState(ALPHA);
SetTexture(BossImage);
SetGraphicRect(64,1,127,64);
DrawGraphic(GetX,GetY);

}

//////////

@Finalize {

}

//////////

task Shot2{
wait(30);

let ang = -90;
let dir = 1;
let angchange;

loop{
angchange = 0.5;
loop(50){
loop(7){
WallBullet(ang);
ang -= 360/7;
}
ang += angchange * dir;
angchange -= 0.01;
wait(2);
}
dir = dir*-1;
yield;
}
}

task WallBullet(ang){
let obj=Obj_Create(OBJ_SHOT);

let bounce = 0;

Obj_SetPosition(obj, GetX+5*cos(ang), GetY-30+5*sin(ang));
Obj_SetSpeed(obj, 3.7);
Obj_SetAngle(obj, ang);
ObjShot_SetGraphic(obj, BLUE23);
ObjShot_SetDelay(obj, 5);
ObjShot_SetBombResist(obj, false);

while(!Obj_BeDeleted(obj)){
if(Obj_GetX(obj)<GetClipMinX && bounce==0){
CreateShot01(Obj_GetX(obj), Obj_GetY(obj), 3.3, 180-Obj_GetAngle(obj), GREEN23, 5);
bounce++;
}
if(Obj_GetX(obj)>GetClipMaxX && bounce==0){
CreateShot01(Obj_GetX(obj), Obj_GetY(obj), 3.3, 180-Obj_GetAngle(obj), GREEN23, 5);
bounce++;
}
if(Obj_GetX(obj)<GetClipMinY && bounce==0){
CreateShot01(Obj_GetX(obj), Obj_GetY(obj), 3.3, 360-Obj_GetAngle(obj)-180, GREEN23, 5);
bounce++;
}
yield;
}
}

///
}

Sorry about the bother, but I'm having trouble with this script.
I want streams of bullets to alternate moving left and right, but the clockwise movement seems greater than the counterclockwise. The streams basically don't stay within the same place, and they can shift greatly if you wait long enough. Over time, this leads to an inevitable death.

I've exaggerated the script to make this more easily seen. Any help?

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #615 on: April 22, 2010, 08:31:36 PM »
I don't see the shifting that you're talking about in the script you posted. I measured the angles by turning on invincibility and planting the player at a place where the bullets would switch directions and held spacebar. The shifting didn't occur.
<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.

KrackoCloud

  • I don't mean to be greedy...
  • ... but white rice is my favorite food.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #616 on: April 22, 2010, 09:24:24 PM »
Woah. I had no idea you could use the spacebar like that.

But anyway, when I use it, the streams are moving the way I described them.

Maybe I didn't say it well enough? I want a stream to move from one point to another. But this doesn't seem to work - The streams do it for a while, but eventually it doesn't work anymore. In fact, one stream will eventually go straight down 90 degrees.

Fetch()tirade

  • serial time-waster
Re: Danmakufu Q&A/Problem Thread v3
« Reply #617 on: April 22, 2010, 11:17:58 PM »
Every time I try to run this, I get some weird error message about tasks and subs or something. What's wrong?

Code: [Select]
#TouhouDanmakufu
#Title[test_06]
#Text[...]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{

let CSD = GetCurrentScriptDirectory;
let shotfx = CSD ~ "sfx\tan0.wav";
let shotfx2 = CSD ~ "sfx\shot3.wav";
let lasfx = CSD ~ "sfx\laser01.wav";

@Initialize{
LoadUserShotData(CSD ~"Data\supershot.txt");
SetLife(1900);
SetTimer(80);
SetScore(700000);
SetDamageRate(45,60);
LoadSE(shotfx);
LoadSE(shotfx2);
LoadSE(lasfx);
MagicCircle(false);
SetText("test_05");
SetPlayerInvincibility(9999);

SetMovePosition03(GetCenterX,GetCenterY,1,100);
test;
}

@MainLoop{
SetCollisionA(GetX,GetY,60);
SetCollisionB(GetX,GetY,16);
yield;
}

@DrawLoop{
yield;
}

@BackGround{
yield;
}

@Finalize{
DeleteSE(shotfx);
DeleteSE(shotfx2);
DeleteSE(lasfx);
yield;
}

function wait(w){
loop(w){yield;}
}

// In any given triangle, this function finds one side of a triangle using the angle opposite of it and the two sides that make that angle.
// It uses a derived form of the law of cosines.

function sidefinder(a, anglegiven, b){
return (a^2 + b^2 - 2 * a * b * cos(anglegiven)) ^ 0.5;
}

// In any given triangle, this function finds one angle of a triangle using the sides next to it, then the side opposite of it.
// It uses a derived form of the law of cosines.

function anglefinder(a, b, c){
return acos((-1 * (c ^ 2 - (a ^ 2 + b ^ 2))) / (2 * a * b));
}

task statlaser(x, y, angle, laslength, laswidth, graphic, delay){
let obj = Obj_Create(OBJ_LASER);
Obj_SetPosition(obj, x, y);
Obj_SetSpeed(obj, 0);
Obj_SetAngle(obj, angle);
ObjLaser_SetLength(obj, laslength);
ObjLaser_SetWidth(obj, laswidth);
ObjShot_SetGraphic(obj, graphic);
ObjLaser_SetSource(obj, false);
ObjShot_SetDelay(obj, delay);
ObjShot_ToItem(obj, true);

wait(360);
ObjShot_FadeDelete(obj);
}

task test{
wait(300);
testpattern;
}

task testpattern{
loop(
statlaser(GetCenterX, GetCenterY, 0, 30, 5, WHITE01, 0);
statlaser(GetCenterX, GetCenterY, 90, 40, 5, WHITE01, 0);
statlaser(GetCenterX+30, GetCenterY, anglefinder(30, sidefinder(30, 40, 90), 40) , sidefinder(30, 40, 90), 5, WHITE01, 0);
wait(599);
yield;
}
}
}

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #618 on: April 22, 2010, 11:25:25 PM »
Code: [Select]
function sidefinder(a, anglegiven, b){
      return (a^2 + b^2 - 2 * a * b * cos(anglegiven)) ^ 0.5;
   }

should be

Code: [Select]
function sidefinder(a, anglegiven, b){
      return ( (a^2 + b^2 - 2 * a * b * cos(anglegiven)) ^ 0.5);
   }
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

Fetch()tirade

  • serial time-waster
Re: Danmakufu Q&A/Problem Thread v3
« Reply #619 on: April 22, 2010, 11:32:06 PM »
Tried it. Didn't work, but I think that would have caused other problems anyways, so thanks.
I also tried moving around the different tasks and functions at the end of the script, and I found that

Code: [Select]
function sidefinder;
function anglefinder;
task test;
task testpattern;
task statlaser;

gives out a different type of error code, this time about statlaser. However, that doesn't make sense because I'm using it in another script, and it seems fine.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #620 on: April 22, 2010, 11:38:19 PM »
When you get the error, pressing ctrl+c should save the error text so you can post it here for everyone to examine. It makes spotting the errors much easier.

On an unrelated note, I don't think there should be yield;s in you @BackGround and @DrawLoop.
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

Fetch()tirade

  • serial time-waster
Re: Danmakufu Q&A/Problem Thread v3
« Reply #621 on: April 22, 2010, 11:56:44 PM »

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #622 on: April 23, 2010, 12:01:06 AM »
Ah, found it.


Quote
   task testpattern{
      loop(
         statlaser(GetCenterX, GetCenterY, 0, 30, 5, WHITE01, 0);
         statlaser(GetCenterX, GetCenterY, 90, 40, 5, WHITE01, 0);
         statlaser(GetCenterX+30, GetCenterY, anglefinder(30, sidefinder(30, 40, 90), 40) , sidefinder(30, 40, 90), 5, WHITE01, 0);
         wait(599);
         yield;
      }
   }
that bracket should be a {. Because it isn't, danmakufu misinterprets the code in a weird way.


It is generally helpful to always look one or two lines before the line danmakufu errors on because faulty use of brackets or semi colons will often make it read the seperate statements in different lines as one single statement.
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #623 on: April 24, 2010, 12:35:13 AM »
Hm, I've been working on a different project ever since my Internet became really shitty.
I've finished about an eighth of it already, and I'm trying to do something that changes according to how many continues the player has used.
Is there a function to do that? Continued; only returns weather whether the player has continued or not.

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem Thread v3
« Reply #624 on: April 24, 2010, 02:18:05 AM »
HALP! I f***ed Up bad! Danmakufu Hates me!
---------------------------
ScriptError
---------------------------
ファイルが見つかりません
(C:\_DataFolder\*Censored*\th_dmh\script\UUC\enemy\Enemy1.txt)
---------------------------
OK   
---------------------------

I didn't find the translation anywhere.
Fake Edit: when transated. says

---------------------------
ScriptError
---------------------------
File Not Found
(C:\_DataFolder\*Censored*\th_dmh\script\UUC\enemy\Enemy1.txt)
---------------------------
OK
---------------------------
somehow Danmakufu hates reading my file.... (it exists)
Is is vista that causes this sh*t?
(same goes for music files, not sound effects, music files, it just refuses to play. Not even CtC is free from this glitch...)

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #625 on: April 24, 2010, 02:47:24 AM »
HALP! I f***ed Up bad! Danmakufu Hates me!
---------------------------
ScriptError
---------------------------
ファイルが見つかりません
(C:\_DataFolder\*Censored*\th_dmh\script\UUC\enemy\Enemy1.txt)
---------------------------
OK   
---------------------------

I didn't find the translation anywhere.
<insertloltranslationhere>
somehow Danmakufu hates reading my file.... (it exists)
Is is vista that causes this sh*t?
(same goes for music files, not sound effects, music files, it just refuses to play. Not even CtC is free from this glitch...)
Eh, you *did* take a look at this, right?

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem Thread v3
« Reply #626 on: April 24, 2010, 03:01:38 AM »
Eh, you *did* take a look at this, right?
I actually *did* but somehow didn't find the solution. I claims to "Not find" my file even though it is there. FDIZASDFGHIGK RAGE >:(
*triple Checks for spelling errors...* Nope.... None..
strange...
I put the enemy to replace the one in ExRumia and it works....
Fake Edit again: Oh wow.. with abit of copyandpasting It works... thanks anyways.. (*whacks head for stupidity*)

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #627 on: April 24, 2010, 03:16:09 AM »
I actually *did* but somehow didn't find the solution. I claims to "Not find" my file even though it is there. FDIZASDFGHIGK RAGE >:(
*triple Checks for spelling errors...* Nope.... None..
strange...
I put the enemy to replace the one in ExRumia and it works....
Fake Edit again: Oh wow.. with abit of copyandpasting It works... thanks anyways.. (*whacks head for stupidity*)
Ah.
Where is the file you summon the enemy from and what do you call to summon the enemy (Yes, that CreateEnemyFromFile function, what did you put there)?

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem Thread v3
« Reply #628 on: April 24, 2010, 03:23:41 AM »
After checking again. it was a stupid TYPO Lol!
that happens soo many times
@Drawloop and @DrawLoop
(captial L)
in this case...
"Enemy1.txt" vs "Enemy01.txt"
FU-

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #629 on: April 24, 2010, 03:26:55 AM »
After checking again. it was a stupid TYPO Lol!
that happens soo many times
@Drawloop and @DrawLoop
(captial L)
in this case...
"Enemy1.txt" vs "Enemy01.txt"
FU-
Hurrrrrrrrrr why must Danmakufu be so specific