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

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Danmakufu Q&A/Problem Thread II
« on: October 21, 2009, 10:10:08 AM »
Old thread: http://www.shrinemaiden.org/forum/index.php?topic=296.0

Other one is about to sage. Stuffman, if you would please.



Henry

  • The observer
  • Exploring to the new world of Danmaku
Re: Danmakufu Q&A/Problem Thread II
« Reply #1 on: October 21, 2009, 12:35:23 PM »
is it locked now?

A more interesting question (what would be done to the author of the 1001st post?)

Btw, Can I include a stage (script) inside a stage (script)?
Old/Forgotten member.

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

puremrz

  • Can't stop playing Minecraft!
Re: Danmakufu Q&A/Problem Thread II
« Reply #2 on: October 21, 2009, 01:02:26 PM »
is it locked now?

A more interesting question (what would be done to the author of the 1001st post?)

Btw, Can I include a stage (script) inside a stage (script)?


Negative. A stage script should be called a game script, for you can have only one stagescript per game. You'll have to mess with tasks or variables so that each stage plays sepparately. So all stages have to be in the same file.
I can't stand/deal with linking to other files, so I make my game using a variable as stagecounter. It's very easy to do that with variables, but it'll become a big file if you don't link stuff from other files :P Oh well.
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

Infy♫

  • Demonic★Moe
  • *
Re: Danmakufu Q&A/Problem Thread II
« Reply #3 on: October 21, 2009, 01:12:47 PM »
can i let enemies draw 3d backgrounds?

Re: Danmakufu Q&A/Problem Thread II
« Reply #4 on: October 21, 2009, 01:50:17 PM »
I'll just move my question from the other topic over here...
After posting my question about recreating Cirno's Diamond Blizzard and what else I'd need to know to make it a success, I started messing around with what I already know, and I think I've got something pretty close.

Code: [Select]
#TouhouDanmakufu
#Title[Snow Sign "Diamond Blizzard"]
#Text[My first attempt at recreating a card.]
#BackGround[IceMountain]
//#BGM[.\bgm\th06_05.wav]
#Player[REIMU, MARISA, player\Rumia\Rumia.txt]
#ScriptVersion[2]

script_enemy_main {
let ImgBoss = "script\img\ExRumia.png";
//let imgSpellBackdrop=GetCurrentScriptDirectory~"img\icewall.png";
let frame = -120;
let movecount = -120;

    @Initialize {
SetScore(50000);
SetLife(240);
SetDamageRate(10,10);
SetTimer(60);
SetInvincibility(30);

SetGraphicRect(1, 1, 64, 64);
LoadGraphic(ImgBoss);
//LoadGraphic(imgSpellBackdrop);

SetMovePosition02(GetCenterX, GetClipMinY + 120, 120);
CutIn(KOUMA, "Snow Sign "\""Diamond Blizzard"\", 0, 0, 0, 0, 0);
    }

    @MainLoop {
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);

if(frame == 10) {
let leftright = rand(-100, 100);
let updown = rand(-50, 50);
loop(10) {
CreateShot01(GetX+leftright, GetY+updown, rand(0.5, 4), rand(0, 359), AQUA23, 20);
    }
frame = 0;
}
if(movecount == 120) {
SetMovePositionRandom01(50,20,5,GetClipMinX()+100,30,GetClipMaxX()-100,100);
movecount = 0;
}
frame++;
movecount++;
    }

    @Finalize {
DeleteGraphic(ImgBoss);
//DeleteGraphic(imgSpellBackdrop);
    }

    @DrawLoop {
SetAlpha(255);
SetTexture(ImgBoss);
SetGraphicRect(1,1,64,64);
DrawGraphic(GetX(),GetY());
    }

//    @BackGround {
// SetAlpha(150);
// SetTexture(imgSpellBackdrop);
// SetGraphicRect(0,0,384,448);
// DrawGraphic(GetCenterX,GetCenterY);
    }
}

Now my question is, how can I clean this up so that it looks like the one from Embodiment of Scarlet Devil? Obviously, I need to figure out how to make a Cirno boss sprite so that it's not Rumia firing things, but what else could I change to make it a better match?

Stuffman

  • *
  • We're having a ball!
Re: Danmakufu Q&A/Problem Thread II
« Reply #5 on: October 21, 2009, 04:46:27 PM »
can i let enemies draw 3d backgrounds?

You should be able to, yes; enemy scripts can take @Background in addition to @DrawLoop.

Re: Danmakufu Q&A/Problem Thread II
« Reply #6 on: October 21, 2009, 04:59:52 PM »
Edit3: Ok i'll leave that other code for later, for now i got a troublesome problem, i got this code here for a boss summoning Murasa's Anchors on this script:


Code: [Select]
#TouhouDanmakufu
#Title[Satori Spellcard 2 - B]
#Text[Satori's Second SpellCard]
#BGM[.\system\SatoriTheme.mp3]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{
#include_function ".\cutin.txt"

let CSD = GetCurrentScriptDirectory;
let imgBoss= CSD ~ "system\satori.PNG";
let cut= CSD ~ "system\satoricut.png";
let bg = CSD ~ "system\SatoriBGa.png";
let bg2 = CSD ~ "system\SatoriBGb.png";

let ANCHOR = CSD~"Anchor.txt";
// let ANCHOR = LoadUserShotData(CSD~"Anchor".txt);

let shotSE = CSD ~ "system\shotSE.wav";
let chargeSE = CSD ~ "system\charging.wav";
let anchorSE = CSD ~ "system\se_boon00.wav";
let TO1 = CSD ~"system\se_timeout.wav";
let TO2 = CSD ~"system\se_timeout2.wav";

let frame = 0;
let frame2 = 0;
let frame3 = 0;
let angle = 0;
@Initialize{
SetLife(500);
SetTimer(60);
SetScore(110000);
SetDamageRate(10,0);
SetInvincibility(120);
// Expert;

LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);
LoadGraphic(bg2);
LoadSE(shotSE);
LoadSE(chargeSE);
LoadSE(anchorSE);
// LoadUserShotData(ANCHOR);
LoadSE(TO1);
LoadSE(TO2);

SetMovePosition02(GetCenterX, GetCenterY - 100, 120); //Move the boss to the top center of the screen.
CutIn(YOUMU,"Recolection ~ Death Anchor",cut,0,0,0,0);
cutin("NAZRIN",cut,0,0,256,512);
Concentration01(120);
PlaySE(chargeSE);
}
@MainLoop{

if(OnBomb==false){
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,21);
}
frame ++;
frame2 ++;
if(GetTimer>4&&GetTimer<=10&&frame3%60==0){
PlaySE(TO1);
}
if(GetTimer<=4&&frame3%60==0){
PlaySE(TO2);
}
if(frame>=120&&frame%60==0){
CreateEnemyFromFile(ANCHOR,GetX,GetY,1,GetAngleToPlayer,GetAngleToPlayer);

}
yield;
}

@DrawLoop{
SetColor(255,255,255);
SetRenderState(ALPHA);

if(OnBomb==false){
SetAlpha(255);
}else{
SetAlpha(150);
}

SetTexture(imgBoss);
SetGraphicRect(0,0,47,64);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);
}
@BackGround{
frame3++;
SetTexture(bg);
SetRenderState(ALPHA);
SetAlpha(90);
SetGraphicRect(-frame3,0,512-frame3,512);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX, GetCenterY);

SetTexture(bg2);
SetRenderState(ALPHA);
SetAlpha(150);
SetGraphicRect(0,0,256,256);
SetGraphicAngle(0,0,frame3);
DrawGraphic(GetCenterX,GetCenterY);
}
@Finalize
{
DeleteGraphic(imgBoss);
DeleteGraphic(cut);
DeleteGraphic(bg);
DeleteSE(shotSE);
DeleteSE(chargeSE);
DeleteSE(anchorSE);
DeleteSE(TO1);
DeleteSE(TO2);
// DeleteUserShotData(ANCHOR);
loop(20){
CreateItem(ITEM_SCORE,GetX+rand(-50,50),GetY+rand(-50,50));
}
CreateItem(ITEM_1UP,GetX,GetY);
}
task PlayAnchor{
PlaySE(anchorSE);
wait(20);
PlaySE(anchorSE);
yield;
}


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

And here's the code for the anchors:
Code: [Select]
script_enemy_main{
let CSD = GetCurrentScriptDirectory;

let imgAnchor = CSD ~ "system\anchor.png";
let WaterSE = CSD ~ "system\se_water.png";

let A = GetArgument;
let S = 0;
let X0 = GetX;
let Y0 = GetY;
let HasCrashed = false;
@Initialize{
SetLife(1);
LoadGraphic(imgAnchor);
LoadSE(WaterSE);
}
@MainLoop{
SetCollisionB(GetX,GetY,40);
if(!HasCrashed){
SetSpeed(S);
S+=0.15;
}
if(GetX<=GetClipMinX || GetX>=GetClipMaxX || GetY<=GetClipMinY || GetY>=GetClipMaxY){

if(!HasCrashed){
PlaySE(WaterSE);
SetSpeed(0);
S=0;
}
HasCrashed = true;
}
if(HasCrashed){
SetSpeed(S);
S-=0.15;
if(GetX==X0&&GetY==Y0){
VanishEnemy;
}
}

}
@DrawLoop{
SetColor(255,255,255);
SetRenderState(ALPHA);
SetTexture(imgAnchor);
SetGraphicRect(0,0,125,128);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,A);
DrawGraphic(GetX,GetY);
}
@Finalize{
DeleteGraphic(imgAnchor);
DeleteSE(WaterSE);
}
}
Basically the problem is that when an anchor returns to the boss all anchors go invisible, and then it doesnt check anymore for a bit, then it checks again and same thing happens

Well guess doesnt matter much if they poof or not, as i doubt anyone would be going behind the boss, specially with all this to dodge:

Note: Is there a way to revert the background back when im not playing PoSR? because i think i overwrote the other one and didnt save a backup copy DX and it looks weird when im not playing PoSR
« Last Edit: October 22, 2009, 06:03:44 AM by Sakura665 »

Stuffman

  • *
  • We're having a ball!
Re: Danmakufu Q&A/Problem Thread II
« Reply #7 on: October 22, 2009, 08:20:32 AM »
Quote
Note: Is there a way to revert the background back when im not playing PoSR? because i think i overwrote the other one and didnt save a backup copy DX and it looks weird when im not playing PoSR

Just delete (or replace) th_dnh\img\STG_Frame.png. The PoSR script folder has a copy of the frame in it if you want to use it again.

I don't have time to look over your main problem, sorry :V
« Last Edit: October 22, 2009, 08:22:57 AM by Stuffman »

Infy♫

  • Demonic★Moe
  • *
Re: Danmakufu Q&A/Problem Thread II
« Reply #8 on: October 22, 2009, 11:36:58 AM »
You should be able to, yes; enemy scripts can take @Background in addition to @DrawLoop.
then, why won't you use enemies as stages?

Thaws

  • _m廿廿m_
Re: Danmakufu Q&A/Problem Thread II
« Reply #9 on: October 22, 2009, 11:54:32 AM »
Edit3: Ok i'll leave that other code for later, for now i got a troublesome problem, i got this code here for a boss summoning Murasa's Anchors on this script:

   @Finalize{
      DeleteGraphic(imgAnchor);
      DeleteSE(WaterSE);
   }
The solution is simple... just delete this DeleteGraphic line at @Finalize of the anchor script.

Stuffman

  • *
  • We're having a ball!
Re: Danmakufu Q&A/Problem Thread II
« Reply #10 on: October 22, 2009, 05:27:01 PM »
then, why won't you use enemies as stages?

Uh, elaborate? Why would you want to?

Infy♫

  • Demonic★Moe
  • *
Re: Danmakufu Q&A/Problem Thread II
« Reply #11 on: October 22, 2009, 05:36:42 PM »
danmakufu crashes when i run this. no error message, no warning. what the hell is doing it? i got no idea!

Code: [Select]
#TouhouDanmakufu[Stage]
#Title[RoND Stage 1 CIRNO!]
#Text[Idiot vs Idiot - Made by CAsercan3]
#Player[player\Rumia2\Rumia.txt]
#ScriptVersion[2]

script_stage_main
{

let normpoint = 150;
   let alpha_effect = 0;
   let bpicker = 1;
   let rotation2 = 255;
   SetCommonData("HelloBoss",1);
   SetCommonData("MakeSprite",0);
   let rotation = 0;
   let redfog = 255;
   let bluefog = 255;
   let greenfog = 255;
   let imagefile = GetCurrentScriptDirectory ~ "sky-33.jpg";
   let imagefile2 = GetCurrentScriptDirectory ~ "sea.jpg";
   let imagefile3 = GetCurrentScriptDirectory ~ "stg4bg.png";
   LoadGraphic(imagefile3);
   let counter = 0;
   let counter2 = 0;
   let alpha = 0;
   let counter3 = 0;
   let frame = 0;
   let frame2 = -120;
   let p = 0;

    function Wait( w ){ loop( w ){ yield }; }
    function WaitForZeroEnemy(){
        while(GetEnemyNum() != 0){yield;}
    }
    function WaitForOneEnemy(){
        while(GetEnemyNum() > 1){yield;}
    }

       task StageTask{
loop(3){
loop(6){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe07.txt",rand(GetCenterX -100,GetClipMaxX),GetClipMinY ,0,0,-1);
Wait(10);
}
Wait(60);
loop(6){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe07.txt",rand(GetClipMinX,GetCenterX +100),GetClipMinY ,0,0,1);
Wait(10);
}
}
loop(2){
p+=20;
loop(10){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe01.txt",GetClipMinX -50,75 +p,0,0,1);
Wait(7);
}
p+=20;
loop(10){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe01.txt",GetClipMaxX,75 +p,0,0,-1);
Wait(7);
}
}

loop(7){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe06.txt",rand(GetCenterX,GetClipMaxX),GetClipMinY ,0,0,-1);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe06.txt",rand(GetClipMinX,GetCenterX),GetClipMinY ,0,0,1);
Wait(75);
}
loop(3){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe02.txt",GetClipMaxX,75 ,0,0,-1);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe02.txt",GetClipMinX,75 ,0,0,1);
Wait(7);
}
loop(6){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe03.txt",GetClipMaxX - rand(1,100),75 ,0,0,-1);
Wait(20);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe03.txt",GetClipMinX + rand(1,100),75 ,0,0,1);
Wait(20);
}
p=10;
loop(3){
p+=20;
loop(10){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe01.txt",GetClipMinX -50,75 +p,0,0,1);
Wait(7);
}
p+=20;
loop(10){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe01.txt",GetClipMaxX,75 +p,0,0,-1);
Wait(7);
}
}
//midboss

//end midboss
Wait(60);
loop(20){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe04.txt",rand(GetClipMinX,GetClipMaxX),GetClipMaxY ,0,0,-1);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe04.txt",rand(GetClipMinX,GetClipMaxX),GetClipMaxY ,0,0,-1);
Wait(40);
}
Wait(50);
loop(2){
p+=20;
loop(10){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe01.txt",GetClipMinX -50,75 +p,0,0,1);
Wait(7);
}
p+=20;
loop(10){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe01.txt",GetClipMaxX,75 +p,0,0,-1);
Wait(7);
}
}
}
ClearStage;

//magical red knives
loop(3){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe09.txt",GetClipMinX +100,GetClipMinY ,0,0,-1);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe09.txt",GetClipMaxX -100,GetClipMinY ,0,0,1);
Wait(110);
}

//magical blue knives
loop(3){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe08.txt",GetClipMinX +100,GetClipMinY ,0,0,-1);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe08.txt",GetClipMaxX -100,GetClipMinY ,0,0,1);
Wait(30);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe08.txt",GetClipMinX +120,GetClipMinY ,0,0,-1);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe08.txt",GetClipMaxX -120,GetClipMinY ,0,0,1);
Wait(30);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe08.txt",GetClipMinX +140,GetClipMinY ,0,0,-1);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe08.txt",GetClipMaxX -140,GetClipMinY ,0,0,1);
Wait(120);
}

//suicidal kunai spam fairies
loop(3){
loop(6){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe07.txt",rand(GetCenterX -100,GetClipMaxX),GetClipMinY ,0,0,-1);
Wait(10);
}
Wait(60);
loop(6){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe07.txt",rand(GetClipMinX,GetCenterX +100),GetClipMinY ,0,0,1);
Wait(10);
}
}
//wall shooters
loop(10){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe06.txt",rand(GetCenterX,GetClipMaxX),GetClipMinY ,0,0,-1);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe06.txt",rand(GetClipMinX,GetCenterX),GetClipMinY ,0,0,1);
Wait(80);
}
//rocket orbs
Wait(120);
loop(20){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe05.txt",rand(GetClipMinX,GetClipMaxX),GetClipMinY ,0,0,-1);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe05.txt",rand(GetClipMinX,GetClipMaxX),GetClipMaxY ,0,0,-1);
Wait(60);
}
//rocket fairies
loop(20){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe04.txt",rand(GetClipMinX,GetClipMaxX),GetClipMaxY ,0,0,-1);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe04.txt",rand(GetClipMinX,GetClipMaxX),GetClipMaxY ,0,0,-1);
Wait(40);
}
//ringmen
loop(3){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe03.txt",GetClipMaxX - rand(1,100),75 ,0,0,-1);
Wait(20);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe03.txt",GetClipMinX + rand(1,100),75 ,0,0,1);
Wait(20);
}
//fork shots
loop(3){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe02.txt",GetClipMaxX,75 ,0,0,-1);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe02.txt",GetClipMinX,75 ,0,0,1);
Wait(7);
}
//8way shots
loop(3){
p+=20;
loop(10){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe01.txt",GetClipMinX -50,75 +p,0,0,1);
Wait(7);
}
p+=20;
loop(10){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe01.txt",GetClipMaxX,75 +p,0,0,-1);
Wait(7);
}
}

WaitForZeroEnemy;
Wait(60);
SetCommonData("HelloBoss",-5);
Wait(255);
SetCommonData("HelloBoss",-4);
Wait(255);
SetCommonData("HelloBoss",-3);
Wait(255);
SetCommonData("HelloBoss",0);
Wait(1000);
SetCommonData("HelloBoss",4);
Wait(255);
ClearStage;

}

   @Initialize
   {
LoadGraphic(imagefile2);
LoadGraphic(imagefile);
SetAllowedContinueCount(4);
SetNormPoint(150);
   }

   @MainLoop
   {
yield;
frame++;
frame2+=GetCommonData("HelloBoss");
if(frame2 == 1){
StageTask;
}
if(GetPoint >= 150 && normpoint == 150){
SetNormPoint(400);
normpoint = 400;
ExtendPlayer(1);
}
if(GetPoint >= 400 && normpoint == 400){
SetNormPoint(900);
normpoint = 900;
ExtendPlayer(1);
}
if(GetPoint >= 900 && normpoint ==900){
SetNormPoint(9999);
normpoint = 9999;
ExtendPlayer(1);
}
rotation++;
rotation2++;
if(GetCommonData("HelloBoss") == 3){
redfog++;
}
if(GetCommonData("HelloBoss") == -3){
redfog--;
}
if(GetCommonData("HelloBoss") == 4){
greenfog++;
}
if(GetCommonData("HelloBoss") == -4){
greenfog--;
}
if(GetCommonData("HelloBoss") == 5){
bluefog++;
}
if(GetCommonData("HelloBoss") == -5){
bluefog--;
}

}
   @BackGround
   {
if(rotation > 255 *2){
rotation = 0;
}
if(rotation2 > 255 *4){
rotation2 = 0;
}

SetFog(500 , 2500 , redfog, greenfog, bluefog);
      WriteZBuffer(true);
      UseZBuffer(true);
      SetRenderState(ALPHA);
      SetViewTo(250 , 0 , 0 );
      SetViewFrom( 1500 , 0, 15 );
      SetPerspectiveClip(10,2000);
      SetGraphicAngle(90, 90, 0);
      SetGraphicRect(1 , 1- rotation, 255 *6 , 255 * 6- rotation);
      SetTexture(imagefile2);
     // SetColor(200,200,200);
      SetGraphicScale(2,2);
      DrawGraphic3D(  -150, -5 , -50);
      SetTexture(imagefile);
      SetGraphicRect(1 , 1, 255 *6 , 255 * 6);
      SetGraphicAngle(0, 90, 180);
      SetAlpha(255);
      DrawGraphic3D( -250,  sin(frame2 /2) *7, sin(frame2 /2) *7);
      SetTexture(imagefile3);
SetGraphicRect(258,1,490,254);
      DrawGraphic3D( rotation *5 -1000,   900 - rotation, -100 );
      DrawGraphic3D( rotation *6 -1000,   1000 - rotation, 100 );
      DrawGraphic3D( rotation2 *5 -1000,   1100 - rotation2 *1.2, -120 );
      DrawGraphic3D( rotation2 *6 -1000,   1000 - rotation2, 80 );

   }

   @Finalize
   {
      DeleteGraphic(imagefile);
   }
}


Stuffman

  • *
  • We're having a ball!
Re: Danmakufu Q&A/Problem Thread II
« Reply #12 on: October 22, 2009, 06:05:41 PM »
What kind of crash? Infinite loop? Windows error? Just closes with no warning?

Infy♫

  • Demonic★Moe
  • *
Re: Danmakufu Q&A/Problem Thread II
« Reply #13 on: October 22, 2009, 06:14:45 PM »
windows gives an error .
when i disable the whole stage task, the stage works normally but nothing happens.
« Last Edit: October 22, 2009, 06:21:29 PM by CAsercan3 »

Re: Danmakufu Q&A/Problem Thread II
« Reply #14 on: October 22, 2009, 08:59:57 PM »
The solution is simple... just delete this DeleteGraphic line at @Finalize of the anchor script.
yeah i did that, however it still stopped checking for a while after the 1st anchor so i dunno what happened, it's like it only wants to check when it wants

Re: Danmakufu Q&A/Problem Thread II
« Reply #15 on: October 23, 2009, 01:14:42 AM »
...What stopped checking.

Re: Danmakufu Q&A/Problem Thread II
« Reply #16 on: October 23, 2009, 01:21:59 AM »
Basically 1 anchor poofs and the others dont poof for a while, then another poofs and then the others dont poof, and so on kinda hard to explain X_X

Edit: Is there a command that makes all the bullets dissapear from the screen without converting them to items?
« Last Edit: October 23, 2009, 05:41:46 AM by Sakura665 »

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread II
« Reply #17 on: October 23, 2009, 05:51:40 AM »
Basically 1 anchor poofs and the others dont poof for a while, then another poofs and then the others dont poof, and so on kinda hard to explain X_X

Edit: Is there a command that makes all the bullets dissapear from the screen without converting them to items?


   DeleteEnemyShotImmediatelyInCirlce(ALL, GetCenterX, GetCenterY, 15000);
I guess...

Stuffman

  • *
  • We're having a ball!
Re: Danmakufu Q&A/Problem Thread II
« Reply #18 on: October 23, 2009, 08:33:40 AM »
windows gives an error .
when i disable the whole stage task, the stage works normally but nothing happens.

Offhand I don't see anything wrong with the stage. Usually when you get a consistent windows error from Danmakufu, it's trying to load something it doesn't like, for whatever reason. Maybe it's something in the enemy file? Try commenting out large portions of the stage task to try to isolate the problem.

Thaws

  • _m廿廿m_
Re: Danmakufu Q&A/Problem Thread II
« Reply #19 on: October 23, 2009, 02:10:59 PM »
Basically 1 anchor poofs and the others dont poof for a while, then another poofs and then the others dont poof, and so on kinda hard to explain X_X

Edit: Is there a command that makes all the bullets dissapear from the screen without converting them to items?

Here's what I guess you mean:
You want anchors to disappear after they crashed and return to the boss.
However, sometimes, they pass through the boss and go offscreen.

Here's what I guess has gone wrong:
This is due to your condition statement for checking when to "poof" the anchors.
The x, y coordinate have to be exactly equal to the original x,y where it's spawned, so most of the time, it will skip over that x, y coordinate. Since the condition was never satisfied, it just goes on and on. So maybe try something like "poof" the anchors when both x, y coordinate is within *insert a range* the original x, y instead of checking for that single point.

Haven't checked this, so I'm not sure if it's the problem.

Re: Danmakufu Q&A/Problem Thread II
« Reply #20 on: October 23, 2009, 10:57:22 PM »
I just started actually trying to make a rendition and slight reiteration of Remilia's Scarlet Gensokyo spell card with object bullets. I have run into an obstacle, though... I cannot seem to spawn an object bullet more than once in an object script (from another object) (for example, when I have count%5 == 0, the spawned object bullet disappears when it is called again). Is it possible to create this effect while using the same object bullet?
(The main reason I am even using object bullets for this, while it CAN be done with old-fashioned CreateShotA, is for the effect of all of the current bullets on the screen activating and moving at once.)


Also, I know this is a rather strange question and off-topic, but how would I know the difference between a spellcard and a regular attack?
« Last Edit: October 23, 2009, 11:20:43 PM by Frazer »

Cabble

  • Ask me about my Cat.
  • Not unwilling to shank you.
Re: Danmakufu Q&A/Problem Thread II
« Reply #21 on: October 23, 2009, 11:49:34 PM »
What would I use to make custom point items and such?

Or power items, for that matter?
I had a teacher who used to play radiohead during class once.

ONCE.

Re: Danmakufu Q&A/Problem Thread II
« Reply #22 on: October 23, 2009, 11:55:42 PM »
@Frazer:
Are you coding with tasks? If you delcare all your variables in a task then your object bullets will not be replaced, since tasks have their own scope (let obj = Obj_Create(OBJ_SHOT);, etc. will only exist inside of that task). If you're just using the @MainLoop to create and spawn the object bullets then you'll need to keep track of them using an array, then call out the specific one you want to use when you want to use it. Kind of need to see your code.

A spellcard has SetScore(..); and usually CutIn(..); declared somewhere in the file. A regular attack has neither.



@Seven Orange Clouds:
Use seperate enemy scripts (CreateEnemyFromFile) that have your point item/power item graphics as their main @DrawLoop "boss graphic". Detect whether or not the player is close to the item, then add inter-script variables (CommonData) to your player script to increase the total damage output (or whatever you're changing). For a point item, then you can just use AddScore(score); whenever the player is close to the "enemy"/point item. Alternatively, you can add CommonData all over the place if you're making a custom point system. Be sure to include things like
if(GetPlayerY < 120){
   SetSpeed(6);
   SetAngle(atan2(GetY - GetPlayerY, GetX - GetPlayerX));
}
For when the player is above the autocollect line. Omit collision detection in the @MainLoop (SetCollisionA and B) so that you cannot shoot or collide with your items. I'd recommend having a lot of experience with how enemy files work, as well as player scripts and stage script before tyring to tackle point items and power ups, so if you're not comfortable with all of those things then I wouldn't advise it.

Drake

  • *
Re: Danmakufu Q&A/Problem Thread II
« Reply #23 on: October 24, 2009, 12:10:24 AM »
@Frazer, you should be able to get them all to move at the same time by incrementing a variable each time a bullet in the line spawns and going (time-(variable*whatever)). Object bullets work just fine though. Listen to Naut.

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

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread II
« Reply #24 on: October 24, 2009, 02:03:20 AM »
SOMEONE HELP ME OUT WITH THIS.
Code: [Select]
#TouhouDanmakufu
#Title[OMFG]
#Text[...Which isn't even a PATTERN.]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let BossImage = "script\img\ExRumia.png";
    let frame = -180;
    let frame2 = -180;
    let spread = 0;
    let trap = 60;
    function se(sound) {
    loop(10) { yield; }
    PlaySE(sound);
    }
    @Initialize {
        SetLife(2400); SetDamageRate(40, 0);
        SetEnemyMarker(true);
        LoadGraphic(BossImage);
        SetTexture(BossImage);
        SetGraphicRect(0, 0, 64, 64);
        SetMovePosition02(GetCenterX, GetClipMinY+100, 60);
        CutIn(KOUMA,"「Danmakufu Paranoia」", "", 0, 0, 0, 0);
        SetScore(1000000); SetDurableSpellCard;
    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 32); //32 for boss, 10 for fairy
        SetCollisionB(GetX, GetY, 24);//24 for boss, 5 for fairy
        if(frame == 30) {
spread=rand(-5, 5);
             se("se\11\se_tan01.wav");
CreateShot01(GetX, GetY, 1, GetAngleToPlayer+spread, ORANGE02, 10);
ascent(i in 0..15) {
CreateShot01(GetX, GetY, 1, GetAngleToPlayer+i*6+spread, ORANGE02, 10);
CreateShot01(GetX, GetY, 1, GetAngleToPlayer-i*6+spread, ORANGE02, 10);
}
            frame = 0;
        }
        if(frame2 == 3) {
             se("se\11\se_kira01.wav");
function paranoia(angle) {
CreateShot01(GetPlayerX+100*cos(angle), GetPlayerY+100*sin(angle), 1, atan2(GetPlayerY-(GetPlayerY+100*sin(angle)), GetPlayerX-(GetPlayerX+100*cos(angle)))-15, WHITE01, 10);
}
loop(3) {
paranoia(rand(0, 360));
}
            frame2 = 0;
        }
        frame++;
        frame2++;
        yield;
    }

    @DrawLoop {
        SetTexture(BossImage);
        DrawGraphic(GetX, GetY);
    }

    @Finalize {
        DeleteGraphic(BossImage);
    }
}
Also, if there are any mistakes, then fix them and ...please tell me what I did wrong while making an exact copy of Koishi's SC. O_o Did I put this in the wrong place? :V

Re: Danmakufu Q&A/Problem Thread II
« Reply #25 on: October 24, 2009, 02:33:01 AM »
Code: [Select]
#TouhouDanmakufu
#Title[OMFG]
#Text[...Which isn't even a PATTERN.]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {

let BossImage = "script\img\ExRumia.png";
let frame = -180;
let frame2 = -180;

function se(sound) {
loop(10) { yield; }
PlaySE(sound);
}

    @Initialize {
SetLife(2400);
SetDamageRate(40, 0);
SetEnemyMarker(true);
LoadGraphic(BossImage);
SetTexture(BossImage);
SetGraphicRect(0, 0, 64, 64);
SetMovePosition02(GetCenterX, GetClipMinY+120, 60);
CutIn(KOUMA,"?Danmakufu Paranoia?", "", 0, 0, 0, 0);
SetScore(1000000);
SetDurableSpellCard;
    }

    @MainLoop {
let rm = rand_int(0, 260);
SetCollisionA(GetX, GetY, 32); //32 for boss, 10 for fairy
SetCollisionB(GetX, GetY, 24);//24 for boss, 5 for fairy
if(frame == 30) {
se("se\11\se_tan01.wav");
ascent(i in 0..15) {
CreateShot01(GetX, GetY, 0.8, GetAngleToPlayer - 42 + (i*6), WHITE02, 1);
}
}
        if(frame == 60) {
se("se\11\se_tan01.wav");
ascent(i in 0..16) {
CreateShot01(GetX, GetY, 0.8, GetAngleToPlayer - 45 + (i*6), WHITE02, 10);
}
frame = 0;
}
        if(frame2>=0){
let r = rand(40, 60);
let a = rand(0, 360);
CreateShotA(0, GetPlayerX + r*cos(a), GetPlayerY + r*sin(a), 10);
SetShotDataA(0, 0, 2, a + rand(90, 120), ((2*(3.1415)*r)/4)/60, -0.025, 0, PURPLE31);
SetShotDataA(0, 80, 0, NULL, 0, 0, 0, PURPLE31);
SetShotKillTime(0, 90);
FireShot(0);
}
if(rm==20){
SetMovePosition03(GetPlayerX + rand(-30, 30), GetClipMinY+rand(120, 160), 10, 0.5);
}
frame++;
frame2++;
}

@DrawLoop{
SetTexture(BossImage);
DrawGraphic(GetX, GetY);
}

@Finalize {
DeleteGraphic(BossImage);
}
}


Just study the card a bit more to make an exact copy... There was nothing "wrong" with the script, just a needless function (paranoia, why declare the function then immediately use it, calling the same random variable every time?) and the code looks like a mess with all those wierd indentations. Just fixed a few things regarding that, and changed the bullets that spawn around you to curve clockwise based on how far they spawn from you. Take a look.

CK Crash

  • boozer
Re: Danmakufu Q&A/Problem Thread II
« Reply #26 on: October 24, 2009, 02:44:46 AM »
Code: [Select]
#TouhouDanmakufu
#Title[Symbol - Danmaku Paranoia]
#Text[Description]
#PlayLevel[Normal]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{
#include_function "lib\SHOT_REPLACE\shot_replace.dnh"

let Sprite = "script\img\ExRumia.png";

@Initialize
{
shotinit;
LoadGraphic(Sprite);
SetInvincibility(60);
SetLife(1000);
SetDamageRate(10, 0);
SetTimer(60);
SetEnemyMarker(true);
SetScore(100000);
CutIn(YOUMU, "Symbol - Danmaku Paranoia", 0, 0, 0, 0, 0);
SetEffectForZeroLife(60,60,0);
Concentration01(120);
maintask;
}

task maintask
{
SetMovePosition02(GetCenterX, GetCenterY-120, 60);
Wait(90);

let delay = 96;
kunai;

loop
{
ascent(i in -4..5){CreateShot01(GetX,GetY,0.8,GetAngleToPlayer+i*11,WHITE02,10);}
Wait(delay);
ascent(i in -4..4){CreateShot01(GetX,GetY,0.8,GetAngleToPlayer+5.5+i*11,WHITE02,10);}
Wait(delay);
if (delay > 24){delay -= 8;}
else{SetDamageRate(30, 0);}
}

}

task kunai
{
loop
{
let angle = rand(0,360);
let r = rand(48, 64);
CreateShotA(0,GetPlayerX+cos(angle)*r,GetPlayerY+sin(angle)*r,10);
SetShotDataA(0, 0, 2, angle + rand(90, 120), ((2*(3.1415)*r)/4)/60, -0.025, 0, PURPLE31);
SetShotDataA(0,100,0,NULL,0,0,0,PURPLE31);
SetShotKillTime(0,121);
CreateShotA(1,0,0,10);
SetShotDataA(1,0,0,0,0,0,0,PURPLE31);
SetShotKillTime(1,10);
AddShot(120,0,1,0);
FireShot(0);
Wait(4);
}
}

function Wait(t)
{
loop(t){yield;}
}

@MainLoop
{
if (OnBomb == false){SetCollisionA(GetX,GetY,32);}
SetCollisionB(GetX,GetY,24);
yield;
}

@DrawLoop
{
SetTexture(Sprite);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
SetGraphicRect(0,0,64,64);
DrawGraphic(GetX,GetY);
}

@Finalize
{
DeleteGraphic(Sprite);
}

}

Here's Danmaku Paranoia in task form as well, so you can see how much simpler it is (stole the angle for the kunai from Naut because he's a silly ninja).

Henry

  • The observer
  • Exploring to the new world of Danmaku
Re: Danmakufu Q&A/Problem Thread II
« Reply #27 on: October 24, 2009, 01:57:07 PM »
Hi...

This script shows an error at "laser[size]=type2;", can somebody tell me about the problem?

Code: [Select]
#TouhouDanmakufu
#Title[Moon-Metal Sign "Sunshine reflector"]
#Text[The danmaku version of the card with same name in SWR]
#Player[FREE]
#BackGround[User()]
#BGM[script\Patchouli\bgm\lockedgirl.wav]
#ScriptVersion[2]

script_enemy_main {
    let frame = -120;
    let bg = "script\Patchouli\images\Bossbggrey.jpg";
    let random;
    let i;
    let j;
    let radius;
    let bullets=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
    let laser=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
    let size=0;
    let angle=0;
    #include_function "..\drawing.txt"
    @Initialize {
       SetLife(1500);
       SetTimer(60);
       SetScore(1000000);
       SetDamageRate(25,0);
       SetMovePosition02(GetCenterX, GetClipMinY+120, 120);
       SetInvincibility(120);
       Concentration01(120);
       PlaySE("script\Patchouli\SFX\Charge.wav");
       CutIn(YOUMU, "Moon-Metal Sign "\""Sunshine reflector"\", "", 0, 0, 0, 0);
       LoadGraphic(ImgBoss);
       SetTexture(ImgBoss);
       SetGraphicRect(0, 0, 64, 64);
    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 16);
        if(frame==60){
           ascent(i in 0..6){
      ascent(j in 0..2){
         Laser(60, 0, GetAngleToPlayer+i*60, -120*j, 60, 0, 60, 1+j);
      }
              ascent(j in 0..2){
Laser(60, 60*3^0.5, GetAngleToPlayer+i*360/6, 120*j, 60, 10, 60, 2);
Laser(30, 90*3^0.5, GetAngleToPlayer+i*360/6, 180-120*j, 60, 20, 60, 1);
              }
      Laser(150, -30*3^0.5, GetAngleToPlayer+i*60, 0, 60, 30, 60, 1);
           }
        }
if(frame%75==0&&frame>75){
   random=rand(0,360);
   ascent(i in 0..8){
      ShootBullet(GetX, GetY, 1.5, random+i*360/8, 10);
   }
}
if(frame%20==0&&frame>120){
   ascent(i in 0..12){
     CreateShot01(GetX, GetY, 1, angle+i*30, 253, 10);
   }
   angle+=3.7;
}
        frame++;
        yield;
    }

    @DrawLoop {
       bossSC;
    }
    @BackGround{
       backgroundSC;
    }
    task Laser(x,y,slant,angle,length,delay,delay2,type){
       loop(delay){yield;}
       let obj=Obj_Create(OBJ_LASER);
       let no;
       let type2=type;
       Obj_SetPosition(obj, GetX+cos(slant)*x-y*sin(slant), GetY+sin(slant)*x+y*cos(slant));
       Obj_SetAngle(obj, slant+angle);
       Obj_SetSpeed(obj, 0);
       ObjLaser_SetLength(obj, length);
       ObjLaser_SetWidth(obj, 10);
       ObjLaser_SetSource(obj, false);
       Obj_SetCollisionToObject(obj,true);
       bullets[size]=obj;
       laser[size]=type2;
       no=size;
       size++;
       if(type2%3==0){
  ObjShot_SetGraphic(obj, 160);
       }
       if(type2%3==1){
          ObjShot_SetGraphic(obj, 158);
       }
       if(type2%3==2){
  ObjShot_SetGraphic(obj, 153);
       }
       ObjShot_SetDelay  (obj, delay2);
       while(Obj_BeDeleted(obj)==false){
          yield;
       }
    }
    task ShootBullet(x,y,v,angle,delay){
       loop(delay){yield;}
       let obj=Obj_Create(OBJ_SHOT);
       let frame2=0;
       let count=5;
       Obj_SetPosition(obj, x, y);
       Obj_SetAngle(obj, angle);
       Obj_SetSpeed(obj, v);
       ObjShot_SetGraphic(obj, 11);
       Obj_SetCollisionToObject(obj,true);
       while(Obj_BeDeleted(obj)==false&&count>0){
  ascent(i in 0..size){
             if(Collision_Obj_Obj(obj, bullets[i])&&frame2>20){
        if(laser[i]==1||laser[i]==2){
   Obj_SetAngle(obj, 2*Obj_GetAngle(bullets[i])-Obj_GetAngle(obj));
}
if(laser[i]%3==2){
   ascent(i in -4..5){
      CreateShot01(Obj_GetX(obj), Obj_GetY(obj), 1.5, Obj_GetAngle(obj)+i*12, 43, 10);
   }
}
count--;
frame2=0;
     }
  }
  frame2++;
          yield;
       }
    }
    @Finalize {
       finalize;
    }
}
Old/Forgotten member.

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

Re: Danmakufu Q&A/Problem Thread II
« Reply #28 on: October 24, 2009, 07:22:04 PM »
@Frazer:
Are you coding with tasks? If you delcare all your variables in a task then your object bullets will not be replaced, since tasks have their own scope (let obj = Obj_Create(OBJ_SHOT);, etc. will only exist inside of that task). If you're just using the @MainLoop to create and spawn the object bullets then you'll need to keep track of them using an array, then call out the specific one you want to use when you want to use it. Kind of need to see your code.

A spellcard has SetScore(..); and usually CutIn(..); declared somewhere in the file. A regular attack has neither.

Well, when I made a script as a spellcard in the past, somebody corrected me and said it was more of a normal attack than a spellcard in the attack pattern itself. I am not sure how they meant it.

I would have posted the code before, but I like to use other boss graphics and even backgrounds now.

Code: [Select]
#TouhouDanmakufu
#Title[Scarlet Gensokyo Object]
#Text[Test script]
#Player[FREE]
#BGM[.\Remilia.mp3]
#ScriptVersion[2]

script_enemy_main {
let ImgBoss = GetCurrentScriptDirectory ~ "img\ExRumia.png";

let count = -60;



task Spawn(x, y, v, angle, angular) {
let obj=Obj_Create(OBJ_SHOT);
let obj2=Obj_Create(OBJ_SHOT);
let move=0;

Obj_SetPosition(obj, x, y);
Obj_SetAngle(obj, angle);
Obj_SetSpeed(obj, v);
ObjShot_SetGraphic(obj, RED03);

     while(Obj_BeDeleted(obj)==false){

let wave=false;

if(count >= 60 && count <= 180 && count%5 == 0){
Obj_SetPosition(obj2, Obj_GetX(obj), Obj_GetY(obj));
Obj_SetAngle(obj2, rand(0, 360));
Obj_SetSpeed(obj2, 0);
ObjShot_SetGraphic(obj2, RED01);
}

if(count == 240){
wave = true;
}

if(count == 245){
wave = false;
}

if(!wave == true){
Obj_SetSpeed(obj2, 1);
ObjShot_SetGraphic(obj2, PURPLE01);
}


       yield;
}
}







@Initialize {
SetLife(2500);
SetTimer(60);
SetScore(10000000);

SetEnemyMarker(true);

SetMovePosition02(225, 120, 60);

LoadGraphic(ImgBoss);
SetGraphicRect(0, 0, 64, 64);
}

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

if(count == 60) {
Spawn(GetX, GetY, 3, 0, 0);
}

count++;
}

@DrawLoop {
SetTexture(ImgBoss);
DrawGraphic(GetX, GetY);
}

@Finalize {
DeleteGraphic(ImgBoss);
}
}

There is another problem having to do with the 'wave' function in that is always seems to equal 'true'.
« Last Edit: October 24, 2009, 07:54:32 PM by Frazer »

Wingz

Re: Danmakufu Q&A/Problem Thread II
« Reply #29 on: October 24, 2009, 07:30:49 PM »
Question: how can I show players score after the fight is over?