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

Re: Danmakufu Q&A/Problem Thread
« Reply #810 on: September 29, 2009, 10:44:02 PM »
I got it working, just had to disable my UAC...

Henry

  • The observer
  • Exploring to the new world of Danmaku
Re: Danmakufu Q&A/Problem Thread
« Reply #811 on: October 01, 2009, 11:09:58 AM »
I've encountered a very weird problem.

The same Spell Card I made is put in 2 different folders with the same source materials. But one of those works perfectly whilst another caused significant slow down.

Can somebody explain this?
Old/Forgotten member.

Old Patchouli Project was outdated but new one is in progress.

Re: Danmakufu Q&A/Problem Thread
« Reply #812 on: October 01, 2009, 08:48:35 PM »
Im having a problem with this script.. I cant get shot replace to work. Can anyone tell me whats wrong with it?

Quote
   
   
   @Initialize{
      SetLife(1500);
      SetTimer(60);
shotinit;
      SetInvincibility(30);
      LoadGraphic(imgExRumia); //Load the boss graphic.
      SetMovePosition02(GetCenterX, GetCenterY - 100, 120); //Move the boss to the top center

of the screen.
   }
   
   @MainLoop{
   SetCollisionA(GetX, GetY, 32);
   SetCollisionB(GetX, GetY, 16);
   frame++;
   
   if(frame==120){
   
      loop(150){
         CreateShot01(GetX, GetY, 7, angle, RED52, 0);
         angle += 780/50;
      }
     
      angle = 0;
      frame = 60;
   }
   
   
   }

   @DrawLoop{
      //All this foolishness pertains to drawing the boss. Ignore everything in @Drawloop

unless you have read and understand Nuclear Cheese's Drawing Tutorial.
      SetColor(255,255,255);
      SetRenderState(ALPHA);
      SetTexture(imgExRumia);
      SetGraphicRect(64,1,127,64);
      DrawGraphic(GetX,GetY);
   }
     
   @Finalize
   {
      DeleteGraphic(imgExRumia);
   }
}

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread
« Reply #813 on: October 01, 2009, 08:53:28 PM »
Im having a problem with this script.. I cant get shot replace to work. Can anyone tell me whats wrong with it?
Just looking...
Did you use #include_function "libSHOT_REPLACEshot_replace.dnh"; ?
Did you have all the // comments on one line?

CK Crash

  • boozer
Re: Danmakufu Q&A/Problem Thread
« Reply #814 on: October 01, 2009, 08:55:16 PM »
Did you remember to use...

#include_function "lib\SHOT_REPLACE\shot_replace.dnh"

...right above @Initialize? This grabs all of the code inside of the shot replace script, so that it can be called using shotinit. Also, a 150 bullet ring at speed 7 sounds insane. The average bullet speed is between 1 and 4, and 36 bullets per ring is a fair amount if you're aiming for a normal level script.

Re: Danmakufu Q&A/Problem Thread
« Reply #815 on: October 01, 2009, 09:12:09 PM »
Thanks for the help, I figured it out. Now I have a new question. How do I add another CreateShot01? I want to add a homing shot so the player cant stay in one safe spot for the entire attack.

CK Crash

  • boozer
Re: Danmakufu Q&A/Problem Thread
« Reply #816 on: October 01, 2009, 09:20:26 PM »
Use GetAngleToPlayer for the bullet angle if you want it to be aimed at the player. An actually homing shot would require knowledge of object bullets. I wouldn't mind walking you through it via PM, but it's relatively advanced.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread
« Reply #817 on: October 03, 2009, 01:37:24 PM »
I am currently immitating the burning aura for bosses and such, however my code seems to cause Danmakufu to clog up and eventually get extreme FPS dropping after a while.

My method is the follow:
- An effect object task that spawns 1 particle using currently a 128x128 texture which is a light particle.
- The task is called within a loop which spawns the particle at random x-offset causing a nice burning aura/flame
- The effect objects scale down during the loop inside the task.

Here is the code for the loop which is inside the effect task.
Code: [Select]

loop {
Obj_SetPosition(obj,x,y);   
        ObjEffect_SetScale(obj, sx, sy);  // scaling
ObjEffect_SetAngle(obj,0,0,dir); // dir
  ObjEffect_SetVertexColor(obj,0,alphret,255,255,255);
ObjEffect_SetVertexColor(obj,1,alphret,255,255,255);
  ObjEffect_SetVertexColor(obj,2,alphret,255,255,255);
  ObjEffect_SetVertexColor(obj,3,alphret,255,255,255);
alphret-=5;  // this is for decreashing alpha value
y-=3; 
dir+=5;
sx-=0.01;  // scales down
sy-=0.01;   // scales down
if(c==60){Obj_Delete(obj);}   // after 60 frames delete the object.
c++;
yield;
}

But it still causes FPS drop =,= why ?


Stuffman

  • *
  • We're having a ball!
Re: Danmakufu Q&A/Problem Thread
« Reply #818 on: October 03, 2009, 03:22:42 PM »
Is the loop terminating correctly once the object is deleted? I dunno I can't see the code around it.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread
« Reply #819 on: October 03, 2009, 03:35:51 PM »
There is nothing after the loop , only a } which is the end of the task. The loop is terminated correctly?

Stuffman

  • *
  • We're having a ball!
Re: Danmakufu Q&A/Problem Thread
« Reply #820 on: October 03, 2009, 03:41:43 PM »
Wait, is it actually a loop and not a while? With no number of iterations specified? If you do that the loop won't end, right? It should be like, loop(61){ shouldn't it?

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread
« Reply #821 on: October 03, 2009, 04:44:05 PM »
Should I replace it with   while(!Obj_BeDeleted)? 

I think indeed the loop is a problem. Let me go try that out.

Edit:

while(!Obj_BeDeleted) fixed the problem. Note to self: "Dnh does not like loops in effects and objects if it is not killed proper"
« Last Edit: October 03, 2009, 06:33:48 PM by Helepolis »

Re: Danmakufu Q&A/Problem Thread
« Reply #822 on: October 03, 2009, 09:49:13 PM »
ok i have a few questions, while i was messing with angle+= i came across something ive ever seen before

 
Code: [Select]
#TouhouDanmakufu
#Title[Freaky Bullets]
#Text[]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let frame = 0;
    let angle = 0;
#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
    @Initialize {
SetMovePosition02(GetCenterX, GetCenterY-120, 120);
        SetLife(900);
        SetDamageRate(100, 50);
        SetTimer(600);
        SetScore(50000);
        SetEnemyMarker(false);
        Concentration01(60);
        Concentration02(60);
        MagicCircle(false);
shotinit;
    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 24);
    frame++;
if(frame%1==0){
angle+=17493;
CreateShot01(GetX,GetY,2,angle+10,AQUA56,0);
CreateShot01(GetX,GetY,2,angle+20,RED56,0);
CreateShot01(GetX,GetY,2,angle+30,BLUE56,0);
CreateShot01(GetX,GetY,2,angle+40,PURPLE56,0);
CreateShot01(GetX,GetY,2,angle+50,ORANGE56,0);
CreateShot01(GetX,GetY,2,angle+60,WHITE56,0);
CreateShot01(GetX,GetY,2,angle,YELLOW56,0);
CreateShot01(GetX,GetY,2,angle+70,GREEN56,0);
}
    }

@DrawLoop{
}

@Finalize
{
}
}

Causes HUGE bullets to fill the screen, why is this?

and also, angle+= only makes the bullets go clockwise, it there a way to make them go counterclockwise? i tried putting the number at the end of angle+= negative butno such results, any ideas?

Stuffman

  • *
  • We're having a ball!
Re: Danmakufu Q&A/Problem Thread
« Reply #823 on: October 03, 2009, 10:24:40 PM »
Someone was talking about this earlier today in IRC, for some reason putting a gigantic value in the angle causes some sort of overflow that makes the shot weird out.

The inverse to += is -=, naturally.

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: Danmakufu Q&A/Problem Thread
« Reply #824 on: October 03, 2009, 10:34:12 PM »
Alright, I have a problem.  I wanted to make a stage script, but I don't think I should have started off the way I did.

I made my spellcards, tested them, they worked, etc etc.  I put them together with a plural script, then I said "bah, I'll just make a stage altogether".

Just when I thought I had this Danmakufu down, it started getting really irritating.


I was putting together a stage script composed of plural scripts for the boss's spellcards.
I wanted the Stage to have it's own background, and the boss's spellcards have its own, depending on whether it was a pre-spellcard or not.

I wanted just a few things I put in the stage script, and build off of that as I go.  I started off very simple.


Code: [Select]
#TouhouDanmakufu[Stage]
#Title[Mokou Stage]
#Text[The stage, Mokou is the boss.]
#Player[FREE]
#ScriptVersion[2]

script_stage_main{

              let background3 = GetCurrentScriptDirectory~"background3.png";




@Initialize{

      LoadGraphic(background3);
      immortal;

}

@Mainloop{
yield;
}



@DrawLoop{
}



@BackGround{

      SetTexture(background3);
      SetGraphicAngle(0,0,0);
      SetGraphicRect(0, 0, 384, 448);
      SetGraphicScale(1,1);
      DrawGraphic(GetCenterX, GetCenterY);

}


@Finalize{
DeleteGraphic(background3);
}


task immortal{
             
          }



}
Everything worked nicely, the background loaded, no crash.
Then I put in the path for the plural script that lead to the boss's spellcards.

Code: [Select]
task immortal{
             
          CreateEnemyBossFromFile(GetCurrentScriptDirectory ~ "Plural.txt",GetCenterX,0,2,90,NULL);
            }

It didn't load.  No error either, but it was just as if I never put in anything at all. To find out where I went wrong, I decided to replace the string for the plural script, to the individual spell script which I tested and worked when loaded by itself (it also had its own background for that spellcard, so it should have loaded too).
But it didn't.  Just the blank stage, with the background which I commanded for the stage script to load.
What's going on here? Why don't my scripts load?

Stuffman

  • *
  • We're having a ball!
Re: Danmakufu Q&A/Problem Thread
« Reply #825 on: October 04, 2009, 01:30:58 AM »
- Try putting a loop(60){yield;} in front of the CreateBoss line. Functions can fail sometimes if you try to load them instantly when the script starts. This will put a bit of delay in front of it.
- Filenames are case sensitive, make sure the file isn't called plural.txt rather than Plural.txt

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: Danmakufu Q&A/Problem Thread
« Reply #826 on: October 04, 2009, 02:17:12 AM »
- Try putting a loop(60){yield;} in front of the CreateBoss line. Functions can fail sometimes if you try to load them instantly when the script starts. This will put a bit of delay in front of it.
- Filenames are case sensitive, make sure the file isn't called plural.txt rather than Plural.txt


It didn't work.
Maybe I'm missing something.  Can you bring out/upload a very simple stage script that loads a plural script for me?  Maybe I'm missing something.  Nothing seems to be working for me anymore.

Stuffman

  • *
  • We're having a ball!
Re: Danmakufu Q&A/Problem Thread
« Reply #827 on: October 04, 2009, 02:22:09 AM »
OH.

MainLoop. Not Mainloop. Capitalize the L. No yield, no task.

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: Danmakufu Q&A/Problem Thread
« Reply #828 on: October 04, 2009, 02:33:35 AM »
OH.

MainLoop. Not Mainloop. Capitalize the L. No yield, no task.


Stuffman, you did it again.

akakldfja;kdja;skfjal;sfjskl;

Re: Danmakufu Q&A/Problem Thread
« Reply #829 on: October 04, 2009, 03:13:07 AM »
Something is wrong with this script and I have no idea what....

Code: [Select]
#TouhouDanmakufu
#Title[Laxative Sign "Suppository Toss"]
#Text[Reisen throws a bunch of suppositorys.]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{
 #include_function "lib\SHOT_REPLACE\shot_replace.dnh"
   let imgExRumia="script\ExRumia\img\ExRumia.png";
   let frame = 0;
   let angle = 0;
   @Initialize{
      shotinit;
      SetLife(1500);
      SetTimer(60);
      SetInvincibility(30);
      CutIn(YOUMU, "Laxative Sign "Suppository Toss", BossCutIn, 0, 0, 200, 600);
      LoadGraphic(imgExRumia); //Load the boss graphic.
      SetMovePosition02(GetCenterX, GetCenterY - 100, 120); //Move the boss to the top center

of the screen.
   }
   
   @MainLoop{
   SetCollisionA(GetX, GetY, 32);
   SetCollisionB(GetX, GetY, 16);
   frame++;
   
   if(frame==120){
   
      loop(150){
         CreateShot01(GetX, GetY, 7, angle, WHITE52, 0);
         angle += 780/50;
         CreateShot01(GetX, GetY, 3, GetAngleToPlayer, WHITE52, 10);
         Frame = 0;
      }
     
      angle = 0;
      frame = 60;
   }
   
   
   }

   @DrawLoop{
      //All this foolishness pertains to drawing the boss. Ignore everything in @Drawloop

unless you have read and understand Nuclear Cheese's Drawing Tutorial.
      SetColor(255,255,255);
      SetRenderState(ALPHA);
      SetTexture(imgExRumia);
      SetGraphicRect(64,1,127,64);
      DrawGraphic(GetX,GetY);
   }
     
   @Finalize
   {
      DeleteGraphic(imgExRumia);
   }
}

CK Crash

  • boozer
Re: Danmakufu Q&A/Problem Thread
« Reply #830 on: October 04, 2009, 03:34:13 AM »
You capitalized "frame" inside of your 150 loop. Remember, Danmakufu is picky about cases.

Re: Danmakufu Q&A/Problem Thread
« Reply #831 on: October 04, 2009, 03:47:09 AM »
You capitalized "frame" inside of your 150 loop. Remember, Danmakufu is picky about cases.

Ahhh! Thank you! It works now, I just removed the line

 CutIn(YOUMU, "Laxative Sign "Suppository Toss", BossCutIn, 0, 0, 200, 600);

And changed that to a lower case f and it works fine now. Thank you.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread
« Reply #832 on: October 06, 2009, 10:34:51 AM »
3D drawing is fun ze! NOT.

I don't know if anybody ever did this before. I made a full cubical room in 3D drawing. The room looks nice and dandy. Now my genius idea was to move the camera around inside the room giving it a flight sensation. ( Altering SetViewTo and SetViewFrom parameters )

However, when the camera moves forward like 512 pixels, it resets and reverses 180 degree moving backwards. I cannot show anything yet here because I am at work.

puremrz

  • Can't stop playing Minecraft!
Re: Danmakufu Q&A/Problem Thread
« Reply #833 on: October 06, 2009, 11:08:43 AM »
Hm, are you moving the entire stage, or only the camera? I have only done forward/backward movement by stage-scrolling so I can't say for sure that the camera may have a distance limit to it. As for the 180 turn, no clue o_O Try changing the scrolling speed, see what difference that makes.

3D drawing is fun ze! NOT.

I don't know if anybody ever did this before. I made a full cubical room in 3D drawing. The room looks nice and dandy. Now my genius idea was to move the camera around inside the room giving it a flight sensation. ( Altering SetViewTo and SetViewFrom parameters )

However, when the camera moves forward like 512 pixels, it resets and reverses 180 degree moving backwards. I cannot show anything yet here because I am at work.
Full Danmakufu game "Juuni Jumon - Summer Interlude" is done!
By the same person who made Koishi Hell 1,2 (except this game is serious)
Topic: http://www.shrinemaiden.org/forum/index.php/topic,9647.0.html

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread
« Reply #834 on: October 06, 2009, 11:33:36 AM »
I am not scrolling the 3D images, I am only moving the camera view around. It is hard to explain. I will try to create a movie, please wait warmly.


Download little movie here and see what happens.
« Last Edit: October 06, 2009, 11:53:32 AM by Helepolis »

Stuffman

  • *
  • We're having a ball!
Re: Danmakufu Q&A/Problem Thread
« Reply #835 on: October 06, 2009, 05:33:44 PM »
I have a strange urge to play Doom again...

Anyway it might've been some kind of math error? Seeing the code would be better, as well as knowing how the camera is supposed to move. Do you want it to turn when it reaches the wall or something?

Re: Danmakufu Q&A/Problem Thread
« Reply #836 on: October 07, 2009, 12:57:52 AM »
is there a way to have a follow a player around? Like keep checking where the player is? ive tried making CreateShotA's and multiple SetShots that tell the bullet to always GetAngleToPlayer,
but it only goes in the one direction, and ive also tried setting a variable for GetAngleToPlayer, and that has failed as well.

Re: Danmakufu Q&A/Problem Thread
« Reply #837 on: October 07, 2009, 01:00:26 AM »
Make an object bullet and get the angle to the player using arctangent every frame

Re: Danmakufu Q&A/Problem Thread
« Reply #838 on: October 07, 2009, 01:03:31 AM »
Make an object bullet and get the angle to the player using arctangent every frame

aahh! object bullets!! grr..those are the ones you make using tasks right?

Re: Danmakufu Q&A/Problem Thread
« Reply #839 on: October 07, 2009, 01:08:20 AM »
aahh! object bullets!! grr..those are the ones you make using tasks right?
Yep