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

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #510 on: September 07, 2011, 07:25:59 AM »
You have laser width and length swapped.

I know you're just doing it to test, but right now what will happen is that the laser will bend instantaneously and have a hideous corner. Gotta curve dat shit.

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

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 #511 on: September 07, 2011, 08:22:40 AM »
FACEDESK!!

That was really stupid of me, thanks. Though in my defense, CreateLaserA has the length and width in the reverse order, so I just assumed it was the same.

BTW if you want some weird danmakufu stuff, try using this code:

Code: [Select]
CreateLaserC(1,GetX,GetY,150,8,78,0);
SetLaserDataC(1,0,3,180,10,0,3);
SetLaserDataC(1,30,3,90,10,0,3);
FireShot(1);
wait(120);
used with the expanded supershot shotsheet, this makes an extremely weird, yet cool looking pattern.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #512 on: September 07, 2011, 12:03:46 PM »
Not to mention, CreateLaserC is not fired from the boss by default because it is asking for X Y. GetX, GetY which is not the boss location (GetEnemyX/Y). Helepolis fails, it auto gets boss-x/y. Ignore this

LaserB is default fired from the boss.

AJS

  • Danmakufu Scripter
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #513 on: September 08, 2011, 09:15:11 PM »
I am completely at a loss here.  I've double, triple, quadruple checked, but I cannot get my plural file to work.  Every time I try to start it up, it simply freezes.  No error message.

Strangely enough, each of the scripts that are involved in this plural file work individually, so I'm fairly confident that the problem doesn't stem from them (I hope).

Here's the plural file code.  I copied it directly from the tutorial here, then inserted my own things:
Code: [Select]
#TouhouDanmakufu[Plural]
#Title[Edgey Boss Fight]
#Text[Courtroom Madness]
#Image[.\system\miles-aha.png]
#BackGround[Default]
#Player[FREE]
#ScriptVersion[2]

#ScriptPathData
#ScriptPath[.\Edgey2.txt]
#ScriptPath[.\Edgey3.txt]
#ScriptPath[.\Edgey.txt]
#ScriptPath[.\Edgey5.txt]
#ScriptNextStep
#ScriptPath[.\Edgey4.txt]

#EndScriptPathData

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #514 on: September 08, 2011, 11:25:06 PM »
Is making a lifebar split into four separate scripts valid?

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

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #515 on: September 09, 2011, 12:54:26 AM »
It is. I have about 15 different lifebar segments in one of my plural scripts just for testing, and it worked.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #516 on: September 09, 2011, 03:59:44 AM »
Stupid questions time.

Are the Edgey files in the same directory?
Are the Edgey files all single attacks?
Do the files you're trying to load in a plural work on their own?
If you only load one script in your plural, does it still freeze? (Check each of em one by one)
...You're not naming that plural script Edgey.txt and attempting to recursively load it in itself are you?
<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.

AJS

  • Danmakufu Scripter
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #517 on: September 09, 2011, 05:45:24 AM »
Stupid questions time.

Are the Edgey files in the same directory?
Are the Edgey files all single attacks?
Do the files you're trying to load in a plural work on their own?
If you only load one script in your plural, does it still freeze? (Check each of em one by one)
...You're not naming that plural script Edgey.txt and attempting to recursively load it in itself are you?
1) Yes. (picture of my directory, for reference in my answer to question 4)
2) Yes.
3) Yes.
4) Yes, it still freezes, along with occasionally displaying this error message:

My Japanese-speaking friend just told me that this message reads that the file "could not be found".  But if the files are in the same directory, I don't see why there should be a problem.
5) Nope.

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #518 on: September 09, 2011, 06:09:08 AM »
> function_cutin and Utsuhoeffect are text files
> no extension in name
> extensions in all the other names

...Cut all the ".txt" off the filenames.

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

AJS

  • Danmakufu Scripter
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #519 on: September 09, 2011, 07:54:41 PM »
> function_cutin and Utsuhoeffect are text files
> no extension in name
> extensions in all the other names

...Cut all the ".txt" off the filenames.
Thanks!  I always questioned the necessity of ".txt" at the end of the files, but didn't give it much thought, since it didn't affect anything outside of the plural files.  But now I know. 
Spoiler:
And knowing is half the battle.

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #520 on: September 09, 2011, 08:44:47 PM »
Open the Run (Win+R) window and run "control folders" to open Folder Options. Go to View, then uncheck "Hide extensions for known file types". Problem solved, everything has extension in filename.

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

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 #521 on: September 12, 2011, 03:44:45 PM »
Hey, I've got a possibly complicated question. My friend asked me if I could make a rotating square of lasers around a point. I tried to do this with object lasers whose starting points rotate around the center point, but I can't seem to get the math right or something, because I keep getting weird motions. So, first of all, is this idea feasible? And second, does anyone know how that might be done? I'll post the failed code that I have if it helps at all.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #522 on: September 12, 2011, 04:49:26 PM »
Yeah shouldn't be too difficult. Use object lasers so you can change position and angle easily. Let 'r' be the radius of the vertices of the square, 'ang_vel' be the number of degrees to rotate per frame, 't' be a frame count, and [CenterX,CenterY] be the coordinates of the center of the circle.

For i from 0 to 3, have lasers at position [x,y] = [CenterX+r*cos(90*i+ang_vel*t),CenterY+r*sin(90*i+ang_vel*t)], each of which with an angle of [90*i+135+ang_vel*t] and a length of [r*sqrt(2)]. You'll need to update the position and angle every frame for each laser. If you want to move the center point of the square around, just change CenterX and CenterY

Let me know if this doesn't work, I didn't actually try it in a script so I may have said something stupid xD
« Last Edit: September 12, 2011, 04:59:28 PM by BajaBlood »

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 #523 on: September 12, 2011, 08:53:58 PM »
Code: [Select]

task mainTask {
wait(30);
lasercage(GetCenterX,GetCenterY,1,100,0);

}


task lasercage(CenterX,CenterY,ang_vel,r,i){
let obj = Obj_Create(OBJ_LASER);
let t = 0;
Obj_SetPosition(obj,CenterX+r*cos(90*i+ang_vel*t),CenterY+r*sin(90*i+ang_vel*t));
Obj_SetAngle(obj,90*i+135+ang_vel*t);
ObjLaser_SetLength(obj,r*2^(1/2));
ObjLaser_SetWidth(obj,15);
ObjShot_SetGraphic(obj,4);
ObjShot_SetDelay(obj,0);
ObjLaser_SetSource(obj,false);

while(!Obj_BeDeleted(obj)) {
Obj_SetPosition(obj,r*cos(90*i+ang_vel*t),r*sin(90*i+ang_vel*t));
Obj_SetAngle(obj,90*i+135+ang_vel*t);

        t++;
yield;
}
}

Here's what I have, though the laser doesn't appear near the middle of the screen. This is only a test, so there's only 1 laser for now. Am I doing something wrong?
« Last Edit: September 12, 2011, 08:56:07 PM by Ozzy »

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #524 on: September 13, 2011, 12:08:04 AM »
It's fine when you first position the laser (CenterX+r*cos(90*i+ang_vel*t),CenterY+r*sin(90*i+ang_vel*t)), but immediately afterwards, in the loop, you got rid of the center point. Right now it spins around (0,0), the point immediately after spawn should be (100,0). Put the center point back in.
« Last Edit: September 13, 2011, 12:09:42 AM by Drake »

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

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 #525 on: September 13, 2011, 12:34:31 AM »
It's fine when you first position the laser (CenterX+r*cos(90*i+ang_vel*t),CenterY+r*sin(90*i+ang_vel*t)), but immediately afterwards, in the loop, you got rid of the center point. Right now it spins around (0,0), the point immediately after spawn should be (100,0). Put the center point back in.

And we've got another stupid mistake. Apparently I'm batting a thousand lately. Thanks for the help, it works now. I added the center point to the initial setposition but forgot to add it to the loop.

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 #526 on: September 13, 2011, 03:21:46 PM »
I've got one more question, is it possible to shoot bullets that will then bounce off the insides of the laser box? I've tried to do it by checking for whether the bullet collides with the laser, but all it seems to do is jiggle around and still pass through most of the time. I figure it's because it's constantly colliding with the laser so it's constantly changing direction.

Schezo

  • en-counse
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #527 on: September 13, 2011, 04:15:15 PM »
Yes, when the bullet connects with the laser you have to manually change the position of the bullet to shift 1 or 2 pixels over in the direction you want or else the bullet will stay on top of the laser constantly changing angles.

Alternately you can make a counter to bounce once, then add a variable to prevent another bounce.

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 #528 on: September 14, 2011, 03:17:28 AM »
Ok, I've done that. Here's what I have:

http://pastebin.com/2HhHUrjv

The bullet is in the same task so as to test. I'll move it to a separate one later.

There's still something wrong, it's probably the angle shift that happens during the collisions. Since the laser walls are constantly rotating, I don't know what to define the angle shift as so that they will bounce correctly.
« Last Edit: September 14, 2011, 02:56:45 PM by Ozzy »

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #529 on: September 15, 2011, 02:27:06 PM »
The generalized formula for a bullet to bounce correctly off a wall with angle 'a' is: final_angle = 2a - init_angle (Note that in cases of a=0 and a=90, as for the walls of the stages, this matches the equations you are probably already familiar with)

The angle of each laser is the same as Obj_GetAngle for each laser. You'll have to check for each laser whether a bullet is intersecting, then use that laser's 'a' value in the equation along with the bullet's initial trajectory to calculate the correct reflection angle for the bullet.
« Last Edit: September 15, 2011, 02:29:46 PM by BajaBlood »

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 #530 on: September 15, 2011, 05:17:51 PM »
The generalized formula for a bullet to bounce correctly off a wall with angle 'a' is: final_angle = 2a - init_angle (Note that in cases of a=0 and a=90, as for the walls of the stages, this matches the equations you are probably already familiar with)

The angle of each laser is the same as Obj_GetAngle for each laser. You'll have to check for each laser whether a bullet is intersecting, then use that laser's 'a' value in the equation along with the bullet's initial trajectory to calculate the correct reflection angle for the bullet.

Thanks a lot for your help so far, but something is still off. The bullets still won't reflect correctly sometimes, depending on where they hit the laser wall. I can't find anything wrong with the angle shifts this time, your math seems flawless. I'm starting to wonder if the combined effect of the rotation and the changing radius is somehow affecting the reflection.

Here it is:

http://pastebin.com/qpUpvcyT

I'm truly stumped as to what's wrong.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #531 on: September 15, 2011, 06:16:19 PM »
EDIT: I'm a dumbass. IGNORE ME!
EDIT2: I didn't look at Ozzy's code but how likely is it that the bullet is ending up in the laser after bounce still? Are you moving the bullet out of the laser at the same time you change the bullet's angle? If not, you should try that.
« Last Edit: September 15, 2011, 06:20:40 PM 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.

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #532 on: September 15, 2011, 07:08:31 PM »
Possibly some shenanigans from Obj_Obj. What would probably work, and would be faster, is checking if the bullet is inside the square.

I'm going to cheat and use a bit of taxicab. Because you're using a square (rotated 45 degrees) where the circle around it has a defined radius, it's easy to check a "collision" of that square by comparing the bullet position to the center of the circle. It's simply if( (|bulletx-centerx|) + (|bullety-centery|) >= r){ collision; }
However since the square is rotating, you need to adjust the target value like uh cos(()%90) [NOT FINISHED LOL]


also the if bounce statement should go before the ascent because redundancy

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

Final508

  • Danmakufu Beginner
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #533 on: September 18, 2011, 07:11:47 AM »
I was there trying to script and test my unfinished script, Suddenly when making the enemy appearance, It wouldn't work. Is there any problem?
Here is the code:

http://pastebin.com/CTB3kjcR

Any problems?

EDIT:

I have done all the stuff, The original (the one with the life,time and others on set_enemy_main) cast off an invisible enemy with life. but I was halfway right now just found about let shot. Unfortunately it says that there is a problem with let angle = 0 (this was the result from the Danmakufu Intermediate Tutorial) and then it just says "CLEAR" after this happens. I am finding about "let shot" but the director says there is no "let shot". I typed "shot", The only results we're the enemy bullets and the description, Including the DeleteSE.
« Last Edit: September 18, 2011, 09:21:56 AM by Final508 »
I mean seriously, Gibberish on a Japanese file? Would anyone think of the source code now?

http://imageshack.us/photo/myimages/684/ohblunderbuss.png

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #534 on: September 18, 2011, 07:58:23 AM »
There are many problems. It doesn't even look like you tested the script even once; it seems as though you typed it all out and now you're surprised it isn't working.

Rule 1: Script problems and questions go here or here depending on danmakufu version.
Rule 2: Always Pastebin long segments of code.
Rule 3: Give as much information as possible when asking for help. If it gave an error, copy it with ctrl+c or take a screenshot. If the game froze, say so, and describe when.

First of all, SetLife(1000);, SetMovePosition01 (GetCenterX,GetCenterY,5);, SetTimer(65); and LoadGraphic(imgBoss); should be in @Initialize, not anywhere else (except for SetMovePosition01, but your intention is to put it in @Init). Similarly SetTexture(imgBoss); and SetGraphicRect(0, 0, 63, 63); should only be in the @DrawLoop. These probably give errors.

Second of all, you shouldn't need to increase frame before even starting the script, you probably don't even want to.

Thirdly, if every time your frame counter hits 60 it goes back to 50, it will never reach anything else. Why are all these frame=50; even there. Are you trying to leave a gap of ten frames in between each firing?

Fourthly, angle += 360/36 and DeleteGraphic(imgBoss) have no semicolon on the end. You always need a semicolon at the end of a statement.

Fifthly, you have a Gety somewhere in there instead of GetY. Danmakufu is case-sensitive, so it will error.

Sixthly, you did not define angle or shot as variables. They do not exist, and you are trying to call them. It will error.

Seventhly, your @DrawLoop's closing bracket is an open bracket instead of a closing bracket. It will error.



There is no way that script could have worked, and you obviously didn't even try to figure out what was wrong before asking for help. Please, you need to seriously go back to the tutorials and try to understand them better. You also need to go read the forum's rules and info thread (which incidentally contains links to tutorials).
« Last Edit: September 18, 2011, 08:02:45 AM by Drake »

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

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #535 on: September 18, 2011, 08:00:12 PM »
EDIT:

I have done all the stuff, The original (the one with the life,time and others on set_enemy_main) cast off an invisible enemy with life. but I was halfway right now just found about let shot. Unfortunately it says that there is a problem with let angle = 0 (this was the result from the Danmakufu Intermediate Tutorial) and then it just says "CLEAR" after this happens. I am finding about "let shot" but the director says there is no "let shot". I typed "shot", The only results we're the enemy bullets and the description, Including the DeleteSE.
Post your new code in pastebin.com so we can check it.

TheTeff007

  • Best Touhou 2015!
  • So much cuteness...!
    • Youtube Channel
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #536 on: September 19, 2011, 08:50:25 PM »
How can I detect Collision between two Object Bullets? Looks like Obj_SetCollisionToObject is only for making activate Collision Detection.
Small Teaser of my upcoming project~

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

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #537 on: September 19, 2011, 08:59:16 PM »
Collision_Obj_Obj or something.
You should code your own collision function for that, though.

TheTeff007

  • Best Touhou 2015!
  • So much cuteness...!
    • Youtube Channel
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #538 on: September 19, 2011, 09:04:02 PM »
I think I don't understand, in the wiki Collision_Obj_Obj is referenced but I can't see any parameters.

By coding my own collision function you mean that I need to make it something like a task?
Small Teaser of my upcoming project~

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

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #539 on: September 19, 2011, 09:06:24 PM »
I think Collisio(ry) has just x(object1, object2) as the parameters...
And of course, you can always just put all of the object ids into an array, like array = [object1, object2], then check if x area around position of object1 intersects with y area around position of object2.