Author Topic: Danmakufu Q&A/Problem thread number 4  (Read 204365 times)

Marco

  • DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI
  • DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI
Re: Danmakufu Q&A/Problem thread number 4
« Reply #270 on: August 15, 2010, 11:30:43 PM »
AMAZING! it's useful for me! Well... it was useful some time ago, I'll thouth "if something like this exist I can ahhh so... yes! and then... perfectly I am a genious! (call my brother) I'm genializing!" [Yes when I talk I use say all that things...] HOWEVER I thinked it was impossible and i've resolved (I think[I don't remember{I like lasers}])

Ah my spellcard is complete, now (not now) I may (may?) create a topic for my scripts! [and play guess the spellcard!]
DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI DANZAI

Beef Owl

  • Why yes, owls do yield beef:
  • It is known as The Strongest White Meat
Re: Danmakufu Q&A/Problem thread number 4
« Reply #271 on: August 16, 2010, 02:57:36 AM »
...whoops, my bad, thanks for the correction.

Dividing it by 0 of course :V

Not to criticize, but wouldn't dividing by 0 give you an undefined value? :V

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem thread number 4
« Reply #272 on: August 16, 2010, 07:17:28 AM »
Object lasers don't use Obj_SetSpeed or ObjShot_SetPenetration, don't include them. There's also no reason to set delay to zero.

My Remilia lasers use both lasers to damage the enemies and enemy enumeration loops to spawn explosions on their position. You can just copy either code for your laser.
Oh, thought penetration worked, because if I would put penetration to 1, the laser would hit once then immediately disappear (brrr sound also confirms this).

I'll be in your debt. I'll try to look and learn before blatantly copying =S

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem thread number 4
« Reply #273 on: August 16, 2010, 07:33:25 AM »
Dividing it by 0 of course :V
Wrong. START with 0.
I mean 0?3=0
0?219038219038109 = 0
Rite?
I'm such a jerk :V

DarkOverord

  • Damn Red Dragons
  • Aaaaaaaaaaaaaaaaargh
    • Lol YouTube
Re: Danmakufu Q&A/Problem thread number 4
« Reply #274 on: August 16, 2010, 07:39:35 PM »
I love how I make a really complicated spellcard with many random variables, and etc. Yet angles and lasers? Well. THAT'S COMPLETELY DIFFERENT!
http://www.majhost.com/gallery/DarkOverord/Other/SS2/Toehoes/damnyouangles.png
Now it's nice the lasers are aiming at the player to the same point. But this isn't exactly what I wanted, hang on I'll get a shot if you hold still.
http://www.majhost.com/gallery/DarkOverord/Other/SS2/Toehoes/aimingforlikethis.png

That's kind of what I want, but basically for ANY angle. So say you're at the top right (Like in my pic and move down), I only want the laser to move towards where the player WAS. I'm sure you guys will know what to do. Here's the green laser script:
Code: [Select]
let x=0;
let ANG=270;
let z=0;
let v=1;
while(x<6){
CreateLaserC(11+x,GetX,GetY,10,80,188,0);
SetShotDirectionType(PLAYER);
SetLaserDataC(11+x,0,2+z,ANG*v,2*v,0,2);

SetLaserDataC(11+x,40,0,0,0,0,2);
SetLaserDataC(11+x,50,4,0,0,0,2);

y=y+10;
z++;
if(y>20){y=0;z=0;v=-1;}
x++;
}
FireShot(11);FireShot(12);FireShot(13);FireShot(14);FireShot(15);FireShot(16);
z and v are just arbitrary values that change :V
« Last Edit: August 18, 2010, 07:29:07 AM by Helepolis »
http://www.youtube.com/user/DarkOverord <-- its wat cool ddes do rite :V

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem thread number 4
« Reply #275 on: August 16, 2010, 07:49:09 PM »
I'd do it with OBJ_SINUATE_LASER. Parse the player's position to the laser at the beginning of the task, then make it hom in on him.


Alternatively, you could do the math. Gimme some minutes...
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."

DarkOverord

  • Damn Red Dragons
  • Aaaaaaaaaaaaaaaaargh
    • Lol YouTube
Re: Danmakufu Q&A/Problem thread number 4
« Reply #276 on: August 16, 2010, 07:59:57 PM »
I'd do it with OBJ_SINUATE_LASER. Parse the player's position to the laser at the beginning of the task, then make it hom in on him.


Alternatively, you could do the math. Gimme some minutes...
I suppose via the maths route I could set it back to Absolute and then sort it that way. It'd be a bit fun mind. Time to look up a function~ Even if I don't use it :3c
http://www.youtube.com/user/DarkOverord <-- its wat cool ddes do rite :V

Lord Phantasm Satori

  • Permabanned
  • RIP 7/21/2010-9/10/2010
Re: Danmakufu Q&A/Problem thread number 4
« Reply #277 on: August 16, 2010, 11:17:23 PM »
what causes the plural, single, stage, etc. selections to not work? I can still use directory, but the other options crash. any ideas on what it could be?

Re: Danmakufu Q&A/Problem thread number 4
« Reply #278 on: August 17, 2010, 12:23:11 AM »
Many things cause stuff to not work. Post scripts.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem thread number 4
« Reply #279 on: August 17, 2010, 12:38:39 AM »
what causes the plural, single, stage, etc. selections to not work? I can still use directory, but the other options crash. any ideas on what it could be?
You mean you entire danmakufu main menu is crashing?

If so, first delete the "script_index.dat" file in your danmakufu folder and look if the error persists.

To prevent it from happening again, look for any script that you added or edited since the last time when you could access the other menu parts. With all of these, check if there is a typo or something in the script head (everything before script_enemy_main). If you have to narrow it down, try removing whole folders. Make sure that you always delete the new "script_index.dat" after each time you encountered this error.


Several things in the script head can make danmakufu store faulty script information in the dat file, making the program crash whenever it accesses the directory the script is inside. The plural, single etc selections in the menu will make danmakufu access all folders to check for the script type, making it crash every single time if there is a problematic script.
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."

DarkOverord

  • Damn Red Dragons
  • Aaaaaaaaaaaaaaaaargh
    • Lol YouTube
Re: Danmakufu Q&A/Problem thread number 4
« Reply #280 on: August 17, 2010, 12:59:02 AM »
So I was looking you the Obj stuff for what I wanted, I still see a problem, every laser is going to require a different angle, unless now you're gonna tell me there's a way of getting obj lasers to home in on a specific XY point? :C

....Nevermind I just got it. I think. You're implying I get the player location, THEN push that into a task with OBJ_SINUATE_LASER, Get the end of the laser, then calculate the angle from there? :V!? Say yes/no/almost? (Also the idea of lasers homing in at an XY ordinate only without angles would be awesome!)
http://www.youtube.com/user/DarkOverord <-- its wat cool ddes do rite :V

Formless God

Re: Danmakufu Q&A/Problem thread number 4
« Reply #281 on: August 17, 2010, 09:20:34 PM »
Explanations.
Thanks a lot ! I was wondering why that wasn't mentioned anywhere in the tutorials (though I probably have overlooked it).



Is there a function to detect the collision between an effect object and a bullet (any kind of bullet except for lasers) ? (you could've guessed what I was trying to accomplish now:
Spoiler:
is it possible to code a reflective barrier at all ?
)

And uh, what are the differences between a task, a subroutine and a function ?
« Last Edit: August 17, 2010, 09:25:03 PM by Formless Gengetsu »

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem thread number 4
« Reply #282 on: August 17, 2010, 09:47:09 PM »
Is there a function to detect the collision between an effect object and a bullet (any kind of bullet except for lasers) ? (you could've guessed what I was trying to accomplish now:
Spoiler:
is it possible to code a reflective barrier at all ?
)
You can check the collision manually, for example with the GetPointToLine function I posted in the Miscelleanous Code Snippets thread.

Quote
And uh, what are the differences between a task, a subroutine and a function ?
A subroutine is just you taking a block of code you need to use several times in a script, so you substitute a single command for this block to save time.
A function is pratically the same, only with a) several parameters to modify this code block and b) the possibility to have it give you a return value, so that they can be used in a similar fashion to GetAngleToPlayer.

A task is structurally different. It is a defined piece of code that runs alongside the MainLoop{}. If you task doesn'T include a yield; in the task, it can be used similar to a function, but it is a little more CPU intensive. If you DO include yield;, well, refer to the intermediate tutorial.  ;)
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."

Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #283 on: August 17, 2010, 11:11:15 PM »
Is there a function to detect the collision between an effect object and a bullet (any kind of bullet except for lasers) ? (you could've guessed what I was trying to accomplish now:
Spoiler:
is it possible to code a reflective barrier at all ?
)
I suppose you could, but it sucks to work properly. It would be better off using math. What shape is it? Are you placing it anywhere in particular; are you moving it around?

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

Beef Owl

  • Why yes, owls do yield beef:
  • It is known as The Strongest White Meat
Re: Danmakufu Q&A/Problem thread number 4
« Reply #284 on: August 18, 2010, 04:22:59 PM »
is it possible to code a reflective barrier at all ?

You could pretty easily adapt this code to work for a specific area instead of the screen borders (though you would have to put it in every bullet, which would suck) but I can't give you much in the ways of specifics because of how vague you're question is

Code: [Select]
while(Obj_BeDeleted(obj) == false)
{
        if(Obj_GetX(obj) < GetClipMinX)
        {
                  Obj_SetAngle(obj, 180 - Obj_GetAngle(obj));
                  Obj_SetX(obj,  Obj_GetX(obj) + 0.1);
        }

        if(Obj_GetX(obj) > GetClipMaxX)
        {
                  Obj_SetAngle(obj, 180 - Obj_GetAngle(obj));
                  Obj_SetX(obj,  Obj_GetX(obj) - 0.1);
        }
}

Not really sure if this is useful but hopefully it helps :)
« Last Edit: August 18, 2010, 04:24:56 PM by Beef Owl »

Formless God

Re: Danmakufu Q&A/Problem thread number 4
« Reply #285 on: August 21, 2010, 08:59:08 PM »
Ah ... no, this is different from the QED effect :<
The barrier should be a rectangle/square that is placed on the player and moves with the player.

Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #286 on: August 21, 2010, 09:04:40 PM »
You could do a circle if you want.

if( (Obj_GetX(obj) - GetPlayerX)^2 + (Obj_GetY(obj) - GetPlayerY)^2 < (radius)^2 ){ bounce; }

A square/rectangle would be

if( objx>plx-left && objx<plx+right && objy>ply-top && objy<ply+bottom ){ bounce; }

However because the bullets could bounce given any angle around the player (instead of a wall that you can only run into one side of), you would need to move the bullet that small amount like
objx += cos(atan2(objy-ply,objx-plx)); objy += sin(atan2(objy-ply,objx-plx)); or something like that.
« Last Edit: August 21, 2010, 09:13:34 PM by Drake »

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

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem thread number 4
« Reply #287 on: August 22, 2010, 01:08:38 AM »
Or you could use Collision_Line_Circle :V
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #288 on: August 22, 2010, 01:35:54 AM »
I don't see how that would be better in this situation.

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

Re: Danmakufu Q&A/Problem thread number 4
« Reply #289 on: August 22, 2010, 03:11:58 AM »
I'm trying to make it so that a bullet will, when it hits the side of the screen, reflect off of it. This is the code I'm using:
Code: [Select]
task fire01{
let dir = 0;
let i = 0;
loop{
bullet01(GetEnemyX,GetEnemyY,3,dir,PURPLE12,5);
if(dir>=0 && i==0 && dir!=45){
dir++;
}
if(dir==45 && i==0){
dir--;
i = 1;
}
if(dir<=45 && i==1 && dir!=0){
dir--;
}
if(dir==0 && i==1){
dir++;
i = 0;
}
wait(2.5);
}
}

function bullet01(x,y,s,dir,g,d){
let obj01 = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj01,x,y);
Obj_SetSpeed(obj01,s);
Obj_SetAngle(obj01,dir);
ObjShot_SetGraphic(obj01,g);
ObjShot_SetDelay(obj01,d);

while(!Obj_BeDeleted(obj01)){
if(Obj_GetX(obj01)>GetClipMaxX){
Obj_SetAngle(obj01,rand(105,179));
}
yield;
}
}
However, the problem is that, once one bullet is fired, the next bullet won't be fired until the first bullet has been deleted. Is there a way to make it so that the next bullet will fire before first is deleted?

Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #290 on: August 22, 2010, 03:24:54 AM »
function -> task

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

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem thread number 4
« Reply #291 on: August 22, 2010, 08:33:16 AM »
I don't see how that would be better in this situation.

he wants a rotating square-shaped barrier on the player that reflects bullets out, right?
Code: [Select]
let barrier_angle=0;
let barrier_width=20;

...

task bullet(blah, blah){
let obj=Obj_Create(OBJ_SHOT);
blah blah blah
while(!Obj_BeDeleted(obj)){
    if(Collision_Line_Circle(GetPlayerX+barrier_width*cos(barrier_angle), GetPlayerY+barrier_width*sin(barrier_angle), GetPlayerX+barrier_width*cos(barrier_angle+180), GetPlayerY+barrier_width*sin(barrier_angle+180), barrier_width, Obj_GetX(obj), Obj_GetY(obj), object_radius)==true){
    *insert reflection code here depending on barrier_angle*
    }
    yield;
}
}
@MainLoop{
    barrier_angle++; //blah
}

This makes a rotating square shaped collision-check area on the player...

if I remember correctly, the reflection code should look something like this...
Code: [Select]
angle=atan2(Obj_GetY(obj)-GetPlayerY, Obj_GetX(obj)-GetPlayerX);
if(angle>=barrier_angle-45 && angle<barrier_angle+45){angleb=barrier_angle;}
if(angle>=barrier_angle+45 && angle<barrier_angle+135){angleb=barrier_angle+90;}
if(angle>=barrier_angle+135 && angle<barrier_angle+225){angleb=barrier_angle+180;}
if(angle>=barrier_angle+225 && angle<barrier_angle+315){angleb=barrier_angle+270;}
Obj_SetAngle(obj, angleb*2-Obj_GetAngle(obj)+180);
« Last Edit: August 22, 2010, 08:45:26 AM by Kylesky »
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Chau

  • Warning! Incoming Engrish post!
Re: Danmakufu Q&A/Problem thread number 4
« Reply #292 on: August 22, 2010, 12:47:13 PM »
Hi everyone,
how do you "shorten" the replay? When I played Concealed the Conclusion I noticed that the replay doesn't show the menu. "IsReplay" can be used to prevent that the menu appears but I think the keys you pressed in the menu still remain saved in the replay so that the replay shows some weird movements at the beginning.
Or am I wrong?

} // end of Engrish

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem thread number 4
« Reply #293 on: August 22, 2010, 12:53:00 PM »
Hey guyz how do I nue line in DrawText?

Re: Danmakufu Q&A/Problem thread number 4
« Reply #294 on: August 22, 2010, 05:52:33 PM »
Sorry Chau I have no idea,

Hey guyz how do I nue line in DrawText?

You have to make an entirely new DrawText

Re: Danmakufu Q&A/Problem thread number 4
« Reply #295 on: August 22, 2010, 06:15:51 PM »
function -> task
That worked, thank you.

Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #296 on: August 22, 2010, 06:59:23 PM »
Hey guyz how do I nue line in DrawText?
type
 in the text

wtf u doin
wtf u doin

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

Re: Danmakufu Q&A/Problem thread number 4
« Reply #297 on: August 22, 2010, 07:35:34 PM »
type
 in the text

I thought that only worked in Dialog?

Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #298 on: August 22, 2010, 07:58:17 PM »
Oh whoops, thought that was what he meant. Might still work, but eh.

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

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem thread number 4
« Reply #299 on: August 22, 2010, 08:55:08 PM »
Oh whoops, thought that was what he meant. Might still work, but eh.
Just tried it, didn't work.