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

Lawence Codye

  • The Nine Tails of Subconscious...
  • Come & your desires shall all become reality...
Re: Danmakufu Q&A/Problem Thread II
« Reply #630 on: December 14, 2009, 03:02:28 PM »
I cannot give you any further information because... ohgodsomuchcode...

yep...

thanks Iryan...funny thing is that is pretty much what I needed to know...& mainTask is where I actually wanted the help at...the rest of the code was just in case...
...(sign)...now it's time to start this shit over from scratch...shouldn't take long though so whatever...
I am the Nine Tails of Subconscious...

Come & your greatest desires will be reality...

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #631 on: December 14, 2009, 03:03:16 PM »
Oh, wait, another thing:

The fps get so low because of a common mistake: You have a task that runs every frame and that activates all the other tasks. Each of the other tasks also runs once per frame. Thus the number of tasks increases exponentially. My tip to fix it: Get rid of the task that activates all the other tasks and make it so that the code inside it is run once every time a season is changed.
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."

Lawence Codye

  • The Nine Tails of Subconscious...
  • Come & your desires shall all become reality...
Re: Danmakufu Q&A/Problem Thread II
« Reply #632 on: December 14, 2009, 03:06:49 PM »
Oh, wait, another thing:

The fps get so low because of a common mistake: You have a task that runs every frame and that activates all the other tasks. Each of the other tasks also runs once per frame. Thus the number of tasks increases exponentially. My tip to fix it: Get rid of the task that activates all the other tasks and make it so that the code inside it is run once every time a season is changed.

hate to play the fool but...umm how do I go about getting the code to run once every frame without the mainTask...?
I am the Nine Tails of Subconscious...

Come & your greatest desires will be reality...

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #633 on: December 14, 2009, 03:15:00 PM »
Um, you could always put stuff in the regular @MainLoop{}, I guess.   Did you learn how to code by watching the Helepolis' videao tutorials, by any chance? :P

Just put the stuff that is inside you "mainTask" right now at the end of the code that changes the "Season" instead. If that is yet part of another task, just put it there.


At what part in the code does the "Season" change? From what you said, it is related to you pressing a user defined key, right? So I guess that you have something like if(GetKeyState(VK_USER)==KEY_PUSH) { Season++; if(Season>5{Season=1; } } somewhere in you script.

Just put the code from your task inside the GetKeyState-if-brackets, and you'll be fine, I think.


On an unrelated note, I am still waiting for the comment on my rough player script.  :V
« Last Edit: December 14, 2009, 04:01:44 PM by Iryan »
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."

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #634 on: December 14, 2009, 06:57:55 PM »
Oh boy, it seems people are messing up often with the microthreading method. Even though it is clearly explained how to do it step by step. I guess it is still something which is annoying to understand but eventually more powerful to use.

It totally depends on style and preferences. Hence I advice people not to think of that style being the best. There is no such thing as best style, it is whatever makes you happy.

Lawence Codye

  • The Nine Tails of Subconscious...
  • Come & your desires shall all become reality...
Re: Danmakufu Q&A/Problem Thread II
« Reply #635 on: December 14, 2009, 09:32:58 PM »
Oh boy, it seems people are messing up often with the microthreading method. Even though it is clearly explained how to do it step by step. I guess it is still something which is annoying to understand but eventually more powerful to use.

It totally depends on style and preferences. Hence I advice people not to think of that style being the best. There is no such thing as best style, it is whatever makes you happy.

...okay...

Um, you could always put stuff in the regular @MainLoop{}, I guess.   Did you learn how to code by watching the Helepolis' videao tutorials, by any chance? :P

On an unrelated note, I am still waiting for the comment on my rough player script.  :V
...actually, yes...this is a bit different though don't you agree...but no, thanks that fixed the hell out of the fps problem...&...you can go get your criticism now... ;)

if(Season=!1){ Obj_Delete(hfire); }

oh &...this;
!=
is what you meant right...cause the other thing spawned me at omfgerrors&errors...thanks...
I am the Nine Tails of Subconscious...

Come & your greatest desires will be reality...

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #636 on: December 14, 2009, 09:35:50 PM »
oh &...this;
!=
is what you meant right...cause the other thing spawned me at omfgerrors&errors...thanks...
Oh. Umm, well, yeah, sorry.  :V

Quote
&...you can go get your criticism now... ;)
Thanks. Wheeee!
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 II
« Reply #637 on: December 14, 2009, 11:28:51 PM »
Back with that object laser question. The yielding-8-frames thing works, but I can't use it for what I'm trying to do. Instead, I'm trying to balance each frame out by having it's width start at 64 and go down 8 each frame, but apparently the way the lasers spawn isn't just "add 1/8 width each frame" because it jumps around a bit. I'm not sure if it's a root or linear or exponential or whatever.

I need an object laser that always stays at an 8-pixel width.

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

Re: Danmakufu Q&A/Problem Thread II
« Reply #638 on: December 15, 2009, 04:05:36 AM »
Edit: as usual, I figured it out as I post my problem. Nevermind.
« Last Edit: December 15, 2009, 04:09:49 AM by Naut »

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #639 on: December 15, 2009, 04:13:52 AM »
I managed to view your post before you edited it, and what I thought was "HOLY SHIT NAUT KNOWS HOW TO COMMENT :V"

However, your array-fu is lacking still.
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

Drake

  • *
Re: Danmakufu Q&A/Problem Thread II
« Reply #640 on: December 15, 2009, 04:16:53 AM »
oh u

I pseudo-solved my problem as well. Don't even ask; just leave it at "Danmakufu is as retarded as ever".

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

Re: Danmakufu Q&A/Problem Thread II
« Reply #641 on: December 15, 2009, 04:31:00 PM »
I managed to view your post before you edited it...

Damnit


...and what I thought was "HOLY SHIT NAUT KNOWS HOW TO COMMENT :V"

Double damnit

However, your array-fu is lacking still.

My arrays weren't even the problem, t'was my silly modulus misplacement. Works perfectly now :3

TheMasterSpark

  • Lunatic lemurialist
Re: Danmakufu Q&A/Problem Thread II
« Reply #642 on: December 15, 2009, 05:26:39 PM »
Hello,

I've recently been trying to get the background of my script(s) to look the way I want it to. I'm having no end of fun making various Shikieiki-themed instances but I've not yet managed to get them to look like proper spell cards. I've currently got Michelangelo's "The Last Judgement" as background but I'd also like to have a certain pattern moving across it, as you can see in This Video.

Now, how exactly do I write it correctly in Danmakufu? I've looked around for a how-to but haven't found one and even though I've had another's script to go by I still couldn't get it to work. Below's my code, but be warned that since I'm quite new to this whole thing there are a fair bit of experimenting going on all over the place. :V

"lay" is the thing I'm trying to get to move across the first background picture.

Code: [Select]
#TouhouDanmakufu
#Title[TrialBoss]
#Text[just a tutorial to present it]
#Player[FREE]
#ScriptVersion[2]
#BGM[.\bgm\Fate.mp3"]
#PlayerLevel[Normal]


script_enemy_main{

let CSD = GetCurrentScriptDirectory;
let ShotData   = CSD ~ "system\supershot2.txt";

let imgBoss = CSD ~ "system\boss21.png";
let cut = CSD ~ "system\slpl13.png";
let bg = CSD ~ "system\judgment.png";
let lay = CSD ~ "system\cdbg21b.png";

let f = 0;
let f2 = 0;
let attack = 0;


let b = 0;


@Initialize{
SetLife(1000);
SetTimer(60);
SetScore(100000);
SetMovePosition01(GetX,120,5);
LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);
LoadUserShotData(ShotData);

CutIn(YOUMU,"Judgement: "\""Final Verdict""\",cut,0,0,256,512);

mainTask;
}

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

@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1.2,1.2);
SetGraphicAngle(0,0,0);

if(int(GetSpeedX())==0){
if(attack==0){

if(f<10){SetGraphicRect(0,0,64,80);}
if(f>=10 && f<20){SetGraphicRect(64,0,128,80);}
if(f>=20 && f<30){SetGraphicRect(128,0,192,80);}
if(f>=30 && f<40){SetGraphicRect(192,0,256,80);}
}
if(attack==1){
SetGraphicRect(0,160,64,240);

}
f2 = 0;

}

if(GetSpeedX()>0){
if(attack==0){
if(f2<5){SetGraphicRect(0,80,64,160);}
if(f2>=5 && f<10){SetGraphicRect(64,80,128,160);}
if(f2>=10 && f<15){SetGraphicRect(128,80,192,160);}
if(f2>=15){SetGraphicRect(192,80,256,160);}
} f2++;

if(attack==1){
SetSpeed(0);
SetGraphicRect(0,160,64,240);
}

}

if(GetSpeedX()<0){
if(attack==0){
SetGraphicAngle(180,0,0);
if(f2<5){SetGraphicRect(0,80,64,160);}
if(f2>=5 && f<10){SetGraphicRect(64,80,128,160);}
if(f2>=10 && f<15){SetGraphicRect(128,80,192,160);}
if(f2>=15){SetGraphicRect(192,80,256,160);}
f2++;
}
if(attack==1){
SetSpeed(0);
SetGraphicRect(0,160,64,240);
}
}

DrawGraphic(GetX,GetY);

f++;

if(f==40){f = 0; }

DrawText("Shikieiki Yamaxanadu",35,30,12,255);
}

@BackGround{
SetTexture(bg);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,512,512);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX,GetCenterY);

SetTexture(lay);
SetGraphicRect(0,0,24000,24000);
SetRenderState(ALPHA);
SetAlpha(35);
SetGraphicScale(1,1);
DrawGraphic(GetCenterX + b, GetCenterY + b);


b++;
if(b>=9000){b=0;}

}

@Finalize{
if(GotSpellCardBonus){
                PlaySE(CSD ~ "SFX\se_cardget.wav");
        }
DeleteGraphic(imgBoss);
DeleteGraphic(cut);
DeleteGraphic(bg);
}

// main task, activates stuff.
task mainTask{
yield;
wait(75);

fire;
fire2;




}



task fire{
loop{
if(GetTimer<31){
PlaySE(CSD~"sfx\se_power0.wav");
Concentration01(120);
wait(50);
attack = 1;
wait(10);


//CreateLaser01(GetX, GetY, 2, GetAngleToPlayer, 200, 16, RED01, 20);
CreateLaserA(1, GetEnemyX, GetEnemyY, 700, 80, PURPLE03, 60);
SetLaserDataA(1, 0, GetAngleToPlayer, 0, 0, 0, 0);

CreateLaserA(2, GetEnemyX, GetEnemyY, 600, 20, BLUE01, 60);
SetLaserDataA(2, 0, GetAngleToPlayer-60, 0, 0, 0, 0);
CreateLaserA(3, GetEnemyX, GetEnemyY, 600, 20, BLUE01, 60);
SetLaserDataA(3, 0, GetAngleToPlayer-90, 0, 0, 0, 0);
CreateLaserA(4, GetEnemyX, GetEnemyY, 600, 20, BLUE01, 60);
SetLaserDataA(4, 0, GetAngleToPlayer-120, 0, 0, 0, 0);
CreateLaserA(5, GetEnemyX, GetEnemyY, 600, 20, BLUE01, 60);
SetLaserDataA(5, 0, GetAngleToPlayer-145, 0, 0, 0, 0);
CreateLaserA(6, GetEnemyX, GetEnemyY, 600, 20, RED01, 60);
SetLaserDataA(6, 0, GetAngleToPlayer+145, 0, 0, 0, 0);
CreateLaserA(7, GetEnemyX, GetEnemyY, 600, 20, RED01, 60);
SetLaserDataA(7, 0, GetAngleToPlayer+120, 0, 0, 0, 0);
CreateLaserA(8, GetEnemyX, GetEnemyY, 600, 20, RED01, 60);
SetLaserDataA(8, 0, GetAngleToPlayer+90, 0, 0, 0, 0);
CreateLaserA(9, GetEnemyX, GetEnemyY, 600, 20, RED01, 60);
SetLaserDataA(9, 0, GetAngleToPlayer+60, 0, 0, 0, 0);

SetShotKillTime(1,120);
SetShotKillTime(2,120);
SetShotKillTime(3,120);
SetShotKillTime(4,120);
SetShotKillTime(5,120);
SetShotKillTime(6,120);
SetShotKillTime(7,120);
SetShotKillTime(8,120);
SetShotKillTime(9,120);

PlaySE(CSD~"sfx\se_lazer00.wav");
FireShot(1);
FireShot(2);
FireShot(3);
FireShot(4);
FireShot(5);
FireShot(6);
FireShot(7);
FireShot(8);
FireShot(9);


wait(120);
attack = 0;
wait(60);


yield;
} else {
yield;
}

}
yield;
}



task fire2{

attack = 1;
wait(30);

loop{


if(GetTimer==51){

PlaySE(CSD~"sfx\se_power1.wav");
Concentration01(120);
wait(10);

}



if(GetTimer==31){

PlaySE(CSD~"sfx\se_power1.wav");
Concentration01(120);
wait(10);

}



if(GetTimer==21){

PlaySE(CSD~"sfx\se_power1.wav");
Concentration01(120);
wait(10);

}


if(GetTimer==11){

PlaySE(CSD~"sfx\se_power1.wav");
Concentration01(120);
wait(10);

}




if(GetTimer>50){
PlaySE(CSD~"sfx\thump.wav");
CreateShot01(rand(5,35),20,2,90,255,50);
CreateShot01(rand(40,65),5,2,90,255,50);
CreateShot01(rand(70,95),20,2,90,255,50);
CreateShot01(rand(100,125),5,2,90,255,50);
CreateShot01(rand(130,155),20,2,90,255,50);
CreateShot01(rand(160,185),5,2,90,255,50);
CreateShot01(rand(190,215),20,2,90,255,50);
CreateShot01(rand(220,245),5,2,90,255,50);
CreateShot01(rand(250,275),20,2,90,255,50);
CreateShot01(rand(280,305),5,2,90,255,50);
CreateShot01(rand(310,335),20,2,90,255,50);
CreateShot01(rand(340,365),5,2,90,255,50);
CreateShot01(rand(370,395),20,2,90,255,50);
CreateShot01(rand(400,425),5,2,90,255,50);
wait(60);

} else if (GetTimer>40){

PlaySE(CSD~"sfx\thump.wav");
CreateShot01(rand(5,35),20,3,90,255,50);
CreateShot01(rand(40,65),5,3,90,255,50);
CreateShot01(rand(70,95),20,3,90,255,50);
CreateShot01(rand(100,125),5,3,90,255,50);
CreateShot01(rand(130,155),20,3,90,255,50);
CreateShot01(rand(160,185),5,3,90,255,50);
CreateShot01(rand(190,215),20,3,90,255,50);
CreateShot01(rand(220,245),5,3,90,255,50);
CreateShot01(rand(250,275),20,3,90,255,50);
CreateShot01(rand(280,305),5,3,90,255,50);
CreateShot01(rand(310,335),20,3,90,255,50);
CreateShot01(rand(340,365),5,3,90,255,50);
CreateShot01(rand(370,395),20,3,90,255,50);
CreateShot01(rand(400,425),5,3,90,255,50);
wait(50);

} else if (GetTimer>30){

PlaySE(CSD~"sfx\thump.wav");
CreateShot01(rand(5,35),20,3,90,255,50);
CreateShot01(rand(40,65),5,3,90,255,50);
CreateShot01(rand(70,95),20,3,90,255,50);
CreateShot01(rand(100,125),5,3,90,255,50);
CreateShot01(rand(130,155),20,3,90,255,50);
CreateShot01(rand(160,185),5,3,90,255,50);
CreateShot01(rand(190,215),20,3,90,255,50);
CreateShot01(rand(220,245),5,3,90,255,50);
CreateShot01(rand(250,275),20,3,90,255,50);
CreateShot01(rand(280,305),5,3,90,255,50);
CreateShot01(rand(310,335),20,3,90,255,50);
CreateShot01(rand(340,365),5,3,90,255,50);
CreateShot01(rand(370,395),20,3,90,255,50);
CreateShot01(rand(400,425),5,3,90,255,50);
wait(40);

} else if (GetTimer>20){

PlaySE(CSD~"sfx\thump.wav");
CreateShot01(rand(5,35),20,4,90,255,50);
CreateShot01(rand(40,65),5,4,90,255,50);
CreateShot01(rand(70,95),20,4,90,255,50);
CreateShot01(rand(100,125),5,4,90,255,50);
CreateShot01(rand(130,155),20,4,90,255,50);
CreateShot01(rand(160,185),5,4,90,255,50);
CreateShot01(rand(190,215),20,4,90,255,50);
CreateShot01(rand(220,245),5,4,90,255,50);
CreateShot01(rand(250,275),20,4,90,255,50);
CreateShot01(rand(280,305),5,4,90,255,50);
CreateShot01(rand(310,335),20,4,90,255,50);
CreateShot01(rand(340,365),5,4,90,255,50);
CreateShot01(rand(370,395),20,4,90,255,50);
CreateShot01(rand(400,425),5,4,90,255,50);
wait(30);

} else if (GetTimer>10){

PlaySE(CSD~"sfx\thump.wav");
CreateShot01(rand(5,35),20,4,90,255,50);
CreateShot01(rand(40,65),5,4,90,255,50);
CreateShot01(rand(70,95),20,4,90,255,50);
CreateShot01(rand(100,125),5,4,90,255,50);
CreateShot01(rand(130,155),20,4,90,255,50);
CreateShot01(rand(160,185),5,4,90,255,50);
CreateShot01(rand(190,215),20,4,90,255,50);
CreateShot01(rand(220,245),5,4,90,255,50);
CreateShot01(rand(250,275),20,4,90,255,50);
CreateShot01(rand(280,305),5,4,90,255,50);
CreateShot01(rand(310,335),20,4,90,255,50);
CreateShot01(rand(340,365),5,4,90,255,50);
CreateShot01(rand(370,395),20,4,90,255,50);
CreateShot01(rand(400,425),5,4,90,255,50);
wait(20);

} else {

PlaySE(CSD~"sfx\thump.wav");
CreateShot01(rand(5,35),20,5,90,255,50);
CreateShot01(rand(40,65),5,5,90,255,50);
CreateShot01(rand(70,95),20,5,90,255,50);
CreateShot01(rand(100,125),5,5,90,255,50);
CreateShot01(rand(130,155),20,5,90,255,50);
CreateShot01(rand(160,185),5,5,90,255,50);
CreateShot01(rand(190,215),20,5,90,255,50);
CreateShot01(rand(220,245),5,5,90,255,50);
CreateShot01(rand(250,275),20,5,90,255,50);
CreateShot01(rand(280,305),5,5,90,255,50);
CreateShot01(rand(310,335),20,5,90,255,50);
CreateShot01(rand(340,365),5,5,90,255,50);
CreateShot01(rand(370,395),20,5,90,255,50);
CreateShot01(rand(400,425),5,5,90,255,50);
wait(15);
}


}
wait = 60;
attack = 0;
yield;
}





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


Perhaps I should also note that whatever I'm doing wrong isn't causing the game to crash, it'll run normally except simply not showing the "lay" picture at all.

Edit: I guess some more background information wouldn't hurt. Here's the "lay" image, just for clarity.
« Last Edit: December 15, 2009, 05:37:58 PM by MasterSpark »

Re: Danmakufu Q&A/Problem Thread II
« Reply #643 on: December 15, 2009, 05:39:26 PM »
All images are infinitely tiled, so scrolling the GraphicRect is often better.

Code: [Select]
   @BackGround{
      SetTexture(bg);
      SetRenderState(ALPHA);
      SetAlpha(255);
      SetGraphicRect(0,0,512,512);
      SetGraphicScale(1,1);
      SetGraphicAngle(0,0,0);
      DrawGraphic(GetCenterX,GetCenterY);

      SetTexture(lay);
      SetGraphicRect(0,0 + b,448, 480 + b);
      SetRenderState(ALPHA);
      SetAlpha(135);
      SetGraphicScale(1,1);
      DrawGraphic(224, 240);
   

      b++;

   }

Uhh, on a related note, another possible reason why your first code "wasn't working" is because SetAlpha(35); means nearly invisible.

TheMasterSpark

  • Lunatic lemurialist
Re: Danmakufu Q&A/Problem Thread II
« Reply #644 on: December 15, 2009, 05:53:00 PM »
Something's still amiss, even with the changes you made. I tried putting "lay" as the primary background instead and got a black canvas - might something be wrong with the image itself?


Re: Danmakufu Q&A/Problem Thread II
« Reply #645 on: December 15, 2009, 05:56:09 PM »
Oh, you didn't load it.

TheMasterSpark

  • Lunatic lemurialist
Re: Danmakufu Q&A/Problem Thread II
« Reply #646 on: December 15, 2009, 06:03:57 PM »
Yes, that seems to have been the problem all along.

:V

This isn't the first time I've forgotten to load stuff into the script. I must have some kind of mental block against that function.

Anyway, thanks for helping me out. :)

I do have an unrelated question as well though. Theoretically speaking, is there anything stopping one from having fairies/regular enemies around during a spellcard attack? I haven't started dabbling with creating such enemies yet but I think that a rad idea for a Shikieiki script would be to have entire formations of dark-clad fairies assaulting you under the Judge's all-seeing gaze.  ;D

Drake

  • *
Re: Danmakufu Q&A/Problem Thread II
« Reply #647 on: December 15, 2009, 06:15:20 PM »
Alrighty. I've been tampering with the lasers for a while now and I still have a few problems. I won't be here for a bit to actually explain things, so I hope the code doesn't confuse anyone too much.

http://www.mediafire.com/?zzi22mdvh2w

-When the laser gets to full length (i.e. starts moving) and you hit it, it will stop.
-When the laser is still growing and you hit it, it will keep growing until the predetermined length before moving. I want it to only grow to the predetermined length, minus what you cut off.
-I haven't tested it recently with any other angles yet, so that might be screwy.

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

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #648 on: December 15, 2009, 07:10:11 PM »
I do have an unrelated question as well though. Theoretically speaking, is there anything stopping one from having fairies/regular enemies around during a spellcard attack? I haven't started dabbling with creating such enemies yet but I think that a rad idea for a Shikieiki script would be to have entire formations of dark-clad fairies assaulting you under the Judge's all-seeing gaze.  ;D

It is very possible and it can be very useful . CreateEnemyFromFile and CreateEnemyFromScript are the commands you are lookin for. The problem, of course, is balancing issues of such cards. Players with penetrating shots will have a huge advantage; If your are supposed to focus on the boss, homing or weaker shot types are quite disadvantaged while on cards where you do want to kill every enemy as quickly as possible homing and spread shot types will dominate.
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."

TheMasterSpark

  • Lunatic lemurialist
Re: Danmakufu Q&A/Problem Thread II
« Reply #649 on: December 15, 2009, 07:22:31 PM »
Hmm, that does sound like something to keep in mind. Perhaps it could be made so that the smaller enemies cannot actually be destroyed? I can imagine Shikieiki throwing out half a dozen of those black portals/holes from PoFV and then have a battery of fairies fire through them on her command. Shiki would be the target for the player all along while the fairies rain down a torrent of randomized bullets. :)

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #650 on: December 15, 2009, 07:34:07 PM »
Hrmm...

If you want the fairies to be indestructable and to interact with Shikieiki's vortexes, it would be better to make them objects stored inside an array instead.

For one, indestructable enemies, even if you don't give them a hitbox to absorb incoming shots, will be targeted by homing player bullets and divert them. The more important thing, however, would be that you need the fairies to shoot bullets which activate the vortexes, and you'll only accomplish that if both objects are inside the same script, at least one of them (in this case the vortexes) being defined without the use of a task so they can be referenced properly.

You know what? That means you would need two different arrays of objects (one for the fairies, one for the vortexes), and one of the array of objects creates object shots that interact with the other array of objects.  :o
That is not exactly what I'd call easy code... *shudders*. 

The result has the potential to be really awesome, but it would be quite a pain to put together. If you still want to do it, I wish you good luck and a good amount of patience.
« Last Edit: December 15, 2009, 07:36:38 PM by Iryan »
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."

TheMasterSpark

  • Lunatic lemurialist
Re: Danmakufu Q&A/Problem Thread II
« Reply #651 on: December 15, 2009, 07:57:30 PM »
I had a feeling that it might become a hassle but there's probably an easy way out to take. How about having the fairies fire object bullets that'll "interact" with the placed vortexes once they reach a certain Y-value on the screen? In other words, the vortexes will simply be placed/drawn unto the screen and I'll then simulate them being activated.
« Last Edit: December 15, 2009, 07:59:05 PM by MasterSpark »

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #652 on: December 15, 2009, 08:04:33 PM »
Hmm, if you define fixed positions for the vortexes, that would actually work. If they are in the same spots every time, it would be very possible to do it with true enemy fairies. If they are somewhat random but still follow a pattern, say, all are placed with fixed distances along a fixed circle, then you could get away if you use common data. In that case the code would get ugly, but not as ugly.

If you want the vortexes to be randomized or for them to vanish and be placed anew while the spellcard goes on, you definitely needed to use object arrays. Well, you could still do it with common data, but by that point that wouldn't make it any less complicated to code.
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."

TheMasterSpark

  • Lunatic lemurialist
Re: Danmakufu Q&A/Problem Thread II
« Reply #653 on: December 15, 2009, 08:11:58 PM »
I'm sure I'll be happy with simply having them fixed in place for the duration of the sequence. I've only been programming things since 3 months back (and that's only been newbie things with JavaScript in school) and I started my Danmakufu-ing two weeks ago, I'm down with realizing my own limitations. At the moment. ;)

Edit: Might there still be a way to have Shikieiki visually deploy them at the beginning of the sequence, instead of having them drawn to the background instantly?
« Last Edit: December 15, 2009, 10:14:11 PM by MasterSpark »

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #654 on: December 16, 2009, 01:33:58 AM »
Damnit

Double damnit

My arrays weren't even the problem, t'was my silly modulus misplacement. Works perfectly now :3

:V :V :V

Well, I didn't catch the error at first glance cause I make silly errors with modulus too (if(frame%=5) lolwut). And when I said your array-fu was lacking, I was looking at how you were storing 6 values handling 6 different parts of a function in the same array without making it two-dimensional. Would've shortened the code a bit if you made it two-dimensional and it would've been more readable too, but I guess you don't want that 'cause it's not MANLY CODING. :V

I'm sure I'll be happy with simply having them fixed in place for the duration of the sequence. I've only been programming things since 3 months back (and that's only been newbie things with JavaScript in school) and I started my Danmakufu-ing two weeks ago, I'm down with realizing my own limitations. At the moment. ;)

Edit: Might there still be a way to have Shikieiki visually deploy them at the beginning of the sequence, instead of having them drawn to the background instantly?

Oh hi, I'm your friendly neighborhood array-whore. :V

If you really want to do what Iryan was suggesting with two arrays of objects interacting with each other, I can help with that, but I can't guarantee that you'll be able to figure out what my code is doing, so I don't think that'll be so helpful for you.

Since you're deciding to do the static approach, if you want Sikieiki to look like she's deploying the at the beginning of a sequence, you can make a task that handles a sprite (or effect object if you're ambitious) at the position of Siki and changes its position every frame towards the set location till it reaches there.
<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.

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread II
« Reply #655 on: December 16, 2009, 04:08:59 AM »
No matter where I try to stick this benign bit of code:
Code: [Select]
if(GetTimer <= 10 && GetTimer > 3){
PlaySE(CSD ~ "Materials/timer1.wav");
wait(60);
}
if(GetTimer <= 3){
PlaySE(CSD ~ "Materials/timer2.wav");
wait(60);
}
yield;
into this:
Code: [Select]
#TouhouDanmakufu
#Title[Danmaku Upgrade "Alpha Shock"]
#Text[An attack from somewhere else, as a Spell Card!]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{

let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "system\PlaceholderBoss.png";
#include_function "lib\ExpandedShotData\shot_replace.dnh";

@Initialize{
SetLife(1000);
SetTimer(80);
SetScore(1000000);
SetMovePosition01(GetCenterX,GetCenterY-60,5);
SetEnemyMarker(true);
SetInvincibility(80);
SetDamageRate(25,25);
LoadGraphic(imgBoss);
shotinit;
CutIn(KOUMA,"Danmaku Upgrade "\""Alpha Shock"\","",0,0,0,0);
mainTask;
}

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

@DrawLoop{

SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,64,64);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);

}

@BackGround{



}

@Finalize{

DeleteGraphic(imgBoss);

}
task mainTask{
wait(50);
loop{
fire;
wait(100);
centerbolt;
wait(100);
}
}

task fire{
let n = 0;
let dxl = 0;
let dxr = 0;
let xa = (448/4)+dxl;
let xb = (448*3/4)+dxr;
//YELLOW01 is 16 px tall and the play field is 480 px tall, but this leaves safe lines
//create two lightning bolts from 1/3 and 2/3 the width of the screen starting at the top
while(n<480/12){
//if n is an odd number, the bullet will move to the right; otherwise it moves to the left
if(floor(n/2) < n/2){
lightning(xa+dxl,12*n,0,0,YELLOW01,n);
lightning(xb+dxr,12*n,0,0,YELLOW01,n);
}else{
lightning(xa+dxl,12*n,0,180,YELLOW01,n);
lightning(xb+dxr,12*n,0,180,YELLOW01,n);
}
wait(1);
dxl=rand_int(-8,8);
dxr=rand_int(-8,8);
xa+=dxl;
xb+=dxr;
n++;
}

n = 0;
dxl = 0;
dxr = 0;
xa = (448/4);
xb = (448*3/4);

}

task centerbolt{
let n = 0;
let dx = 0;
let xc = (448/2)+dx;
//create a lightning bolt starting from the top middle
while(n<480/12){
//bullets in the middle chain will have the opposite system from that above
if(floor(n/2) < n/2){
lightning(xc+dx,12*n,0,180,YELLOW01,n);
}else{
lightning(xc+dx,12*n,0,0,YELLOW01,n);
}
wait(1);
dx=rand_int(-8,8);
n++;
}
n = 0;
dx = 0;
xc = (448/2);
}

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

//generate object bullet
task lightning(x,y,v,dir,graphic,delay){
let shard = Obj_Create(OBJ_SHOT);
Obj_SetPosition(shard,x,y);
Obj_SetAngle(shard,dir);
ObjShot_SetGraphic(shard,graphic);
ObjShot_SetDelay(shard,delay);
ObjShot_SetBombResist(shard,false);
wait(90+delay);
Obj_SetSpeed(shard,1.5);

}

}
one of the following happens:
1) Danmakufu freezes when the timer hits 10.
2) The pattern goes berserk when the timer hits 10.
3) The entire card is rendered inert.

Where should I put the timer function?

Re: Danmakufu Q&A/Problem Thread II
« Reply #656 on: December 16, 2009, 04:46:06 AM »
I'm trying to add an event to a plural, but when i put it right in to one of the spells, it plays over the action. How do i make it so it goes Event starts > Event Finishes > Spell Starts as opposed to them starting at the same time.
Just wanted to shout out and say thanks for all the time and effort your putin in to make sure smogon has then best VGC'ers around.

Hat

  • Just an unassuming chapeau.
  • I will never be ready.
Re: Danmakufu Q&A/Problem Thread II
« Reply #657 on: December 16, 2009, 06:15:39 AM »
Code: [Select]
#TouhouDanmakufu
#Title[Danmaku Upgrade "Alpha Shock"]
#Text[An attack from somewhere else, as a Spell Card!]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{

let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "system\PlaceholderBoss.png";
#include_function "lib\ExpandedShotData\shot_replace.dnh";

   @Initialize{
      SetLife(1000);
      SetTimer(80);
      SetScore(1000000);
      SetMovePosition01(GetCenterX,GetCenterY-60,5);
      SetEnemyMarker(true);
      SetInvincibility(80);
      SetDamageRate(25,25);
      LoadGraphic(imgBoss);
      shotinit;
      CutIn(KOUMA,"Danmaku Upgrade "\""Alpha Shock"\","",0,0,0,0);
      mainTask;
  SoundTask;
   }

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

   @DrawLoop{

   SetTexture(imgBoss);
   SetRenderState(ALPHA);
   SetAlpha(255);
   SetGraphicRect(0,0,64,64);
   SetGraphicScale(1,1);
   SetGraphicAngle(0,0,0);
   DrawGraphic(GetX,GetY);

   }

   @BackGround{



   }

   @Finalize{

   DeleteGraphic(imgBoss);

   }
   task mainTask{
      wait(50);
      loop{
         fire;
         wait(100);
         centerbolt;
         wait(100);
      }
   }

   task fire{
      let n = 0;
      let dxl = 0;
      let dxr = 0;
      let xa = (448/4)+dxl;
      let xb = (448*3/4)+dxr;
      //YELLOW01 is 16 px tall and the play field is 480 px tall, but this leaves safe lines
      //create two lightning bolts from 1/3 and 2/3 the width of the screen starting at the top
      while(n<480/12){
         //if n is an odd number, the bullet will move to the right; otherwise it moves to the left
         if(floor(n/2) < n/2){
            lightning(xa+dxl,12*n,0,0,YELLOW01,n);
            lightning(xb+dxr,12*n,0,0,YELLOW01,n);
         }else{
            lightning(xa+dxl,12*n,0,180,YELLOW01,n);
            lightning(xb+dxr,12*n,0,180,YELLOW01,n);
         }
         wait(1);
         dxl=rand_int(-8,8);
         dxr=rand_int(-8,8);
         xa+=dxl;
         xb+=dxr;
         n++;
      }
     
      n = 0;
      dxl = 0;
      dxr = 0;
      xa = (448/4);
      xb = (448*3/4);
     
   }

   task centerbolt{
      let n = 0;
      let dx = 0;
      let xc = (448/2)+dx;
      //create a lightning bolt starting from the top middle
      while(n<480/12){
         //bullets in the middle chain will have the opposite system from that above
         if(floor(n/2) < n/2){
            lightning(xc+dx,12*n,0,180,YELLOW01,n);
         }else{
            lightning(xc+dx,12*n,0,0,YELLOW01,n);
         }
         wait(1);
         dx=rand_int(-8,8);
         n++;
      }
      n = 0;
      dx = 0;
      xc = (448/2);
   }

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

   //generate object bullet
   task lightning(x,y,v,dir,graphic,delay){
      let shard = Obj_Create(OBJ_SHOT);
      Obj_SetPosition(shard,x,y);
      Obj_SetAngle(shard,dir);
      ObjShot_SetGraphic(shard,graphic);
      ObjShot_SetDelay(shard,delay);
      ObjShot_SetBombResist(shard,false);
      wait(90+delay);
      Obj_SetSpeed(shard,1.5);

   }
   task SoundTask{
loop{if(GetTimer <= 10 && GetTimer > 3){
PlaySE(CSD ~ "Materials/timer1.wav");
wait(60);
}
if(GetTimer <= 3){
PlaySE(CSD ~ "Materials/timer2.wav");
wait(60);
}
yield;}

}
}
Try this. Your problem was that you were calling 'wait' in the Mainloop, and yield; has substantially different effects depending on whether it's called in the Mainloop or outside it. I don't have the sound files, so I can't tell, but get back to me on this if this doesn't work (I relegated your snippet to a task, SoundTask, and called it separately from Maintask)

Also, yeah yeah, my syntax is kinda crap, big deal. I tested it, and it didn't freeze or do anything scary past timer = 10

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #658 on: December 16, 2009, 06:57:56 AM »
No matter where I try to stick this benign bit of code:
Code: [Select]
if(GetTimer <= 10 && GetTimer > 3){
PlaySE(CSD ~ "Materials/timer1.wav");
wait(60);
}
if(GetTimer <= 3){
PlaySE(CSD ~ "Materials/timer2.wav");
wait(60);
}
yield;
into this:
Code: [Select]
#TouhouDanmakufu
#Title[Danmaku Upgrade "Alpha Shock"]
#Text[An attack from somewhere else, as a Spell Card!]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{

let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "system\PlaceholderBoss.png";
#include_function "lib\ExpandedShotData\shot_replace.dnh";

@Initialize{
SetLife(1000);
SetTimer(80);
SetScore(1000000);
SetMovePosition01(GetCenterX,GetCenterY-60,5);
SetEnemyMarker(true);
SetInvincibility(80);
SetDamageRate(25,25);
LoadGraphic(imgBoss);
shotinit;
CutIn(KOUMA,"Danmaku Upgrade "\""Alpha Shock"\","",0,0,0,0);
mainTask;
}

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

@DrawLoop{

SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,64,64);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);

}

@BackGround{



}

@Finalize{

DeleteGraphic(imgBoss);

}
task mainTask{
wait(50);
loop{
fire;
wait(100);
centerbolt;
wait(100);
}
}

task fire{
let n = 0;
let dxl = 0;
let dxr = 0;
let xa = (448/4)+dxl;
let xb = (448*3/4)+dxr;
//YELLOW01 is 16 px tall and the play field is 480 px tall, but this leaves safe lines
//create two lightning bolts from 1/3 and 2/3 the width of the screen starting at the top
while(n<480/12){
//if n is an odd number, the bullet will move to the right; otherwise it moves to the left
if(floor(n/2) < n/2){
lightning(xa+dxl,12*n,0,0,YELLOW01,n);
lightning(xb+dxr,12*n,0,0,YELLOW01,n);
}else{
lightning(xa+dxl,12*n,0,180,YELLOW01,n);
lightning(xb+dxr,12*n,0,180,YELLOW01,n);
}
wait(1);
dxl=rand_int(-8,8);
dxr=rand_int(-8,8);
xa+=dxl;
xb+=dxr;
n++;
}

n = 0;
dxl = 0;
dxr = 0;
xa = (448/4);
xb = (448*3/4);

}

task centerbolt{
let n = 0;
let dx = 0;
let xc = (448/2)+dx;
//create a lightning bolt starting from the top middle
while(n<480/12){
//bullets in the middle chain will have the opposite system from that above
if(floor(n/2) < n/2){
lightning(xc+dx,12*n,0,180,YELLOW01,n);
}else{
lightning(xc+dx,12*n,0,0,YELLOW01,n);
}
wait(1);
dx=rand_int(-8,8);
n++;
}
n = 0;
dx = 0;
xc = (448/2);
}

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

//generate object bullet
task lightning(x,y,v,dir,graphic,delay){
let shard = Obj_Create(OBJ_SHOT);
Obj_SetPosition(shard,x,y);
Obj_SetAngle(shard,dir);
ObjShot_SetGraphic(shard,graphic);
ObjShot_SetDelay(shard,delay);
ObjShot_SetBombResist(shard,false);
wait(90+delay);
Obj_SetSpeed(shard,1.5);

}

}
one of the following happens:
1) Danmakufu freezes when the timer hits 10.
2) The pattern goes berserk when the timer hits 10.
3) The entire card is rendered inert.

Where should I put the timer function?

I would stick that in a separate task and call it once and only once somewhere when the spellcard starts. @Initialize would be fine. Before the wait(50); in your mainTask would work too.

EDIT: Oh... I should read down farther before I answer a question. <_<

I'm trying to add an event to a plural, but when i put it right in to one of the spells, it plays over the action. How do i make it so it goes Event starts > Event Finishes > Spell Starts as opposed to them starting at the same time.

In you are using purely tasks like Helepolis's video tutorials teach you to, putting if(OnEvent){yield;} in the very beginning of you mainTask should solve your problem. If you are putting everything in the @MainLoop, put everything in your @MainLoop inside if(!OnEvent){//stuff} so that it only runs when there is no event going on.

<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 II
« Reply #659 on: December 16, 2009, 04:06:49 PM »
I have a problem with my player script.

When I focus, the dot around the hitbox is supposed to fade in quickly once you push the button and to fade away just as fast when you release it. The relevant code is:
Code: [Select]
if((GetKeyState(VK_SLOWMOVE)==KEY_PUSH||GetKeyState(VK_SLOWMOVE)==KEY_HOLD)&&focusdot<255){ focusdot+=15; }
if((GetKeyState(VK_SLOWMOVE)==KEY_PULL||GetKeyState(VK_SLOWMOVE)==KEY_FREE)&&focusdot>0){ focusdot-=15; }


SetTexture(img_dot);
SetGraphicRect(0, 0, 7, 7);
SetAlpha(focusdot);
DrawGraphic(GetPlayerX, GetPlayerY);

Now, the problem is: When I focus, the dot fades in as planned, but when the maximum is reached, the white center becomes transparent again. I have no idea why this is happening.

Anyone got an idea?
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."