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

TheMasterSpark

  • Lunatic lemurialist
Re: Danmakufu Q&A/Problem Thread v3
« Reply #870 on: May 27, 2010, 08:00:45 PM »
Quote from: Bitz
Yeah, shove a giant "black curtain" Object Effect on top of everything.

Okay, thanks for that.

I'm sorry to be bothering you again but I seem to have run into a problem with a script of mine, and I'm more or less stumped as to what's causing it. The script revolves around a ring of Zombies spawning around the player and unless they're shot, the Zombies will all explode in unison after 3 seconds, releasing a shower of body parts. The thing here is that after the fifth ring of Zombies have been spawned, it all just starts to... well, spaz out. The sixth ring of Zombies will release only the zombie heads and the seventh ring and onwards won't appear on the screen at all, although the sound effect can still be heard. I guess it has to be something with my script enemies, since a regular ring of bullets works without issues..

Here's a link the code~

Linky!

« Last Edit: May 27, 2010, 08:41:08 PM by MasterSpark »

Drake

  • *
Re: Danmakufu Q&A/Problem Thread v3
« Reply #871 on: May 27, 2010, 08:34:43 PM »
First of all, please use pastebin from now on if you could. Scrolling down a page of entire scripts is really tedious.

The only thing I noticed that was odd right away was the wait(3.3);. Why exactly are you trying to loop a decimal, it doesn't work. Probably not the problem, just saying.

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

TheMasterSpark

  • Lunatic lemurialist
Re: Danmakufu Q&A/Problem Thread v3
« Reply #872 on: May 27, 2010, 08:40:06 PM »
Ah right, sorry about that Drake. I'll modify the post and include a link to pastebin instead.

About that wait(3.3), to be perfectly honest I found inspiration for that in one of Helepolis' scripts and used it without question. It seems to work just fine, despite being a decimal~

Edit: I've fiddled around some more, trying to isolate the cause of the problem. I think it has something to do with the firing of the body parts. I tried removing the self-detonation process and the rings of Zombies would then spawn as intended. However, once I had shot enough of them (which also causes them to explode) the same issue crept up, with no more Zombie rings appearing. Is there anything wrong with how I've linked the various familiars together?

As a side question, what is the last parameter used in CreateEnemyFromScript? The Wiki says that it's a "User-defined argument" but I still haven't really been able to determine what that is, exactly..
« Last Edit: May 28, 2010, 03:20:11 PM by MasterSpark »

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 v3
« Reply #873 on: May 28, 2010, 03:32:45 PM »
As a side question, what is the last parameter used in CreateEnemyFromScript? The Wiki says that it's a "User-defined argument" but I still haven't really been able to determine what that is, exactly..

That's just an extra argument for when you're making multiple enemies with the same script...

For example, if you're trying to make multiple familiars or enemies with only a small difference, you can create them using the same script... Useful if, for example, you have multiple enemies with the same pattern, but shooting at different angles... just set their angles in that last argument than call this in the script
Code: [Select]
let angle=GetArgument;
or something like that...
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Re: Danmakufu Q&A/Problem Thread v3
« Reply #874 on: May 28, 2010, 04:40:44 PM »
Basically, it's any extra value you want to pass along to your enemy script from wherever you're spawning it. As Kylesky said, just use GetArgument inside the enemy script to retrieve that value. Can be boolean, numerical, String/array, char -- whatever you want it to be -- it's "user-defined" after all.

Also, yeah, you can pass decimals in the "loop" function, but I'm not sure what that does. I'd hypothesize it either truncates or rounds the decimal somehow.

TheMasterSpark

  • Lunatic lemurialist
Re: Danmakufu Q&A/Problem Thread v3
« Reply #875 on: May 28, 2010, 04:50:27 PM »
Alright, thanks for clearing that up for me. :)

Continuing with my current problem, can only a finite number of script enemies be used at any one time? Since a single ring of zombies consist of 60 scripted enemies in one go (10 zombies, 50 body parts), that might be putting some strain on the game?

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread v3
« Reply #876 on: May 28, 2010, 05:40:05 PM »
The maximum is 256, I believe. If they're not deleting themselves correctly, it could be a problem. You could probably use object bullets for the body parts to cut down on the load.

TheMasterSpark

  • Lunatic lemurialist
Re: Danmakufu Q&A/Problem Thread v3
« Reply #877 on: May 28, 2010, 06:13:50 PM »
Quote from: Azure Lazuline
The maximum is 256, I believe. If they're not deleting themselves correctly, it could be a problem. You could probably use object bullets for the body parts to cut down on the load.

Ah, now that seems to be it!

Another lesson learned - do not abuse script enemies. :)

Now I need to get cracking on making the graphics available for object bullets..

Thanks a lot. :)

Edit: I feel almost embarassed to ask about a thing like this, but I seem to have hit a little snag with my bouncing bullets. I want the bullets to bounce from whichever border of the field that it hits, but I can only get the ones on the Y-axle to work. Here's how the relevant code looks..

Code: [Select]
while(!Obj_BeDeleted(obj)){

if(Obj_GetY(obj) > GetClipMaxY) {
Obj_SetAngle(obj,-dir); //This one works..
}

if(Obj_GetY(obj) < GetClipMinY) {
Obj_SetAngle(obj,-dir); //This one too..
}

if(Obj_GetX(obj) > GetClipMaxX) {
Obj_SetAngle(obj,-dir); //This one doesn't..
}

if(Obj_GetX(obj) < GetClipMinX) {
Obj_SetAngle(obj,-dir); //And neither does this one..
}
yield;
}

Does the code for bouncing bullets on the X-axle look any different than that?
« Last Edit: May 29, 2010, 06:31:48 PM by MasterSpark »

Gc

  • youtu.be/pRZpjlrKM8A
Re: Danmakufu Q&A/Problem Thread v3
« Reply #878 on: May 29, 2010, 07:33:57 PM »
Code: [Select]
while(!Obj_BeDeleted(obj)){

if(Obj_GetY(obj) > GetClipMaxY) {
Obj_SetAngle(obj,-dir); //This one works..
}

if(Obj_GetY(obj) < GetClipMinY) {
Obj_SetAngle(obj,-dir); //This one too..
}

if(Obj_GetX(obj) > GetClipMaxX) {
Obj_SetAngle(obj,-dir); //This one doesn't..
}

if(Obj_GetX(obj) < GetClipMinX) {
Obj_SetAngle(obj,-dir); //And neither does this one..
}
yield;
}

Does the code for bouncing bullets on the X-axle look any different than that?
[/quote]
IIRC, to bounce something on the X axis, you have to use 180 - *current angle*

TheMasterSpark

  • Lunatic lemurialist
Re: Danmakufu Q&A/Problem Thread v3
« Reply #879 on: May 30, 2010, 08:09:23 PM »
Quote from: The Cube
IIRC, to bounce something on the X axis, you have to use 180 - *current angle*

Yup, that was it. Thanks. :)

Thaws

  • _m廿廿m_
Re: Danmakufu Q&A/Problem Thread v3
« Reply #880 on: June 01, 2010, 12:18:13 PM »
Uh... I saw several people mention regarding shotsheets that dimensions are preferred to be in power of 2.

Well.. I didn't know about this before therefore I haven't done so.

So I was wondering what's the significance of doing this?

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread v3
« Reply #881 on: June 01, 2010, 12:32:26 PM »
Uh... I saw several people mention regarding shotsheets that dimensions are preferred to be in power of 2.

Well.. I didn't know about this before therefore I haven't done so.

So I was wondering what's the significance of doing this?
Fujiwara did a quality check on my shotsheet and discovered that if the dimensions of the image isn't a power of 2, it will show up with distorted or bleach colours in game. This goes for any image that is loaded into danmakufu. I don't know for sure if the same counts for graphicrects (don't think so). But for images it does.

So basically a image of 256x256 = ok,  253x129 is bad. My expanded shotsheet is 513x768 which is also bad.

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread v3
« Reply #882 on: June 01, 2010, 06:02:55 PM »
In most cases, it honestly doesn't matter - it's just a very small upgrade in quality. But if you're going to be looking at this image hundreds of times in every level, it should look as good as possible.

SparklingOrange

  • Is a scrub.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #883 on: June 01, 2010, 08:39:24 PM »
I'm having a huge issue where my script looks to be correct, but when executed, causes Danmakufu to freeze. Whether I'm causing an overflow or not, it's really frustrating. I'm trying to make an enemy script where it shoots a circle shot similar to the spinners in Hina's stage in MoF, and only the movement works...
Code: [Select]
//stage 1 enemy 2. Stops at a point, shoots a circle shot, then retreats.
script_enemy_main{
let get = GetCurrentScriptDirectory;

    let EnemyImage = get ~ ".\img\dummy.png";
let pow2 = get ~ ".\se\pow2.wav";
    @Initialize {
LoadSE(pow2);
        LoadGraphic(EnemyImage);
        SetLife(150);
SetScore(1500);
        SetInvincibility(30);
        SetEnemyMarker(false);
        SetDurableSpellCard;

mainTask;
    }

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

    @DrawLoop {
        SetTexture(EnemyImage);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,8,8);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
        DrawGraphic(GetX, GetY);
       
    }

    @Finalize {
    }
task mainTask{
move;
wait(60);
fire;
wait(90);
exit;
yield;
}

task move{
if(GetX>GetCenterX){
SetMovePosition03(GetCenterX+100,GetCenterY-90,10,4);
}
else{
SetMovePosition03(GetCenterX-100,GetCenterY-90,10,4);
}
yield;
        }
task exit{
SetMovePosition03(GetX(),GetCenterY-500,12,4);
if(GetY<GetClipMinY){
VanishEnemy;
}
yield;
}
task fire{
let angle=0;
let x=0;
loop{
PlaySE(pow2);
while(x<15){
CreateShot02(GetX(),GetY(),8,angle,-4,0.5,WHITE11,1);
angle+=360/15;
x++;
}
}
yield;
}
function wait(w){
loop(w){yield;}
}
}

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #884 on: June 01, 2010, 09:35:53 PM »
I'm having a huge issue where my script looks to be correct, but when executed, causes Danmakufu to freeze. Whether I'm causing an overflow or not, it's really frustrating. I'm trying to make an enemy script where it shoots a circle shot similar to the spinners in Hina's stage in MoF, and only the movement works...

lots of code


There's quite a few things here that you seem to be misunderstanding and things that can be improved upon, but to start with let's take a look at what's causing Danmakufu to freeze.

This is what your fire task looks like:
Code: [Select]
      task fire{   
         let angle=0;
         let x=0;
            loop{
                  PlaySE(pow2);
                  while(x<15){
                     CreateShot02(GetX(),GetY(),8,angle,-4,0.5,WHITE11,1);
                     angle+=360/15;
                     x++;
                     }   
                  }
               yield;
            }
It's hard to catch but you have an infinite loop in there with no yields. A loop without a specified number will continue until it encounters a break; or a yield; in a task. Unfortunately, the yield in your fire task seems to be outside of the loop so Danmakufu continues to try to run the code inside the loop until it finishes (which is never). This is what's causing the freeze because the code can't advance.

Now about your other problems (that you didn't mention but are bugging me), try to keep your spacing more easily readable. The spacing I would've used in the above code would be more like this:
Code: [Select]
      task fire{   
        let angle=0;
        let x=0;
        loop{
          PlaySE(pow2);
          while(x<15){
            CreateShot02(GetX(),GetY(),8,angle,-4,0.5,WHITE11,1);
            angle+=360/15;
            x++;
          }   
        }
        yield;
      }
This groups the codes that are inside braces so that you can more easily see which functions are being called where. It also becomes more apparent that the yield is outside the loop.

Lastly, you seem to be misunderstanding how tasks work. They do not inherently loop. For example, the following bit of code will not loop when called:
Code: [Select]
task DoesNotLoop {
  CreateShot01(GetX, GetY, 3, GetAngleToPlayer, RED01, 10);
  Wait(30);
}
All it will do is create a single shot and stop running. If you intend the boss to shoot something every 30 frames for as long as it exists, you need to do this instead:
Code: [Select]
task DoesLoop {
  loop{
    CreateShot01(GetX, GetY, 3, GetAngleToPlayer, RED01, 10);
    Wait(30);
  }
}

Hope that helps.

EDIT: Scratch that I just noticed you're doing a normal enemy. The yields at the end of each task are rather pointless though.
« Last Edit: June 01, 2010, 09:40:12 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.

Elementoid

  • Having a heated affair with feux-familiars
Re: Danmakufu Q&A/Problem Thread v3
« Reply #885 on: June 01, 2010, 11:43:24 PM »
This thing I made (surprisingly) works as intended, except that for some reason, the bullets are spawning and then curving inwards, while they should be spawning at the boss' coordinates and then curving outwards. It probably has to do with how the objects' positions are changed manually, but I can't see how or why.

SparklingOrange

  • Is a scrub.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #886 on: June 02, 2010, 12:13:11 AM »
Hope that helps.

EDIT: Scratch that I just noticed you're doing a normal enemy. The yields at the end of each task are rather pointless though.

Thanks for the tip, Blargel. I wasn't sure where the yield; should be...but I noticed that was probably the reason for the freeze due to the infinite loop thing...

One more thing, how does CreateLaserA exactly work? I tried playing around with it to make a laser shoot at an angle for some frames, rebound, then reflect to another angle, but all it does is make a spinning laser that doesn't really cut off from the base. When that didn't work, I tried creating an object laser based on what Helepolis said about object shots in his video, but I only managed to spawn the laser. It didn't move.

Also, there must be a math function out there that allows me to make a straight-line shot aimed at the player without using GetAngleToPlayer;...when I use that, the straight line breaks up when the player moves due to the position relative to the frame the shot is fired. What could it be?

Fetch()tirade

  • serial time-waster
Re: Danmakufu Q&A/Problem Thread v3
« Reply #887 on: June 02, 2010, 12:19:59 AM »
The SetSpeed option for object lasers is totally useless. They can only be moved manually through SetPosition. And making lasers reflect off of walls is a lot harder than making bullets do it, I'm not really sure how.

Information on CreateLaserA should be on the wiki. The reason it spins is because that angle adjust value is the rate of adjustment, not a new angle, and it should be a very small number. And CreateLaserA makes lasers that don't terminate from the base, that's the way it is. The only ones that do are CreateLaserC and object lasers.

As for the straight-shooting, atan2 is your answer: it get the angle from point A to point B. For a recreation of GetAngleToPlayer, it would look like:

atan2 (GetPlayerY - GetEnemyY, GetPlayerX - GetEnemyX);

or more simply:

atan2 (PointB y  value - PointA y value, PointB x value - PointA x value);

*The spaces in between are just for clarity.

It's pretty useful.
« Last Edit: June 02, 2010, 12:23:54 AM by Flashtirade »

DgBarca

  • Umineko fuck yeah
  • Spoilers ?
Re: Danmakufu Q&A/Problem Thread v3
« Reply #888 on: June 02, 2010, 09:22:42 AM »
How is the radius of the bullet hitbox calculated in danmakufu ?
if it is rect=(16,15,32,30)
((32-16)+(30-15))/2 ?
[21:16] <redacted> dgbarca makes great work
[21:16] <redacted> i hope he'll make a full game once

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #889 on: June 02, 2010, 10:05:48 AM »
Also, there must be a math function out there that allows me to make a straight-line shot aimed at the player without using GetAngleToPlayer;...when I use that, the straight line breaks up when the player moves due to the position relative to the frame the shot is fired. What could it be?

Something like this?
Code: [Select]
task StraightLine {
    let angle = GetAngleToPlayer;
    loop(10){
        CreateShot01(GetX, GetY, 3, angle, RED01, 10);
        Wait(5);
    }
}
<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.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #890 on: June 02, 2010, 10:07:58 AM »
Code: [Select]
        Wait(5);
What was that about never using Wait with a capital w to define something because it is an actual function related to even scripts..?
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."

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #891 on: June 02, 2010, 10:09:19 AM »
That's Helepolis's stance. I personally don't give a damn... Probably because I don't do event scripts often.
<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.

DgBarca

  • Umineko fuck yeah
  • Spoilers ?
Re: Danmakufu Q&A/Problem Thread v3
« Reply #892 on: June 02, 2010, 10:16:43 AM »
Is there a way to prevent bullets to FadeDelete when you get hit ?
[21:16] <redacted> dgbarca makes great work
[21:16] <redacted> i hope he'll make a full game once

Thaws

  • _m廿廿m_
Re: Danmakufu Q&A/Problem Thread v3
« Reply #893 on: June 02, 2010, 10:18:27 AM »
Is there a way to prevent bullets to FadeDelete when you get hit ?

I believe you'd need to set those bullets to be bomb resistant.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #894 on: June 02, 2010, 10:23:21 AM »
Do you mean that they should be removed instantly without the fading, or do you mean that they should survive the death of the player?
If the former, you could try if(OnPlayerMissed==true){ Obj_Delete(obj); }. Maybe it will delete the bullet instantly before it can be fade deleted.
If the latter, you can use ObjShot_SetBombResist. If you want the bullets to survive hitting the player but not bombing, you cann add if(OnBomb==true){ ObjShot_SetBombResist(obj, false); }

That's Helepolis's stance. I personally don't give a damn... Probably because I don't do event scripts often.
Just damage prevention. If Orange is told about this issue, he won't have to spend many hours looking for the source of the bad allocation error if he eventually decides to make an event.  ;)
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."

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #895 on: June 02, 2010, 10:27:07 AM »
Just damage prevention. If Orange is told about this issue, he won't have to spend many hours looking for the source of the bad allocation error if he eventually decides to make an event.  ;)

It's not going to give bad allocation and no one uses tasks in event scripts anyway. The MainLoop itself seems to get paused during the default TextOut and Wait functions in events so there's no need for tasks.

EDIT: Also, the default ExRumia stage uses Wait instead of wait for its stage task as well. :V
<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.

Fetch()tirade

  • serial time-waster
Re: Danmakufu Q&A/Problem Thread v3
« Reply #896 on: June 03, 2010, 03:30:49 AM »
This might sound stupid, but I keep on getting a missing-brackets error for this line of code.

Code: [Select]
if(currentspeed /= minmaxspeed){Obj_SetSpeed(obj, currentspeed + accel);}

What's wrong?

Gc

  • youtu.be/pRZpjlrKM8A
Re: Danmakufu Q&A/Problem Thread v3
« Reply #897 on: June 03, 2010, 03:35:56 AM »
This might sound stupid, but I keep on getting a missing-brackets error for this line of code.

Code: [Select]
if(currentspeed /= minmaxspeed){Obj_SetSpeed(obj, currentspeed + accel);}

What's wrong?
Code: [Select]
if(currentspeed != minmaxspeed){Obj_SetSpeed(obj, currentspeed + accel);}

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 v3
« Reply #898 on: June 03, 2010, 03:37:34 AM »
This might sound stupid, but I keep on getting a missing-brackets error for this line of code.

Code: [Select]
if(currentspeed [b]/=[/b] minmaxspeed){Obj_SetSpeed(obj, currentspeed + accel);}

What's wrong?

what are you trying to do? I'm guessing it's supposed to be "is not equal to" ? if so... then you should use != there's no such thing as /= :V

EDIT: damn... cube beat me to it :|
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Areylie

  • Cirno's Sister
    • Lymia's Website
Re: Danmakufu Q&A/Problem Thread v3
« Reply #899 on: June 03, 2010, 03:39:45 AM »
Do you mean that they should be removed instantly without the fading, or do you mean that they should survive the death of the player?
If the former, you could try if(OnPlayerMissed==true){ Obj_Delete(obj); }. Maybe it will delete the bullet instantly before it can be fade deleted.
If the latter, you can use ObjShot_SetBombResist. If you want the bullets to survive hitting the player but not bombing, you cann add if(OnBomb==true){ ObjShot_SetBombResist(obj, false); }
Just damage prevention. If Orange is told about this issue, he won't have to spend many hours looking for the source of the bad allocation error if he eventually decides to make an event.  ;)
Actually, the following lines of code will do.

if(OnPlayerMissed)
if(OnBomb){ ObjShot_SetBombResist(obj, false); }

OnPlayerMissed, and OnBomb both return either "true" or "false", which is the same thing that "a==b" returns. In other words (function that returns "true" or "false") == true is a complete noop.
[Geek code (3.12): GCS/H/M d+(-) s+:->--:- a--->? C+(++++)>$ UL++@ P+(++) L+++ E- W++ N o K? w-@ O- M- V? PS++@ PE>- Y+ PGP++ t- 5? X? R+@ tv- b+(++) DI D-- G? e>+++(++++) h! r++ x-]
[Furry code (1.3): FFm1r A !C D? H+++ M? P++++ R-- T W !Z Sf! RLCT a- cl+~++++>$ d--- e>+++ f? h* i++/+++ j+ p+ sf!]