Maidens of the Kaleidoscope

~Hakurei Shrine~ => Rika and Nitori's Garage Experiments => Topic started by: Helepolis on October 21, 2009, 10:10:08 AM

Title: Danmakufu Q&A/Problem Thread II
Post by: Helepolis 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.


Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Henry 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)?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: puremrz 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.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Infy♫ on October 21, 2009, 01:12:47 PM
can i let enemies draw 3d backgrounds?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Janitor Morgan 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?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Stuffman 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.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Sakura665 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:
(http://i238.photobucket.com/albums/ff164/Sakura301/WOWANCHORS.jpg)
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
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Stuffman 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
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Infy♫ 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?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Thaws 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.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Stuffman on October 22, 2009, 05:27:01 PM
then, why won't you use enemies as stages?

Uh, elaborate? Why would you want to?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Infy♫ 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);
   }
}

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Stuffman on October 22, 2009, 06:05:41 PM
What kind of crash? Infinite loop? Windows error? Just closes with no warning?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Infy♫ 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.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Sakura665 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
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on October 23, 2009, 01:14:42 AM
...What stopped checking.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Sakura665 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?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon 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...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Stuffman 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.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Thaws 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.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Frazer 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?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Cabble 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?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut 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.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake 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.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon 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
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut 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.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: CK Crash 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).
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Henry 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;
    }
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Frazer 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'.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Wingz on October 24, 2009, 07:30:49 PM
Question: how can I show players score after the fight is over?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on October 24, 2009, 10:46:10 PM
hm...
Code: [Select]
#TouhouDanmakufu
#Title[Flower Test]
#Text[????]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main {
let BossImage = "script\img\ExRumia.png";
let frame = -60;
let a = 0;
let num = 10;
let graphic = [RED12, ORANGE12, YELLOW12, GREEN12, AQUA12, BLUE12, PURPLE12, WHITE12];
@Initialize {
SetLife(2400);
SetDamageRate(40, 0);
SetEnemyMarker(true);
LoadGraphic(BossImage);
SetMovePosition02(GetCenterX, GetClipMinY+100, 60);
CutIn(KOUMA,"「花の色は良いですか?」", "", 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 == 90) {
loop(num) {
ascent (i in 0..8) {
ascent (j in 0..8) {
CreateShot01(GetX, GetY, 0.75*(i+j*0.5)+1, a+i*2.75, graphic[j], 10);
CreateShot01(GetX, GetY, 0.75*(i+j*0.5)+1, a-i*2.75, graphic[j], 10);
}
}
a+=360/num;
}
a+=9.5;
frame = 0;
}
frame++;
}
@DrawLoop {
SetTexture(BossImage);
SetGraphicRect(0, 0, 64, 64);
DrawGraphic(GetX, GetY);
}
@Finalize {
DeleteGraphic(BossImage);
}
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Janitor Morgan on October 25, 2009, 04:42:48 AM
While working on my Halloween Contest entry, I was fiddling with the BGM for a spellcard, and found that the MP3 I'm using doesn't work when I call it with #BGM. Strange, because a test spellcard I made the other day also uses an MP3, and that track works just fine.

Should I find a different MP3, or come back to that later?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Thaws on October 25, 2009, 04:59:32 AM
While working on my Halloween Contest entry, I was fiddling with the BGM for a spellcard, and found that the MP3 I'm using doesn't work when I call it with #BGM. Strange, because a test spellcard I made the other day also uses an MP3, and that track works just fine.

Should I find a different MP3, or come back to that later?
I've never gotten a .mp3 to work and somehow it works when converted to .wav, maybe you can try that.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Janitor Morgan on October 25, 2009, 05:13:47 AM
I've never gotten a .mp3 to work and somehow it works when converted to .wav, maybe you can try that.
I tried a freeware converter I found, and not only did it not work, but it magically changed the file size from 4.5 MB to 30 MB.  :V
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on October 25, 2009, 05:17:04 AM
wav files are unnecessarily huge

don't worry about it
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Janitor Morgan on October 25, 2009, 05:34:14 AM
oh wut

There was an extraneous LoadGraphic(BossImage); keeping the MP3 from playing. Go figure.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on October 25, 2009, 07:59:32 AM
When mp3s or wav files don't play, use Audacity (freeware and very good program) to change their format such as hz/channels etc. No need to nessecary turn them into wav files.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Henry on October 25, 2009, 01:27:01 PM
Can somebody tell me about the usage of "~" character in Danmakufu?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on October 25, 2009, 02:58:52 PM
Mostly used with GetCurrentScriptDirectory. Like:

GetCurrentScriptDirectory ~ "pathname/file.txt"

 Further more I don't know.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Cabble on October 25, 2009, 03:01:52 PM
Whenever I try to play this no bullets come out.

I know it has something to do with the shotdata but I don't know what!

Code: [Select]
#TouhouDanmakufu
#Title[Water Sign [Flowing Current]]
#Text[]
#BackGround[Default]
#PlayLevel[Probably Hard]
#ScriptVersion[2]

script_enemy_main{
   let frame = 0;
   let count = 0;
   let angle2 = 15;
   let count2 = 0;
#include_function "lib\ExpandedShotData\shot_replace.dnh";

    @Initialize{
        SetLife(8000);
      SetScore(100000);
      SetMovePosition01(GetCenterX, GetCenterY - 60, 3);
      SetInvincibility(300);
     
      CutIn(YOUMU, "Water Sign [Flowing Current]", 0, 0, 0, 0, 0);
shotinit;
    }

    @MainLoop{
      SetCollisionA(GetX, GetY, 32);
      SetCollisionB(GetX, GetY, 16);
frame+=5;
count++;
count2++;
if(count==2){
CreateShot01(GetX, GetY, 2, frame+GetAngleToPlayer, SP02, 0);
CreateShot01(GetX, GetY, 2, 0-frame+GetAngleToPlayer, SP02, 0);
count=0;
}
if(count2==72){
loop(30){
CreateShot01(GetX, GetY, 2, GetAngleToPlayer-angle2, WHITE02, 0);
angle2--;
}
angle2=15;
count2 =0;
}
}
    @DrawLoop{}
    @Finalize{}

    @BackGround{}

}//end script
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on October 25, 2009, 03:07:48 PM
Maybe load your shotdata inside @Initialize ^^   
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Cabble on October 25, 2009, 03:10:53 PM
And now it doesn't call the extra bullets that are in that shotdata and raises and error ^^
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on October 25, 2009, 03:16:21 PM
And now it doesn't call the extra bullets that are in that shotdata and raises and error ^^

Odd. I copypasted your script from the code section and works fine for me. Spawns bullets and stuff.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Sakura665 on October 25, 2009, 03:17:07 PM
While working on my Halloween Contest entry, I was fiddling with the BGM for a spellcard, and found that the MP3 I'm using doesn't work when I call it with #BGM. Strange, because a test spellcard I made the other day also uses an MP3, and that track works just fine.

Should I find a different MP3, or come back to that later?

So far i've managed mp3s to work, i usually record a "video?" with Hypercam or rip videos off youtube with the sound i want, then i put it into windows movie maker on the external audio portion and save it, so it saves as .wma then i use a freeware .wma > mp3 converter, and with that so far all mp3s have worked. (Note: when i just change the extension wma > mp3 without applying a converter it doesnt work, maybe that was the problem with yours?)

Can somebody tell me about the usage of "~" character in Danmakufu?

I remember i read somewhere ~ is used to concatenate 2 strings of characters, but like Helepolis explained earlier is mainly used to concatenate the string returned by GetCurrentScriptDirectory and the rest of the directory, but it could have other uses
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Cabble on October 25, 2009, 03:18:43 PM
It keeps giving me errors about "SP02"
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Sakura665 on October 25, 2009, 03:24:53 PM
It keeps giving me errors about "SP02"

Weird, i copy/pasted your script and it doesnt give me an error either, maybe you should check your ExpandedShotData scripts
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Cabble on October 25, 2009, 03:28:07 PM
Re-downloaded V2, still didn't work. Bleh.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Cabble on October 25, 2009, 03:34:19 PM
Never mind i fixed it, it spawns them by the ids in shot_all  :V
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on October 25, 2009, 03:40:42 PM
Then I guess there is something dodgy with the replacement words. I believe Onthenet already said some of them were dodgy/bugged.

You people should also learn to spawn them by IDs you know :V Makes it flexible when you want to spawn a rainbow coloured pattern with the same type of bullets. Saves you trouble of making arrays.

PS: if you are not far with your shots, I would either advice you to use v4 of ExpandedShotData. They are better because the graphicrects are fixed. Though you have to modify the IDs to find the same bullet again.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Cabble on October 25, 2009, 04:03:08 PM
I thought it didn't have a shot replace  ???
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Janitor Morgan on October 25, 2009, 04:10:06 PM
So far i've managed mp3s to work, i usually record a "video?" with Hypercam or rip videos off youtube with the sound i want, then i put it into windows movie maker on the external audio portion and save it, so it saves as .wma then i use a freeware .wma > mp3 converter, and with that so far all mp3s have worked. (Note: when i just change the extension wma > mp3 without applying a converter it doesnt work, maybe that was the problem with yours?)
It turns out that the problem with my mp3 was that I had an extra LoadGraphic statement. Not sure why that interfered, but my BGM works now.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on October 25, 2009, 04:23:35 PM
I thought it didn't have a shot replace  ???

It doesn't therefor you should learn to spawn them by ID :V
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Cabble on October 25, 2009, 04:26:39 PM
It doesn't therefor you should learn to spawn them by ID :V

Well that's easy. Just go through the list until I find which one I want :D
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on October 25, 2009, 04:50:16 PM
I've been working this for a while, but I don't quite get the ascent statement.  I know how to make it work, but I don't understand how it works or what it does.
Code: [Select]
ascent( (variable) in (first value)..(limit value) ) {
    (statements)
}

What is all this?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Janitor Morgan on October 25, 2009, 04:52:04 PM
If I had to guess, I'd say it's the same thing as a for loop in Java, where (variable) starts at (first value), runs the statements, then goes up by one and loops until it runs the statements at (last value).

Does that make sense?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on October 25, 2009, 04:58:42 PM
Oh, I get it.  So it's like a
Code: [Select]
variable++; but with a starting and ending limit, right?


If that's the case, how can I make the ending limit infinite?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on October 25, 2009, 05:01:18 PM
ascent(x in a..b){ *stuff* }

...does the following:

Danmakufu creates a temporary variable x that can be used inside the stuff. Then the *stuff* is repeated several times; once for x=a, once for x=a+1 and so forth until x=b-1.

Basically it is similar to a regular loop where you use a variable that is increased inside the loop, but it takes less time to type. I think I have never used the loop statement besides loop(n){ yield; }. I always use ascent.


Edit: Infinite?!. If you could do that, the program would freeze because it has to do infite things in a single frame. What exactly do you want to accomplish..?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on October 25, 2009, 05:10:27 PM
Edit: Infinite?!. If you could do that, the program would freeze because it has to do infite things in a single frame. What exactly do you want to accomplish..?

Well, lets say the variable I'm using will represent an angle and I want that to keep increasing every frame.  If I put in a random number, lets say, 360, then it will keep doing it until about 2Pi radians.  But what if I want it to keep increasing past that, so it keeps making "circles"?  Sure, I could put in a rediculously high number, but it will still stop at some point.  It wouldn't have to do everything all at once as long as if I put in a yield statement somewhere in with the ascent.  So, do you know what the statement for infinity is?


EDIT: I'm not really using angles with it, I'm just using an example here.  I'm making something big, and I want to keep it a secret until it comes out.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on October 25, 2009, 05:16:46 PM
Um, I don't think there is, but it sounds like whatever you want to accomplish would be easier if you just had a task with a while(GetEnemyLife>0){ *stuff* } that gets called during @Initialize and that includes a yield; and a variable increment.

Also, if you really need to go to a point where the program doesn't execute your orders anymore because you give it too many per frame, I think it may be time to reconsider the script you are trying to make.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on October 25, 2009, 05:23:35 PM
Um, I don't think there is, but it sounds like whatever you want to accomplish would be easier if you just had a task with a while(GetEnemyLife>0){ *stuff* } that gets called during @Initialize and that includes a yield; and a variable increment.

Also, if you really need to go to a point where the program doesn't execute your orders anymore because you give it too many per frame, I think it may be time to reconsider the script you are trying to make.


I already do.  And believe me, this is necessary.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on October 25, 2009, 05:31:56 PM
Well, I just cannot fathom why you would need to keep increasing the variable beyond 360 instead of setting it back to 0 and start again from there, unless you really want to unleash number of bullets at once that may look cool but will crash an/or slow down the game to a degree that the look isn't worth it.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on October 25, 2009, 05:39:48 PM
Alright, here's another question.

How can I make an effect object both move at a desired angle and rotate at a desired speed at the same time?  Because I've only found one way to do that, and it's through object creation and deletion frame by frame.  I admit, it's a lot of work, but fully customizable.

EDIT: And no, not type in angle etc frame by frame, I mean setting X and Y coordinates and ObjEfffect_SetAngle(x,y,z) through a loop, with the object deletion at the end of the loop so it creates new x y and z every time it spawns.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on October 25, 2009, 05:47:06 PM
I've never used effect objects before, but if they work similar to bullet objects you can just let the regular angle rotate and simulate the actual movement trough a relative SetPosition command:

Set the movement speed to 0.
Create a variable speed and a variable angle
Now, inside the loop that occurs once every frame, put:
Obj_SetPosition(obj, Obj_GetX(obj) + speed*cos(angle), Obj_GetY(obj) + speed*sin(angle) );

There you go.  8)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on October 25, 2009, 05:52:41 PM

Obj_SetPosition(obj, Obj_GetX(obj) + speed*cos(angle), Obj_GetY(obj) + speed*sin(angle) );

Well, that's what I came out with.  The object loop, frame by frame. I mean without doing that.

Nevermind, found it.  WOOOOoow... I can't believe I didn't see it earlier.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Sakura665 on October 25, 2009, 06:39:27 PM
Well i dont see the point in ascent, it works less often than (let variable; loop(number){do stuff; variable++;}variable=0;) for some reason, and if you want an infinite loop you can just use loop{do stuff}, ionno in one spellcard i used ascent and didnt work, then made a loop and it worked, so idk but i will just stay with loops for now
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Azure Lazuline on October 25, 2009, 08:35:01 PM
Quick question, is there any way to change the enemy death sound for a script, without using the "put this file in this directory to overwrite the default" trick?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on October 25, 2009, 08:56:32 PM
why isn't the lasers firing the bullets?ive messed around with it for days and i cant figure it out.
Code: [Select]
#TouhouDanmakufu
#Title[new74570253]
#Text[「」]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{
#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
let frame = 0;
let frame2 = 0;
let angle = 0;
let ahoaha = 0;
let n = rand(0, 360);
@Initialize{
SetLife(800);
SetMovePosition02(GetCenterX,GetCenterY,0);
SetTimer(90);
shotinit;

}

@MainLoop{
SetCollisionA(GetX,GetY,16);
SetCollisionB(GetX,GetY,16);
frame++;
if(frame%70==0){
CreateLaserA(0, GetX, GetY, 400, 60, BLUE60, 30);
SetLaserDataA(0, 0, GetAngleToPlayer, 0, 0, 1, 180);
SetLaserDataA(0, 30, NULL, 0, 0, 0, 180);
SetShotKillTime(0, 60);
FireShot(0);

CreateLaserA(1, GetX, GetY, 400, 60, BLUE60, 30);
SetLaserDataA(1, 0, GetAngleToPlayer, 0, 0, -1, 180);
SetLaserDataA(1, 30, NULL, 0, 0, 0, 180);
SetShotKillTime(1, 60);
FireShot(1);

AddShot(50, 0,2, 30);
CreateShotA(2, 0, 0, 0);
SetShotDataA(2, 0, 3, rand(0, 360), 1, 0, 0, AQUA02);

AddShot(50, 1,3, 30);
CreateShotA(3, 0, 0, 0);
SetShotDataA(3, 0, 3, rand(0, 360), 1, 0, 0, AQUA02);


}}

@DrawLoop{

}

@BackGround{

}

@Finalize{

}



}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: CK Crash on October 25, 2009, 09:03:44 PM
The Addshots have to be before the FireShot of the "creating" bullet. Treat Addshot bullets as a property of a CreateShot (put them where the SetShotData stuff is).
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Sakura665 on October 25, 2009, 09:09:01 PM
why isn't the lasers firing the bullets?ive messed around with it for days and i cant figure it out.
Code: [Select]
#TouhouDanmakufu
#Title[new74570253]
#Text[「」]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{
#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
let frame = 0;
let frame2 = 0;
let angle = 0;
let ahoaha = 0;
let n = rand(0, 360);
@Initialize{
SetLife(800);
SetMovePosition02(GetCenterX,GetCenterY,0);
SetTimer(90);
shotinit;

}

@MainLoop{
SetCollisionA(GetX,GetY,16);
SetCollisionB(GetX,GetY,16);
frame++;
if(frame%70==0){
CreateLaserA(0, GetX, GetY, 400, 60, BLUE60, 30);
SetLaserDataA(0, 0, GetAngleToPlayer, 0, 0, 1, 180);
SetLaserDataA(0, 30, NULL, 0, 0, 0, 180);
SetShotKillTime(0, 60);
FireShot(0);

CreateLaserA(1, GetX, GetY, 400, 60, BLUE60, 30);
SetLaserDataA(1, 0, GetAngleToPlayer, 0, 0, -1, 180);
SetLaserDataA(1, 30, NULL, 0, 0, 0, 180);
SetShotKillTime(1, 60);
FireShot(1);

AddShot(50, 0,2, 30);
CreateShotA(2, 0, 0, 0);
SetShotDataA(2, 0, 3, rand(0, 360), 1, 0, 0, AQUA02);

AddShot(50, 1,3, 30);
CreateShotA(3, 0, 0, 0);
SetShotDataA(3, 0, 3, rand(0, 360), 1, 0, 0, AQUA02);


}}

@DrawLoop{

}

@BackGround{

}

@Finalize{

}



}

The correct way to do it is, CreateShot, SetShotData, CreateShot (diff ID), SetShotData, AddShot(the one in the 2nd CreateShot), FireShot.

AddShots are like FireShots, except makes them being fired from another bullet, so you have to set their data before using AddShot, and their data has to be input before FireShot, hope i didnt cofuse you more, you can also read and check the examples on the tutorials at the wiki
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Cabble on October 25, 2009, 10:42:44 PM
BLEGH

Ok shotdata V4 isn't working for me.

How do I brighten up a bullet ingame?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on October 26, 2009, 12:10:16 AM
BLEGH

Ok shotdata V4 isn't working for me.

How do I brighten up a bullet ingame?

Hmmm... If it's an added bullet (from LoadUserShotData;) then you can put
Code: [Select]
render = ADD in the shot replacement script.

I dunno what you're talking about.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Janitor Morgan on October 26, 2009, 05:06:31 AM
So, effect objects. It's my first time using them, so I've been sure to read how the functions work and everything. I decided to test a script, and got an error. Here's the MainLoop from my code; it's really the only relevant part:
Code: [Select]
    @MainLoop {
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);

if (frame == 0) {
let ID = Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(ID, Texture);
ObjEffect_SetPrimitiveType(ID, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(ID, 4);
ObjEffect_SetVertexXY(ID, 0, 150, 0);
ObjEffect_SetVertexXY(ID, 1, 234, 0);
ObjEffect_SetVertexXY(ID, 2, 150, 448);
ObjEffect_SetVertexXY(ID, 3, 234, 448);
ObjEffect_SetVertexUV(ID, 0, 0, 0);
ObjEffect_SetVertexUV(ID, 1, 84, 0);
ObjEffect_SetVertexUV(ID, 2, 0, 448);
ObjEffect_SetVertexUV(ID, 3, 84, 448);
ObjEffect_SetVertexColor(ID, 0, 150, 150, 0, 150);
ObjEffect_SetVertexColor(ID, 1, 150, 150, 0, 150);
ObjEffect_SetVertexColor(ID, 2, 150, 150, 0, 150);
ObjEffect_SetVertexColor(ID, 3, 150, 150, 0, 150);
}
if (frame == 120) {
Obj_Delete(ID);
frame = -120;
}
frame++;

    }
The error in question would be the Obj_Delete(ID) near the end. The only reason I can think of for it messing up is that it's in a different if statement, but I can't just let the object stack on top of itself for the entire script. Any advice?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: RavenEngie on October 26, 2009, 06:01:02 PM
So, effect objects. It's my first time using them, so I've been sure to read how the functions work and everything. I decided to test a script, and got an error. Here's the MainLoop from my code; it's really the only relevant part:

      code goes here

The error in question would be the Obj_Delete(ID) near the end. The only reason I can think of for it messing up is that it's in a different if statement, but I can't just let the object stack on top of itself for the entire script. Any advice?

Delete that chunk of object stuff, and paste this outside MainLoop, DrawLoop, etc.

Code: [Select]
task effect {
      let ID = Obj_Create(OBJ_EFFECT);
      ObjEffect_SetTexture(ID, Texture);
      ObjEffect_SetPrimitiveType(ID, PRIMITIVE_TRIANGLESTRIP);
      ObjEffect_CreateVertex(ID, 4);
      ObjEffect_SetVertexXY(ID, 0, 150, 0);
      ObjEffect_SetVertexXY(ID, 1, 234, 0);
      ObjEffect_SetVertexXY(ID, 2, 150, 448);
      ObjEffect_SetVertexXY(ID, 3, 234, 448);
      ObjEffect_SetVertexUV(ID, 0, 0, 0);
      ObjEffect_SetVertexUV(ID, 1, 84, 0);
      ObjEffect_SetVertexUV(ID, 2, 0, 448);
      ObjEffect_SetVertexUV(ID, 3, 84, 448);
      ObjEffect_SetVertexColor(ID, 0, 150, 150, 0, 150);
      ObjEffect_SetVertexColor(ID, 1, 150, 150, 0, 150);
      ObjEffect_SetVertexColor(ID, 2, 150, 150, 0, 150);
      ObjEffect_SetVertexColor(ID, 3, 150, 150, 0, 150);

      while(Obj_BeDeleted(ID) == false){
            if(frame == 120){
                  Obj_Delete(ID);
                  frame = -120;
            }
            yield;
      }
}

And put in @MainLoop...

Code: [Select]
if(frame == 0){
      effect;
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on October 26, 2009, 07:33:09 PM
The problem is indeed the delete being in a different block of code. Once the first if statement is done, any variables that were created in it are cleared from the memory so the ID variable doesn't exist anymore in the second if statement.

I'm not too familiar with microthreading but from my knowledge of them, Ravenlock's solution works fine. If you don't like microthreads (like me lol), you can always use arrays to manage objects.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Janitor Morgan on October 26, 2009, 08:09:01 PM
Putting the object's variables in a task fixed the error, and also stopped it from constantly building upon itself. Thanks for the help!
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on October 26, 2009, 10:36:08 PM
Is there a way to fire CreateShotAs over time, but have them activate/change all at once?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on October 26, 2009, 11:20:17 PM
There are two ways to do that.

1.) Using the standard frame or count variable to modify the activation time:
Code: [Select]
if(count%5 == 0 && count >=60 && count <=120){
  CreateShotA(0, GetX, GetY, 10);
  SetShotDataA(0, 0, 2, 90, 0, 0, 0, RED01);
  SetShotDataA(0, 180-count, 2, 180, 0, 0, 0, RED01);
  FireShot(0);
}

2.) Using an ascent statement coupled with varying delay times:
Code: [Select]
ascent(i in 0..13){
  CreateShotA(0, GetX, GetY, i*5+10);
  SetShotDataA(0, 0, 2, 90, 0, 0, 0, RED01);
  SetShotDataA(0, 120-i*5, 2, 180, 0, 0, 0, RED01);
  FireShot(0);
}

Both of these would create approximately the same behavior with slightly different visual effects with the delay.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Azure Lazuline on October 27, 2009, 03:11:12 AM
I asked this a little while ago but got no response (sorry if it seems like I'm attention hogging; this just seems like it should be very simple, yet I can't find the answer). Is there any way to remove or replace the default sound effect made by destroyed enemies (the one that sounds like paper ripping)? Also, is there a way to make the enemy do something when destroyed by your character, but not when you call VanishEnemy? @Finalize{} seems to run for both.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on October 27, 2009, 03:56:19 AM
I asked this a little while ago but got no response (sorry if it seems like I'm attention hogging; this just seems like it should be very simple, yet I can't find the answer). Is there any way to remove or replace the default sound effect made by destroyed enemies (the one that sounds like paper ripping)? Also, is there a way to make the enemy do something when destroyed by your character, but not when you call VanishEnemy? @Finalize{} seems to run for both.

Default Sound effect for destroyed enemy would  be found in your se folder. Then put in a "seEnemyExplode01.wav" which is whatever sound you want to be played when your enemy is defeated.
Also, if you want to have something done in @Finalize only when you enemy is DEFEATED, and not VANISHED, you use:
Code: [Select]
@Finalize { if(!BeVanished) { DoSomething(put, parameters, here); } }
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Azure Lazuline on October 27, 2009, 04:09:40 AM
Default Sound effect for destroyed enemy would  be found in your se folder. Then put in a "seEnemyExplode01.wav" which is whatever sound you want to be played when your enemy is defeated.
Is there any way to do that without telling the user of the script to put this file in that directory (I.E., somehow override the file with something from the script directory)? If not, it's not too big of a deal, but it would simplify things a little. As for the other answer, thanks, I must have overlooked that function when going through the list...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on October 27, 2009, 04:15:29 AM
Is there any way to do that without telling the user of the script to put this file in that directory (I.E., somehow override the file with something from the script directory)?

No.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on October 27, 2009, 04:22:52 AM
You just put all the replaced files in a separate folder and tell everyone to set it as default, pretty much.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on October 27, 2009, 04:36:23 AM
Or just upload your whole danmakufu folder onto mediafire instead of just the script.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Nimble on October 27, 2009, 02:34:54 PM
May I ask about original image file from th_dnh.dat in danmakufu?

I look in old thread and find that I can change GUI by replace new file in img / sfx danmakufu root folder. So I think about change something a bit.

Working with 32*32 grid number png feel like trapped in reimu's last spell.

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Henry on October 27, 2009, 02:45:25 PM
oh, there is a thread about this, but it is quite hard to do the puzzle, in fact. (none of us had considerable result of that)

By the way, is there a way to make Byakuren's & Shinki's Curved Laser (Fixed position)?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on October 27, 2009, 03:04:05 PM
May I ask about original image file from th_dnh.dat in danmakufu?

I look in old thread and find that I can change GUI by replace new file in img / sfx danmakufu root folder. So I think about change something a bit.

Working with 32*32 grid number png feel like trapped in reimu's last spell.

The thread is called: "Unraveveling the mysteries of danmakufu (http://www.shrinemaiden.org/forum/index.php?topic=3167.0)"

And I only found a few things with that 32x32 sheet I made ( which you seem to mention ).

Nobody has cracked the file yet and neither anything is to be found on google/internet.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Nimble on October 27, 2009, 05:14:29 PM
Seem like I'm really sleepy while searching about GUI replace in whole Rika's Garage & Old Q&A thread yesterday..... How can I miss that thread.

I did the same thing from hex to all tool I found on Drake's thread.

Then, I'll try keep working on grip :V


while (mystery != solve) { edit; save; restart danmakufu; }

(Sorry for my bad language too, bow)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on October 27, 2009, 07:07:53 PM
By the way, is there a way to make Byakuren's & Shinki's Curved Laser (Fixed position)?

Isn't that just a solid stream of bullets waving back and forth?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: CK Crash on October 27, 2009, 07:38:31 PM
oh, there is a thread about this, but it is quite hard to do the puzzle, in fact. (none of us had considerable result of that)

By the way, is there a way to make Byakuren's & Shinki's Curved Laser (Fixed position)?

Assuming you're not talking about the actual curved lasers (which are made with LaserC functions):

Code: [Select]
task byaphase
{
let angle = 0;
let anglechange = 0.5;
loop
   {
   CreateShot01(GetX-64,GetY-96,4,angle+95,BLUE21,30); //top left
   CreateShot01(GetX-64,GetY-96,4,angle+155,BLUE21,30);
   CreateShot01(GetX-64,GetY-96,4,angle+35,BLUE21,30);

   CreateShot01(GetX+64,GetY-96,4,-angle+85,BLUE21,30); //top right
   CreateShot01(GetX+64,GetY-96,4,-angle+145,BLUE21,30);
   CreateShot01(GetX+64,GetY-96,4,-angle+25,BLUE21,30);


   CreateShot01(GetX-128,GetY+32,4,-angle+80,BLUE21,30); //bottom left
   CreateShot01(GetX-128,GetY+32,4,-angle+140,BLUE21,30);
   CreateShot01(GetX-128,GetY+32,4,-angle+20,BLUE21,30);

   CreateShot01(GetX+128,GetY+32,4,angle+100,BLUE21,30); //bottom right
   CreateShot01(GetX+128,GetY+32,4,angle+160,BLUE21,30);
   CreateShot01(GetX+128,GetY+32,4,angle+40,BLUE21,30);

   if (angle > 12 || angle < -12){anglechange = -anglechange;}
   angle += anglechange;
   loop(4){yield;}
   }
}

You may want to tweak the positions they spawn from and the exact angle, but this matches fairly well.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on October 28, 2009, 02:23:47 AM
Code: [Select]
#TouhouDanmakufu
#Title[Sakuya Scarlet]
#Text[Remilia Izayoi]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let BossImage = "script\img\ExRumia.png";
    let IsSelectingColour = true; let delaystart = -120;
    let startingplayercoordinates = [GetPlayerX, GetPlayerY];
    let destinycolour = 0; let destinytext = ["Red", "Orange", "Yellow", "Green", "Aqua", "Blue", "Purple", "White"];
    let destinyfont = [[255, 0, 0], [255, 192, 128], [255, 255, 0], [0, 255, 0], [128, 192, 255], [0, 0, 255], [255, 0, 255], [255, 255, 255]];
    let frame = -180;
    let a = rand(0, 360);
    let num = 5;
    let graphic_knife = [RED32, ORANGE32, YELLOW32, GREEN32, AQUA32, BLUE32, PURPLE32, WHITE32];
    let graphic_bubble = [RED03, ORANGE03, YELLOW03, GREEN03, AQUA03, BLUE03, PURPLE03, WHITE03];
    @Initialize {
        SetLife(2400); SetDamageRate(40, 0);
        SetEnemyMarker(true);
        SetTimer(60);
        LoadGraphic(BossImage);
        SetMovePosition02(GetCenterX, GetClipMinY+100, 60);
        CutIn(KOUMA,"「Destiny-Defined Colour」", "", 0, 0, 0, 0);
        SetScore(1000000); SetDurableSpellCard;
    }

    @MainLoop {
        if(frame > 0) {
loop(num) {
CreateShot01(GetX, GetY, 3, a+rand(-3, 3), graphic_knife[destinycolour], 10);
CreateShot01(GetX, GetY, 3, -a+rand(-3, 3), graphic_knife[destinycolour], 10);
a+=360/num;
}
a+=num/2+3;
        }
        if(frame == 180) {
loop(40) {
CreateShot01(GetX, GetY, 3, a, graphic_bubble[destinycolour], 10);
a+=360/40;
}
        }
        if(frame == 180) {
frame = -120;
a = rand(0, 360);
SetMovePosition03(rand(GetClipMinX+50, GetClipMaxX-50), rand(GetClipMinY+50, GetCenterY-50), 10, 2);
        }
        if(IsSelectingColour) {
SetTimer(GetTimer+1); ForbidShot(true); ForbidBomb(true);
SetPlayerX(startingplayercoordinates[0]); SetPlayerY(startingplayercoordinates[1]);
if(GetKeyState(VK_DOWN) == KEY_PUSH) { destinycolour++; }
if(GetKeyState(VK_UP) == KEY_PUSH) { destinycolour--; }
if(destinycolour < 0) { destinycolour = 0; } if(destinycolour > 7) { destinycolour = 7; }
if(GetKeyState(VK_SHOT) == KEY_PUSH && delaystart >= 0){ ForbidShot(false); ForbidBomb(false); IsSelectingColour = false; }
if(delaystart < 60) { delaystart++; }
        }
        if(!IsSelectingColour) {
SetCollisionA(GetX, GetY, 32); //32 for boss, 10 for fairy
SetCollisionB(GetX, GetY, 24);//24 for boss, 5 for fairy
frame++;
        }
    }

    @DrawLoop {
        if(IsSelectingColour) {
        DrawText("Select Colour.", GetClipMaxX/4, GetClipMaxY*3/4-12, 12, 255);
        SetFontColor(destinyfont[destinycolour][0], destinyfont[destinycolour][1], destinyfont[destinycolour][2], destinyfont[destinycolour][0], destinyfont[destinycolour][1], destinyfont[destinycolour][2]);
        DrawText(destinytext[destinycolour], GetClipMaxX/4, GetClipMaxY*3/4, 24, 255);
        }
        SetFontColor(destinyfont[destinycolour][0], destinyfont[destinycolour][1], destinyfont[destinycolour][2], destinyfont[destinycolour][0], destinyfont[destinycolour][1], destinyfont[destinycolour][2]);
        DrawText("海龍 爾夜知", 40, 36, 12, 255);
        SetTexture(BossImage);
        SetGraphicRect(0, 0, 64, 64);
        DrawGraphic(GetX, GetY);
    }

    @Finalize {
        DeleteGraphic(BossImage);
    }
}
Rate. Now. Is tidiness even necessary when you make a game??

edit: POST #⑨0! Yes!!
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on October 28, 2009, 02:32:02 AM
If you want other people to understand what the hell you're doing/you to understand when you come back to it later, yes.

It's honestly stupidly random and unnecessarily hard. I like how you experimented with the colors, but the vibe just isn't there for me.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on October 28, 2009, 02:33:25 AM
If you want other people to understand what the hell you're doing/you to understand when you come back to it later, yes.

It's honestly stupidly random and unnecessarily hard. I like how you experimented with the colors, but the vibe just isn't there for me.
Shhhh... not so loud! I want some noob to wreck his brain trying to figure out how everything works. Honestly, I tried to go for something like Remi's LW in IN... but somehow I decided, why not? And now, there are WHAT THE FUCK I DONT EVEN number of variables. Arrays. Arrays. Arrays. Arrays. Arrays.
Anyways, it's at least a bit tidier than last time, isn't it?.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Henry on October 28, 2009, 12:08:39 PM
Assuming you're not talking about the actual curved lasers (which are made with LaserC functions):

Code: [Select]
task byaphase
{
let angle = 0;
let anglechange = 0.5;
loop
   {
   CreateShot01(GetX-64,GetY-96,4,angle+95,BLUE21,30); //top left
   CreateShot01(GetX-64,GetY-96,4,angle+155,BLUE21,30);
   CreateShot01(GetX-64,GetY-96,4,angle+35,BLUE21,30);

   CreateShot01(GetX+64,GetY-96,4,-angle+85,BLUE21,30); //top right
   CreateShot01(GetX+64,GetY-96,4,-angle+145,BLUE21,30);
   CreateShot01(GetX+64,GetY-96,4,-angle+25,BLUE21,30);


   CreateShot01(GetX-128,GetY+32,4,-angle+80,BLUE21,30); //bottom left
   CreateShot01(GetX-128,GetY+32,4,-angle+140,BLUE21,30);
   CreateShot01(GetX-128,GetY+32,4,-angle+20,BLUE21,30);

   CreateShot01(GetX+128,GetY+32,4,angle+100,BLUE21,30); //bottom right
   CreateShot01(GetX+128,GetY+32,4,angle+160,BLUE21,30);
   CreateShot01(GetX+128,GetY+32,4,angle+40,BLUE21,30);

   if (angle > 12 || angle < -12){anglechange = -anglechange;}
   angle += anglechange;
   loop(4){yield;}
   }
}

You may want to tweak the positions they spawn from and the exact angle, but this matches fairly well.

So for the curved lasers, a velocity of 0 and angle acceleration enables the motion like that?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on October 28, 2009, 03:12:10 PM
Question ze:

I am trying to fool around with custom life bars by creating a function for it. However my math is amazing as ever and can't get the size proportions right. It is like this:

Enemy Life is, let's say: 1000. The static size of the lifebar is ALWAYS 300 pixels long. Now depending on a math function I have to convert the 1000 life to equal size of 300. Meaning if the enemy takes 100 damage, the life bar has to decrease with the same %. Eventually if the enemy life hits 0, the lifebar should be 0 pixels wide as well.

But I keep messing up the math , either my lifebar is shrinking too slow or too fast >.<
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on October 28, 2009, 03:34:53 PM
Question ze:

I am trying to fool around with custom life bars by creating a function for it. However my math is amazing as ever and can't get the size proportions right. It is like this:

Enemy Life is, let's say: 1000. The static size of the lifebar is ALWAYS 300 pixels long. Now depending on a math function I have to convert the 1000 life to equal size of 300. Meaning if the enemy takes 100 damage, the life bar has to decrease with the same %. Eventually if the enemy life hits 0, the lifebar should be 0 pixels wide as well.

But I keep messing up the math , either my lifebar is shrinking too slow or too fast >.<

Let's hope the code I write makes sense without explanation.
Code: [Select]
enemy_script_main{
  let maxLife;
  let currentLife;
  let percentage;
  let lifeBarLeft;

  @Initialize{
    SetLife(1000);
    maxLife = GetEnemyLife();
    CustomLifeBar;
  }

  @MainLoop{
    yield;
  }

  @DrawLoop{
  }

  @Finalize{
  }

  task CustomLifeBar{
    currentLife = GetEnemyLife();
    percentage = currentLife/maxLife;
    lifeBarLeft = ceil(300*percentage);

    //Do stuff with lifeBarLeft which now stores how many pixels your life bar should be.

    yield;
  }
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on October 28, 2009, 03:42:14 PM
FFFFFFFFF I knew I was missing something. Though I kept dividing  GetEnemyLife with 300 and such. Which is obviously NOT the method.

ps, what does ceil do? Cannot remember anymore. Round up/down to nearest with no decimals?

(heads out to try the code)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on October 28, 2009, 03:45:18 PM
ceil = round up

ceil(8.9) = 9
ceil(8.1) = 9
ceil(8.0000000000000001) = 9

The opposite is floor which rounds down similarly.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on October 28, 2009, 03:47:03 PM
durr math stuff insert here

Code: [Select]
SetLength(healthbar, 300-((300/totallife)*GetLife());And just run it every frame.

EDIT: beaten derpderp
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on October 28, 2009, 03:59:54 PM
I am such an frikken idiot when it comes down to implementing math in code. Argh....

My life bar loads up and extends till 300, but when the math code kicks in, it pops ALL the way to the left :V

Code: [Select]
--- Declaring above  maxLife and inside @initialize before calling hpBar I do maxLife = GetEnemyLife;

--- function
    // hp life
    task hpBar{
// vars
let lifebarSize = 0;
let lifebarReady = 0;
        let enyLife;
let hpp; // hp percentage
let nhp; // new hp (updated aka left over)

let obj = Obj_Create(OBJ_EFFECT);

// effect functions etc.
ObjEffect_SetTexture(obj,lifebar);
Obj_SetPosition(obj,40,40);
ObjEffect_SetLayer(obj,7);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(obj, 4);

while(! Obj_BeDeleted(obj)) {

// requires to be inside loop for update
          ObjEffect_SetVertexXY(obj, 0, 0, -4);
          ObjEffect_SetVertexUV(obj, 0, 0, 0);
          ObjEffect_SetVertexXY(obj, 1, lifebarSize, -4);
          ObjEffect_SetVertexUV(obj, 1, 128, 0);
          ObjEffect_SetVertexXY(obj, 2, 0, 4);
          ObjEffect_SetVertexUV(obj, 2, 0, 32);
          ObjEffect_SetVertexXY(obj, 3, lifebarSize, 4);
          ObjEffect_SetVertexUV(obj, 3, 128, 32);

if(lifebarSize<300 && lifebarReady == 0){ lifebarSize+=5; } // prepares the lifebar to 300
if(lifebarSize==300){ lifebarReady = 1;} // switch
if(lifebarReady==1){ // start animating it

enyLife = GetEnemyLife;
hpp = enyLife/maxLife;
nhp = ceil(300*hpp);
lifebarSize -= nhp;
}
yield;
}
}

Ok you may laugh now.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on October 28, 2009, 05:48:32 PM
Enemy starts with 1000. First iteration does this:

hpp = 1000/1000 = 1
nhp = ceil(300*1) = 300
lifebarSize = 300 - 300 = 0

You also shouldn't need another variable for GetEnemyLife if it does it every frame. If this code works you can break it into separate variables if you want.

Code: [Select]
      if(lifebarReady==1){                   // start animating it
         lifebarSize = 300-ceil((300/maxLife)*GetEnemyLife());
      }
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on October 28, 2009, 06:03:06 PM
Let's hope the code I write makes sense without explanation.
Code: [Select]
enemy_script_main{
  let maxLife;
  let currentLife;
  let percentage;
  let lifeBarLeft;

  @Initialize{
    SetLife(1000);
    maxLife = GetEnemyLife();
    CustomLifeBar;
  }

  @MainLoop{
    yield;
  }

  @DrawLoop{
  }

  @Finalize{
  }

  task CustomLifeBar{
    currentLife = GetEnemyLife();
    percentage = currentLife/maxLife;
    lifeBarLeft = ceil(300*percentage);

    //Do stuff with lifeBarLeft which now stores how many pixels your life bar should be.

    yield;
  }
}

What, "enemy_script_main"? No!
Anyways, custom life bar, as in Satori's things at the end?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on October 28, 2009, 06:23:53 PM
Enemy starts with 1000. First iteration does this:

hpp = 1000/1000 = 1
nhp = ceil(300*1) = 300
lifebarSize = 300 - 300 = 0

You also shouldn't need another variable for GetEnemyLife if it does it every frame. If this code works you can break it into separate variables if you want.

Code: [Select]
      if(lifebarReady==1){                   // start animating it
         lifebarSize = 300-ceil((300/maxLife)*GetEnemyLife());
      }

PLEASE WAIT WARMLY AS I ATTEMPT AGAIN ( hits head against the desk a few times )

Edit: the lifebar bar now jumps suddenly to some unknown location lol. Like diagonal. What the hell ?

Edit2: %$#FAFADADASD    ** goes to boot laptop and copy the code over from there **

Edit3:   =D =D =D It works, but Drake. Your code is not 100% correct I seen:

               lifebarSize = 300-ceil((300/maxLife)*GetEnemyLife());  <--- 300 has to go in the beginning
               lifebarSize = ceil((300/maxLife)*GetEnemyLife());  <--- like this.

(http://i38.tinypic.com/ojfnrd.png)

Edit4: Allright, though there seem to be a glitch with this. First of all, the original lifebar is ALWAYS updated before any other task. So sometimes like mm bar is left or when using the 'H' button, a whole chuck stays. See here (http://i36.tinypic.com/nprkw9.png)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on October 28, 2009, 06:35:48 PM
PLEASE WAIT WARMLY AS I ATTEMPT AGAIN ( hits head against the desk a few times )

Edit: the lifebar bar now jumps suddenly to some unknown location lol. Like diagonal. What the hell ?

Edit2: %$#FAFADADASD    ** goes to boot laptop and copy the code over from there **
I tried it too, but the effect obbject doesn't shrink. Am I doing something wrong?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on October 28, 2009, 06:59:56 PM
What, "enemy_script_main"? No!
Anyways, custom life bar, as in Satori's things at the end?

Bah, I always just copy-paste a framework, but I wrote it out straight into the reply thing here this time.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on October 28, 2009, 10:52:03 PM
How does graphic layering work? is there a way to put a graphic over the bullets, boss, and the player?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on October 28, 2009, 10:56:49 PM
Make an effect object, declare it's vertices and such and then ObjEffect_SetLayer(obj, 4); or 5 or something.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on October 28, 2009, 11:37:57 PM
Make an effect object, declare it's vertices and such and then ObjEffect_SetLayer(obj, 4); or 5 or something.

is there a way to put that into a task or something?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: CK Crash on October 28, 2009, 11:50:46 PM
Of course, the same way that you would make an object bullet, but instead of OBJ_SHOT use OBJ_EFFECT. Remove all of the shot-only functions and replace them with the necessary effect-only ones.

Here is an example that I used to make a "stage title":

Code: [Select]
task DrawTitle
{
let obj=Obj_Create(OBJ_EFFECT);
let alpha = 0;
let x = 100;

ObjEffect_SetTexture(obj,Title);
ObjEffect_SetRenderState(obj,ALPHA);
ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLEFAN);
ObjEffect_SetLayer(obj,6);

ObjEffect_CreateVertex(obj,4); //Set the 4 corners of the graphic
ObjEffect_SetVertexUV(obj,0,0,0);
ObjEffect_SetVertexUV(obj,1,320,0);
ObjEffect_SetVertexUV(obj,2,320,240);
ObjEffect_SetVertexUV(obj,3,0,240);

ObjEffect_SetVertexXY(obj,0,-160,-120); //Set where those corners draw relative to the object
ObjEffect_SetVertexXY(obj,1,160,-120);
ObjEffect_SetVertexXY(obj,2,160,120);
ObjEffect_SetVertexXY(obj,3,-160,120);

while(alpha<255) //while still fading in...
{
ascent(vertex in 0..4){ObjEffect_SetVertexColor(obj,vertex,alpha,255,255,255);} //Updates the object alpha
Obj_SetPosition(obj,x,200);
alpha+=3;
x++;
yield;
}
loop(120) //wait a bit...
{
Obj_SetPosition(obj,x,200);
x++;
yield;
}
while(alpha>0) //while fading out...
{
ascent(vertex in 0..4){ObjEffect_SetVertexColor(obj,vertex,alpha,255,255,255);}
Obj_SetPosition(obj,x,200);
alpha-=3;
x++;
yield;
}
Obj_Delete(obj);
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on October 28, 2009, 11:56:28 PM
And here I was going to try and ninja Onthenet with an ObjEffect example like this:

Code: [Select]
task ohjesus{
let l2 = Obj_Create(OBJ_EFFECT); //l2 is the farthest section of the ..., not attached to the ....
ObjEffect_SetTexture(l2, gfs);
ObjEffect_CreateVertex(l2, 4);
ObjEffect_SetRenderState(l2, ALPHA);
ObjEffect_SetPrimitiveType(l2, PRIMITIVE_TRIANGLEFAN);
ObjEffect_SetVertexUV(l2, 0, 79, 12);
ObjEffect_SetVertexUV(l2, 1, 116, 12);
ObjEffect_SetVertexUV(l2, 2, 116, 101);
ObjEffect_SetVertexUV(l2, 3, 76, 101);
let l1 = Obj_Create(OBJ_EFFECT); //l1 is the closest section of the ..., attached to the .... Drawn second so it appears above l2.
ObjEffect_SetTexture(l1, gfs);
ObjEffect_CreateVertex(l1, 4);
ObjEffect_SetRenderState(l1, ALPHA);
ObjEffect_SetPrimitiveType(l1, PRIMITIVE_TRIANGLEFAN);
ObjEffect_SetVertexUV(l1, 0, 11, 12);
ObjEffect_SetVertexUV(l1, 1, 52, 12);
ObjEffect_SetVertexUV(l1, 2, 52, 100);
ObjEffect_SetVertexUV(l1, 3, 11, 100);
let x = 948 - 80; //coordinates of the tip of the ....
let y = 480;
let hy = 100;
let counter = -10;
loop{
counter++;
if(counter>=30 && counter<45){
x-=4;
y-=8;
}
if(counter>=45 && counter<60){
x-=4;
y+=8;
}
if(counter>=90 && counter<105){
x-=4;
y-=8;
}
if(counter>=105 && counter<120){
x-=4;
y+=8;
}
if(counter>=150 && counter<165){
x-=4;
y-=8;
}
if(counter>=165 && counter<180){
x-=4;
y+=8;
}
if(counter>=210 && counter<225){
x-=4;
y-=8;
}
if(counter>=225 && counter<240){
x-=4;
y+=8;
}
if(counter>=270 && counter<285){
x-=4;
y-=8;
}
if(counter>=285 && counter<300){
x-=4;
y+=8;
}
if(counter>=330 && counter<345){
x-=4;
y-=8;
}
if(counter>=345 && counter<360){
x-=4;
y+=8;
}
if(counter>=440 && counter<455){
x-=6;
y-=6;
}
if(counter>=455 && counter<460){
x-=6.5;
y-=2;
}
let ang = atan2(y - kingy, x - kingx); //Angle from the ... to the tip of the ....
let x1 = ((kingx + x)/2) + (((hy^2) - ((kingx + x)/2))^0.5)*cos(ang + 90); //X coordinate of the ....
let y1 = ((kingy + y)/2) + (((hy^2) - ((kingy + y)/2))^0.5)*sin(ang + 90); //Y coordinate of the ....
let ang1 = atan2(y1 - kingy, x1 - kingx); //Angle from the ... to the ....
let ang2 = atan2(y - y1, x - x1); //Angle from the ... to the tip of the ....
ObjEffect_SetVertexXY(l2, 0, x1 + 20*cos(ang1 - 45), y1 + 20*sin(ang1 - 45));
ObjEffect_SetVertexXY(l2, 1, x1 + 20*cos(ang1 + 45), y1 + 20*sin(ang1 + 45));
ObjEffect_SetVertexXY(l2, 2, kingx + 20*cos(ang1 + 135), kingy + 20*sin(ang1 + 135));
ObjEffect_SetVertexXY(l2, 3, kingx + 20*cos(ang1 + 225), kingy + 20*sin(ang1 + 225));
ObjEffect_SetVertexXY(l1, 0, x1 + 20*cos(ang2 - 95), y1 + 20*sin(ang2 - 95));
ObjEffect_SetVertexXY(l1, 1, x1 + 20*cos(ang2 + 95), y1 + 20*sin(ang2 + 95));
ObjEffect_SetVertexXY(l1, 2, x + 20*cos(ang2 + 135), y + 20*sin(ang2 + 135));
ObjEffect_SetVertexXY(l1, 3, x + 20*cos(ang2 + 225), y + 20*sin(ang2 + 225));
if(((x - GetPlayerX)^2 + ((y - 20) - GetPlayerY)^2)^0.5<20 || ((x1 - GetPlayerX)^2 + (y1 - GetPlayerY)^2)^0.5<20 && variable==1){
ShootDownPlayer;
variable=2;
}
yield;
} //end loop
} //end task

I see it was a good thing I didn't.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on October 29, 2009, 01:31:15 AM
is there a way to have a layered image go down the field? like its scrolling down?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on October 29, 2009, 01:39:13 AM
is there a way to have a layered image go down the field? like its scrolling down?
DrawGraphic(<x-co>, yvariable);
...
and somewhere:
yvariable -= <a value> ;
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on October 29, 2009, 01:39:45 AM
Create a variable for it's y coordinates, increase the variable, keep setting the Object's XY vertices at the end of your while loop. Actually, my example does this, though I didn't and still don't expect you to read it :V

Edit: ahhh, ninja'd. Nice job. Even though your response does nothing for Objects, :S
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Henry on October 29, 2009, 01:49:00 AM
Why this segment does not make the enemy move in a curve?

Code: [Select]
SetMovePositionHermite(GetCenterX*2-GetX, GetY, 10, 90, 10, -90, 60);
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Azure Lazuline on October 29, 2009, 05:07:55 AM
Is there any way (or workaround) to add a 3D background to a plural-script that's more than one layer deep? If there's no way to make it 3D, is there any way to get it multi-layered anyway?
If neither are possible, it's not too big of a deal (I'm making a stage anyway), but it would be nice to use the same background when you choose to just practice the boss.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on October 29, 2009, 07:46:27 AM
Is there any way (or workaround) to add a 3D background to a plural-script that's more than one layer deep? If there's no way to make it 3D, is there any way to get it multi-layered anyway?
If neither are possible, it's not too big of a deal (I'm making a stage anyway), but it would be nice to use the same background when you choose to just practice the boss.

You can always use common data to have the scripts communicate with each other. Store all the variables in it and recall them in the next attack so that there's no jump in the background? Might be kinda weird when it actually becomes a stage though.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on October 29, 2009, 02:27:46 PM
Sorry for the double post.

I'm trying to narrow down a problem and it'd be a great help if someone could tell me if there was anything wrong with this effect object code since I'm new to effects.. No error occurs when making the effect object, but nothing is being drawn. If I run it with the debug window open, the log tab outputs something about the path of the two PNG files that I have, but I double-checked the path and they are named correctly and in the correct folder.

Code: [Select]
let RED_GRAPHIC = "lib\Ikareimu\img\RedShield.png";
let BLUE_GRAPHIC = "lib\Ikareimu\img\BlueShield.png";
let ShieldObj;

task CreateShield(
  yield;
  ShieldObj = Obj_Create(OBJ_EFFECT);
  Obj_SetAlpha(ShieldObj, 255);

  // GetCurrentColor is a function that gets common data.
  // RED and BLUE are variables.
  // These are defined in an #include_function so don't worry about them.
  if(GetCurrentColor == RED){
    ObjEffect_SetTexture(ShieldObj, RED_GRAPHIC);
  }
  if(GetCurrentColor == BLUE){
    ObjEffect_SetTexture(ShieldObj, BLUE_GRAPHIC);
  }

  Obj_SetCollisionToObject(ShieldObj, true);
  ObjEffect_SetRenderState(ShieldObj, ADD);
  ObjEffect_CreateVertex(ShieldObj, 4);
  ObjEffect_SetPrimitiveType(ShieldObj, PRIMITIVE_TRIANGLEFAN);
  ObjEffect_SetVertexUV(ShieldObj, 0, 1, 1);
  ObjEffect_SetVertexUV(ShieldObj, 1, 64, 1);
  ObjEffect_SetVertexUV(ShieldObj, 2, 64, 64);
  ObjEffect_SetVertexUV(ShieldObj, 3, 1, 64);
  while(!Obj_BeDeleted(ShieldObj)){
    Shield_update;
    Obj_SetPosition(ShieldObj, GetPlayerX, GetPlayerY);
    if(GetCurrentColor == RED){
      ObjEffect_SetTexture(ShieldObj, RED_GRAPHIC);
    }
    if(GetCurrentColor == BLUE){
      ObjEffect_SetTexture(ShieldObj, BLUE_GRAPHIC);
    }
    yield;
  }
}
@Initialize{
  LoadGraphic(RED_GRAPHIC);
  LoadGraphic(BLUE_GRAPHIC);
  CreateShield;
}

@MainLoop{
  yield;
}

EDIT: Nevermind, I just realized this is a terrible way to do what I wanted to do.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on October 29, 2009, 06:43:25 PM
Despite your edit, I'll answer your question anyways. ObjEffect_SetVertexUV declares the vertices on your image, ObjEffect_SetVertexXY plots the corresponding vertices on to the Danmakufu field. You're missing the XY portion of an ObjEffect (you're not telling Danmakufu where to draw the image), so nothing is drawn.

Before you say "yes I am", Obj_SetPosition does not work with ObjEffects, nor does Obj_SetAlpha for that matter (to set the alpha value of an ObjEffect, you need to use ObjEffect_SetVertexColor(id, vertex, alpha, red, green, blue); ). A pain in the ass, but setting each vertex also allows you to bend and distort the image however you please. Useful when you get used to it.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on October 29, 2009, 11:09:18 PM
Despite your edit, I'll answer your question anyways. ObjEffect_SetVertexUV declares the vertices on your image, ObjEffect_SetVertexXY plots the corresponding vertices on to the Danmakufu field. You're missing the XY portion of an ObjEffect (you're not telling Danmakufu where to draw the image), so nothing is drawn.

Before you say "yes I am", Obj_SetPosition does not work with ObjEffects, nor does Obj_SetAlpha for that matter (to set the alpha value of an ObjEffect, you need to use ObjEffect_SetVertexColor(id, vertex, alpha, red, green, blue); ). A pain in the ass, but setting each vertex also allows you to bend and distort the image however you please. Useful when you get used to it.

Ah, I see. Well, hopefully I'll get it right the second time when I really need to use an effect object for something. Thanks!
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: canobiecrazy on October 30, 2009, 01:50:30 AM
Im such a noob....

Please help with this one. I keep getting "Bad Allocation".

Code: [Select]
#TouhouDanmakufu
#Title[Fantasy Seal Lol not]
#Text[blahblah]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{
#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
let CSD = GetCurrentScriptDirectory;

let imgBoss = CSD ~ "system\cirno.png";
let cut = CSD ~ "system\cirnocut.png";
let bg = CSD ~ "system\lake.png";

@Initialize{
SetLife(1000);
SetTimer(60);
SetScore(100000);
SetMovePosition01(GetCenterX,GetCenterY,5);
LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);
shotinit;

CutIn(YOUMU,"Holy Amulet -Spread-",cut,0,0,300,384);

mainTask;
}

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

@DrawLoop{

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

}

@BackGround{

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

}

@Finalize{
DeleteGraphic(imgBoss);
DeleteGraphic(cut);
DeleteGraphic(bg);
}


task mainTask{
wait(120);
yield;
fire;
movement;
}

task movement{
loop{
SetMovePosition01(GetCenterX-100,120,5);
wait(120);
SetMovePosition01(GetCenterX+100,120,5);
wait(120);
yield;
}

}

task fire{
let x = 0;
let dir = 0;
let dira = 0;

loop{

while(x<36){
CreateShotA(1,GetEnemyX+75*cos(dir),GetEnemyY+75*sin(dir),30);
SetShotDataA(1,0,0,dir,0,0,0,RED01);
SetShotDataA(1,60,2,dir,0.5,0,2,YELLOW01);
FireShot(1);
CreateShotA(2,GetEnemyX+75*sin(dir),GetEnemyY+75*cos(dir),30);
SetShotDataA(2,0,0,dira,0,0,0,YELLOW01);
SetShotDataA(2,60,2,dira,-0.5,0,2,RED01);
FireShot(2);

}
dir+=360/36;
dira-=360/36;
x++;

x = 0;
dir = 0;
dira = 0;
wait(60);

yield;
}
}


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

}

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on October 30, 2009, 02:41:01 AM
Im such a noob....

Please help with this one. I keep getting "Bad Allocation".

Your "fire" task's while loop is not exiting and became an infinite. Here's a revised version of what I believe you were trying to do.

Code: [Select]
task fire{
let x = 0;
let dir = 0;
let dira = 0;
loop{
while(x<36){
CreateShotA(1,GetEnemyX+75*cos(dir),GetEnemyY+75*sin(dir),30);
SetShotDataA(1,0,0,dir,0,0,0,RED01);
SetShotDataA(1,60,2,dir,0.5,0,2,YELLOW01);
FireShot(1);
CreateShotA(2,GetEnemyX+75*sin(dir),GetEnemyY+75*cos(dir),30);
SetShotDataA(2,0,0,dira,0,0,0,YELLOW01);
SetShotDataA(2,60,2,dira,-0.5,0,2,RED01);
FireShot(2);
dir+=360/36;
dira-=360/36;
x++;
}

x = 0;
dir = 0;
dira = 0;
wait(60);
yield;
}
}

By the way, that "bad allocation" message is bizarre. If my fix works, then I don't understand what causes it. The last time I got that message, it was because of a stupid mistake where I mixed up a function with a variable and tried to do "function = 1;"
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on October 30, 2009, 05:00:54 AM
I'm not sure which fourm to post this on but since its a question, ill post it here...

how would you change a sprite when its moving left or right? and how about when its getting ready to attack?

Credit goes to Alwaysthe(9) for the sprite sheet:(http://i600.photobucket.com/albums/tt84/Happyhobo810/normalguykokomustil.png)

i tried using the snippet for the Satori boss Onthenet helped me wiht but i can not get it right >_<, and thanks in advance!!
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on October 30, 2009, 05:57:30 AM
Boy, I need to actually work at work instead of check the Danmakufu forum every hour. >.>

What I usually do is put a variable that stores a string (a number works too if you wanna remember which number belongs to which animation). In the case you have, I'd put something like "normal" for the left/right/normal poses, "charge" for the charging animation, and "attack" for the attack animation. Then you just set the variable as one of those three for when you want to change them.

In the draw loop, you set which part of the sprite sheet to draw based off of the variable. As for detecting left/right movement, you can call GetSpeed to get the enemy's speed. If it's positive, the boss is going right. If it's negative, the boss is going left. And if it's 0 (I actually suggest detecting less than 0.1 or something like that), the boss is not moving or only doing vertical movement. Just set the correct section of the sprite sheet according to the value returned by GetSpeed.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Henry on October 30, 2009, 07:53:35 AM
Only sprites for turning left (or right) of a boss (or an enemy) are required because we can reflect the image, is that true?

(If I would like to reflect horizontally (left to right and vice versa), I should use
Code: [Select]
SetGraphicAngle(0, 180, 0);, right?)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on October 30, 2009, 08:28:39 AM
You certainly can reflect a sprite like that, but keep in mind that some characters aren't symmetrical. For example, if you were to flip Marisa, she has a single braid and a ribbon on her hat that would be on the wrong side for one of the directions. Of course, not many people are going to actually notice minor details like that so it's up to you whether you do that or not.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on October 30, 2009, 03:07:19 PM
I'm not sure which fourm to post this on but since its a question, ill post it here...

how would you change a sprite when its moving left or right? and how about when its getting ready to attack?

Credit goes to Alwaysthe(9) for the sprite sheet:(http://i600.photobucket.com/albums/tt84/Happyhobo810/normalguykokomustil.png)

i tried using the snippet for the Satori boss Onthenet helped me wiht but i can not get it right >_<, and thanks in advance!!

I'll be making left-right moving sprites this afternoon, and finishing touches tomorrow, k? (And if they're easy enough, they'll be done today! Haha.)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on October 30, 2009, 03:08:00 PM
You certainly can reflect a sprite like that, but keep in mind that some characters aren't symmetrical. For example, if you were to flip Marisa, she has a single braid and a ribbon on her hat that would be on the wrong side for one of the directions. Of course, not many people are going to actually notice minor details like that so it's up to you whether you do that or not.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Henry on October 30, 2009, 03:29:30 PM
You certainly can reflect a sprite like that, but keep in mind that some characters aren't symmetrical. For example, if you were to flip Marisa, she has a single braid and a ribbon on her hat that would be on the wrong side for one of the directions. Of course, not many people are going to actually notice minor details like that so it's up to you whether you do that or not.

Most enemies does not have much details and:
aren't they covered by danmaku?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: DgBarca on October 30, 2009, 07:39:12 PM
I have a player script(ReimuA) (based on Naut SanaeB) that have for basic shots :
Code: [Select]
task amulet(x, y, ang, v, d){
let obj = Obj_Create(OBJ_SHOT);
let angleBOOM = ang;
Obj_SetPosition(obj, x, y);
Obj_SetAngle(obj, ang);
Obj_SetSpeed(obj, v);
let xx = x;
let yy = y;
let xc = xx;
let yc = yy;
ObjShot_SetGraphic(obj, 7);
ObjShot_SetDamage(obj, d);
ObjShot_SetBombResist(obj, true);
ObjShot_SetPenetration(obj, 2);

while(! Obj_BeDeleted(obj)){
xc = Obj_GetX(obj);
yc = Obj_GetY(obj);
}

let amul=Obj_Create(OBJ_EFFECT);
  let Yvar = 8;
  ObjEffect_SetTexture(amul,GetCurrentScriptDirectory~"reimu.png");
  ObjEffect_SetRenderState(amul,ALPHA);
  ObjEffect_SetPrimitiveType(amul,PRIMITIVE_TRIANGLEFAN);
  ObjEffect_CreateVertex(amul,4);
  ObjEffect_SetVertexColor(amul, 0, 205, 200, 255, 255);
  ObjEffect_SetVertexColor(amul, 1, 205, 200, 255, 255);
  ObjEffect_SetVertexColor(amul, 2, 205, 200, 255, 255);
  ObjEffect_SetVertexColor(amul, 3, 205, 200, 255, 255);
  loop(2){
  ObjEffect_SetVertexUV(amul,0,49,143);
  ObjEffect_SetVertexUV(amul,1,61,143);
  ObjEffect_SetVertexUV(amul,2,61,161);
  ObjEffect_SetVertexUV(amul,3,49,161);
  ObjEffect_SetVertexXY(amul,0,xc,yc - Yvar);
  ObjEffect_SetVertexXY(amul,1,xc,yc - Yvar);
  ObjEffect_SetVertexXY(amul,2,xc,yc + Yvar);
  ObjEffect_SetVertexXY(amul,3,xc,yc + Yvar);
  Yvar+=8;
  yield;}
  loop(2){
  ObjEffect_SetVertexUV(amul,0,49,161);
  ObjEffect_SetVertexUV(amul,1,61,161);
  ObjEffect_SetVertexUV(amul,2,61,179);
  ObjEffect_SetVertexUV(amul,3,49,179);
  ObjEffect_SetVertexXY(amul,0,xc,yc - Yvar);
  ObjEffect_SetVertexXY(amul,1,xc,yc - Yvar);
  ObjEffect_SetVertexXY(amul,2,xc,yc + Yvar);
  ObjEffect_SetVertexXY(amul,3,xc,yc + Yvar);
  Yvar+=8;
  yield;}
  loop(2){
  ObjEffect_SetVertexUV(amul,0,49,179);
  ObjEffect_SetVertexUV(amul,1,61,179);
  ObjEffect_SetVertexUV(amul,2,61,197);
  ObjEffect_SetVertexUV(amul,3,49,197);
  ObjEffect_SetVertexXY(amul,0,xc,yc - Yvar);
  ObjEffect_SetVertexXY(amul,1,xc,yc - Yvar);
  ObjEffect_SetVertexXY(amul,2,xc,yc + Yvar);
  ObjEffect_SetVertexXY(amul,3,xc,yc + Yvar);
  Yvar+=8;
  yield;}
loop(2){
  ObjEffect_SetVertexUV(amul,0,36,143);
  ObjEffect_SetVertexUV(amul,1,48,143);
  ObjEffect_SetVertexUV(amul,2,48,161);
  ObjEffect_SetVertexUV(amul,3,36,161);
  ObjEffect_SetVertexXY(amul,0,xc,yc - Yvar);
  ObjEffect_SetVertexXY(amul,1,xc,yc - Yvar);
  ObjEffect_SetVertexXY(amul,2,xc,yc + Yvar);
  ObjEffect_SetVertexXY(amul,3,xc,yc + Yvar);
  Yvar+=8;
  yield;}
 
  Obj_Delete(amul);
 
}

task amuletbreak(xc,yc) {
  let amul=Obj_Create(OBJ_EFFECT);
  let Yvar = 8;
  ObjEffect_SetTexture(amul,GetCurrentScriptDirectory~"sanae.png");
  ObjEffect_SetRenderState(amul,ADD);
  ObjEffect_SetLayer(amul, 8);
  ObjEffect_SetPrimitiveType(amul,PRIMITIVE_TRIANGLEFAN);
  ObjEffect_CreateVertex(amul,4);
  ObjEffect_SetVertexColor(amul, 0, 255, 200, 255, 255);
  ObjEffect_SetVertexColor(amul, 1, 255, 200, 255, 255);
  ObjEffect_SetVertexColor(amul, 2, 255, 200, 255, 255);
  ObjEffect_SetVertexColor(amul, 3, 255, 200, 255, 255);
  loop(2){
  ObjEffect_SetVertexUV(amul,0,49,143);
  ObjEffect_SetVertexUV(amul,1,61,143);
  ObjEffect_SetVertexUV(amul,2,61,161);
  ObjEffect_SetVertexUV(amul,3,49,161);
  ObjEffect_SetVertexXY(amul,0,xc,yc - 17);
  ObjEffect_SetVertexXY(amul,1,xc,yc - 17);
  ObjEffect_SetVertexXY(amul,2,xc,yc + 16);
  ObjEffect_SetVertexXY(amul,3,xc,yc + 16);
  Yvar+=8;
  yield;}
  loop(2){
  ObjEffect_SetVertexUV(amul,0,49,161);
  ObjEffect_SetVertexUV(amul,1,61,161);
  ObjEffect_SetVertexUV(amul,2,61,179);
  ObjEffect_SetVertexUV(amul,3,49,179);
  ObjEffect_SetVertexXY(amul,0,xc,yc - Yvar);
  ObjEffect_SetVertexXY(amul,1,xc,yc - Yvar);
  ObjEffect_SetVertexXY(amul,2,xc,yc + Yvar);
  ObjEffect_SetVertexXY(amul,3,xc,yc + Yvar);
  Yvar+=8;
  yield;}
  loop(2){
  ObjEffect_SetVertexUV(amul,0,49,179);
  ObjEffect_SetVertexUV(amul,1,61,179);
  ObjEffect_SetVertexUV(amul,2,61,197);
  ObjEffect_SetVertexUV(amul,3,49,197);
  ObjEffect_SetVertexXY(amul,0,xc,yc - Yvar);
  ObjEffect_SetVertexXY(amul,1,xc,yc - Yvar);
  ObjEffect_SetVertexXY(amul,2,xc,yc + Yvar);
  ObjEffect_SetVertexXY(amul,3,xc,yc + Yvar);
  Yvar+=8;
  yield;}
loop(2){
  ObjEffect_SetVertexUV(amul,0,36,143);
  ObjEffect_SetVertexUV(amul,1,48,143);
  ObjEffect_SetVertexUV(amul,2,48,161);
  ObjEffect_SetVertexUV(amul,3,36,161);
  ObjEffect_SetVertexXY(amul,0,xc,yc - Yvar);
  ObjEffect_SetVertexXY(amul,1,xc,yc - Yvar);
  ObjEffect_SetVertexXY(amul,2,xc,yc + Yvar);
  ObjEffect_SetVertexXY(amul,3,xc,yc + Yvar);
  Yvar+=8;
  yield;}
 
  Obj_Delete(amul);
 
}


But amulet break does not work...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on October 30, 2009, 07:42:39 PM
I'm not sure which fourm to post this on but since its a question, ill post it here...

how would you change a sprite when its moving left or right? and how about when its getting ready to attack?

Credit goes to Alwaysthe(9) for the sprite sheet: (pixely image)

i tried using the snippet for the Satori boss Onthenet helped me wiht but i can not get it right >_<, and thanks in advance!!

You... can use the stuff in the ExRumia scripts as an example...
Code: [Select]
SetRenderState(ALPHA);
SetAlpha(255);
SetTexture(imgExRumia);
if(int(GetSpeedX())==0){SetGraphicRect(64,1,127,64);}
else if(GetSpeedX()>0){SetGraphicRect(192,1,255,64);}
else if(GetSpeedX()<0){SetGraphicRect(128,1,191,64);}
DrawGraphic(GetX(),GetY());
You can also use a variable like "animation" and increment it every frame. Then you can use in @DrawLoop:
Code: [Select]
if(int(GetSpeedX) == 0) { if(animation == <value>) { SetGraphicRect(left, top, right, bottom); } repeat_setting_graphic_coordinates; }
and all that.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on October 31, 2009, 02:18:28 AM
Help!


I got my magic circle to finally work.  It's the proper kind, ZUN style.  Problem is even though I can make it spin, I can't make it shrink.  It's pretty simple, all I gotta do is shrink the radius.  Problem is, it's not that simple
at least not for me, anyway.

Here's the two stuff needed.

Code: [Select]
#TouhouDanmakufu
 #Title[magic circle]
 #Text[]
 #Player[FREE]
 #ScriptVersion[2]
 
 script_enemy_main{
      let imagefile = GetCurrentScriptDirectory ~ "etama3.png";
      let objid;




    @Initialize{
      SetMovePosition02(GetCenterX,GetCenterY-100,0);
      SetLife(1);
      LoadGraphic(imagefile);
     
      object;
      }
 
    @MainLoop{

     yield;
    }
 
    @DrawLoop{
    }
 
    @BackGround{
    }
 
    @Finalize{
    }





   task object{ yield; yield;



          objid = Obj_Create(OBJ_EFFECT);
          Obj_SetX(objid, GetX);
          Obj_SetY(objid, GetY);


          ObjEffect_SetScale(objid,1,1);
       

          ObjEffect_SetRenderState(objid,ADD);
 

          ObjEffect_SetTexture(objid, imagefile);

          ObjEffect_SetPrimitiveType(objid, PRIMITIVE_TRIANGLESTRIP);

           let totalradius=250;
                 let angle=0;       let repeat=8;   ////how many times the image is repeated
         let sides=100;  let i=0;    let d=0;     let Z=0;  let RotateSpeed=0.5;
         

       
         
          ObjEffect_CreateVertex(objid, sides*2+2);      /// vertices
         

          loop(sides+1){       ///the sides are done in pairs, the added loop is to finish the circle

ObjEffect_SetVertexUV(objid,i*2,16,d*repeat/sides);
              ObjEffect_SetVertexUV(objid,i*2+1,0,d*repeat/sides);
             

          ObjEffect_SetVertexXY(objid, i*2, totalradius*cos(angle), totalradius*sin(angle));
          ObjEffect_SetVertexXY(objid, i*2+1, (totalradius+22)*cos(angle), (totalradius+22)*sin(angle));
             
angle+=360/sides;        //// number of sides
i++;        //// the id # increases by 1 every loop
d+=-128;  /// the vertical size of the spellcard shown

                   }   




             while(Obj_BeDeleted(objid)==!true){ ObjEffect_SetAngle(objid,0,0,Z);  Z+=RotateSpeed; yield;}
                   
     }

     






}
and yes, I seriously created 202 vertices to make this circle.  It's proper
(http://img202.imageshack.us/img202/9937/etama3.png)



If I can get this part down, I'll easily be able to manipulate the inside and outside vertices too, to make the circle expand widely ZUN style, so it shapes a circle on the outside but a star on the inside of the circle when the spellcard starts.  Pretty cool, huh.


Anyway, what can I do to get the value of "totalradius" to shrink about 0.01 pixels per frame?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on October 31, 2009, 07:10:50 AM
Dear lord Mokou, you need to organize your code's spacing better. Use tabs OR spaces. Don't use both or it goes screwy. It might line up in one editor, but it won't line up in others.

Anyway, to answer your question take a look at the following code which is a copy of your while loop at the end of your task, edited to be slightly easier to read and with some an extra thing added in:
Code: [Select]
   
while(Obj_BeDeleted(objid)==!true){
    ObjEffect_SetAngle(objid,0,0,Z);
    Z+=RotateSpeed;

    if( conditions for making the circle shrink == true ){
        totalradius -= 0.01;
        ascent(i in 0..202){   //where 202 is the number of vertices
          ObjEffect_SetVertexXY(objid, i, totalradius*cos(angle), totalradius*sin(angle));
        }
    }

    yield;
}

Now, since I utterly fail with object effects, I have no idea if the above code actually works, but you should get the idea of what I was trying to accomplish.

Oh and lastly, instead of writing Obj_BeDeleted(objid)==!true, you can just write !Obj_BeDeleted(obj). It'll mean the same thing and it's a bit shorter and easier to understand ('cause in plain English, yours is saying "Object is deleted is equal to not true" while this one says "Object is not deleted".
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: PT8Sceptile on October 31, 2009, 08:07:30 AM
For Fujiwara no Mokou:

Code: [Select]
#TouhouDanmakufu
#Title[magic circle]
#Text[]
#Player[FREE]
#ScriptVersion[2]
 
script_enemy_main{
    let imagefile = GetCurrentScriptDirectory ~ "etama3.png";
    let objid;




    @Initialize{
SetMovePosition02(GetCenterX,GetCenterY-100,0);
SetLife(1);
LoadGraphic(imagefile);
SetTimer(30);
object;
    }
 
    @MainLoop{
yield;
    }
 
    @DrawLoop{
    }
 
    @BackGround{
    }
 
    @Finalize{
    }

task object{
objid = Obj_Create(OBJ_EFFECT);
Obj_SetX(objid, GetX);
Obj_SetY(objid, GetY);
ObjEffect_SetScale(objid,1,1);
ObjEffect_SetPrimitiveType(objid, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_SetRenderState(objid,ADD);
ObjEffect_SetTexture(objid, imagefile);
let totalradius=0;     
let repeat=8;   ////how many times the image is repeated
let sides=100;     
let d=0;     
let Z=0; 
let RotateSpeed=0.5;

let ctime = GetTimer*60;
let itime = ctime;
         
ObjEffect_CreateVertex(objid, sides*2+2);      /// vertices
ascent(i in 0..(sides+1)){       ///the sides are done in pairs, the added loop is to finish the circle
ObjEffect_SetVertexUV(objid,i*2,16,d*repeat/sides);
ObjEffect_SetVertexUV(objid,i*2+1,0,d*repeat/sides);
d+=-128;  /// the vertical size of the spellcard shown
}   
while(!Obj_BeDeleted(objid)){
ascent(i in 0..sides+1) {
ObjEffect_SetVertexXY(objid, i*2, totalradius*ctime/itime*cos(i*360/sides + Z), totalradius*ctime/itime*sin(i*360/sides + Z));
ObjEffect_SetVertexXY(objid, i*2+1, (totalradius*ctime/itime+22)*cos(i*360/sides + Z), (totalradius*ctime/itime+22)*sin(i*360/sides + Z));
}
Z+=RotateSpeed;
if (totalradius < 250) {
totalradius+= 3; //The bigger this number is, the quicker the circle will expand.
}
ctime--;
yield;
}
                   
}

}

Now it should expand quickly and then shrink in accordance with the time remaining. Blargel had the right idea, but he forgot to set the coordinates of the outer layer vertices in his example. I also formatted it so it wouldn't be that confusing.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on October 31, 2009, 01:17:15 PM
Thanks a lot.  But gah! I hate ascents, I'd so much rather use loop instead, ascent just doesn't work well for me.  I'll have to re-arrange that.

lord Mokou

Haha wow.  What a title!
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on October 31, 2009, 02:20:59 PM
Haha wow.  What a title!

:x

Dear lord, comma, Mokou. With "dear lord" being an expression similar to "holy crap".
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on October 31, 2009, 07:18:00 PM
(http://img687.imageshack.us/img687/6781/file0022.png)(http://img682.imageshack.us/img682/6546/file34.png)(http://img202.imageshack.us/img202/7400/file0024.png)


Why can't I get this part right darnit?


Code: [Select]
#TouhouDanmakufu
#Title[magic circle 3]
#Text[]
#Player[FREE]
#ScriptVersion[2]
 
script_enemy_main{
    let imagefile = GetCurrentScriptDirectory ~ "etama3.png";
    let objid;




    @Initialize{
      SetMovePosition02(GetCenterX,GetCenterY-100,0);
      SetLife(1);
      LoadGraphic(imagefile);
      SetTimer(60);
      object;
    }
 
    @MainLoop{
      yield;
    }
 
    @DrawLoop{
    }
 
    @BackGround{
    }
 
    @Finalize{
    }

   task object{   yield; yield;


      objid = Obj_Create(OBJ_EFFECT);
      Obj_SetX(objid, GetX);
      Obj_SetY(objid, GetY);
      ObjEffect_SetScale(objid,1,1);
      ObjEffect_SetPrimitiveType(objid, PRIMITIVE_TRIANGLESTRIP);
      ObjEffect_SetRenderState(objid,ADD);
      ObjEffect_SetTexture(objid, imagefile);

      let totalradius=250;
      let repeat=8;
      let sides=80;     
      let d=0;     
      let rotate=0;
      let RotateSpeed=0;
      let IN=0;
      let OUT=30;
      let timer=50*60;
      let timer2=timer;
      let accelerate=-20;

         
      ObjEffect_CreateVertex(objid, sides*2+2);   



                     ascent(i in 0..sides+1){

                         ObjEffect_SetVertexUV(objid,i*2,16,d*repeat/sides);
                         ObjEffect_SetVertexUV(objid,i*2+1,0,d*repeat/sides);
                         d+=-128;
                            }


      while(!Obj_BeDeleted(objid)){



                     ascent(i in 0..sides+1){         ///inside

                     let radiusINX=(totalradius*timer/timer2 +IN)*cos(i*360/sides +rotate);
                     let radiusINY=(totalradius*timer/timer2 +IN)*sin(i*360/sides +rotate);

                     let radiusOUTX=(totalradius*timer/timer2 +OUT)*cos(i*360/sides +rotate);
                     let radiusOUTY=(totalradius*timer/timer2 +OUT)*sin(i*360/sides +rotate);

                         ObjEffect_SetVertexXY(objid, i*2, radiusINX, radiusINY);
                         ObjEffect_SetVertexXY(objid, i*2+1, radiusOUTX, radiusOUTY);


                           }

               rotate+=RotateSpeed;
               timer+=accelerate;
               accelerate+=-2;
               yield;
               if(timer/timer2<-0.06){Obj_Delete(objid);}
               }


                   
   }
 


 

}



I thought this part would be easy.  But I just don't know how to attack it properly.  From what I see, if you just take one part, it starts of as a perfect circle and caves into itself as it goes.
But there's an order... it makes a pentagon.  There are three parts; the corners of the pentagon cave in at one accelerating speed, and the sides directly between each corner caves in about twice as fast.

But the part that will make it really hard for me to replicate is that the 'corners' of the pentagon bend in gradually.  They're wavy, not pointy and triangle-like.  It makes me wonder if sine or cosine is somehow involved.

(http://img682.imageshack.us/img682/9140/th004.png)
This will also be useful again when capturing spellcards without death, where the circle going around the boss will move to the player and cave into them.  Very similar to Mokou's resurrection style, except it caves in at a much faster rate, and holds then spins around the player for a bit.


So much work for such little effects!

It's the small stuff that makes the game great.  Can anyone help me with this?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on October 31, 2009, 07:32:48 PM
I don't need help for this, but everyone comes to this thread so I'll post it here too.

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

I finished the maple explosion and maple charge functions. Next up is item spawning, probably.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: NOVA on November 01, 2009, 06:48:43 PM
This probably a really common problem that newfags ask for help with all the time. :|

uh can you tell me whats wrong here
(http://www.iaza.com/work/091102C/what50666.png)
im trying to make a long laser that sticks around for a while because of its length.
but after a while, the SPRITE the laser moves on an axis, but the hitbox stays where the laser was originally shot.

im basically using

Code: [Select]
{
            if (frame == 200)

    {
        CreateLaser01(+rand(0, 900), +rand(0, 200), 50, GetAngleToPlayer, 9000000, 30, YELLOW05, 60);
frame=0;

        CreateLaser01(+rand(0, 900), +rand(0, 200), 50, +rand(0, 180), 9000000, 30, GREEN05, 60);
frame=0;

    }
            frame++;
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on November 01, 2009, 07:01:39 PM
This probably a really common problem that newfags ask for help with all the time. :|

uh can you tell me whats wrong here
<image>
im trying to make a long laser that sticks around for a while because of its length.
but after a while, the SPRITE the laser moves on an axis, but the hitbox stays where the laser was originally shot.

im basically using

Code: [Select]
{
            if (frame == 200)

    {
        CreateLaser01(+rand(0, 900), +rand(0, 200), 50, GetAngleToPlayer, 9000000, 30, YELLOW05, 60);
frame=0;

        CreateLaser01(+rand(0, 900), +rand(0, 200), 50, +rand(0, 180), 9000000, 30, GREEN05, 60);
frame=0;

    }
            frame++;
}

I would use a CreateLaserB for that.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 01, 2009, 07:06:23 PM
wtf i don't even know what you're trying to do there

Context please?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Stuffman on November 01, 2009, 07:06:35 PM
I see two issues with your lasers:
- First, one of your lasers is using GetAngleToPlayer, but that won't work because it calculates the angle based on the enemy to the player, not the shot to the player. Unless you're doing it that way intentionally.
- Your hitbox issues are coming from the fact that your laser is moving incredibly fast and is unbelievably huge. Lasers don't really do hit detection correctly at that size, mainly because the graphic is stretched so much it doesn't correctly map to the hitbox. As bman said, I think the function you want to look into for a stationary laser is CreateLaserA.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: NOVA on November 01, 2009, 09:51:59 PM
I was using a massive laser to give the effect of a stationary laser. So you're saying CreateLaserA would work then? alright i'll give that a try.

and yea i wasnt really concerned about my angle at that point.

thanks.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Hello Purvis on November 02, 2009, 12:51:09 AM
So I got a problem that stumped Helepolis, so I'll toss it out there for the lot of ye to deal with.

Whenever I finish playing a script, be it through winning it or electing not to continue after dying, Danmakufu crashes. I've tried this with Helepolis' Perfect Imperishable Bucket and four incarnations of Ravenlocke's Seven Force script, and it happens every time.

For reference, I am running it on XP via AppLocale.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 02, 2009, 01:14:13 AM
I can't even come close to the effect I wanted to do.  It seems impossible.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lux on November 02, 2009, 07:21:35 AM
I can't even get the file to extract... I got it from the link on both wikis, and when I try to extract it, it gives me this...

!   C:\Documents and Settings\Owner\Local Settings\Temp\th_dnh.zip: The archive is either in unknown format or damaged


I'm sure this should be asked somewhere else, but seeming that this is a problem with Danmakufu and all...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 02, 2009, 08:24:09 AM
Where did you download it from? From the link inside the FAQ I hope? Because that one is working fine. I just redownloaded it yesterday.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lux on November 02, 2009, 08:54:15 AM
Yep. I just tried to re-download it though, and it worked... Now I have to figure out how to install the East Asian Language pack without the CD DX

Thanks for the help, you'll probably be seeing me here again soon.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Snaka on November 02, 2009, 11:50:32 AM
Hey, just wondering if it was possible to make dialogue in danmakufu? And if so, how?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 02, 2009, 11:55:17 AM
Hey, just wondering if it was possible to make dialogue in danmakufu? And if so, how?

Yup, and they're called events.
Sounds like someone needs to write an event tutorial for Danmakufu (not me, I dunno how to do them so well either).
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Snaka on November 02, 2009, 12:05:12 PM
Thanks, I'll have to look that up sometime...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 02, 2009, 12:31:14 PM
Thanks, I'll have to look that up sometime...

Have you checked the intermediate tutorial (http://www.shrinemaiden.org/forum/index.php?topic=865.msg31787#msg31787) inside the stickies? They explain how to do it.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Snaka on November 02, 2009, 12:44:17 PM
Ok, I will check the INTERMEDIATE TUTORIAL :D
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 02, 2009, 12:46:32 PM
^.^  good. Then you will be atleast "one of the few" who reads the stickies.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 02, 2009, 05:03:26 PM
Yeah seriously guys, read the freakin' stickies before you ask questions. Mainly the FAQ and TUTORIALS. They might have information in them, but hey, what do I know.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blaman on November 02, 2009, 05:31:40 PM
My apologies if this is one of those things that've already been asked, but I was wodering how to get an event script to stop everything else from continuing. What I mean is when I have an event script start right before the boss, the boss will still come in and start their first attack while the conversation is still going on. I'd appreciate it if someone could let me know. :)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on November 02, 2009, 05:53:08 PM
My apologies if this is one of those things that've already been asked, but I was wodering how to get an event script to stop everything else from continuing. What I mean is when I have an event script start right before the boss, the boss will still come in and start their first attack while the conversation is still going on. I'd appreciate it if someone could let me know. :)
in the first boss attack script:
Code: [Select]
if(!OnEvent) {
functions; //including like, incr.ing counting variables... and stuff.
}
From my memory, so I can't be 100% sure if this is how you do it.
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 02, 2009, 06:44:13 PM
What AlwaysThe⑨ posted is incorrect, if(!OnEvent){} means "if not currently playing an event". If you're using the way I taught in the intermediate tutorial (tasks), simply put:

Code: [Select]
CreateEventFromScript("talk");
while(OnEvent==true){
    yield;
}
CreateEnemyBossFromFile(...);

The while code get if an event is currently running, and suspends the task until it finishes. Thus, when your event script ends, the boss script starts.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blaman on November 02, 2009, 06:59:38 PM
Yeah, I read through the intermediate course you posted. Thank you very much for the help. :D
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on November 02, 2009, 08:46:38 PM
What AlwaysThe⑨ posted is incorrect, if(!OnEvent){} means "if not currently playing an event". If you're using the way I taught in the intermediate tutorial (tasks), simply put:

Code: [Select]
CreateEventFromScript("talk");
while(OnEvent==true){
    yield;
}
CreateEnemyBossFromFile(...);

The while code get if an event is currently running, and suspends the task until it finishes. Thus, when your event script ends, the boss script starts.

Ah, crap. I should be dooing this stuff more often. Either that or post a link to the tutorials.
Edit: Lemme try out that code you posted...
Edit: I'll just make an enemy just for an event, then wait until it dies (finishes the event), then continue the stage or something. it works better (for me, personally). \(^o^)/
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: NOVA on November 02, 2009, 10:42:51 PM
Uh, I can't seem to get CreateLaserA to work.
i just start the script and no green laser ever appears, and i tried different X Y starting points that getx and gety but i still don't know how to make the laser happen. (this was based on an issue i had on the last page)
using:
Code: [Select]
{
            if (frame == 200)

    {
        CreateLaserA(1, GetX, GetY, 300, 20, GREEN01,0);
SetLaserDataA(1, 90, 0, 0, 0, 0, 180);

frame=0;

        CreateLaser01(230,200, 50, GetAngleToPlayer, 9000000, 30, YELLOW05, 10);
frame=0;

CreateLaser01(+rand(37, 230),+rand(0, 200), 50, +rand(0, 90), 9000000, 30, RED05, 60);
frame=0;


    }
            frame++;
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on November 02, 2009, 10:53:21 PM
Uh, I can't seem to get CreateLaserA to work.
i just start the script and no green laser ever appears, and i tried different X Y starting points that getx and gety but i still don't know how to make the laser happen. (this was based on an issue i had on the last page)
using:
Code: [Select]
{
            if (frame == 200)

    {
        CreateLaserA(1, GetX, GetY, 300, 20, GREEN01,0);
SetLaserDataA(1, 90, 0, 0, 0, 0, 180);

frame=0;

        CreateLaser01(230,200, 50, GetAngleToPlayer, 9000000, 30, YELLOW05, 10);
frame=0;

CreateLaser01(+rand(37, 230),+rand(0, 200), 50, +rand(0, 90), 9000000, 30, RED05, 60);
frame=0;


    }
            frame++;
}
You need a FireShot(1);  in there.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: NOVA on November 02, 2009, 11:04:47 PM
Ok, that worked.

thanks
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on November 02, 2009, 11:44:40 PM
is there a way to use atan2 when the bullets are firing at random?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 02, 2009, 11:49:56 PM
atan2 is usually used to find the angle from a certain point from boss (or anywhere else a bullet is spawned) to a player (or some other destination, whatever you want)

You put this one in the angle parameter, it's used to get the angle from the boss to the player.
Quote
atan2(GetPlayerY - GetY, GetPlayerX - GetX)

Uh, is that what you're looking for?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on November 03, 2009, 12:01:32 AM
atan2 is usually used to find the angle from a certain point from boss (or anywhere else a bullet is spawned) to a player (or some other destination, whatever you want)

You put this one in the angle parameter, it's used to get the angle from the boss to the player.
Uh, is that what you're looking for?

not exactly, i want to fire bullets randomly from the bottom of the screen that float up, and after a certain amount of time is up and they are on the top of the screen, to fire down at the player...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: CK Crash on November 03, 2009, 12:26:31 AM
Code: [Select]
task bullet1
{
let obj = Obj_Create(OBJ_SHOT);
*insert the typical stuff*
while(Obj_BeDeleted(obj)==false && Obj_GetY(obj)>GetClipMinY+16){yield;} //yield while still existing and not at top of screen
if (Obj_BeDeleted(obj)==false){Obj_SetAngle(obj,atan2(GetPlayerY-Obj_GetY(obj),GetPlayerX-Obj_GetX(obj)));} //if bullet still exists, aim it at player
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 03, 2009, 01:10:04 AM
stupid question

Code: [Select]
angletoitem = atan2(Obj_GetY(obj) - GetPlayerY, Obj_GetX(obj) - GetPlayerX);

if(Obj_GetY(obj) - GetPlayerY <= sin(angletoitem) * 50 && Obj_GetX(obj) - GetPlayerX <=cos (angletoitem) * 50){
    Obj_Delete(obj);
}

This is supposed to delete the object when it gets within a certain radius of the player. It only works properly when the object is of positive x and y distance from the player. Why is this.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 03, 2009, 01:46:48 AM
Because atan2 gets and angle between (-180, 180].

A better way to code it would be:

if(((Obj_GetX(obj) - GetPlayerX)^2 + (Obj_GetY(obj) - GetPlayerY)^2)^0.5 < 50){
    Obj_Delete(obj);
}

If the distance between the player and the item is less than 50, delete it.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 03, 2009, 02:26:17 AM
This is driving me insane.

(http://img682.imageshack.us/img682/9140/th004.png)

Why can't I get this thing right?!

I need help with this.  Can someone tell me how I can get it down properly?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 03, 2009, 02:59:44 AM
Create an object effect with 12 vertices (or 24, or 48, blah blah, any number you want to divide evenly really), and bring in every second vertex towards the center. Creating it with 12 vertices is shown below:

(http://i641.photobucket.com/albums/uu134/Nautth/ineffect.jpg)

This would be how I would do it, anyway.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 03, 2009, 03:41:05 AM
This would be how I would do it, anyway.

Uh, the one to the right would work, but I don't see how the one to the left will actually be curvy, seeing how it's done.  Actually, I don't even know how to attack it properly.  I've been at it for about a week, and still got nowhere and can't get it down.  Sorry if I'm asking for so much... but here's what I came out with so far.

Maybe you can take a look at it... (http://www.mediafire.com/download.php?f2vegzmjmwm)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 03, 2009, 03:47:07 AM
The left picture is how the actual graphic looks, the right picture is how you would code it using vertices. So for the top half, you have your circular graphic mapped out using twelve vertices. By reducing the radius on every second vertex (as illustrated by the bottom right picture), the image will bend and contort to look like the bottom left picture, which is what you're tyring to acheive, I thought.

I'll take a look anyways, but I have no promises and I'm not going to code it for you. You'll learn something out of this, damn it!
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 03, 2009, 03:48:39 AM
thank you naut and stuff
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 03, 2009, 03:57:27 AM
You'll learn something out of this, damn it!

I'm trying, I'm trying!  :'(
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on November 03, 2009, 09:14:38 AM
I have a problem that I've just been dealing with since when I started using danmakufu, but lately... It's getting really annoying... I just wanna fix it already...

ok, here's the problem... Danmakufu doesn't display text and some graphics properly for me... I'll give some examples (I used my multiply to upload the images so there might be "multiply" at the bottom right of the picture)

(http://images.kyle090594.multiply.com/image/1/photos/25/500x500/1/Picture.jpg?et=1VnWRyfVuUgZZ840slbKmg&nmid=294805183)
the hell... I have to squint just to read...

(http://images.kyle090594.multiply.com/image/1/photos/25/500x500/3/picture3.jpg?et=X2,sebt8%2BsmVE1VLJRr0ag&nmid=294805183)
Can't read spell card name, score, graze, point and FPS

(http://images.kyle090594.multiply.com/image/1/photos/25/500x500/4/picture4.jpg?et=8DOPnT46f6nJ7,mRUQLzRw&nmid=294805183)
Can't even see spell card bonus

(http://images.kyle090594.multiply.com/image/1/photos/25/500x500/5/Picture5.jpg?et=xlPJzaC1J1mYZMhmJQCUNw&nmid=294805183)
I have absolutely no idea what the hell happens here

(http://images.kyle090594.multiply.com/image/1/photos/25/500x500/6/Picture6.jpg?et=a6coXw0N0OKom%2Bl805Nujw&nmid=294805183)
(I used helepolis' Halloween entry cause it's the first script I thought of that makes use of events) Can't even read what they're saying...

(http://images.kyle090594.multiply.com/image/2/photos/25/500x500/7/snapshot000a.png?et=dYnL8SZ6HTfN4ZGos4R52w&nmid=294808919)
(http://images.kyle090594.multiply.com/image/2/photos/25/500x500/9/snapshot000c.png?et=pvPJMtsRxftIT8gc9wX0Vg&nmid=294808919)
This is what I get when pressing the home button...


Can someone help me?  :-\
I've already tried redownloading it 4 times... and it works properly on the computers of other people I know... I just don't know why my computer can't make it work properly...
This isn't even the worst yet... I was lucky that it showed solid text today... sometimes it shows extremely thin text that's really hard to read... and once, it wasn't showing text AT ALL
For those who are wondering, I use Windows XP with 1GB ram and 2GHz...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 03, 2009, 03:32:25 PM
Despite your edit, I'll answer your question anyways. ObjEffect_SetVertexUV declares the vertices on your image, ObjEffect_SetVertexXY plots the corresponding vertices on to the Danmakufu field. You're missing the XY portion of an ObjEffect (you're not telling Danmakufu where to draw the image), so nothing is drawn.

Before you say "yes I am", Obj_SetPosition does not work with ObjEffects, nor does Obj_SetAlpha for that matter (to set the alpha value of an ObjEffect, you need to use ObjEffect_SetVertexColor(id, vertex, alpha, red, green, blue); ). A pain in the ass, but setting each vertex also allows you to bend and distort the image however you please. Useful when you get used to it.
Ah, I see. Well, hopefully I'll get it right the second time when I really need to use an effect object for something. Thanks!

Well then, I managed to create and manage a 50-vertex effect object just recently. I think I understand how they work now. Just thanking you again Naut.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 03, 2009, 03:46:40 PM
kyle, it almost looks like a graphical problem. Like videocard drivers or settings. But I never encountered such a thing before.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on November 03, 2009, 04:36:33 PM
Blah, how do I get atan2 to work again if I want to aim a shot that's not on the Boss to the player?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 03, 2009, 04:38:32 PM
atan2(GetPlayerY - BulletY, GetPlayerX - BulletX)

Bullet spawned on (224, 240):

CreateShot01(224, 240, 3, atan2(GetPlayerY - 240, GetPlayerX - 224), RED01, 10);

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on November 03, 2009, 04:39:21 PM
atan2(GetPlayerY - BulletY, GetPlayerX - BulletX)

Bullet spawned on (224, 240):

CreateShot01(224, 240, 3, atan2(GetPlayerY - 240, GetPlayerX - 224), RED01, 10);
Thank you very much Naut :3
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Nonnie Grey on November 03, 2009, 08:53:06 PM
Pardon this newbie's barging in. ^_^* I know most of the questions posted here are concerning coding, but I'd like a bit of insight on a problem with the software itself.

For some reason, Danmakufu won't let me open it in anything other than fullscreen mode. Whenever I set it up to open in window mode, it comes up for a split second, then disappears (I suspect a crash), but in fullscreen, it works perfectly fine to my knowledge. Pressing Home for screenshots doesn't work, though.

The only other problems I have with it involve graphics.

(http://img.photobucket.com/albums/v231/Kayorei/whatswrongwiththispicture.png)
An example... The framerate's low because this computer is pretty slow. Maybe that's a factor?

Something tells me those black boxes aren't supposed to be there. Also, some bullets with semitransparent parts (like the wings on the butterfly bullets) have transparency issues and when I clear a script, the "playing field" part of the screen disappears and leaves me with just the word "Clear" on the screen.

Any reason why it might be doing this?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Prime 2.0 on November 03, 2009, 10:25:17 PM
kyle, it almost looks like a graphical problem. Like videocard drivers or settings. But I never encountered such a thing before.

I have, though it wasn't quite as bad. I knew someone who had text display weird like that, and I can't take screenshots with HOM without stuff getting a little messed up... but I don't know how to resolve either issue.

I didn't come here just to say that though, as I have an issue here of my own:

(http://img265.imageshack.us/img265/1551/illegible.png)

This is a cropped screenshot of CAsercan3's phantasm stage, showing the playfield HUD.

And, as I'm certain you have noticed, the text is almost unreadable. And while this doesn't afflict all text, it's certainly not restricted to that script. I've seen screenshots and videos from other people showing that text in a completely different(and legible) font, and I'm wondering what the deal here is, and what I can do about it.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on November 03, 2009, 10:55:34 PM
Question: how can I show players score after the fight is over?

i would define a variable such as

let score = GetScore;

then after the battle make a seperate script and use

DrawText on the screen with "score" as the text, such as :

DrawText("score", 200, 240, 10, idk what goes here...);
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on November 03, 2009, 11:19:09 PM
idk what goes here
alpha of the text (how opaque the text is? idk what it really means. transparency?)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on November 03, 2009, 11:25:16 PM
Is there any way i can make this script harder?:


Code: [Select]
#TouhouDanmakufu
#Title[???]
#Text[「」]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{
#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
let frame = 0;
let angle2 = 1;
let go = 0;
let random = rand(0, 360);
let graze = GetGraze;
@Initialize{
SetLife(800);
SetMovePosition02(GetCenterX,GetCenterY-120,0);
shotinit;

}

@MainLoop{
SetCollisionA(GetX,GetY,16);
SetCollisionB(GetX,GetY,16);
frame++;
if(frame%10==0){
angle2-=0.010;
ascent(o in 1..8){
CreateShotA(0, GetX, GetY, 0);
SetShotDataA(0, 0, 1*o, 15, 0, -0.05, 0.005, RED21);
SetShotDataA(0, 30, 1.8, 90, 0, 0, 0, WHITE21);
SetShotDataA(0, 80, 1.8, 90, -angle2, 0, 0, RED21);
SetShotKillTime(0, 340);
FireShot(0);

CreateShotA(1, GetX, GetY, 0);
SetShotDataA(1, 0, 1*o, 165, 0, -0.05, 0.005, RED21);
SetShotDataA(1, 30, 1.8, 90, 0, 0, 0, WHITE21);
SetShotDataA(1, 80, 1.8, 90, angle2, 0, 0, RED21);
SetShotKillTime(1, 340);
FireShot(1);}}

if(angle2<-0.5){
angle2=0.6;}

if(GetPlayerY<250){
CreateShot01(GetPlayerX, GetPlayerY, 1, rand(0, 360), ORANGE02, 80);}



}
@DrawLoop{}
@Finalize{}



}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Henry on November 04, 2009, 01:16:59 AM
Is there any way i can make this script harder?:


Code: [Select]
#TouhouDanmakufu
#Title[???]
#Text[「」]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{
#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
let frame = 0;
let angle2 = 1;
let go = 0;
let random = rand(0, 360);
let graze = GetGraze;
@Initialize{
SetLife(800);
SetMovePosition02(GetCenterX,GetCenterY-120,0);
shotinit;

}

@MainLoop{
SetCollisionA(GetX,GetY,16);
SetCollisionB(GetX,GetY,16);
frame++;
if(frame%10==0){
angle2-=0.010;
ascent(o in 1..8){
CreateShotA(0, GetX, GetY, 0);
SetShotDataA(0, 0, 1*o, 15, 0, -0.05, 0.005, RED21);
SetShotDataA(0, 30, 1.8, 90, 0, 0, 0, WHITE21);
SetShotDataA(0, 80, 1.8, 90, -angle2, 0, 0, RED21);
SetShotKillTime(0, 340);
FireShot(0);

CreateShotA(1, GetX, GetY, 0);
SetShotDataA(1, 0, 1*o, 165, 0, -0.05, 0.005, RED21);
SetShotDataA(1, 30, 1.8, 90, 0, 0, 0, WHITE21);
SetShotDataA(1, 80, 1.8, 90, angle2, 0, 0, RED21);
SetShotKillTime(1, 340);
FireShot(1);}}

if(angle2<-0.5){
angle2=0.6;}

if(GetPlayerY<250){
CreateShot01(GetPlayerX, GetPlayerY, 1, rand(0, 360), ORANGE02, 80);}



}
@DrawLoop{}
@Finalize{}



}
It is already hard enough, but if it should be harder:

Code: [Select]
#TouhouDanmakufu
#Title[???]
#Text[「」]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{
#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
let frame = 0;
let angle2 = 1;
let go = 0;
let random = rand(0, 360);
let graze = GetGraze;
   @Initialize{
      SetLife(800);
      SetMovePosition02(GetCenterX,GetCenterY-120,0);
      shotinit;

   }

   @MainLoop{
      SetCollisionA(GetX,GetY,16);
      SetCollisionB(GetX,GetY,16);
      frame++;
   if(frame%10==0){
   angle2-=0.010;
      ascent(o in 1..8){
   CreateShotA(0, GetX, GetY, 0);
   SetShotDataA(0, 0, 1*o, 15, 0, -0.05, 0.005, RED21);
   SetShotDataA(0, 30, 1.8, 115, 0, 0, 0, WHITE21);
   SetShotDataA(0, 80, 1.8, 115, -angle2, 0, 0, RED21);
   SetShotKillTime(0, 340);
   FireShot(0);

   CreateShotA(1, GetX, GetY, 0);
   SetShotDataA(1, 0, 1*o, 165, 0, -0.05, 0.005, RED21);
   SetShotDataA(1, 30, 1.8, 75, 0, 0, 0, WHITE21);
   SetShotDataA(1, 80, 1.8, 75, angle2, 0, 0, RED21);
   SetShotKillTime(1, 340);
   FireShot(1);}}

   if(angle2<-0.5){
   angle2=0.6;}
   
   if(GetPlayerY<250){
   CreateShot01(GetPlayerX, GetPlayerY, 1, rand(0, 360), ORANGE02, 80);}
   

         
   }
   @DrawLoop{}
   @Finalize{}



}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: NOVA on November 04, 2009, 02:19:22 AM
How do you edit/view the bullet and laser graphics?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Seiryuu on November 04, 2009, 02:58:12 AM
First off, I have graphic problems, one of which is why can't I see the SetEffectForZeroLifeEffect?

Second, I'm trying to use the timer to set up certain patterns. But for some reason, it doesn't let me access the while loop which activates at 100 seconds left and under. Can I only have one?

Code: [Select]
#TouhouDanmakufu
#Title[Test 3: トイレ練習]
#Text[XXをできました!]
#Player[FREE]
#Image[.\img\lulzsmiley.png]
#BGM[.\bgm\irm88.mp3]
#PlayLevel[Easy, Lunatic?]
#ScriptVersion[2]

script_enemy_main{
#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "img\flandresprite.png";
let cut = CSD ~ "img\flandrecutin.png";
let bg = CSD ~ "img\toilet.png";
let timer = 157;


@Initialize{
shotinit;
SetLife(5000);
SetTimer(157);
SetScore(80200);
SetDurableSpellCard;
SetDamageRate(0,0);

SetMovePosition01(GetCenterX,100,5);

LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);

CutIn(YOUMU,"?│?? ?u?g?C?????K?v",cut,0,0,500,400);
SetEnemyMarker(true);
Concentration01(120);
MagicCircle(true);
mainTask;
}

@MainLoop{
SetCollisionA(GetX,GetY,28);
SetCollisionB(GetX,GetY,20);
yield;
timer--;
}

@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,128,128);
SetGraphicScale(0.6,0.6);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);


}

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


}

@Finalize{
DeleteGraphic(imgBoss);
DeleteGraphic(cut);
DeleteGraphic(bg);

}

task mainTask{
wait(90);
fire;
yield;
}



task fire{
let x = 0;
let dir = 0;
loop{
yield;
if(GetTimer==148){
  CreateShot01(GetX,GetY,8,GetAngleToPlayer,RED03,90);
wait(60);
}
while(GetTimer<=123){
CreateShot01(GetX,GetY,3,GetAngleToPlayer,BLUE12,50);
  CreateShot01(GetX,GetY,2,GetAngleToPlayer+50,BLUE12,60);
CreateShot01(GetX,GetY,2,GetAngleToPlayer+40,BLUE12,60);
CreateShot01(GetX,GetY,2,GetAngleToPlayer-50,BLUE12,60);
CreateShot01(GetX,GetY,2,GetAngleToPlayer-40,BLUE12,60);
CreateShot01(GetX,GetY,4,GetAngleToPlayer-90,BLUE12,60);
CreateShot01(GetX,GetY,5,GetAngleToPlayer-70,BLUE12,60);
CreateShot01(GetX,GetY,3.7,GetAngleToPlayer+23,BLUE12,47);
CreateShot01(GetX,GetY,4.1,GetAngleToPlayer+14,BLUE12,28);
CreateShot01(GetX,GetY,2,GetAngleToPlayer+5,BLUE12,40);
CreateShot01(GetX,GetY,2,GetAngleToPlayer-8,BLUE12,60);
CreateShot01(GetX,GetY,2,GetAngleToPlayer-14,BLUE12,60);
CreateShot01(GetX,GetY,2,GetAngleToPlayer+8,BLUE12,96);
CreateShot01(GetX,GetY,2,GetAngleToPlayer-6,BLUE12,35);
CreateShot01(GetX,GetY,2,GetAngleToPlayer-5,BLUE12,60);
wait(20);
}
while(GetTimer<=100){
CreateShot01(GetX,GetY,4,GetAngleToPlayer,YELLOW54,50);
wait(20);
}
}
}


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

}

Thanks for reading this![/color]
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on November 04, 2009, 03:55:58 AM
How do you edit/view the bullet and laser graphics?

well, if i am understanding your question right, there are 13 default bullet graphics, and lasers are drawn with bullet graphics:

(http://i600.photobucket.com/albums/tt84/Happyhobo810/DanmakuBullets.jpg)

other wise, you can make your own bullet sheet such as the shot replace, or Puremrz's shot sheet.(which is awesome btw!)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on November 04, 2009, 04:03:50 AM
First off, I have graphic problems, one of which is why can't I see the SetEffectForZeroLifeEffect?

Second, I'm trying to use the timer to set up certain patterns. But for some reason, it doesn't let me access the while loop which activates at 100 seconds left and under. Can I only have one?

Code: [Select]
#TouhouDanmakufu
#Title[Test 3: トイレ練習]
#Text[XXをできました!]
#Player[FREE]
#Image[.\img\lulzsmiley.png]
#BGM[.\bgm\irm88.mp3]
#PlayLevel[Easy, Lunatic?]
#ScriptVersion[2]

script_enemy_main{
#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "img\flandresprite.png";
let cut = CSD ~ "img\flandrecutin.png";
let bg = CSD ~ "img\toilet.png";
let timer = 157;


@Initialize{
shotinit;
SetLife(5000);
SetTimer(157);
SetScore(80200);
SetDurableSpellCard;
SetDamageRate(0,0);

SetMovePosition01(GetCenterX,100,5);

LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);

CutIn(YOUMU,"?│?? ?u?g?C?????K?v",cut,0,0,500,400);
SetEnemyMarker(true);
Concentration01(120);
MagicCircle(true);
mainTask;
}

@MainLoop{
SetCollisionA(GetX,GetY,28);
SetCollisionB(GetX,GetY,20);
yield;
timer--;
}

@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,128,128);
SetGraphicScale(0.6,0.6);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);


}

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


}

@Finalize{
DeleteGraphic(imgBoss);
DeleteGraphic(cut);
DeleteGraphic(bg);

}

task mainTask{
wait(90);
fire;
yield;
}



task fire{
let x = 0;
let dir = 0;
loop{
yield;
if(GetTimer==148){
  CreateShot01(GetX,GetY,8,GetAngleToPlayer,RED03,90);
wait(60);
}
while(GetTimer<=123){
CreateShot01(GetX,GetY,3,GetAngleToPlayer,BLUE12,50);
  CreateShot01(GetX,GetY,2,GetAngleToPlayer+50,BLUE12,60);
CreateShot01(GetX,GetY,2,GetAngleToPlayer+40,BLUE12,60);
CreateShot01(GetX,GetY,2,GetAngleToPlayer-50,BLUE12,60);
CreateShot01(GetX,GetY,2,GetAngleToPlayer-40,BLUE12,60);
CreateShot01(GetX,GetY,4,GetAngleToPlayer-90,BLUE12,60);
CreateShot01(GetX,GetY,5,GetAngleToPlayer-70,BLUE12,60);
CreateShot01(GetX,GetY,3.7,GetAngleToPlayer+23,BLUE12,47);
CreateShot01(GetX,GetY,4.1,GetAngleToPlayer+14,BLUE12,28);
CreateShot01(GetX,GetY,2,GetAngleToPlayer+5,BLUE12,40);
CreateShot01(GetX,GetY,2,GetAngleToPlayer-8,BLUE12,60);
CreateShot01(GetX,GetY,2,GetAngleToPlayer-14,BLUE12,60);
CreateShot01(GetX,GetY,2,GetAngleToPlayer+8,BLUE12,96);
CreateShot01(GetX,GetY,2,GetAngleToPlayer-6,BLUE12,35);
CreateShot01(GetX,GetY,2,GetAngleToPlayer-5,BLUE12,60);
wait(20);
}
while(GetTimer<=100){
CreateShot01(GetX,GetY,4,GetAngleToPlayer,YELLOW54,50);
wait(20);
}
}
}


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

}

Thanks for reading this![/color]

I am sorry I can only answer one of your questions, i do not see a SetEffectForZeroLife in your script.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Seiryuu on November 04, 2009, 04:17:33 AM
I am sorry I can only answer one of your questions, i do not see a SetEffectForZeroLife in your script.
It's not in this one. My other script runs smoothly, yet when the effect, all the bullet graphics dissapear.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on November 04, 2009, 04:23:18 AM
is there a way to check if the player is in the same place after a few seconds? I tried different statements and I wasnt getting the right "product"

@ Seiryuu: When the boss dies the bullets turn into point items
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 04, 2009, 04:33:31 AM
posx = GetPlayerX;
posy = GetPlayerY;
loop(120){yield;}
if(posx==GetPlayerX && posy==GetPlayerY){
    youwin;
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 04, 2009, 04:49:29 AM
When working on 3d backgrounds, is there a way to make the camera rotate on the Z-axis, so it looks like a room is spinning?

So far, all I can do is make it spin on the Y-axis by changing the azimuthal angle value in

SetViewFrom(focus,azimuthal, elevation);

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on November 04, 2009, 10:26:18 AM
kyle, it almost looks like a graphical problem. Like videocard drivers or settings. But I never encountered such a thing before.

ok, thanks for trying to help anyway...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 04, 2009, 10:35:58 AM
When working on 3d backgrounds, is there a way to make the camera rotate on the Z-axis, so it looks like a room is spinning?

So far, all I can do is make it spin on the Y-axis by changing the azimuthal angle value in

SetViewFrom(focus,azimuthal, elevation);

Try the parameters of SetViewTo. I think I asked before a similar question. Though it was in the old Q&A thread.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 04, 2009, 04:26:31 PM
Try the parameters of SetViewTo. I think I asked before a similar question. Though it was in the old Q&A thread.


I read the entire thread, you said something about movement, but nothing like what I"m asking for.

Uh, are you sure SetViewTo will work?  I've changed every parameter.  All SetViewTo does is tell where on the 3d coordinate plane the camera is looking at.  SetViewTo(X,Y,Z)  But what I'm looking for is how to make it so the camera spins on the Z axis, not move on it.  So that the room looks like it's spinning clockwise or counterclockwise.

And Z is backwards darnit!!  Makes things so confusing, because in order for the camera to move right when I make the X a higher value, and left when it's a lower value, I must put the azimuthal angle at 90 so the camera faces "forward".  But that also leaves a problem, because the camera faces toward the negative end of Z.  So Z++ makes it look as if you're walking backwards instead of forwards.  It's unsolvable, the Z parameter in danmakufu is backwards.  I checked.

So, how do I make the camera actually rotate around the Z axis, just like changing azimuthal angle in SetViewFrom(focus,azimuthal,elevation); ?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on November 05, 2009, 03:40:33 AM
I'm not really sure if this is an "appropriate" question for this thread but,

What kind of emotion and bullets match with the colour purple?

on another note, this may seem like an "ehheh" question (what ever that is) but,

How exactly to while and else statements work? If they go in an if statement wouldnt that make them if statements?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on November 05, 2009, 03:44:58 AM
I'm not really sure if this is an "appropriate" question for this thread but,

What kind of emotion and bullets match with the colour purple?

on another note, this may seem like an "ehheh" question (what ever that is) but,

How exactly to while and else statements work? If they go in an if statement wouldnt that make them if statements?
Colour can match up to something like... immaturity... dishonesty... That stuff.

While statements SEEM to be DIFFERENT from if statements. Like, while statements can be used to check stuff like if there are enemies on the field, or there are bullets on the screen... etc. Else statements are like, if this thing is true, do this. otherwise, if this other thing is true, do this. otherwise... etc.
Someone correct me. I KNOW I'm wrong somewhere here.

Someone else will answer you, I don't really know.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on November 05, 2009, 03:56:03 AM
while loops are like if statements and loops combined, they keep looping until the statement is false.

else dictates what code to run if the 'if' statement is false


examples:

if(person == Naut){
    Set difficulty = HAHAHAHAHA
    }
else{
    Set difficulty = Normal
    }

In this theoretical example, if the statement is true, ie the variable called 'person' is equal to "Naut", then it runs whatever is in that segment (which would be set the difficult to HAHAHAHA(ry). The else segment is only excecuted if the original if statment is false, ie the person is not Naut.

Furthermore "else if" statements run if all the other if and else if statements before it in the chain are false.

example:

if(person == Naut){
    Set difficulty = HAHAHAHAHA
    }
else if(person == Suikama){
    Set difficulty = Extra
    }
else if(person == GIL){
    Set difficulty = beyond humanly possible
    }
else{
    Set difficulty = Normal
    }

If the person is GIL, then only the code in that section will run (difficultly = lolimpossible). If the person is me, then difficulty will be extra. And so on. If the person is none of the above then else runs.


Now while loop examples

while(lives >=0){
    keepplaying = true;
    }

So as long as the variable lives is bigger than 0, that loop will keep running. As a result, becareful when using while loops. If the statement never becomes false, then you could end up with an infinite loop, which could result in danmakufu freezing.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on November 05, 2009, 04:02:29 AM
while loops are like if statements and loops combined, they keep looping until the statement is false.

else dictates what code to run if the 'if' statement is false


examples:

if(person == Naut){
    Set difficulty = HAHAHAHAHA
    }
else{
    Set difficulty = Normal
    }

In this theoretical example, if the statement is true, ie the variable called 'person' is equal to "Naut", then it runs whatever is in that segment (which would be set the difficult to HAHAHAHA(ry). The else segment is only excecuted if the original if statment is false, ie the person is not Naut.

Furthermore "else if" statements run if all the other if and else if statements before it in the chain are false.

example:

if(person == Naut){
    Set difficulty = HAHAHAHAHA
    }
else if(person == Suikama){
    Set difficulty = Extra
    }
else if(person == GIL){
    Set difficulty = beyond humanly possible
    }
else{
    Set difficulty = Normal
    }

If the person is GIL, then only the code in that section will run (difficultly = lolimpossible). If the person is me, then difficulty will be extra. And so on. If the person is none of the above then else runs.


Now while loop examples

while(lives >=0){
    keepplaying = true;
    }

So as long as the variable lives is bigger than 0, that loop will keep running. As a result, becareful when using while loops. If the statement never becomes false, then you could end up with an infinite loop, which could result in danmakufu freezing.

Oh. My friggin' gawd.
But would person = "Naut", and not Naut?
Er, yeah.

Edit: Oh, Sui, you should have put yourself first, haha.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on November 05, 2009, 04:05:07 AM
Oh. My friggin' gawd.
But would person = "Naut", and not Naut?
Er, yeah.
Technically depends. Typically it would be a string (with the quotation marks and what not), but if Naut was a variable (like Naut = 9001 or something), then it wouldn't be a String.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on November 05, 2009, 04:28:15 AM
Technically depends. Typically it would be a string (with the quotation marks and what not), but if Naut was a variable (like Naut = 9001 or something), then it wouldn't be a String.
Err, yeah, I forgot to say strings and variables and stuff.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on November 05, 2009, 04:45:10 AM
How would i make bullets that spawn around the player, all go in at the angle into the player? like one of sakuya's StB scenes?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on November 05, 2009, 04:54:39 AM
let distance = 50; //or something
ascent(i in 0..36){
    CreateShot01(GetX+distance*cos(GetX), GetY+distance*sin(GetY), speed, i*10, graphic, delay);
    distance--;
    }

I might have messed up the sin/cos functions a bit but it would look something like that.

Essentially to spawn stuff in a circle around an object, you'll need to use trig functions. There's more info about them in the tutorials.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 05, 2009, 04:58:19 AM
let distance = 50; //or something
ascent(i in 0..36){
    CreateShot01(GetX + distance*cos(i*10), GetY + distance*sin(i*10), speed, i*10, graphic, delay);
    distance--;
    }
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on November 05, 2009, 05:00:30 AM

CreateShot01(GetX+radius*cos(ANGLE), GetY+radius*sin(ANGLE), speed, ANGLE+alter, graphic, delay);

does that mean make sure ANGLE is the same, or something?

...oh Naut & co, you lifesavers.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on November 05, 2009, 05:02:25 AM
derp
Wait why did you remove distance--;? He wants the bullets to go in towards the player.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 05, 2009, 05:03:54 AM
Yeah bros, totally a tutorial for that. (http://www.shrinemaiden.org/forum/index.php?topic=865.msg31776#msg31776)

@Suikama, whatever he typed I do not get what you said out of it :|
Plus, what you coded would make them spin in towards the boss, not the player.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on November 05, 2009, 05:05:19 AM
Yeah bros, totally a tutorial for that. (http://www.shrinemaiden.org/forum/index.php?topic=865.msg31776#msg31776)

@Suikama, whatever he typed I do not get what you said out of it :|
Plus, what you coded would make them spin in towards the boss, not the player.
DERP

I meant GetPlayerX/Y NOT GetX/Y

And he basically wants this http://www.youtube.com/watch?v=ZNN4c508_us
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 05, 2009, 05:08:22 AM
let k = 36;
let angle = 0;

loop(k){
   CreateShot01(GetPlayerX + 70*cos(angle), GetPlayerY + 70*sin(angle), 2, angle - 180, RED32, 30);
   angle+=360/k;
}

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on November 05, 2009, 05:09:51 AM
let k = 36;
let angle = 0;

loop(k){
   CreateShot01(GetPlayerX + 70*cos(angle), GetPlayerY + 70*sin(angle), 2, angle - 180, RED32, 30);
   angle+=360/k;
}
For some reason I forgot that bullets actually moved on thier own

:VSUPERDERP:V
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 05, 2009, 09:07:56 AM
Btw quite funny ZUN uses the glowing round bullets as shotdelay effect. He uses it like everywhere. And the lasers in MoF/SA/UFO are spawned with the same bullets except rotating very fast.

Me needs to do some more investigation regarding this.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 05, 2009, 03:29:12 PM
Did anyone figure out how to spin the camera about Z axis yet?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 05, 2009, 03:48:29 PM
Did anyone figure out how to spin the camera about Z axis yet?

As far as I can gather, the only way to do this is to rotate the whole world rather than the camera. Unless there's a function missing in the wiki... which is pretty likely.


For example, GetLife is missing. But I'm not sure where to add it or how to word it. There's GetEnemyLife which returns the life left of the boss, and GetLife which returns the life of the enemy that it is being called from. For example, if there is a fairy with 100 life and no boss, calling GetLife in its script will return 100 if it just spawned, and calling GetEnemyLife will return 0.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 05, 2009, 04:04:17 PM
Add it to the new good wiki. (http://dmf.shrinemaiden.org/wiki/index.php?title=Functions)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 05, 2009, 04:05:17 PM
Btw quite funny ZUN uses the glowing round bullets as shotdelay effect. He uses it like everywhere. And the lasers in MoF/SA/UFO are spawned with the same bullets except rotating very fast.

Me needs to do some more investigation regarding this.
IDs 149-155. People tend to use them for actual bullets, but in reality their purpose is only for bullet delay. For all types of bullets, too.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 05, 2009, 04:51:10 PM
As far as I can gather, the only way to do this is to rotate the whole world rather than the camera. Unless there's a function missing in the wiki... which is pretty likely.


Something tells me, you don't have to move the whole world, but the camera instead.

If you've played SA Phantasm, you'll see the camera swerve left and right, and rotate on the Z axis just a bit.  If you look even more closely, it turns counterclockwise a bit as it swerves toward the left wall, and clockwise a bit as it swerves toward the right wall.  I don't know how to do that, but I hope I can find out.

(http://img10.imageshack.us/img10/1250/thdnh2009110511592703.png) (http://img689.imageshack.us/img689/9219/thdnh2009110511593750.png)


You know what I'm talking about, right?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 05, 2009, 05:17:18 PM
Quote
Something tells me, you don't have to move the whole world, but the camera instead.

If you've played SA Phantasm, you'll see the camera swerve left and right, and rotate on the Z axis just a bit.  If you look even more closely, it turns counterclockwise a bit as it swerves toward the left wall, and clockwise a bit as it swerves toward the right wall.  I don't know how to do that, but I hope I can find out.

(images)

You know what I'm talking about, right?

Yeah, I know. Well if there's a script that's able to do it, someone should look through it and check how its done then.
*proceeds to look for the thread and download it*

EDIT: My internet is being ungodly slow. I'll be able to look through it in like an hour (yup, 4KBps), but it shouldn't be that hard to look through it yourself too.


EDIT2:
Quote
Add it to the new good wiki.

Added.

EDIT3: As far as I can gather, the second parameter of SetViewFrom may somehow control the z-rotation. I'll have to look into this later. It's 2am and should sleep.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 05, 2009, 06:43:34 PM
Not exactly a question, but I'm so close to getting this magic circle thing down properly, I can almost feel it  ;D

(http://img23.imageshack.us/img23/7334/thdnh2009110513391506.png)

BUT IT WON'T STOP SPINNING AND IT'S DRIVING ME CRAZY AKJFJDKLFAKL;DJKLAKL
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on November 05, 2009, 06:59:59 PM
Code: [Select]
#TouhouDanmakufu
#Title[Trig Pattern]
#Text[...WOOT TRIG!!]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let BossImage = "script\img\ExRumia.png";
    let frame = -120;
    let a = 0;
    let num = 20;
    @Initialize {
        SetLife(2400); SetDamageRate(40, 0);
        SetEnemyMarker(true);
        LoadGraphic(BossImage);
        SetTexture(BossImage);
        SetGraphicRect(0, 0, 64, 64);
        SetMovePosition02(GetCenterX, GetClipMinY+100, 60);
        CutIn(KOUMA,"Danmaku Sign「Made in Danmakufu」", "", 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 <= 360 && frame > 0) {
CreateShot01(GetX+100*cos(a+180+90), GetY-100*cos(a+90), 3, -a, RED21, 10);
CreateShot01(GetX+100*cos(a+180+90), GetY-100*cos(a+90), 3, a, RED21, 10);
CreateShot01(GetX-100*cos(a+90), GetY+100*cos(a+90), 3, a, RED21, 10);
CreateShot01(GetX-100*cos(a+90), GetY+100*cos(a+90), 3, -a, RED21, 10);
a+=3;
        }
        if(frame > 420 && frame <= 720) {
CreateShot01(GetX+100*cos(a+180+90), GetY-50*cos(a+90), 3, -a, ORANGE21, 10);
CreateShot01(GetX+100*cos(a+180+90), GetY-50*cos(a+90), 3, a, ORANGE21, 10);
CreateShot01(GetX-100*cos(a-90), GetY+50*cos(a-90), 3, a, ORANGE21, 10);
CreateShot01(GetX-100*cos(a-90), GetY+50*cos(a-90), 3, -a, ORANGE21, 10);
a-=3;
        }
        if(frame == 720) { frame = -60; }
        frame++;
    }

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

    @Finalize {
        DeleteGraphic(BossImage);
    }
}
Came up with this when trying to replicate Roarschach. Doesn't even look like Rorschach at all.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 05, 2009, 07:17:01 PM
EDIT2:Added.

Let us pray that Blargel has another fit of boredom.

(http://i641.photobucket.com/albums/uu134/Nautth/beast.jpg)

Thanks for the contribution. I love you <3

But now I have to translate it all.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on November 05, 2009, 07:32:31 PM
Not exactly a question, but I'm so close to getting this magic circle thing down properly, I can almost feel it  ;D

(http://img23.imageshack.us/img23/7334/thdnh2009110513391506.png)

BUT IT WON'T STOP SPINNING AND IT'S DRIVING ME CRAZY AKJFJDKLFAKL;DJKLAKL
Well, if I know anything about effect objects, and I don't, then you make the object rotate by calling a function that sets the angle of the objects relative to its actual angle, right? To make it stop spinning in a way that doesn't look stupid, just have the amount the angle rotates by each frame be determined by a variable which is reduced every frame right after the angle setting function. I believe exponential deceleration would be both easier and look better in this case, so just have the angular velocity of your object be vspin and call "vspin=vspin*0.995" or something like that.

Of course, if the angular velocity of them objects doesn't work that way, then I just typed total rubbish, but from looking at the functions in the wiki, I think I may at least not be completely wrong.  :V
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 05, 2009, 07:55:38 PM
No no.
It's not the angle that's making it spinning.  In fact, in reality it's not spinning at all.

The angles are all where they are supposed to be.  The thing that's making it spinning is the 30*sin(digit) that I put in there, that gets added to the radius.  See, the SetVertex is in an ascent in order for me to have like 100 some vertices.  The ascent itself is also in a loop.

In the ascent, the digit does digit++;
Then, the whole thing gets added to the real radius of the circle.  Which in this picture, happens to be 0. (That's why it looks like it's stretching toward the center)


In short, some parts of the circle get an extra radius than others, depending on the value of the digit. If it becomes over 180, it resets to 0, since I'm using sine.  This way, I get that constant hill effect.

But because the digit constantly becomes digit++; (which is necessary for the hill-effect)   ,   it also constantly shrinks and enlarges, making it look like it's spinning, when it's not.

Get it?  I could make it so the thing isn't "spinning" by adding an equal negative somewhere in the loop, and the star will be "stayed put", but then the wrap, or the words you can read there, start moving in that "circle".
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 05, 2009, 08:06:56 PM
Posting code is usually a key element in getting other people to troubleshoot something for you.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 05, 2009, 08:22:22 PM
haha nevermind I got it.  Woohoo a perfect replica too.

I'll post it later if you want to see it.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on November 05, 2009, 08:28:18 PM
<snip>
Well, if I understand your way correctly (and I think I don't), then just replace the
digit++;
with
digit+=vspin;
then add the vspin=vspin*0.995; into the loop outside the ascent cluster.

Alternatively, to just reduce the spinning, make it so that you add a negative somewhere that isn't equal but just different enough to make it look good. You'll have to toy on the exact value, maybe even take a negative one. Anything between 0.5 and 0.9 times the regular spinning factor should make the spinning less annoying.


...I really like to talk about stuff I don't know about as if I did...

Augh, lunardial'd. Blah, if it works then it is fine I guess.  :P
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 05, 2009, 10:53:33 PM
No no, I've already got it down perfectly.  It was hard, but I did it. ;D
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 05, 2009, 11:49:02 PM
Let us pray that Blargel has another fit of boredom.

beast.jpg

Thanks for the contribution. I love you <3

But now I have to translate it all.

The thing is, any domain with the string "wiki" or "blog" seems to be blocked in China so to access touhou.wikia.com, I need to do some annoying stuff that isn't always available for me. I thought that if I wanted to do some scripting whenever I wanted without memorizing all the functions and parameters, I might as well add the remaining functions.

Also, I'm an idiot. GetLife actually IS in there already... but I was looking in the wrong place. I don't get why GetX, GetY, GetEnemyX, GetEnemyY, and GetEnemyLife are all in informational functions, but GetLife is in Enemy Script Functions. Crazy Japanese categorization? :V
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 06, 2009, 12:00:43 AM
The idea behind the new wiki is to change it from the old one, and translate all the functions into English.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Cyclone722 on November 06, 2009, 05:40:54 AM
How do I get get a random number to not repeat itself?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 06, 2009, 05:52:57 AM
How do I get get a random number to not repeat itself?

I'll take a stab at that:

let r = 0;
let arr = [];

...

r = rand(i, j); //where i and j are your lower and upper random number limits

ascent(k in 0..length(arr)){
   while(r==ar[k]){
       r = rand(i, j);
   }
}

arr = arr ~ r;

Code can create infinite loops though, so don't do it for a small difference in i and j for a long period of time (this is practically ignorable as long as you use rand(...) instead of rand_int(...), so don't worry about it). Somebody else would probably do a better job of eliminating the previous random numbers from the pool, though.


Actually, this code doesn't work, but I tried. Disregard.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 06, 2009, 08:01:57 AM
If you're gonna just use rand, you will probably not have to worry about reusing numbers since it returns crazy numbers like 39.3982374982374 or -1.293748392. If you wanna use integers though, here's a method that may work. (not tested)

Code: [Select]
let result;
let resultIndex;
let randomIntegers = [];
let smallestInteger = -12; //change to whatever you want it to be
let largestInteger = 15; //change this to whatever value too
ascent(i in smallestInteger..largestInteger+1){
  randomIntegers = randomIntegers ~ [i];
}

...


if(length(randomIntegers) > 0){
  resultIndex = rand_int(0, length(randomIntegers)-1);
  result = randomIntegers[resultIndex];
  randomIntegers = erase(randomIntegers, resultIndex);
}
else{
  //Whatever's in here will be run if you ran out of integers.
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 06, 2009, 03:44:16 PM
Something tells me, you don't have to move the whole world, but the camera instead.

If you've played SA Phantasm, you'll see the camera swerve left and right, and rotate on the Z axis just a bit.  If you look even more closely, it turns counterclockwise a bit as it swerves toward the left wall, and clockwise a bit as it swerves toward the right wall.  I don't know how to do that, but I hope I can find out.


Double-post, but it's relatively important! The mystery of the SA Phantasm camera z-rotation is solved. The result? It's impossible to rotate the camera about the z-axis in Danmakufu!

SA Phantasm does indeed make the camera rotate to achieve the effect you're going for, but not on the z-axis. As I thought previously, it was with the second parameter of SetViewFrom, aka the y-axis. What they did was build the environment on the x-y plane and moved the camera's y-position in SetViewTo to simulate moving forward rather than build the environment on the x-z plane and moving the camera's z-position.

This pretty much means you're gonna need to flip your 3-D environment and camera 90 degrees forward. and then change the second parameter of SetViewFrom to make it rotate on the "z"-axis (which is really the y-axis now according to Danmakufu).
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 06, 2009, 04:30:12 PM
In general that's probably a good idea if your stage requires moving forward instead of upwards or something. A bit complicated, but still.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 06, 2009, 04:32:44 PM
I could swear you could achieve the z-axis rotation in Danmakufu as I have used it but then again. I could be completely wrong with it as well.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: RavenEngie on November 06, 2009, 07:09:09 PM
Right, I've run across a problem while spawning each of the forces for my Seven Force (http://www.mediafire.com/?tywynnvjunm) script. I've managed to make them spawn in a random order, as per what I promised, but sometimes the same one spawns more than once in a battle.

http://www.mediafire.com/?sharekey=8c7b707f7b527b3a6b21be4093fab7ac30d0413cb4ef3c7bbf1b77d2eb488dac (http://www.mediafire.com/?sharekey=8c7b707f7b527b3a6b21be4093fab7ac30d0413cb4ef3c7bbf1b77d2eb488dac)

Those are the files I'm working with right now. Try it and see what happens.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 06, 2009, 07:39:07 PM

Double-post, but it's relatively important! The mystery of the SA Phantasm camera z-rotation is solved. The result? It's impossible to rotate the camera about the z-axis in Danmakufu!

SA Phantasm does indeed make the camera rotate to achieve the effect you're going for, but not on the z-axis. As I thought previously, it was with the second parameter of SetViewFrom, aka the y-axis. What they did was build the environment on the x-y plane and moved the camera's y-position in SetViewTo to simulate moving forward rather than build the environment on the x-z plane and moving the camera's z-position.

This pretty much means you're gonna need to flip your 3-D environment and camera 90 degrees forward. and then change the second parameter of SetViewFrom to make it rotate on the "z"-axis (which is really the y-axis now according to Danmakufu).


Oh. My. God.  If you're saying what I think you're saying, then the camera is actually moving and pointing UPward instead of forward?!

That's genius!  I should have thought of that...
If that's the cause, then it's just an illusion.  You're moving up and don't even know it!  Truly, genius.

EDIT:

Wow, it's so easy.
Code: [Select]
#TouhouDanmakufu[Stage]
#Title[How do I rotate about Z?]
#Text[you need the colorful box for this]
#Player[FREE]
#ScriptVersion[2]

script_stage_main
{
   let rotation = 0;
   let imagefile = GetCurrentScriptDirectory ~ "bg1.png";
   let viewX=0;
   let viewY=0;
   let viewZ= 10;
   let focus = 250;
   let azimuthal=90;
   let elevation=-55;
   let frame=0;
   let number=63;

   let depth_buffer_enable = true;

   @Initialize
   {
      LoadGraphic(imagefile);
      makeithappen;
   }

   @MainLoop
   {
    yield;

   }

   @DrawLoop
   {
   }

   @BackGround
   {



      WriteZBuffer(depth_buffer_enable);
      UseZBuffer(depth_buffer_enable);

      SetViewTo(viewX, viewY, viewZ);
      SetViewFrom(focus, azimuthal, elevation);

      SetFog(200, 350, 0, 0, 0);



      // Draw the box
      SetAlpha(255);
      SetTexture(imagefile);
      SetGraphicRect(0, 0, 127, 127);


      SetGraphicAngle(0, -180, 0);
      DrawGraphic3D(0, 0, 63);

      SetGraphicAngle(0, -180, 0);
      DrawGraphic3D(0, number*2, 63);

      SetGraphicAngle(0, -180, 0);
      DrawGraphic3D(0, number*4, 63);

      SetGraphicAngle(0, -180, 0);
      DrawGraphic3D(0, number*6, 63);

      SetGraphicAngle(0, -180, 0);
      DrawGraphic3D(0, number*8, 63);

      SetGraphicAngle(0, -180, 0);
      DrawGraphic3D(0, number*10, 63);



      SetGraphicAngle(0, 90, 0);
      DrawGraphic3D(63, 0, 0);

      SetGraphicAngle(0, 90, 0);
      DrawGraphic3D(63, number*2, 0);

      SetGraphicAngle(0, 90, 0);
      DrawGraphic3D(63, number*4, 0);
      SetGraphicAngle(0, 90, 0);
      DrawGraphic3D(63, number*6, 0);
      SetGraphicAngle(0, 90, 0);
      DrawGraphic3D(63, number*8, 0);
      SetGraphicAngle(0, 90, 0);
      DrawGraphic3D(63, number*10, 0);
      SetGraphicAngle(0, 90, 0);
      DrawGraphic3D(63, number*12, 0);



      SetGraphicAngle(0, 270, 0);
      DrawGraphic3D(-63, 0, 0);


      SetGraphicAngle(0, 270, 0);
      DrawGraphic3D(-63, number*2, 0);
      SetGraphicAngle(0, 270, 0);
      DrawGraphic3D(-63, number*4, 0);
      SetGraphicAngle(0, 270, 0);
      DrawGraphic3D(-63, number*6, 0);
      SetGraphicAngle(0, 270, 0);
      DrawGraphic3D(-63, number*8, 0);
      SetGraphicAngle(0, 270, 0);
      DrawGraphic3D(-63, number*10, 0);
      SetGraphicAngle(0, 270, 0);
      DrawGraphic3D(-63, number*12, 0);

      SetGraphicAngle(90, 0, 0);
      DrawGraphic3D(0, 63, 0);

      SetGraphicAngle(-90, 0, 0);
      DrawGraphic3D(0, -63, 0);


   }

   @Finalize
   {
      DeleteGraphic(imagefile);
   }

task makeithappen{ let digit=0;


loop{     digit+=2;

azimuthal+=cos(digit); yield; viewY++;  if(viewY>number*6){viewY=number*4}   }



}



}

(http://img4.imageshack.us/img4/6830/snapshot000a.png)

The code makes you go "forward" on that plane, which goes on forever.

it doesn't really go on forever, you're stuck in an infinite loop
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 06, 2009, 10:25:45 PM
I think the direction you are heading really depends on how you make your stage scroll (perspective and such). As I have this stage where you have the feeling you are going forward. But at the end everything is 2D anyway :V especially during boss fights.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on November 07, 2009, 12:35:27 AM
Is this one possible?
Code: [Select]
#TouhouDanmakufu
#Title[Stuff 2]
#Text[OMFG THE INK BLOTS!
THE INK BLOTS!!!!

This one may very well be impossible.]
#ScriptVersion[2]

script_enemy_main {
let frame = 0;
let frame2 = -120;
let x = GetX;
let y = GetY; //+170;
let a = 0;
function wait(k){
loop(k){yield;}
}

    @Initialize {
        SetLife(1500); if(GetPlayerType == REIMU_A || GetPlayerType == REIMU_B) { SetDamageRate(40, 0); } else { SetDamageRate(20, 0); } SetTimer(75);
        SetEnemyMarker(true);
        SetMovePosition02(GetCenterX, GetClipMinY+100, 60);
        CutIn(KOUMA,"Little Rock「Rorschach Test」", "", 0, 0, 0, 0);
        SetScore(10000000);
SetShotAutoDeleteClip(500, 500, 500, 500);
    }

    @MainLoop {
x = GetX;
y = GetY;
if(frame < 300) { frame++; }
frame2++;
if(frame2 == 60) { SetMovePosition02(GetClipMinX+50, GetClipMaxY-25, 120); }
if(frame2 == 180) { SetMovePosition02(GetClipMaxX-50, GetClipMaxY-25, 120); }
if(frame2 == 300) { SetMovePosition02(GetCenterX, GetClipMinY+150, 120); }
if(frame2 == 420) { PlaySE(GetCurrentScriptDirectory~"se\se_ch00.wav"); SetColor(0, 0, 255); Concentration02(120); }
if(frame2 == 540) { SetMovePosition02(GetCenterX, GetClipMaxY, 10); }
if(frame2 == 560) {
PlaySE(GetCurrentScriptDirectory~"se\se_water.wav");
ascent(i in -6..6) {
CreateShot01(GetX, GetY, 5, GetAngleToPlayer+i*12, BLUE03, 10);
}
SetMovePosition02(GetCenterX, GetClipMinY+50, 30);
frame2 = 0;
}
               if(frame == 120) { lissajous; }
        if(!OnBomb) { SetCollisionA(GetX, GetY, 32); } //32 for boss, 10 for fairy
        SetCollisionB(GetX, GetY, 24);//24 for boss, 5 for fairy

yield;

    }
    @DrawLoop {
    }

    @Finalize {
        if(GotSpellCardBonus) {
loop(50) { CreateItem(ITEM_SCORE, GetX+rand(-150, 150), GetY+rand(-50, 50)); }
        } else {
loop(5) { CreateItem(ITEM_SCORE, GetX+rand(-150, 150), GetY+rand(-50, 50)); }
        }
    }

task lissajous {
x = GetX;
y = GetY; //+170;
loop(300) {
CreateShot02(x-100*cos(a-90), y-75*cos(a-90), -5, -a, 0.1, 3, RED04, 10);
CreateShot02(x-100*cos(a+90), y+75*cos(a+90), -5, a+180, 0.1, 3, RED04, 10);
a+=6.5;
wait(1);
}
wait(1);
loop(300) {
CreateShot02(x-75*cos(a-90), y-125*cos(a-90), -5, -a, 0.1, 3, ORANGE04, 10);
CreateShot02(x-75*cos(a+90), y+125*cos(a+90), -5, a+180, 0.1, 3, ORANGE04, 10);
a+=6.5;
wait(1);
}
lissajous;
}
}

Seems not to be so for me.
(Thanks Naut for Rorschach (matHh) base) (also i heart cosine!)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 07, 2009, 01:42:50 AM
I've got a question.  It's pretty trivial, though.

Is there a way to load ANM files into Danmakufu?  The kind that are direct rips from the games?

Somehow, I think they'll give a better color value and resolution than the converted PNGs
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 07, 2009, 02:26:47 AM
no and no
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on November 07, 2009, 02:45:50 AM
Oh. Anyway to make it easier?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Delpolo on November 07, 2009, 03:11:46 AM
After stopping for months, I decided to go back and start writing some more scripts, starting by fixing an old one. Problem is, it keeps on freezing and I can't figure out why (though I know it's because of the task). Here's my whole script:

Code: [Select]
#TouhouDanmakufu
#Title[Help needed]
#Text[The task seems to freeze it. Why?]
#Image[]
#BackGround[IceMountain]
#BGM[.\bgm.mp3]
#PlayLevel[Fix]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let BossImage = ".\script\Arthur\Images\Boss.png";
    let BossCutIn = ".\script\Arthur\Images\BossCutIn.png";
    let cx=GetCenterX();
    let cy=GetCenterY();
    let frame=0;
    let a=0; // Angle.
let time=0;
let bullet=0; // To test for 'add' (which is to check if we count up the time or not).

task eye (a) {
let add=0;
if(bullet==0) {
bullet++;
add++;
}
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, cx+60*cos(a), 170+15*sin(a));
Obj_SetAngle(obj, atan2(sin(a), 4*cos(a)));
Obj_SetSpeed(obj, 0.75);
ObjShot_SetGraphic(obj, WHITE05);
ObjShot_SetDelay  (obj, 0);
ObjShot_SetBombResist (obj, true);
      while(Obj_BeDeleted(obj)==false) {
if(add==1) {time++;}
if(time==120) {Obj_SetSpeed(obj, 0);}
yield;
}
}

    @Initialize {
        LoadGraphic(BossImage);
        SetMovePosition02(cx+0, 170, 50);
        SetLife(2500);
        SetDamageRate(10, 10);
        SetTimer(300);
        SetInvincibility(100);
        CutIn(KOUMA, "Default", BossCutIn, 0, 0, 34, 48);
        SetScore(1000000);
        SetEnemyMarker(true);
        SetDurableSpellCard;
        Concentration01(50);
        MagicCircle(false);
        SetEffectForZeroLife(60, 100, 0);
    }

 @MainLoop {
SetCollisionA(GetX, GetY, 9);
SetCollisionB(GetX, GetY, 15);
if(frame>=60) {
if(frame==60) {
CreateShotA(0, cx, 170, 0);
SetShotDataA(0, 0, 0, 0, 0, 0, 0, AQUA01);
FireShot(0);
ascent (a in 1..361) {
if(a%2==0) {
eye (a); // The eyeball shape.
}
CreateShotA(a, cx+5*cos(a+90), 170+5*sin(a+90), 0); // Starting from here...
SetShotDataA(a, 0, 0.225, a+90, 0, 0, 0.25, AQUA01);
SetShotDataA(a, 120, 0, a+90, 0, 0, 0.25, AQUA01);
FireShot(a);
CreateShotA(a, cx+5*cos(a+90), 170+5*sin(a+90), 0);
SetShotDataA(a, 0, 0.0975, a+90, 0, 0, 0.25, AQUA01);
SetShotDataA(a, 120, 0, a+90, 0, 0, 0.25, AQUA01);
FireShot(a); // To here, it'd all for the iris...
}
}
yield;
}
frame++
    }

    @DrawLoop
    {
SetColor(255,255,255);
SetTexture(BossImage);
if(GetSpeedX()>0){
SetGraphicRect(65, 1, 95, 61);
} else if(GetSpeedX()<0){
SetGraphicRect(1, 1, 31, 61);
} else {
SetGraphicRect(33, 1, 63, 61);
} // Draw him moving correctly.
DrawGraphic(GetX(), GetY());
    }

    @Finalize
{
DeleteGraphic(BossImage);
}

}

(Can I just say "task eye", or is the "(a)" needed?)

Yes, I realise I called the task 180 times, but I don't know how to control 180 bullets in one task (don't know how to use arrays yet), though I doubt it's because of that; before trying to remake it, the old script called it 360 times and it didn't freeze. I know it's the task which is the problem because commenting out the task (and all references to it) makes the script work.

The task is basically calling 180 bullets, then stopping them in place after 2 seconds (after their creation) to form an eye shape. I use a task because I'd need to control every bullet individually near the end (by "closing" the eye), so I'd need to use "Obj_GetY" and move it depending on where it is, which I don't think I can do easily with "CreateShotA" (or some other "CreateShot_").

I really hate to make people go through all this just for me, but I'd like to at least finish this.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 07, 2009, 03:29:41 AM
The ascent function creates it's variable automatically, you shouldn't need to initialize the variable.

You're also CREATING 180 OBJECTS AND FIRING 360 SHOTS IN ONE FRAME JESUS CHRIST
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 07, 2009, 04:03:10 AM
Rename the variable "add" to anything other than, uh, add. "Ad", for example. Kind of an odd thing to crash on though.

Code: [Select]
#TouhouDanmakufu
#Title[Help needed]
#Text[The task seems to freeze it. Why?]
#Image[]
#BackGround[IceMountain]
#BGM[.\bgm.mp3]
#PlayLevel[Fix]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let BossImage = ".\script\Arthur\Images\Boss.png";
    let BossCutIn = ".\script\Arthur\Images\BossCutIn.png";
    let cx=GetCenterX();
    let cy=GetCenterY();
    let frame=0;
    let a=0; // Angle.
let time=0;
let bullet=0; // To test for 'add' (which is to check if we count up the time or not).

task eye (a) {
let ad=0;
if(bullet==0) {
bullet++;
ad++;
}
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, cx+60*cos(a), 170+15*sin(a));
Obj_SetAngle(obj, atan2(sin(a), 4*cos(a)));
Obj_SetSpeed(obj, 0.75);
ObjShot_SetGraphic(obj, WHITE05);
ObjShot_SetDelay  (obj, 0);
ObjShot_SetBombResist (obj, true);
      while(Obj_BeDeleted(obj)==false) {
if(ad==1) {time++;}
if(time==120) {Obj_SetSpeed(obj, 0);}
yield;
}
}

    @Initialize {
        LoadGraphic(BossImage);
        SetMovePosition02(cx+0, 170, 50);
        SetLife(2500);
        SetDamageRate(10, 10);
        SetTimer(300);
        SetInvincibility(100);
        CutIn(KOUMA, "Default", BossCutIn, 0, 0, 34, 48);
        SetScore(1000000);
        SetEnemyMarker(true);
        SetDurableSpellCard;
        Concentration01(50);
        MagicCircle(false);
        SetEffectForZeroLife(60, 100, 0);
    }

 @MainLoop {
SetCollisionA(GetX, GetY, 9);
SetCollisionB(GetX, GetY, 15);
if(frame>=60) {
if(frame==60) {
CreateShotA(0, cx, 170, 0);
SetShotDataA(0, 0, 0, 0, 0, 0, 0, AQUA01);
FireShot(0);
ascent (a in 1..361) {
if(a%2==0) {
eye (a); // The eyeball shape.
}
CreateShotA(a, cx+5*cos(a+90), 170+5*sin(a+90), 0); // Starting from here...
SetShotDataA(a, 0, 0.225, a+90, 0, 0, 0.25, AQUA01);
SetShotDataA(a, 120, 0, a+90, 0, 0, 0.25, AQUA01);
FireShot(a);
CreateShotA(a, cx+5*cos(a+90), 170+5*sin(a+90), 0);
SetShotDataA(a, 0, 0.0975, a+90, 0, 0, 0.25, AQUA01);
SetShotDataA(a, 120, 0, a+90, 0, 0, 0.25, AQUA01);
FireShot(a); // To here, it'd all for the iris...
}
}
yield;
}
frame++
    }

    @DrawLoop
    {
SetColor(255,255,255);
SetTexture(BossImage);
if(GetSpeedX()>0){
SetGraphicRect(65, 1, 95, 61);
} else if(GetSpeedX()<0){
SetGraphicRect(1, 1, 31, 61);
} else {
SetGraphicRect(33, 1, 63, 61);
} // Draw him moving correctly.
DrawGraphic(GetX(), GetY());
    }

    @Finalize
{
DeleteGraphic(BossImage);
}

}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Delpolo on November 07, 2009, 04:38:50 AM
...That's it? Seriously?

Okay, having changed "add" to "check", another problem arises: there's only one white bullet that appears. (See here (http://i46.photobucket.com/albums/f128/Alleo/Fail.png), with part of script if needed.)

Trying to find the error, changing the "181" to "361" in the "ascent" (obviously) doesn't change anything, nor does commenting out the "if(check==1) {time++;}", so I assume it's something else. (The task is still the same, save for the add-check swap.)

Also, is there a function for "CreateShotA" bullets that makes bombs unable to absorb them?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 07, 2009, 04:43:38 AM
??

Code: [Select]
#TouhouDanmakufu
#Title[Help needed]
#Text[The task seems to freeze it. Why?]
#Image[]
#BackGround[IceMountain]
#BGM[.\bgm.mp3]
#PlayLevel[Fix]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let BossImage = ".\script\Arthur\Images\Boss.png";
    let BossCutIn = ".\script\Arthur\Images\BossCutIn.png";
    let cx=GetCenterX();
    let cy=GetCenterY();
    let frame=0;
    let a=0;      // Angle.
   let time=0;
   let bullet=0;   // To test for 'add' (which is to check if we count up the time or not).

   task eye (a) {
      let ad=0;
      if(bullet==0) {
         bullet++;
         ad++;
      }
      let obj=Obj_Create(OBJ_SHOT);
      Obj_SetPosition(obj, cx+60*cos(a), 170+15*sin(a));
      Obj_SetAngle(obj, atan2(sin(a), 4*cos(a)));
      Obj_SetSpeed(obj, 0.75);
      ObjShot_SetGraphic(obj, WHITE05);
      ObjShot_SetDelay  (obj, 0);
      ObjShot_SetBombResist (obj, true);
            while(Obj_BeDeleted(obj)==false) {
         if(ad==1) {time++;}
         if(time==120) {Obj_SetSpeed(obj, 0);}
         yield;
      }
   }

    @Initialize {
        LoadGraphic(BossImage);
        SetMovePosition02(cx+0, 170, 50);
        SetLife(2500);
        SetDamageRate(10, 10);
        SetTimer(300);
        SetInvincibility(100);
        CutIn(KOUMA, "Default", BossCutIn, 0, 0, 34, 48);
        SetScore(1000000);
        SetEnemyMarker(true);
        SetDurableSpellCard;
        Concentration01(50);
        MagicCircle(false);
        SetEffectForZeroLife(60, 100, 0);
    }

 @MainLoop {
   SetCollisionA(GetX, GetY, 9);
   SetCollisionB(GetX, GetY, 15);
   if(frame>=60) {
      if(frame==60) {
         CreateShotA(0, cx, 170, 0);
         SetShotDataA(0, 0, 0, 0, 0, 0, 0, AQUA01);
         FireShot(0);
         ascent (a in 1..361) {
            if(a%2==0) {
               eye (a);                  // The eyeball shape.
            }
            CreateShotA(a, cx+5*cos(a+90), 170+5*sin(a+90), 0);      // Starting from here...
            SetShotDataA(a, 0, 0.225, a+90, 0, 0, 0.25, AQUA01);
            SetShotDataA(a, 120, 0, a+90, 0, 0, 0.25, AQUA01);
            FireShot(a);
            CreateShotA(a, cx+5*cos(a+90), 170+5*sin(a+90), 0);
            SetShotDataA(a, 0, 0.0975, a+90, 0, 0, 0.25, AQUA01);
            SetShotDataA(a, 120, 0, a+90, 0, 0, 0.25, AQUA01);
            FireShot(a);                  // To here, it'd all for the iris...
         }
      }
      yield;
   }
   frame++
    }

    @DrawLoop
    {
   SetColor(255,255,255);
   SetTexture(BossImage);
   if(GetSpeedX()>0){
      SetGraphicRect(65, 1, 95, 61);
   } else if(GetSpeedX()<0){
      SetGraphicRect(1, 1, 31, 61);
   } else {
      SetGraphicRect(33, 1, 63, 61);
   }                // Draw him moving correctly.
   DrawGraphic(GetX(), GetY());
    }

    @Finalize
   {
      DeleteGraphic(BossImage);
   }

}

??

(http://i641.photobucket.com/albums/uu134/Nautth/gggggg.jpg)

??

By the way, you're not incrementing the angle for your eye task, which is why all the bullets are being spawned at the same angle, and thus look like one bullet.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Delpolo on November 07, 2009, 04:50:21 AM
Nevermind, I'm an idiot who removed the "(a)" in "eye (a)" after I thought it was useless.

No problems anymore, thanks Naut!
(No, I didn't say "Thanks... not!")
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Seiryuu on November 07, 2009, 06:13:53 AM
Ok, so I want to make two rings of bullets (angles opposite to each other), and now I'm ending up with spinning bullets in the corners. I actually find that quite cool, but how can I include the second ring of bullets? And can you have two while loops?

Code: [Select]
#TouhouDanmakufu
#Title[Test 4: ?J???@?u???z???v]
#Text[Can you escape this illusionary gate?]
#Player[FREE]
#Image[.\img\lulzsmiley.png]
#BGM[.\bgm\necroremix.mp3]


#ScriptVersion[2]

script_enemy_main{



let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "img\yukarisprite.png";
let cut = CSD ~ "img\yukaricutin.png";
let bg = CSD ~ "img\eyebg.png";
let timer = 157;


@Initialize{
SetLife(5000);
SetTimer(60);
SetScore(103600);
//SetDurableSpellCard;

SetMovePosition01(GetCenterX,100,5);

LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);

CutIn(YOUMU,"?J?? ?u???z???v",cut,0,0,600,553);
SetEnemyMarker(true);
Concentration01(120);
MagicCircle(true);
mainTask;
}

@MainLoop{
SetCollisionA(GetX,GetY,28);
SetCollisionB(GetX,GetY,20);
yield;
}

@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,128,128);
SetGraphicScale(0.6,0.6);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);


}

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


}

@Finalize{
DeleteGraphic(imgBoss);
DeleteGraphic(cut);
DeleteGraphic(bg);

}

task mainTask{
wait(90);
fire;
yield;
}



task fire{
let x = 0;
let dir = 0;
loop{
CreateShotA(1,GetX,GetY,30);
SetShotDataA(1,0,5,GetAngleToPlayer,0.05,-0.07,3,PURPLE01);
SetShotDataA(1,60,5,GetAngleToPlayer,0.1,-0.07,3,PURPLE01);
FireShot(1);

CreateShotA(2,GetX,GetY,30);
SetShotDataA(2,0,6,GetAngleToPlayer,0.001,0.001,9,PURPLE01);
FireShot(2);

CreateShotA(6,GetX,GetY,30);
SetShotDataA(6,0,5,GetAngleToPlayer,-0.05,-0.07,3,PURPLE01);
SetShotDataA(6,60,5,GetAngleToPlayer,-0.1,-0.07,3,PURPLE01);
FireShot(6);

while(x<36){
CreateShotA(4,GetX+60*cos(dir),GetY+80*sin(dir),30);
SetShotDataA(4,0,5,dir,0,0,0,PURPLE11);
SetShotDataA(4,60,5,dir,60,0.1,2,PURPLE11);
FireShot(4);
dir+=360/60;
x++;
}
//while(x<36){
//CreateShotA(5,GetX+60*cos(dir),GetY+80*sin(dir),30);
//SetShotDataA(5,0,5,dir,0,0,0,PURPLE11);
//SetShotDataA(5,60,5,dir,-1.9,0,2,PURPLE11);
//FireShot(5);
//dir+=360/60;
//x++;
//}
x=0;
dir=0;

CreateLaserA(0,GetX,GetY,400,20,PURPLE03,0);
SetLaserDataA(0,0,0,1,-1,2,180);
SetShotKillTime(0,180);
FireShot(0);

CreateLaserA(3,GetX,GetY,400,20,PURPLE03,0);
SetLaserDataA(3,0,180,-1,-1,-2,180);
SetShotKillTime(3,180);
FireShot(3);

wait(60);
}
}


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

}
[/color]
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 07, 2009, 06:35:20 AM
Instead of trying to have two while loops run similtaneously, why not just spawn both rings in one loop?

Code: [Select]
#TouhouDanmakufu
#Title[Test 4: ?J???@?u???z???v]
#Text[Can you escape this illusionary gate?]
#Player[FREE]
#Image[.\img\lulzsmiley.png]
#BGM[.\bgm\necroremix.mp3]


#ScriptVersion[2]

script_enemy_main{



let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "img\yukarisprite.png";
let cut = CSD ~ "img\yukaricutin.png";
let bg = CSD ~ "img\eyebg.png";
let timer = 157;


@Initialize{
SetLife(5000);
SetTimer(60);
SetScore(103600);
//SetDurableSpellCard;

SetMovePosition01(GetCenterX,100,5);

LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);

CutIn(YOUMU,"?J?? ?u???z???v",cut,0,0,600,553);
SetEnemyMarker(true);
Concentration01(120);
MagicCircle(true);
mainTask;
}

@MainLoop{
SetCollisionA(GetX,GetY,28);
SetCollisionB(GetX,GetY,20);
yield;
}

@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,128,128);
SetGraphicScale(0.6,0.6);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);


}

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


}

@Finalize{
DeleteGraphic(imgBoss);
DeleteGraphic(cut);
DeleteGraphic(bg);

}

task mainTask{
wait(90);
fire;
yield;
}



task fire{
let x = 0;
let dir = 0;
loop{
CreateShotA(1,GetX,GetY,30);
SetShotDataA(1,0,5,GetAngleToPlayer,0.05,-0.07,3,PURPLE01);
SetShotDataA(1,60,5,GetAngleToPlayer,0.1,-0.07,3,PURPLE01);
FireShot(1);

CreateShotA(2,GetX,GetY,30);
SetShotDataA(2,0,6,GetAngleToPlayer,0.001,0.001,9,PURPLE01);
FireShot(2);

CreateShotA(6,GetX,GetY,30);
SetShotDataA(6,0,5,GetAngleToPlayer,-0.05,-0.07,3,PURPLE01);
SetShotDataA(6,60,5,GetAngleToPlayer,-0.1,-0.07,3,PURPLE01);
FireShot(6);

while(x<36){
CreateShotA(4,GetX+60*cos(dir),GetY+80*sin(dir),30);
SetShotDataA(4,0,5,dir,0,0,0,PURPLE11);
SetShotDataA(4,60,5,dir,60,0.1,2,PURPLE11);
FireShot(4);
CreateShotA(5,GetX+60*cos(dir),GetY+80*sin(dir),30);
SetShotDataA(5,0,5,dir,0,0,0,PURPLE11);
SetShotDataA(5,60,5,dir,-1.9,0,2,PURPLE11);
FireShot(5);
dir+=360/60;
x++;
}
x=0;
dir=0;

CreateLaserA(0,GetX,GetY,400,20,PURPLE03,0);
SetLaserDataA(0,0,0,1,-1,2,180);
SetShotKillTime(0,180);
FireShot(0);

CreateLaserA(3,GetX,GetY,400,20,PURPLE03,0);
SetLaserDataA(3,0,180,-1,-1,-2,180);
SetShotKillTime(3,180);
FireShot(3);

wait(60);
}
}


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

}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Seiryuu on November 07, 2009, 06:40:35 AM
Instead of trying to have two while loops run similtaneously, why not just spawn both rings in one loop?

Code: [Select]
#TouhouDanmakufu
#Title[Test 4: ?J???@?u???z???v]
#Text[Can you escape this illusionary gate?]
#Player[FREE]
#Image[.\img\lulzsmiley.png]
#BGM[.\bgm\necroremix.mp3]


#ScriptVersion[2]

script_enemy_main{



let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "img\yukarisprite.png";
let cut = CSD ~ "img\yukaricutin.png";
let bg = CSD ~ "img\eyebg.png";
let timer = 157;


@Initialize{
SetLife(5000);
SetTimer(60);
SetScore(103600);
//SetDurableSpellCard;

SetMovePosition01(GetCenterX,100,5);

LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);

CutIn(YOUMU,"?J?? ?u???z???v",cut,0,0,600,553);
SetEnemyMarker(true);
Concentration01(120);
MagicCircle(true);
mainTask;
}

@MainLoop{
SetCollisionA(GetX,GetY,28);
SetCollisionB(GetX,GetY,20);
yield;
}

@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,128,128);
SetGraphicScale(0.6,0.6);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);


}

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


}

@Finalize{
DeleteGraphic(imgBoss);
DeleteGraphic(cut);
DeleteGraphic(bg);

}

task mainTask{
wait(90);
fire;
yield;
}



task fire{
let x = 0;
let dir = 0;
loop{
CreateShotA(1,GetX,GetY,30);
SetShotDataA(1,0,5,GetAngleToPlayer,0.05,-0.07,3,PURPLE01);
SetShotDataA(1,60,5,GetAngleToPlayer,0.1,-0.07,3,PURPLE01);
FireShot(1);

CreateShotA(2,GetX,GetY,30);
SetShotDataA(2,0,6,GetAngleToPlayer,0.001,0.001,9,PURPLE01);
FireShot(2);

CreateShotA(6,GetX,GetY,30);
SetShotDataA(6,0,5,GetAngleToPlayer,-0.05,-0.07,3,PURPLE01);
SetShotDataA(6,60,5,GetAngleToPlayer,-0.1,-0.07,3,PURPLE01);
FireShot(6);

while(x<36){
CreateShotA(4,GetX+60*cos(dir),GetY+80*sin(dir),30);
SetShotDataA(4,0,5,dir,0,0,0,PURPLE11);
SetShotDataA(4,60,5,dir,60,0.1,2,PURPLE11);
FireShot(4);
CreateShotA(5,GetX+60*cos(dir),GetY+80*sin(dir),30);
SetShotDataA(5,0,5,dir,0,0,0,PURPLE11);
SetShotDataA(5,60,5,dir,-1.9,0,2,PURPLE11);
FireShot(5);
dir+=360/60;
x++;
}
x=0;
dir=0;

CreateLaserA(0,GetX,GetY,400,20,PURPLE03,0);
SetLaserDataA(0,0,0,1,-1,2,180);
SetShotKillTime(0,180);
FireShot(0);

CreateLaserA(3,GetX,GetY,400,20,PURPLE03,0);
SetLaserDataA(3,0,180,-1,-1,-2,180);
SetShotKillTime(3,180);
FireShot(3);

wait(60);
}
}


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

}
Tried that and it doesn't work. Even after I changed it to yours, it still spawns just the one.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye on November 08, 2009, 12:42:38 AM
umm...okay, another question I have.  What function(s) should I use to change shot types for a character I want to have multiple shot types...
like...the VIVIT player for example(looking at the script in no way helped me what so ever...)?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 08, 2009, 12:58:00 AM
Tried that and it doesn't work. Even after I changed it to yours, it still spawns just the one.

??

(http://i641.photobucket.com/albums/uu134/Nautth/kkkkkkkk.jpg)

??

Code: [Select]
#TouhouDanmakufu
#Title[Test 4: èJòäü@üuîÂæzûÕüv]
#Text[Can you escape this illusionary gate?]
#Player[FREE]
#Image[.\img\lulzsmiley.png]
#BGM[.\bgm\necroremix.mp3]


#ScriptVersion[2]

script_enemy_main{



let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "img\yukarisprite.png";
let cut = CSD ~ "img\yukaricutin.png";
let bg = CSD ~ "img\eyebg.png";
let timer = 157;


@Initialize{
SetLife(5000);
SetTimer(60);
SetScore(103600);
//SetDurableSpellCard;

SetMovePosition01(GetCenterX,100,5);

LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);

CutIn(YOUMU,"èJòä üuîÂæzûÕüv",cut,0,0,600,553);
SetEnemyMarker(true);
Concentration01(120);
MagicCircle(true);
mainTask;
}

@MainLoop{
SetCollisionA(GetX,GetY,28);
SetCollisionB(GetX,GetY,20);
yield;
}

@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,128,128);
SetGraphicScale(0.6,0.6);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);


}

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


}

@Finalize{
DeleteGraphic(imgBoss);
DeleteGraphic(cut);
DeleteGraphic(bg);

}

task mainTask{
wait(90);
fire;
yield;
}



task fire{
let x = 0;
let dir = 0;
loop{
CreateShotA(1,GetX,GetY,30);
SetShotDataA(1,0,5,GetAngleToPlayer,0.05,-0.07,3,PURPLE01);
SetShotDataA(1,60,5,GetAngleToPlayer,0.1,-0.07,3,PURPLE01);
FireShot(1);

CreateShotA(2,GetX,GetY,30);
SetShotDataA(2,0,6,GetAngleToPlayer,0.001,0.001,9,PURPLE01);
FireShot(2);

CreateShotA(6,GetX,GetY,30);
SetShotDataA(6,0,5,GetAngleToPlayer,-0.05,-0.07,3,PURPLE01);
SetShotDataA(6,60,5,GetAngleToPlayer,-0.1,-0.07,3,PURPLE01);
FireShot(6);

while(x<36){
CreateShotA(4,GetX+60*cos(dir),GetY+80*sin(dir),30);
SetShotDataA(4,0,5,dir,0,0,0,PURPLE11);
SetShotDataA(4,60,5,dir,60,0.1,2,PURPLE11);
FireShot(4);
CreateShotA(5,GetX+60*cos(dir),GetY+80*sin(dir),30);
SetShotDataA(5,0,5,dir,0,0,0,PURPLE11);
SetShotDataA(5,60,5,dir,-1.9,0,2,PURPLE11);
FireShot(5);
dir+=360/60;
x++;
}
x=0;
dir=0;

CreateLaserA(0,GetX,GetY,400,20,PURPLE03,0);
SetLaserDataA(0,0,0,1,-1,2,180);
SetShotKillTime(0,180);
FireShot(0);

CreateLaserA(3,GetX,GetY,400,20,PURPLE03,0);
SetLaserDataA(3,0,180,-1,-1,-2,180);
SetShotKillTime(3,180);
FireShot(3);

wait(60);
}
}


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

}

??


@UltimaRepman:
Have so that when you press "c" (VK_USER), a new variable is initialized your shot pattern, and all your shots are now based off the new variable (used to be count, is now count2, or something). When you hit "c" again, all the variables can revert back so that you resume your first shot pattern.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on November 08, 2009, 01:04:33 AM
Okuu player
Dammit Naut
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 08, 2009, 01:20:34 AM
Dammit Naut
ur slow
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on November 08, 2009, 01:29:19 AM
ur slow
i no :<
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 08, 2009, 01:31:48 AM
quoted post

two-word analysis
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on November 08, 2009, 01:39:20 AM
two-word analysis
C-c-combo keeper
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on November 08, 2009, 06:45:27 AM
Grr..i have been into every page in Rika's Garage and I can not find the Shot Replace script that I accidentaly changed...and I have tried the Wiki and I still can not find it...know where I can find it?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Johnny Walker on November 08, 2009, 07:10:49 AM
Grr..i have been into every page in Rika's Garage and I can not find the Shot Replace script that I accidentaly changed...and I have tried the Wiki and I still can not find it...know where I can find it?

Search here:
http://www.shrinemaiden.org/forum/index.php?topic=18.0 (http://www.shrinemaiden.org/forum/index.php?topic=18.0)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on November 08, 2009, 07:20:02 AM
Search here:
http://www.shrinemaiden.org/forum/index.php?topic=18.0 (http://www.shrinemaiden.org/forum/index.php?topic=18.0)

.....I am offically a 9 now....

Edit: It wont let me download the file, I get some an error saying this:
Your Hosting Account is Suspended
Your account has been suspended by x10Hosting's administration.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Johnny Walker on November 08, 2009, 07:34:59 AM
.....I am offically a 9 now....

Edit: It wont let me download the file, I get some an error saying this:
Your Hosting Account is Suspended
Your account has been suspended by x10Hosting's administration.
uploaded:

http://www.mediafire.com/download.php?ddjmdue1jm0 (http://www.mediafire.com/download.php?ddjmdue1jm0)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on November 08, 2009, 07:37:14 AM
uploaded:

http://www.mediafire.com/download.php?ddjmdue1jm0 (http://www.mediafire.com/download.php?ddjmdue1jm0)

thank you very much
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Nimble on November 08, 2009, 10:04:08 AM
I get some graphic problem with my enemy. I take enemy script from Blargel ExPatchouli stage, after learn how it working. I try to make one.

(http://www.pocketonline.net/g2engine/d/36263-1/whiteproblem.jpg)
When enemy are spining. White edge appear from nowhere around enemy sprite. (top area)
When I make them stop spining. Everything seem fine. (bottom area - but the leaf is still spining)

Any advice for this problem?
Code: [Select]
script_enemy_main{

    let enemyframe = 0;
    let enemyframe2 = 0;
    let imgAngle=0;
    let imgEnemy=GetCurrentScriptDirectory~"..\..\img\enemy\devicered.png";

//--------------------------------------------------------------------------------------------------------------

    @Initialize{
        SetLife(50);
        LoadGraphic(imgEnemy);
        SetTexture(imgEnemy);
        SetGraphicRect(0,0,32,32);
        SetGraphicScale(1, 1);
        SetMovePosition02(GetX, GetY, 0);
    }

//--------------------------------------------------------------------------------------------------------------

    @MainLoop
{
SetCollisionA(GetX(),GetY(),24);
SetCollisionB(GetX(),GetY(),24);


if (enemyframe2 == 30)
{

PlaySE(GetCurrentScriptDirectory~"..\..\sfx\Shot1.wav");

CreateShot01(GetX, GetY, 3, 60, GREEN01, 0);
CreateShot01(GetX, GetY, 3, 90, GREEN01, 0);
CreateShot01(GetX, GetY, 3, 120, GREEN01, 0);

SetMovePosition02(GetX-100, GetY+25, 30);
}

if (enemyframe2 == 60)
{

PlaySE(GetCurrentScriptDirectory~"..\..\sfx\Shot1.wav");

CreateShot01(GetX, GetY, 3, 60, GREEN01, 0);
CreateShot01(GetX, GetY, 3, 90, GREEN01, 0);
CreateShot01(GetX, GetY, 3, 120, GREEN01, 0);

SetMovePosition02(GetX+100, GetY+25, 30);
enemyframe2 = 0;
}

if (enemyframe == 600)
{
VanishEnemy;
}

enemyframe++;
enemyframe2++;
}



//--------------------------------------------------------------------------------------------------------------

    @Finalize{
        if(BeVanished==false){
            loop(3){
                CreateItem(ITEM_SCORE,GetX+rand(-25,25),GetY+rand(-25,25));
            }
        }
    }

//--------------------------------------------------------------------------------------------------------------

    @DrawLoop{
        SetTexture(imgEnemy);
        SetColor(255,255,255);
        SetRenderState(ALPHA);
        SetGraphicAngle(0,0,imgAngle);
        DrawGraphic(GetX(),GetY());

        SetRenderState(ADD);
        SetGraphicAngle(0,0,imgAngle);
        DrawGraphic(GetX(),GetY());

        imgAngle-=4;
        if(imgAngle<-360){imgAngle=0;}
    }
}

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 08, 2009, 10:15:12 AM
Welcome to the drawing engine of Danmakufu, that likes to put graphics off center when spinning. ( Probably this is the problem )

Try to increase the boundaries for the image, like the graphicrect. So if a image is 32x32 try to set the boundaries to 34x34 and retry again. I generally would advice this to anybody who is spinning graphics.

Remember that the boundary setting becomes annoying when you have images very close to eachother ( like I have with my shotscript )
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Nimble on November 08, 2009, 11:21:17 AM
I try on change graphicreact from your advice to 0,0,32,32 0,0,34,34 1,1,32,32 1,1,34,34... up to 36 (start overlap) and less.
But white edge still appear every try.

Or I have to change something in my enemy image?
(http://www.pocketonline.net/g2engine/d/36269-1/devicered.png)
I make it transpalency by default (and already try with complete black (000000) background, but no different :'()
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Stuffman on November 08, 2009, 03:24:17 PM
Haha he meant the size of the image itself.

If you want to alter the size of the graphicrect you should be making it one pixel smaller.

Although, I'm not sure that's the problem. It looks like the transparent pixels on the inside and rim are mapping as nontransparent when rotated, and changing the box size would be done to address garbage appearing on the edges.

I dunno what to do about it, though.

Oh, just so you know, your rects should be something like 1,1,30,30. 0~32 is technically 33 pixels since 0 counts.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on November 08, 2009, 04:54:28 PM
Also, is there a function for "CreateShotA" bullets that makes bombs unable to absorb them?
You need object bullets for taht.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 08, 2009, 10:55:44 PM
But white edge still appear every try.


Try putting the actual image on a 512 by 512 png file with transparency if you use ALPHA rendering, or put it in with a black background if you use ADD.  You'll get a clearer image, and it should solve your white edge problem.  Danmakufu is very picky when it comes to input, so try to keep up to its standards.


Oh, and my question... I want to change some of Danmakufu's default sounds... what can I do?  Anybody know?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Nimble on November 08, 2009, 11:55:27 PM

Try putting the actual image on a 512 by 512 png file with transparency if you use ALPHA rendering, or put it in with a black background if you use ADD.  You'll get a clearer image, and it should solve your white edge problem.  Danmakufu is very picky when it comes to input, so try to keep up to its standards.


Oh, and my question... I want to change some of Danmakufu's default sounds... what can I do?  Anybody know?
Thank you very much, when remove SetRenderState(ADD); problem solve.

From Unraveling the mysteries of th_dnh.dat (http://www.shrinemaiden.org/forum/index.php?topic=3167.0)

You need se folder in danmakufu root directory and insert what sfx you need to change in this folder like
Touhou_Danmakufu\se\sePlayerCollision.wav
If you want to change the sfx when player die.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 09, 2009, 12:17:46 AM
Unraveling the mysteries of th_dnh.dat (http://www.shrinemaiden.org/forum/index.php?topic=3167.0)

Oooh, thanks.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on November 09, 2009, 02:17:40 AM
How would i make bullets that start at the top left corner(32, 16) fill all of X and Y of the field in a downward, right way every frame? ive tried using ascents but it just spawns them at the same time. like this:

(http://i600.photobucket.com/albums/tt84/Happyhobo810/Cleaver.jpg)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 09, 2009, 02:30:26 AM
Put in a yield after you spawn the bullet.

I try to to refrain from ascents, because it limits you to use a limited number of bullets.  I'd rather use loop, because there's no limit, but everyone has their thing I guess.


EDIT: If you're using ascent to make, oh lets say, 30 bullets spawn, instead of using
Code: [Select]
ascent(i in 0..30){
bullets go here;
}

Use instead
Code: [Select]
loop(30){
bullets go here;
}


and if you want to shoot 30 bullets out of there, every frame, you'd want to put in
Code: [Select]
loop{
loop(30){ bullets go here;}
yield;}

But if you microthread, and want stuff to happen afterwords, you'd want to use that definition in a task instead.

Code: [Select]
stuff happens;
stuff happens;
loop(30){yield;}
I want this to happen now;
stuff happens;


///somewhere in the script_stage_main brackets///

task I want this to happen now{
loop{ stuff happens; yield; }
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on November 09, 2009, 02:36:46 AM
I tried that and it does the same thing, im using CreateShotAs as well.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 09, 2009, 02:37:55 AM
I tried that and it does the same thing, im using CreateShotAs as well.


Then put the yield at wherever FireShot is, because that's the one that actually fires the bullet.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on November 09, 2009, 02:42:20 AM

Then put the yield at wherever FireShot is, because that's the one that actually fires the bullet.
Code: [Select]
if(frame%40==0){
ascent(x in 2..60){
ascent(y in 1..60){
CreateShotA(0, 31*x, 16*y, 1);
SetShotDataA(0, 0, 0, 0, 0, 0, 0, BLUE01);
SetShotDataA(0, 20, 2, 90, 0, 0, 0, BLUE01);
yield;FireShot(0);
}}}//x,y,frame closure in order
this is what i have been using, and its in the mainloop.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on November 09, 2009, 02:49:42 AM
How would i make bullets that start at the top left corner(32, 16) fill all of X and Y of the field in a downward, right way every frame? ive tried using ascents but it just spawns them at the same time. like this:

(http://i600.photobucket.com/albums/tt84/Happyhobo810/Cleaver.jpg)

Try using delayed bullets...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on November 09, 2009, 02:50:54 AM
Try using delayed bullets...

how?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 09, 2009, 02:51:18 AM
mainloop

Gah, I hate arrays.  You really should microthread. It makes things a lot easier.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on November 09, 2009, 02:53:55 AM
Gah, I hate arrays.  You really should microthread. It makes things a lot easier.

been there, tried that, failed miserably  :V
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on November 09, 2009, 02:58:49 AM
how?
CreateShot01(x, y, velocity, angle, graphic, delay);
CreateShotA(ID, x, y, delay);
SetShotDataA(..., ...);
FireShot(ID);
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 09, 2009, 03:00:03 AM
It's pretty simple.  Before @Initialize or after @Finalize, load up your task and tell what it does.  Microthreading is essential if you want to make good scripts without confusing yourself, and if you want stuff to happen after one another or if other standards are met, or if you want timed shots so they are in sync with music or etc.


Code: [Select]
script_enemy_main{


@Initialize{
stuffhappens;
}


@DrawLoop{
}

@MainLoop{
yield;}


@Finalize{
}


task stuffhappens{  CreatShot...whatever you want to happen...
  }
}


If you want stuffhappens to repeat over and over again, simply put the task in a loop, and a yield at the end of it.  It makes things VERY easy to use, because it doesn't load up over and over again every frame, like @MainLoop. That can really mess things up.  Microthreading a task can make it happen just once, or as many times as you want.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on November 09, 2009, 03:16:32 AM
*woops clicked the wrong button*
Thanks Mokou!
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye on November 09, 2009, 04:10:51 AM
Okay, next Question(s)...
1. Do I use a separate task if I want to change the SetEffect_SetVertexUV coordinates of my player's Options...or do I just place that info somewhere in the task the handles my options...?

2. How do I get a line to form a circle like below(if a tutorial tells me how, point me to it)...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on November 09, 2009, 06:42:45 AM
Okay, next Question(s)...
1. Do I use a separate task if I want to change the SetEffect_SetVertexUV coordinates of my player's Options...or do I just place that info somewhere in the task the handles my options...?

2. How do I get a line to form a circle like below(if a tutorial tells me how, point me to it)...
2. you can visit nuclear cheese's effect object tutorial (here (http://dmf.shrinemaiden.org/wiki/index.php?title=Nuclear_Cheese%27s_Effect_Object_Tutorial))... just form lots of vertices... I think...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: ChaoStar on November 09, 2009, 04:04:13 PM
So, for some reason, Danmakufu won't load any single spellcards. All I can get to work are entire boss fights and such.

I run Danmakufu on windows XP, via parallels.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 09, 2009, 04:10:14 PM
@ChaoStar:

By "wont load", do you mean crashes on start up, or wont appear in the game menu? Any and all text files that do not start with #TouhouDanmakufu will not appear in the main menu. This way you can make runnable scripts that cannot be played individually (like how full games consist of many small scripts but none of them appear in the menu), perhaps this is the issue? Screenshots would be helpful towards clarification.


@UltimaRepman
:
1. Handle the ObjEffect_SetVertexUV in the option task, it's so much easier.

2. Unfortunately, Danmakufu doesn't have a function capable of clipping the image into a circle (available to us, that is, the Magic Circle function does this internally... Fffffff), so you'll have to make an ObjEffect with a trillion vertices, like AlwaysThe⑨ said.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 09, 2009, 07:02:19 PM
Unfortunately, Danmakufu doesn't have a function capable of clipping the image into a circle (available to us, that is, the Magic Circle function does this internally... Fffffff), so you'll have to make an ObjEffect with a trillion vertices, like AlwaysThe⑨ said.


Do you mean make a straight image and bend it into a circle?  It's actually pretty simple, and I can show you how to do it if you want.  I can even take that circle and bend it into a star, or whatever other shape you can think of.  Both pointy edges and smooth.  It took a while, but I've figured it out.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: ChaoStar on November 09, 2009, 08:54:36 PM
@ChaoStar:

By "wont load", do you mean crashes on start up, or wont appear in the game menu? Any and all text files that do not start with #TouhouDanmakufu will not appear in the main menu. This way you can make runnable scripts that cannot be played individually (like how full games consist of many small scripts but none of them appear in the menu), perhaps this is the issue? Screenshots would be helpful towards clarification.

By 'won't load', I mean it crashes upon loading the spellcard. It gives me no error message, either.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 09, 2009, 10:19:57 PM
By 'won't load', I mean it crashes upon loading the spellcard. It gives me no error message, either.

The way I see it, one of three things could be happening. One, you're trying to load an object effect at Initialize without putting in yield; first.  Two, you're spawning infinite bullets, or calling infinite tasks all in one frame by placing it in a loop and forgetting to put yield; in it. Or three, you're loading a filetype that danmakufu doesn't recognise (a different type of text file, a music file that isn't .mp3, .ogg, or .wav.

Try looking over the script.  If the problem persists, post it here.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye on November 09, 2009, 10:44:54 PM

Do you mean make a straight image and bend it into a circle?  It's actually pretty simple, and I can show you how to do it if you want.  I can even take that circle and bend it into a star, or whatever other shape you can think of.  Both pointy edges and smooth.  It took a while, but I've figured it out.

yes...this is what I mean...& could you please?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 10, 2009, 06:03:22 AM
Derrrrrp.
Code: [Select]
CreateShotA(idused, ((idused%48)*8)+32, (floor(idused/48)*8)+16), 5);
SetShotDataA(idused,0,0,270,0,0,0,WHITE05);
FireShot(idused);
gives me error 「CreateShotAの引数の数が違います」, which means "CreateShotA has the wrong number of arguments", except... there are four. Which there should be. I dun get it. Only thing I can think of is idused gets too big or something; it goes from 0 to 2351.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Janitor Morgan on November 10, 2009, 06:14:03 AM
Only thing I can think of is idused gets too big or something; it goes from 0 to 2351.

Probably this, yeah. The expanded shotdata script can only go up to 255, so it's possible that the same holds true for the standard functions as well.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Azure Lazuline on November 10, 2009, 06:30:33 AM
Code: [Select]
(floor(idused/48)*8)+16)

Code: [Select]
( ( ) ) )

Don't feel bad, we all make that mistake sometimes...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 10, 2009, 06:31:06 AM
HAHAHA IT WORKS I'M A GENIUS

(http://img199.imageshack.us/img199/2263/successp.jpg)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 10, 2009, 08:31:05 AM
FFFF why is programming functions which are essential so hard in danmakufu. Or is just because I am an idiot. For Iyajitsu ( and my own use ) I am trying to program a spellcircle that shrinks in proportion with the given timer ( Hey, sounds familiar like my lifebar question ).

The math is this time not the problem, I think. More like the smoothness of the scaling. Spellcircle is 0.68 after it is done expanding/animating. So starting scale is 0.68.

let scale = 0.68;
let p = 0;   

- Inside @initialize -->  scale = 0.68/GetTimer
- Script boots . . .  'p' increases and decreases to its starting size --> 0.68.
- A task with delay of 60 frames does:   p -= scale;

It works, as timer reaches 0 the circle is also like gone/small. But the stepping is unnatural and not smooth. I want a similar feeling like the build in spellcircle or the ones you see in the official games.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on November 10, 2009, 09:36:27 AM
let scale = 0.68;
let p = 0;   

- Inside @initialize -->  scale = 0.68/GetTimer
- Script boots . . .  'p' increases and decreases to its starting size --> 0.68.
- A task with delay of 60 frames does:   p -= scale;

It works, as timer reaches 0 the circle is also like gone/small. But the stepping is unnatural and not smooth. I want a similar feeling like the build in spellcircle or the ones you see in the official games.

try doing something like 0.68/(a-GetTimer), where a is the starting timer... so as the timer decreases the value 0.68 is divided by increases... not sure if this would work though...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 10, 2009, 10:57:44 AM
Try making a variable that stores GetTimer*60-1 and decrements every frame instead. Then you can update the circle every frame to make it smooth instead of jumpy every second. The -1 is so that it disappears the frame before the timer runs out and doesn't just stay there in as a minuscule circle.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 10, 2009, 11:54:45 AM
Try making a variable that stores GetTimer*60-1 and decrements every frame instead. Then you can update the circle every frame to make it smooth instead of jumpy every second. The -1 is so that it disappears the frame before the timer runs out and doesn't just stay there in as a minuscule circle.

size = (0.68)/(GetTimer*60-1);

=

win

Thank you. You are awesome. Now that this is tackled, time to script the bursting animation of the inner circle.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Henry on November 10, 2009, 01:07:36 PM
(**Back to here at last**)
Can I reflect the graphics by reversing the x-coordinates in SetGraphicRect?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: ChaoStar on November 10, 2009, 01:20:12 PM
The way I see it, one of three things could be happening. One, you're trying to load an object effect at Initialize without putting in yield; first.  Two, you're spawning infinite bullets, or calling infinite tasks all in one frame by placing it in a loop and forgetting to put yield; in it. Or three, you're loading a filetype that danmakufu doesn't recognise (a different type of text file, a music file that isn't .mp3, .ogg, or .wav.

Try looking over the script.  If the problem persists, post it here.

Turns out, it was the fact that for some reason, my virtual XP wouldn't localize it, all the way. I fixed it. <3
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 10, 2009, 01:46:01 PM
Hmmm... looks like some people could really use those codes for the magic circle effect that I learned.  I'll post it here later, as soon as I get back to my work. Math is so essential. It looks so hard, but it's actually very simple, and it'll make sense why everything is where it is. You guys will thank me for this.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 10, 2009, 01:46:46 PM
(**Back to here at last**)
Can I reflect the graphics by reversing the x-coordinates in SetGraphicRect?

What do you mean reflect? Like create a 2nd image next to it being mirrored? Or are you trying to simply flip/mirror a graphic?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 10, 2009, 07:10:02 PM
ATTN HELE
let speed = 0;
let acc = 0.5 or something;
let radius = 3;

speed+=acc;
radius+=speed;
radius*cos(dir); or whatever
acc-=0.05;

radius will increase with a downwards acceleration for 10 frames until acc hits 0 and radius hits 5.75 or something.
Then radius starts to slow down until it hits 0, and acc and speed is fairly small. More than likely it will come back at a fairly high speed.

I dunno. Something like this, screw around with values.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: 8lue Wizard on November 10, 2009, 08:47:07 PM
Is there a way to change one value in an array without rebuilding the entire ****in' thing? I'm trying to get bullets to fade out, and this is what I ended up with:
Code: [Select]
            let i = 0;
            while (i < length(ninja)) {
                let alph = ninja2[0] - 15;
                ninja2 = erase(ninja2,0);
                Obj_SetAlpha(ninja[i], alph);
                if(alph <= 15) {
                    ninja = erase(ninja,i);
                } else {
                    ninja2 = ninja2 ~ [alph];
                    i++;
                }
            }

Note what's happening to ninja2 there. It works, but it's almost certainly the ugliest hakcjob I've ever done.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 10, 2009, 10:16:05 PM
Is there a way to change one value in an array without rebuilding the entire ****in' thing? I'm trying to get bullets to fade out, and this is what I ended up with:
Code: [Select]
            let i = 0;
            while (i < length(ninja)) {
                let alph = ninja2[0] - 15;
                ninja2 = erase(ninja2,0);
                Obj_SetAlpha(ninja[i], alph);
                if(alph <= 15) {
                    ninja = erase(ninja,i);
                } else {
                    ninja2 = ninja2 ~ [alph];
                    i++;
                }
            }

Note what's happening to ninja2 there. It works, but it's almost certainly the ugliest hakcjob I've ever done.

I stared at that block for like a minute and I can't figure out what the heck you were trying to do so I'll just answer your question. To change an element in an array, all you need is this

let array = [0, 1, 2, 3, 4, 3];
array[5] = 5;

In that example, the array became [0, 1, 2, 3, 4, 5].
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: 8lue Wizard on November 10, 2009, 10:56:12 PM
really? 'cuz I was trying to do "ninja2[ i ] = ninja2[ i ] - 15;" and it was throwing errors. Ah well, whatever. It works, I'm not gonna start throwing wrenches at it now.

Basically the whole thing is a really roundabout way of tracking each bullet's alpha value ('cuz some idiot decided Obj_GetAlpha() was a waste of time, I guess.)

also, lol@ italics
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Cabble on November 11, 2009, 01:15:46 AM
The stage ends immediately. I know it's the enemy script too.

Code: [Select]
script_enemy_main {
@Initialize{
SetLife(10);
  Main();
yield;
 }
@MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
yield;
 }
@DrawLoop{
 }
@Finalize{
CreateItem(ITEM_SCORE,GetX,GetY);
 }
task Main(){
yield;
CreateShot01(GetX,GetY,2,rand(0,360),BLUE01,0);
}

Here's the stage

Code: [Select]
#TouhouDanmakufu[Stage]
#Title[Stage 1 Easy]
#Text[...]
#Image[]
#Background[]
#BGM[.\SE\Iku.mp3]
#Player[FREE]
#ScriptVersion[2]

script_stage_main{

 function Wait(let frames){
   loop(frames){yield;}
 }
 function WaitForZeroEnemy{
  while(GetEnemyNum != 0){yield;}
 }
 task stage{
  CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy1.txt", GetCenterX, GetCenterY, 0, 0, 0);
  WaitForZeroEnemy;
  Wait(120);
  CreateEnemyBossFromFile(GetCurrentScriptDirectory~"TenshiBossE.txt", 0, 0, 0, 0, 0);
  WaitForZeroEnemy;
  Wait(180);
  CreateEnemyBossFromFile(GetCurrentScriptDirectory~"IkuBossE.txt", 0, 0, 0, 0, 0);
  WaitForZeroEnemy;
  Wait(60);
  Clear;
 }
  @Initialize{
 stage;
  }
 @MainLoop{
   yield;
  }
  @Background{

  }
  @Finalize{

  }
}

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on November 11, 2009, 02:16:22 AM
...
task stage{
  Wait(60);
  CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy1.txt", GetCenterX, GetCenterY, 0, 0, 0);
  WaitForZeroEnemy;
...
Is what I do when it happens. Not sure if that's the fix.

EDIT: You forgot to put the closing bracket in Enemy1 (at the very end).
EDIT: Then there's no TenshiBossE.txt and IkuBossE.txt. That's probably all.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 11, 2009, 02:19:43 AM
That does fix it. The cause is that an enemy is being made in @Initialize which, for some reason, Danmakufu doesn't like. Putting just 1 yield would fix the problem, though more would be preferred since spawning enemies before the player gets a chance to get ready isn't very good design.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Cabble on November 11, 2009, 03:23:59 AM
Ok it's fixed, but now in this script iku won't show up.

Code: [Select]
#TouhouDanmakufu[Stage]
#Title[Stage 1 Easy]
#Text[...]
#Image[]
#Background[]
#BGM[.\SE\Iku.mp3]
#Player[FREE]
#ScriptVersion[2]

script_stage_main{

 function Wait(let frames){
   loop(frames){yield;}
 }
 function WaitForZeroEnemy{
  while(GetEnemyNum != 0){yield;}
 }
 task stage{
Wait(2*60);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy1.txt", GetCenterX-150, GetCenterY-175, 0, 0, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy1.txt", GetCenterX+150, GetCenterY-175, 0, 0, 0);
  WaitForZeroEnemy;
  Wait(1*60);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy1.txt", GetCenterX, GetCenterY-175, 0, 0, 0);
WaitForZeroEnemy;
Wait(3*60);
  CreateEnemyBossFromFile(GetCurrentScriptDirectory~"TenshiBossE.txt", 0, 0, 0, 0, 0);
  WaitForZeroEnemy;
  Wait(1*60);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
WaitForZeroEnemy;
Wait(120);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy1.txt", GetCenterX, GetCenterY-175, 0, 0, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);

WaitForZeroEnemy;
Wait(120);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
WaitForZeroEnemy;
Wait(180);
  CreateEnemyBossFromFile(GetCurrentScriptDirectory~"IkuBossE.txt", 0, 0, 0, 0, 0);
  WaitForZeroEnemy;
  Wait(60);
  Clear;
 }
  @Initialize{
 stage;
  }
 @MainLoop{
   yield;
  }
  @Background{

  }
  @Finalize{

  }
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on November 11, 2009, 03:51:11 AM
Ok it's fixed, but now in this script iku won't show up.

Code: [Select]
#TouhouDanmakufu[Stage]
#Title[Stage 1 Easy]
#Text[...]
#Image[]
#Background[]
#BGM[.\SE\Iku.mp3]
#Player[FREE]
#ScriptVersion[2]

script_stage_main{

 function Wait(let frames){
   loop(frames){yield;}
 }
 function WaitForZeroEnemy{
  while(GetEnemyNum != 0){yield;}
 }
 task stage{
Wait(2*60);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy1.txt", GetCenterX-150, GetCenterY-175, 0, 0, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy1.txt", GetCenterX+150, GetCenterY-175, 0, 0, 0);
  WaitForZeroEnemy;
  Wait(1*60);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy1.txt", GetCenterX, GetCenterY-175, 0, 0, 0);
WaitForZeroEnemy;
Wait(3*60);
  CreateEnemyBossFromFile(GetCurrentScriptDirectory~"TenshiBossE.txt", 0, 0, 0, 0, 0);
  WaitForZeroEnemy;
  Wait(1*60);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
WaitForZeroEnemy;
Wait(120);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy1.txt", GetCenterX, GetCenterY-175, 0, 0, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);

WaitForZeroEnemy;
Wait(120);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
WaitForZeroEnemy;
Wait(180);
  CreateEnemyBossFromFile(GetCurrentScriptDirectory~"IkuBossE.txt", 0, 0, 0, 0, 0);
  WaitForZeroEnemy;
  Wait(60);
  Clear;
 }
  @Initialize{
 stage;
  }
 @MainLoop{
   yield;
  }
  @Background{

  }
  @Finalize{

  }
}
Is Iku in the right script directory?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Azure Lazuline on November 11, 2009, 04:11:57 AM
Hm, I don't know when the last time somebody requested this was, but it's been pretty common, so here it is:

Code: [Select]
task ImageCircle(graphic,left,top,right,bottom,centerX,centerY,radius,width,segments,rotation,layer,alpha,renderstate,red,green,blue){

    yield;
    let obj = Obj_Create(OBJ_EFFECT);
    let n=0;

    Obj_SetPosition   (obj, centerX,centerY);
    Obj_SetSpeed      (obj, 0);
    Obj_SetAngle(obj, 0);
    ObjEffect_SetTexture(obj,graphic);
    ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLESTRIP);
    ObjEffect_SetScale(obj,1,1);
    ObjEffect_SetAngle(obj,0,0,rotation);
    ObjEffect_SetLayer(obj,layer);
    ObjEffect_CreateVertex(obj,(segments*2)+2);
    ObjEffect_SetRenderState(obj,renderstate);

    n=0;
    loop((segments*2)+2){
ObjEffect_SetVertexColor(obj,n,alpha,red,green,blue);
if(n%2==0){ObjEffect_SetVertexUV(obj,n,left+(right/segments)*floor(n/2),top);
} else {   ObjEffect_SetVertexUV(obj,n,left+(right/segments)*floor(n/2),bottom);
}
ObjEffect_SetVertexXY(obj,n, cos((360/segments)*floor(n/2))*(radius-(n%2)*width), sin((360/segments)*floor(n/2))*(radius-(n%2)*width) );
n++;
    }

    yield;
    Obj_Delete(obj);
}

(http://i439.photobucket.com/albums/qq111/Azure777/snapshot003b.jpg)

It takes any image and converts it to a circle, made in about one hour. It only lasts one frame by default (so you can pass the variables directly to the function without changing the function itself, which you can keep in a library of sorts), though feel free to change that. It seems like it has a lot of parameters, but all of them are self-explanatory, and once again, it makes it so you can just use this single task for everything. Any questions or suggestions?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 11, 2009, 05:05:06 AM
Alright, the long-awaited effect is explained here.  Thank you for your patience-.  Now, on to the little tutorial.
(http://www.shrinemaiden.org/forum/index.php?action=dlattach;topic=3218.0;attach=2847;image)(http://www.shrinemaiden.org/forum/index.php?action=dlattach;topic=3218.0;attach=2849;image)

Now, first thing we need to do.  I'll set a code here for you, and explain what it does.  Some explanations are in the code, so take a second to look at it.  I don't go to the basics of the basics, that's something everyone should figure out on their own.

Code: [Select]
#TouhouDanmakufu
#Title[magic circle 2]
#Text[]
#Player[FREE]
#ScriptVersion[2]
 
script_enemy_main{
    let imagefile = GetCurrentScriptDirectory ~ "index.png";




    @Initialize{
      SetMovePosition02(GetCenterX,GetCenterY-100,0);  ///the object will be on the boss's position
      SetLife(1);
      LoadGraphic(imagefile);
      object;
    }
 
    @MainLoop{
      yield;
    }
 
    @DrawLoop{
    }
 
    @BackGround{
    }
 
    @Finalize{
    }

   task object{   yield; yield;     ///the yield needs to be in place so Danmakufu doesn't crash.  Object effects cannot load directly at Initialize unless a couple of frames pass first.


      let objid = Obj_Create(OBJ_EFFECT);
      Obj_SetX(objid, GetX);    ///the Object will be on the Boss's X and Y position
      Obj_SetY(objid, GetY);
      ObjEffect_SetScale(objid,1,1);
      ObjEffect_SetPrimitiveType(objid, PRIMITIVE_TRIANGLESTRIP);  ///the basics you need to know
      ObjEffect_SetRenderState(objid,ADD);
      ObjEffect_SetTexture(objid, imagefile);

      let totalradius=100;   ////the real radius of the circle
      let repeat=2;            ////number of times the image is repeated in the circle.  The higher, the more scrunched-up the circle will look.  the lower, the more stretched the image will look (height-wise)
      let sides=80;      ////it's not a perfect circle. It actually has 80 "sides".  If it were 3, it'd be a triangle.
      let d=0;             //// this will be used to determine the height of the image later
      let Z=0;             //// it will spin upon the Z axis
      let RotateSpeed=1;       ///added to Z to rotate the circle
      let IN=0;              ////added to the real radius, this will be where the inner vertices of the circle will be.
      let OUT=30;         ////added to the real radius, this will be where the outer vertices of the circle will be. It should be equal to the width of the desired image (not the whole image, just the part you want seen.  A bigger number will stretch the image (width-wise).  Experiment and see.


         
      ObjEffect_CreateVertex(objid, 2+sides*2);   ///here, we're making the vertices for the whole circle. A triangle with 3 sides would have 8 vertices, not 6, because the first two are used to "start" the triangle (or any other shape you're doing). The first is the inner verticy, the second is the outer verticy.  Then inner again, then outer, and so on.


////everything below is explained in forum

                     ascent(i in 0..sides+1){    ///since we're doing the shape in pairs, the number vertices will be half of the ObjEffect_CreateVertex

                         ObjEffect_SetVertexUV(objid,i*2,32,d*repeat/sides);  ///the first is the inner verticy
                         ObjEffect_SetVertexUV(objid,i*2+1,0,d*repeat/sides);   ///the second is outer verticy
                         d+=-256;  ////the height of the actual png image.  When it goes out of bounds, it repeats itself.  This can be done infinitely.
                            }
////see the forum for explanation of everything below

      while(!Obj_BeDeleted(objid)){



                     ascent(i in 0..sides+1){         

                     let radiusINX=(totalradius +IN)*cos(i*360/sides +Z);
                     let radiusINY=(totalradius +IN)*sin(i*360/sides +Z);   

                     let radiusOUTX=(totalradius +OUT)*cos(i*360/sides +Z);
                     let radiusOUTY=(totalradius +OUT)*sin(i*360/sides +Z);

                         ObjEffect_SetVertexXY(objid, i*2, radiusINX, radiusINY);
                         ObjEffect_SetVertexXY(objid, i*2+1, radiusOUTX, radiusOUTY);


                           }

               yield;
               }


                   
   }
   








}

ObjEffect_SetVertexUV(objid,i*2,32,d*repeat/sides);
To explain this, lets use the first value of the ascent, which is zero.  Remember, it's done in pairs.  So I'll put in two. The variables in the parameters are like so. Remember, the first vertex is always 0! (id, verticy#, x-coordinate on PNG, Y-coordinate on PNG);  In Danmakufu, it looks like this, with the "i" value in ascent equal to 0.

Code: [Select]
ObjEffect_SetVertexUV(objid,0*2,32,d*repeat/sides);
ObjEffect_SetVertexUV(objid,0*2+1,32,d*repeat/sides);

This way, when i=0,  it will be doubled, so the first verticy will be 0.  Then one added, so the second verticy will be value 1, which is what we want.  Then, when i=1, the verticy value will be doubled again, so 1*2=2. That's our 3rd verticy.  Then one added, 4th verticy will have value of 3, and so on.

Next, d*repeat/sides.  We have 80 sides, with 162 vertices, as you noticed. To make things simple, lets make the repeat value 1, so we only have 1 "line" image in our circle. Since we have 80 sides, we also have to define 81 angles in our circle.  Remember, the first angle will be our "start", and every angle after that will define where our inner and outer vertices of the circle will be.  The entire image will be 256 pixels in height, so 256 pixels divided by 81 angles (the first angle will be the top of our image, so we actually divide the image by 80), that will be how many times we divide that one png "line".  It will stretch all the way around until the circle completes itself, which will make it look messy, so we'll have to repeat the image more than once so it doesn't look like a stretched image. In code, we'll put this as d*repeat/sides.  "d" being the height of the image, divided 80 "times" (sides) due to all the angles, and "repeat" being how many times we multiply the height. 256*2=512, so we're actually dividing the 512 pixels of the "line" by 80.  This looks much neater.

Next, mapping the image on Danmakufu.  The parameters for ObjEffect_SetVertexXY are (id, verticy number, X-coordinate of verticy, Y-coordinate of verticy);

Code: [Select]
ObjEffect_SetVertexXY(objid, i*2, radiusINX, radiusINY);  Remember, we're doing this in pairs, so there's an inner AND outer vertex for the circle.  Two for each angle, so we also have this
Code: [Select]
ObjEffect_SetVertexXY(objid, i*2+1, radiusOUTX, radiusOUTY); Remember what we learned before about the vertex numbers?  We apply it here too. So it's very simple. Same number of ascents as before since we're doing the verticies in pairs, and the same basic code.  "i*2" for the inner, and "i*2+1" for the outer.  Next, defining the X and Y parameters.  It's actually a bit long, so I let a variable represent them to make them a bit shorter.

Code: [Select]
let radiusINX=(totalradius +IN)*cos(i*360/sides +Z); We're using cosine for the X parameter, as always. Basic stuff. Because of that, we have to use 360/sides in there, since there are 360 degrees in a full circle.  Since we're not using 360 sides, we can't just plug in cosine(i+Z).  Instead, we use (i*360/sides+Z).  i being our actual angle which the verticy pairs will lay, and 360/sides being the format we lay it in.  This way, we could use 8 sides to make an octagon, 3 sides to make a triangle, or whatever.  We're not limited to having always using 360 sides because of cosine this way , we could use more or less, whichever we want.  Now that 360/sides is out of the way, what's the "i" for?  We use that for our angle.  The first angle at 0 degrees, then (when i=1, we define our SECOND pair of vertices ) 2nd angle at 4.5 degrees (since we have 80 sides to our circle.  360/80=4.5) The added "Z" in our parameter is the added degrees we use that allows us to "spin" our circle.  When i=2, we define our third pair of vertices, which will be 2*4.5, which is at 9 degrees.  Smart, huh?  360 degrees divide by 4.5 degrees per angle equals 80.  See why we use ascent (i in 0..80+1) now?  And instead name it to (ascent i in..sides+1) instead? We'll easily make it from a pentagon to an 80-sided circle with only having to change 1 variable, instead of like 20.  That's why we use the variable "sides". Remember, we need our added 1 there to actually finish our circle, since our first vertices will only be our starting angle.

We do the same thing for the Y parameter, but instead of using cosine, we use sine.
Code: [Select]
let radiusINY=(totalradius +IN)*sin(i*360/sides +Z);It does the same exact thing, except the sin there is used for our Y parameter. Sine of zero degrees is 0, so our Y parameter doesn't change for GetY; , though the cosine(0 degrees)=1, so it's 100 pixels to the right.  Now since that's out of the way, you might be wondering what the IN there is for?  Well, first let me explain why we have the OUT in
Code: [Select]
let radiusOUTX=(totalradius +OUT)*cos(i*360/sides +Z);Since OUT=30, our radius for the second vertex in each pair of verticies will alway be 30 more than our "totalradius" value.  This is especially useful when we want to shrink our circle without having to reduce the width of the displayed PNG image.  Also, if we want to shrink our circle with the timer, we could just make a timer value. In the beginning of our script, we can put in let timer=GetTimer*60 (multiply by 60 because of 60 frames per second), then let timer2=timer.

After that, we just subtract the value of timer by 1 each frame.  then, we just apply it to the variable totalradius. By now, you should see what's going on here just by looking at it.
Code: [Select]
#TouhouDanmakufu
#Title[magic circle]
#Text[]
#Player[FREE]
#ScriptVersion[2]
 
script_enemy_main{
    let imagefile = GetCurrentScriptDirectory ~ "index.png";
    let objid;




    @Initialize{
      SetMovePosition02(GetCenterX,GetCenterY-100,0);
      SetLife(1);
      LoadGraphic(imagefile);
      SetTimer(10);
      object;
    }
 
    @MainLoop{
      yield;
    }
 
    @DrawLoop{
    }
 
    @BackGround{
    }
 
    @Finalize{
    }

   task object{   yield; yield;


      objid = Obj_Create(OBJ_EFFECT);
      Obj_SetX(objid, GetX);
      Obj_SetY(objid, GetY);
      ObjEffect_SetScale(objid,1,1);
      ObjEffect_SetPrimitiveType(objid, PRIMITIVE_TRIANGLESTRIP);
      ObjEffect_SetRenderState(objid,ADD);
      ObjEffect_SetTexture(objid, imagefile);

      let totalradius=250;
      let repeat=3;
      let sides=80;     
      let d=0;     
      let rotate=0;
      let RotateSpeed=1;
      let timer=GetTimer*60;
      let timer2=timer;
      let IN=-totalradius;
      let OUT=-totalradius;


         
      ObjEffect_CreateVertex(objid, sides*2+2);   



                     ascent(i in 0..sides+1){

                         ObjEffect_SetVertexUV(objid,i*2,32,d*repeat/sides);
                         ObjEffect_SetVertexUV(objid,i*2+1,0,d*repeat/sides);
                         d+=-256;
                            }


      while(!Obj_BeDeleted(objid)){



                     ascent(i in 0..sides+1){         

                     let radiusINX=(totalradius*timer/timer2+IN)*cos(i*360/sides +rotate);
                     let radiusINY=(totalradius*timer/timer2+IN)*sin(i*360/sides +rotate);

                     let radiusOUTX=(totalradius*timer/timer2+OUT)*cos(i*360/sides +rotate);
                     let radiusOUTY=(totalradius*timer/timer2+OUT)*sin(i*360/sides +rotate);

                         ObjEffect_SetVertexXY(objid, i*2, radiusINX, radiusINY);
                         ObjEffect_SetVertexXY(objid, i*2+1, radiusOUTX, radiusOUTY);


                           }


               if(IN<0){IN+=totalradius/100;}
               if(OUT<30){OUT+=totalradius/20;}
               rotate+=RotateSpeed;
               timer--;
               yield;
               }


                   
   }
   








}

The reason why we have to define function SetVertexXY each frame is because it changes every frame.  If you want it to spin or shrink or whatever, you'll have to have it in just before the end of the loop, like so.
Code: [Select]
while(!Obj_BeDeleted(objid)){

all your SetVertexXY ascents here....
yield;
Z++;  //or Z+=rotation, and define the rotation variable up near the top of the task
timer--;
whatever else;
}


Okay, next.  This is where the somewhat tricky part comes in.  This is completely optional, but can have a really cool effect.  Next we want to bend the circle into a star shape with smooth edges.  Okay, here we go.
(http://img697.imageshack.us/img697/578/snapshot.png)

Next, we want to put in two new variables. "extra" and "digit".
"extra" will be our extra radius added onto our real radius, "totalradius" See how the edges there are smooth? They move in a smooth and wavy-like motion, kind of like a wave, and really reminds us of how sine looks like when we graph it. That's because, we're using it! We're actually using sin(angle) for this.  Remember, our initial angle is at 0 degrees, so sine of 0 is 0.  Then, as we move to 90 degrees in our sine, our resultant goes toward 1. Then as we go to 180, sin moves toward 0 again, then at 270 degrees, we get a resultant toward -1, and as we finish our 360 degrees in our sine, our resultant finishes at 0 again. That's one full revolution.  Up there in the image above, we have 5 revolutions. Now, one pixel isn't noticable, so we'll have to multiply our resultant by a considerable amount.  40 pixels is good, so our "extra" will have the value of 40, multiplied by our sine function, which altogether will be added on to our value of "totalradius"

Remember how we did 5 revolutions? That's what the variable "digit" will equal.  Keep that in mind.  Now, when dealing with sine or cosine, they revolve around 360 degrees, or in our case, we'll have to use 360 angles.  That can eat up on our memory so we'll need to tone it down a bit.  It's the same thing we did before when dealing with sine.  "360/sides"  So in our X parameter of our inner verticy, we'd have this.
Code: [Select]
let radiusINX=(radius+RadiusIN+extra*sin(360/sides*digit))*cos(i*angle +rotate);Then, in the ascent, since we want the value of "digit" to change while we're forming our circle, we also put this in the ascent
Code: [Select]
digit+=5;Get it?  If we had 360 sides, that'd also be 360 angles.  360/360=1.  sin(1*5)=0.087  Which is what we want.  The next angle, it would be sin(1*10)=0.17;, and so on for the next 360 angles. But because we use sin(360/sides), we don't have to have 360 sides in our circle for the sine to work, and can use less instead.  sin(360/sides*digit) is what we want, and so it works.  Basically what we did here is make 5 revolutions, and get the sin value of each degree in each revolution, and add that to the total radius of our circle as we make it.  This is how we get that wavy effect.

Now, we just plug it in our inner and outer vertex components, and this is what we should get.
Code: [Select]
                     let radiusINX=(radius+RadiusIN+extra*sin(360/sides*digit))*cos(i*angle +rotate);
                     let radiusINY=(radius+RadiusIN+extra*sin(360/sides*digit))*sin(i*angle +rotate);

                     let radiusOUTX=(radius+RadiusOUT+extra*sin(360/sides*digit))*cos(i*angle +rotate);
                     let radiusOUTY=(radius+RadiusOUT+extra*sin(360/sides*digit))*sin(i*angle +rotate);

Then, with the digit adding to itself, in each loop of the ascent, we just plug in the variables we made into the actual parameters for our verticies.  Altogether, it should look like this.

Code: [Select]
                     ascent(i in 0..sides+1){
                     

                     let radiusINX=(radius+RadiusIN+extra*sin(360/sides*digit))*cos(i*angle +rotate);
                     let radiusINY=(radius+RadiusIN+extra*sin(360/sides*digit))*sin(i*angle +rotate);

                     let radiusOUTX=(radius+RadiusOUT+extra*sin(360/sides*digit))*cos(i*angle +rotate);
                     let radiusOUTY=(radius+RadiusOUT+extra*sin(360/sides*digit))*sin(i*angle +rotate);

                    digit+=5;


                         ObjEffect_SetVertexXY(circle, i*2, radiusINX, radiusINY);
                         ObjEffect_SetVertexXY(circle, i*2+1, radiusOUTX, radiusOUTY);

                                     }

The one little pesky problem here is, "ascent(i in 0..sides+1)"
Because of that added 1, it throws our entire circle off and makes it spin and look funky.  We could fix it by adding 1 to our sides in
Code: [Select]
(radius+RadiusOUT+extra*sin((360(sides+1))*digit))*cos(i*angle +rotate);, but then that X and Y coordinates for our last pair of verticies will be off, and the star doesn't connect to itself and looks funky because of the "digit+=5".  It finishes our sine at 360 degrees, but because our first angle is use to start our circle (the one we use for our first pair of verticies), the last angle we use to define our last pair of IN and OUT verticies gets an extra 5, and our finishing verticies get the value of (360/sides*digit), with digit=405 (which, with our sine and our number of sides in our circle being 80, is equal to digit=5), where as the first angle for our first verticies get (360/sides*digit) with digit=0.    So instead, we use our ascent without the added 1.  This will make our star look good, but incomplete because the finishing angle is missing.  That last pair of verticies will have to be added manually.  I take the time to do it.  NOTE: the variable lastdigit=digit.  Initially, digit was 0 before the while(!Obj_BeDeleted(circle)) loop , so lastdigit is also 0.  When the last pair of verticies are made, they are made with the exact same variables with just a few small differences.  Our last angle is equal to our first angle, and the verticies along with it are also the same, so we must have the same variables altogether but with the variable
Code: [Select]
lastdigit equal to initial digit, before it adds a 5 to itself.  i=0 in our first run of the ascent, so our last angle is also equal to zero degrees, + the added Z for rotation.  This gives us a perfect star.

Here's the code you should have in it in your while loop.  Notice, LastINX, etc, should be almost exactly the same as your initial INX, with a few exceptions like the lastdigit, and so on. Wherever the variable "i" would go, replace with 0, since our first run in ascent with "i" also equals zero.

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



                     ascent(i in 0..sides){
                     

                     let radiusINX=(radius+RadiusIN+extra*sin(360/sides*digit))*cos(i*angle +rotate);
                     let radiusINY=(radius+RadiusIN+extra*sin(360/sides*digit))*sin(i*angle +rotate);

                     let radiusOUTX=(radius+RadiusOUT+extra*sin(360/sides*digit))*cos(i*angle +rotate);
                     let radiusOUTY=(radius+RadiusOUT+extra*sin(360/sides*digit))*sin(i*angle +rotate);

                    digit+=5;


                         ObjEffect_SetVertexXY(circle, i*2, radiusINX, radiusINY);
                         ObjEffect_SetVertexXY(circle, i*2+1, radiusOUTX, radiusOUTY);

                                     }


                    let LastInX=(radius+RadiusIN+extra*sin(360/sides*lastdigit))*cos(0*angle +rotate);
                    let LastInY=(radius+RadiusIN+extra*sin(360/sides*lastdigit))*sin(0*angle +rotate);

                     let LastOutX=(radius+RadiusOUT+extra*sin(360/sides*lastdigit))*cos(0*angle +rotate);
                     let LastOutY=(radius+RadiusOUT+extra*sin(360/sides*lastdigit))*sin(0*angle +rotate);

                        ObjEffect_SetVertexXY(circle, sides*2, LastInX, LastInY);
                        ObjEffect_SetVertexXY(circle, sides*2+1, LastOutX, LastOutY);



               
               if(extra>0){extra+=addtoextra;}
               yield;
               }


Altogether, you can warp it to your desire, very easily.  Stuff like coloring the verticies, changing the alpha value, number of sides, our circle has, IF its a circle, it should all be elementary at this point.

The entire code for the warping circle
Code: [Select]
#TouhouDanmakufu
#Title[magic circle 3]
#Text[]
#Player[FREE]
#ScriptVersion[2]
 
script_enemy_main{
    let imagefile = GetCurrentScriptDirectory ~ "index.png";




    @Initialize{
      SetMovePosition02(GetCenterX,GetCenterY-100,0);
      SetLife(1);
      LoadGraphic(imagefile);
      SetTimer(60);
      object;
    }
 
    @MainLoop{
      yield;
    }
 
    @DrawLoop{
    }
 
    @BackGround{
    }
 
    @Finalize{
    }

   task object{   yield; yield;


      let circle = Obj_Create(OBJ_EFFECT);
      Obj_SetX(circle, GetX);
      Obj_SetY(circle, GetY);
      ObjEffect_SetScale(circle,1,1);
      ObjEffect_SetPrimitiveType(circle, PRIMITIVE_TRIANGLESTRIP);
      ObjEffect_SetRenderState(circle,ADD);
      ObjEffect_SetTexture(circle, imagefile);

      let radius=100;
      let RadiusIN=0;
      let RadiusOUT=30;
      let INA=0;
      let OUTA=0;
      let repeat=6;
      let sides=60;
      let d=0;     
      let rotate=0;
      let RotateSpeed=1;
      let angle=360/sides;
      let angle2=0;
      let digit=rand(0,180);
      let lastdigit=digit;
      let extra=40;
      let addtoextra=-0.4;
     
   



         
      ObjEffect_CreateVertex(circle, sides*2+2);   



                     ascent(i in 0..sides+1){

                         ObjEffect_SetVertexUV(circle,i*2,32,d*repeat/sides);
                         ObjEffect_SetVertexUV(circle,i*2+1,0,d*repeat/sides);

                         d+=-256;
                            }


      while(!Obj_BeDeleted(circle)){



                     ascent(i in 0..sides){
                     

                     let radiusINX=(radius+RadiusIN+extra*sin(360/sides*digit))*cos(i*angle +rotate);
                     let radiusINY=(radius+RadiusIN+extra*sin(360/sides*digit))*sin(i*angle +rotate);

                     let radiusOUTX=(radius+RadiusOUT+extra*sin(360/sides*digit))*cos(i*angle +rotate);
                     let radiusOUTY=(radius+RadiusOUT+extra*sin(360/sides*digit))*sin(i*angle +rotate);

                    digit+=5;


                         ObjEffect_SetVertexXY(circle, i*2, radiusINX, radiusINY);
                         ObjEffect_SetVertexXY(circle, i*2+1, radiusOUTX, radiusOUTY);

                                     }


                    let LastInX=(radius+RadiusIN+extra*sin(360/sides*lastdigit))*cos(0*angle +rotate);
                    let LastInY=(radius+RadiusIN+extra*sin(360/sides*lastdigit))*sin(0*angle +rotate);

                     let LastOutX=(radius+RadiusOUT+extra*sin(360/sides*lastdigit))*cos(0*angle +rotate);
                     let LastOutY=(radius+RadiusOUT+extra*sin(360/sides*lastdigit))*sin(0*angle +rotate);

                        ObjEffect_SetVertexXY(circle, sides*2, LastInX, LastInY);
                        ObjEffect_SetVertexXY(circle, sides*2+1, LastOutX, LastOutY);



               
               if(extra>0){extra+=addtoextra;}
               yield;
               }

     
     }
   








}

It's set up so you can easily manipulate it.  Good luck.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on November 11, 2009, 05:06:01 AM
This deserves a spot in the intermediate tutorial
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Frazer on November 11, 2009, 05:12:46 AM
Hm. I have run into a situation with object bullets once more.

I am trying to make the bullets fall erratically down the screen, but they do not move at all.

Code: [Select]
task flower(x, angle) {
     let obj=Obj_Create(OBJ_SHOT);

     Obj_SetPosition(obj, x, GetClipMinY);
     Obj_SetAngle(obj, angle);
     Obj_SetSpeed(obj, 0);
     ObjShot_SetGraphic(obj, RED12);
     ObjShot_SetDelay(obj, 10);
     ObjShot_SetBombResist(obj, true);

     while(Obj_BeDeleted(obj)==false){

Obj_SetPosition(obj, Obj_GetX(obj) + rand(-2, 2), Obj_GetY(obj) + rand(1, 3));
Obj_SetAngle(obj, Obj_GetAngle(obj) + 3);


       yield;
}
}

The speed has nothing to do with it, because I want the bullets to fall in groups of four (i.e. shuriken shape). Neither the angle nor the position of the bullets change here, for some odd reason (practically everything inside "while(Obj_BeDeleted)" does not work). What is the problem here?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 11, 2009, 05:16:45 AM
Hm. I have run into a situation with object bullets once more.

I am trying to make the bullets fall erratically down the screen, but they do not move at all.

Code: [Select]
task flower(x, angle) {
     let obj=Obj_Create(OBJ_SHOT);

     Obj_SetPosition(obj, x, GetClipMinY);
     Obj_SetAngle(obj, angle);
     Obj_SetSpeed(obj, 0);
     ObjShot_SetGraphic(obj, RED12);
     ObjShot_SetDelay(obj, 10);
     ObjShot_SetBombResist(obj, true);

     while(Obj_BeDeleted(obj)==false){

Obj_SetPosition(obj, Obj_GetX(obj) + rand(-2, 2), Obj_GetY(obj) + rand(1, 3));
Obj_SetAngle(obj, Obj_GetAngle(obj) + 3);


       yield;
}
}

The speed has nothing to do with it, because I want the bullets to fall in groups of four (i.e. shuriken shape). Neither the angle nor the position of the bullets change here, for some odd reason (practically everything inside "while(Obj_BeDeleted)" does not work). What is the problem here?

Nothing wrong with your task from what I can tell in my quick glance. Is there a yield; in your @MainLoop?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Frazer on November 11, 2009, 05:22:34 AM
Nope. I just did that and it fixed.

I forgot about the yield. I really make the clumsiest mistakes sometimes.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Azure Lazuline on November 11, 2009, 05:28:05 AM
Aww, Mokou's circle script is fancier than mine... oh well, I'm sure mine has its uses. Mokou's is more customizable while mine has everything ready from the get-go.
Great tutorial by the way, you should put it in its own thread so it can have its own discussion.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye on November 11, 2009, 05:38:57 AM
@Fujiwara no Mokou
Thank you very much...now to create...5 Seasons...
& I agree with some others that all that should be an addition to a tutorial, it's own tutorial or
made into a thread topic for discussion...

Also thanks all others who helped me with whatever else I ask for help with...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 11, 2009, 05:46:23 AM
I haven't read it all yet, but that's still great. Especially if Hele can make use of this code. Probably deserves a spot somewhere as it's not exactly a tutorial, though. Post it on the wiki for sure.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 11, 2009, 05:48:56 AM
Think it's time we start compiling an "expert tutorial (or database)", which will most likely consist only of instructions for really complicated effects, much like this one.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 11, 2009, 05:50:05 AM
 ;D Haha thanks.  I think I'll get back to this later, though. There's a lot of work for me to do.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 11, 2009, 06:56:28 AM
Expert tutorial section , go.

I haven't read it all yet, but that's still great. Especially if Hele can make use of this code. Probably deserves a spot somewhere as it's not exactly a tutorial, though. Post it on the wiki for sure.

Definitely. I was fooling around already trying to shape but kept getting the sides wrong leaving a gap in the circle. Also the texture mapping was horrible. Now with this tutorial I can finally shape a good looking one.

I will read the tutorial fully tonight or so to try out things.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Nimble on November 11, 2009, 09:45:05 AM
Some graphic question :V

I looking for drawing function that can make a layer of BG and scroll them like in #BackGround, but don't find any.

I want to make multi layer scrolling background like this
(http://www.pocketonline.net/g2engine/d/36575-1/bgneed.JPG)
Is it possible in danmakufu?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 11, 2009, 10:09:08 AM
That is extremely easy.

somewhere in the beginning: let scrolling = 0;
Inside @BackGround:   
DrawGraphic(GetX, GetY+scrolling); <--- drawing
scrolling++;  <-- scroll speed.

Remember the order of drawing, the first drawn image is always at the bottom. The 2nd is above it etc.

Example:

// ground
SetTexture(ground);
blabla SetGraphicRect, Angle etc.
DrawGraphic(GetX, GetY+scrolling);

// bushes / forest
SetTexture(forest);
blabla SetGraphicRect, Angle etc.
DrawGraphic(GetX, GetY+scrolling2); <-- different speed or unless you are math whiz add math

// clouds
SetTexture(clouds);
blabla SetGraphicRect, Angle etc.
DrawGraphic(GetX, GetY+scrolling3);  <--- same as above
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 11, 2009, 10:20:10 AM
I have had a go at Fujiwara's spellcircle code, though I don't get the extreme complexity of the circle spawning. Note that the following is just an analysis. You can take it as you want it :V Right, to explain myself:

Am I missing vital information here why the circle has so many spreaded out math and functions? If I take a look for example at your Spellcircle code on page 5 ( didn't knew there was one there ). It is so much easier and simple to spawn. Aswell as achieving the same endresults for the simple beings. The difference I can tell between both codes is this one has the ability to retain image rects while shrinking.

Though I am puzzled why you are rotating the vertexs inside the code and not just use ObjEffect_SetAngle(0,0,spin);?

Also the double yield is not needed. The circle does spawn even if you call the task inside @initialize

I think we can make this spellcircle codewise more efficient. I'll dig bit more through it. I am having trouble with imitating so I will try the good old copy/paste method and then break down while analysing.


Edit: ( just a sum up what I personally think it can be improved / changed
I am not a math whizkid so for the "lagging" behaviour of the circle simply create a familiar upon spellcircle spawn and use the effect object code here. Then add a function for movement, see below.

task circleMove{loop{SetMovePosition03(GetEnemyX,GetEnemyY,10,10); yield;}}

- Double yields not needed
- Obj_SetPosition(objid,GetX,GetY);   inside the loop. to reposition the circle with the enemy.
- Rotation done with  ObjEffect_SetAngle(obj,0,0,rotation); ( eliminates the rotationspeed var, rotation can be kept just set the speed with  rotation++; or rotation+=5; or w/e )
        
I am liking Fujiwara's spellcircle code. It is strong, it just needs some cleanup that is all.
Double circle spawned , note how the outercircles are "lagging" behind the main spellcircle.
(http://i33.tinypic.com/23miv5.png)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Nimble on November 11, 2009, 10:54:07 AM
That is extremely easy.

somewhere in the beginning: let scrolling = 0;
Inside @BackGround:   
DrawGraphic(GetX, GetY+scrolling); <--- drawing
scrolling++;  <-- scroll speed.

Remember the order of drawing, the first drawn image is always at the bottom. The 2nd is above it etc.

Example:

// ground
SetTexture(ground);
blabla SetGraphicRect, Angle etc.
DrawGraphic(GetX, GetY+scrolling);

// bushes / forest
SetTexture(forest);
blabla SetGraphicRect, Angle etc.
DrawGraphic(GetX, GetY+scrolling2); <-- different speed or unless you are math whiz add math

// clouds
SetTexture(clouds);
blabla SetGraphicRect, Angle etc.
DrawGraphic(GetX, GetY+scrolling3);  <--- same as above
(http://www.pocketonline.net/g2engine/d/36581-2/dd5a410049c49567386a3295c56b85bdfc241f87.jpg) (http://www.pocketonline.net/g2engine/d/36580-1/dd5a410049c49567386a3295c56b85bdfc241f87.jpg)
Oh I didn't think of this..... oTL~

Thank you so much :)

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Infy♫ on November 11, 2009, 08:11:35 PM
I wonder if someone here could possibly make the music i got, playable for danmakufu? because some songs make danmakufu act weird or crash!
at certain points i am being forced to use songs i dont want to use or that dont fit very well...
or at least tell me how to make them playable using audacity
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: ^^flandre^^ on November 11, 2009, 08:15:28 PM
I wonder if someone here could possibly make the music i got, playable for danmakufu? because some songs make danmakufu act weird or crash!
at certain points i am being forced to use songs i dont want to use or that dont fit very well...
or at least tell me how to make them playable using audacity
Try to see if there are any similarities in the bitrate/sample rate of the songs you are using that work, and convert the songs that don't work according to those values.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 11, 2009, 08:52:37 PM
Convert your songs to non-variable bitrate .mp3 or .wav (former is preferred due to not being lolheug).
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Infy♫ on November 11, 2009, 09:15:32 PM
so how can i possibly change bitrate?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 11, 2009, 09:38:04 PM
Alright, I'm hearing some people telling me that I should put that little tutorial earlier in a wiki or something.
Where exactly do you guys want me to put it?

Also, just a heads up, my stage will come out soon. Just letting you guys know.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 11, 2009, 09:42:06 PM
Alright, I'm hearing some people telling me that I should put that little tutorial earlier in a wiki or something.
Where exactly do you guys want me to put it?

Also, just a heads up, my stage will come out soon. Just letting you guys know.

Would you atleast be so kind to read other people's posts, commenting/asking things about your posts?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 11, 2009, 10:03:57 PM
Would you atleast be so kind to read other people's posts, commenting/asking things about your posts?

I've read 'em.  Not many questions, though. Mostly comments that tell me that it should go put it into the new wiki
I don't know where it is
.

Oh, to answer your question. I'm not too good with lagging behavior, but I can figure it out.  Once again, we just need to use in our little friend sine so that it speeds up and slows down with the boss fluently instead of just following the boss dead-center.  When I first made the object, the two yields there were needed for the object effect to load.  It doesn't need it now, though, so you were right about that part.  I guess I changed something somewhere so it doesn't need it now.

As for the complexity of it all, it's all very simple.  For the rotation, you could use ObjEffect_SetAngle(0,0,spin);, or you could use ObjEffect_SetVertexXY(all the parameters);.  They both do exactly the same thing.  I honestly prefer doing it the second way though, because I can actually see what's happening when I do it, and change each individual vertices to my desire.  So lets say, one part of the circle spins faster than the other, and then it switches around, so the circle constantly warps and changes, without really changing shape. It's more flexible this way.

EDIT: Oh, and the spread out math is because putting everything straight out in SetVertexXY instead of letting variables represent them, makes the whole thing seam much more complex than it really is.  That's why I have so much letINX; let OUTX; let INY; letOUTY; there.  The added IN or RadiusIN, lets you change the pixel value where the inner vertices are, added to the real radius totalradius.  the OUT does the same thing, except it's 30 more pixels away from IN (which, in our case, just happens to be zero).  This gives our image width.  If IN=-totalradius, our inner vertices will be at the value of 0, or at GetY; (since the object constantly follows the boss, or whatever).  By changing it so it slowly goes toward 0 from -radius, the circle can have a stretching growing effect, similar to that ZUN uses in PCB and Danmakufu here does.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 11, 2009, 10:14:06 PM
Eh, you didn't quite understood it. First of all, I never asked anything more than the math coding. I was mere making comments / constructive critism on the rest of your code.

Lagging behaviour is just an extra for those who pay attention to detail.

Control all vertices as you desire? You are spawning them inside a loop to form a full circle. They all get standard data parsed with math to calculate a full circle. Unless you modify the math to shape it into something else ( like you star ). Neverless, I don't see the reason to move the vertices around unless you want them to warp. It needs at the end some math to achieve. ( not my expertise anyway )

They were just comments for the sake of simplicity and more clearer code. At the end, if it is going to be a tutorial it has to be clear from errors and unwanted things. Right now as it is, it is even more a chaos to figure what what is exactly happning during the code.

Same goes for the circle repositioning, I don't see it anywhere happening ( unless I am blind and missed something ).

That is all.

Edit: This convo btw reminds me to like really dig through my cutin script and like totally rescript it. Like it is now, my cutin script is kind of trash ( codewise ) ingame it just looks ok.

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 11, 2009, 10:23:01 PM
Standard, unless I put in an extra variable in there added where Z is, that changes as the circle forms.

Neverless, I don't see the reason to move the vertices around unless you want them to warp. It needs at the end some math to achieve. ( not my expertise anyway )

Haha, it's the small little details that nobody ever really notices that makes the game great.  It's a little habbit I picked up from ZUN.  Stuff like adding pointless and unneeded decorations to his characters make them get so much attention, and so much work for a small effect like the magic circle gives the game its spark.   These things add up. I put in a lot of time coding this stuff constantly tweaking things here and there, and adding sensless things like a circle that changes shape and follows the boss.  There are other things I put in my game, but I'm not going to tell any more until I finish the stage.

EDIT: is the cutin an object effect?  Because if it is, I recommend loading it on a 512 X 512 png and in DrawLoop for best quality (so it doesn't come out a little blurry).  You could do it as an object effect, but for some reason whenever I do that the Obj_SetAlpha doesn't work and I end up having to use ObjEffect_SetVertexColor.  I don't have much of a problem with that, except when the image loads from 0 alpha to 255, and then back to 0 again, the color values RGB also go up and down with it, so they're all tied together.  This makes the image looks dark when the alpha value is half of what it really is, where as in @DrawLoop, it will keep its color value even if the alpha value drops.  Again, this just might be because I'm using ObjEffect_SetVertexColor, but it doesn't work with Obj_SetAlpha when I'm using effect objects (or am I doing something wrong here?)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 11, 2009, 10:30:20 PM
I lol'ed a little ironic. You make it sound like nobody ( including me ) pays attention to them, the details.

If you are contributing something , atleast make it user friendly till a certain extend. We know this is expert material being discussed. But that doesn't mean it should be a labyrinth of code. And you didn't answered where the circle repositioning is occurring.

And nobody is telling you to reveal all your personal code secrets. :V we all have something to brag with. Because bragging and praising is what is all about no ? ( well, bragging is not really correct word. But coming up with something unique is always nice ).
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 11, 2009, 10:39:30 PM
Brag? Naaaaw, I'm just doing it for personal fun haha :D
Anyway, I'd like you to help me out a little.  Why isn't Obj_SetAlpha working? It's so puzzling, I want to change alpha value without SetVertexColor.

Code: [Select]
#TouhouDanmakufu
#Title[magic circle]
#Text[]
#Player[FREE]
#ScriptVersion[2]
 
script_enemy_main{
    let imagefile = GetCurrentScriptDirectory ~ "index.png";




    @Initialize{
      SetMovePosition02(GetCenterX,GetCenterY-100,0);
      SetLife(1);
      LoadGraphic(imagefile);
      object;
    }
 
    @MainLoop{
      yield;
    }
 
    @DrawLoop{
    }
 
    @BackGround{
    }
 
    @Finalize{
    }

   task object{   yield; yield;     

      let objid = Obj_Create(OBJ_EFFECT);
      Obj_SetX(objid, GetX);   
      Obj_SetY(objid, GetY);
      ObjEffect_SetScale(objid,1,1);
      ObjEffect_SetPrimitiveType(objid, PRIMITIVE_TRIANGLESTRIP); 
      ObjEffect_SetRenderState(objid,ALPHA);
      ObjEffect_SetTexture(objid, imagefile);

      let totalradius=100;   
      let repeat=2;         
      let sides=80;     
      let d=0;           
      let Z=0;           
      let RotateSpeed=1;     
      let IN=0;             
      let OUT=30;         

                Obj_SetAlpha(objid,0);
      ObjEffect_CreateVertex(objid, 2+sides*2); 


                     ascent(i in 0..sides+1){   

                         ObjEffect_SetVertexUV(objid,i*2,32,d*repeat/sides);
                         ObjEffect_SetVertexUV(objid,i*2+1,0,d*repeat/sides);   
                         d+=-256; 
                            }


      while(!Obj_BeDeleted(objid)){



                     ascent(i in 0..sides+1){         

                     let radiusINX=(totalradius+IN)*cos(i*360/sides +Z);
                     let radiusINY=(totalradius+IN)*sin(i*360/sides +Z);   

                     let radiusOUTX=(totalradius+OUT)*cos(i*360/sides +Z);
                     let radiusOUTY=(totalradius+OUT)*sin(i*360/sides +Z);

                         ObjEffect_SetVertexXY(objid, i*2, radiusINX, radiusINY);
                         ObjEffect_SetVertexXY(objid, i*2+1, radiusOUTX, radiusOUTY);


                           }

               yield;
               }


                   
   }
   








}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 11, 2009, 10:43:24 PM
I wish I could awnser that question. Unfortunate, you need SetVertexColor and modify alpha parameter. I was struggling hard with this when making the cutinscript when I discovered you cannot modify Alpha with Set_Alpha. I don't know why this is happening.

If we take a look at Wiki, it clearly reports SetAlpha modifies the alpha of the object. But we are not spawning objects but vertices. And therefor I think we can only use the setvertexcolor code.

Edit: To clarify. We are indeed creating an object with the first variable. But the Object gets the properties of an EffectObject. Therefor it won't listen anymore to certain parameters. Like  Obj_SetAngle --> becomes ObjEffect_SetAngle. I don't get the logic of SetAlpha for effect objects, surely it is purely meant for ObjectBullets, maybe lasers? I haven't really digged deep into this. But at the end it comes down to SetVertexColor. =((
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 11, 2009, 10:54:52 PM
Why isn't Obj_SetAlpha working? It's so puzzling, I want to change alpha value without SetVertexColor.

>Object Effect
>Change alpha without SetVertexColor

You can't.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 11, 2009, 10:56:53 PM
That's a problem.  Looks like my CutIn will have to go in DrawLoop instead...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 11, 2009, 11:01:39 PM
??

Just default the rgb to 255 and change only the alpha! It's the exact same thing as SetAlpha expect requires you to type a bit more (which you can circumvent with ctrl c and v)!

How is that a problem?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 11, 2009, 11:34:14 PM
Because the SetVertex makes the image darker. Even though We're only changing the Alpha value, the color value changes with it.

Experiment with an image in Drawloop with alpha rendering, and compare it to the same images, but with the vertices.  You'll see what I mean. The image gets darker.  I don't like that.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on November 12, 2009, 01:59:24 AM
How would you make bullets that intertwine with another stream? like in Kanako's Cross spell thing...errr like this
Lol sorry for the horrible picture, done with out glasses and in MS paint..

(http://i600.photobucket.com/albums/tt84/Happyhobo810/rarw.jpg)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 12, 2009, 02:42:34 AM
Code: [Select]
task spiral(minx,miny,freq,amp){
    let count = 0;
    while(count<GetClipMaxY-miny){
        CreateShot01(minx, miny+(count),0,90,WHITE05,10);
        CreateShot01(minx+((sin((miny+(count))*freq))*amp), miny+(count),0,90,WHITE05,10);
        count+=3;
        yield;
    }
}

change as you will, very basic
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Cabble on November 12, 2009, 03:16:21 AM
Whenever I start danmakufu, nothing happens. The process is up, but the window doesn't appear. Then, whenever I delete the process, it deletes explorer.exe too. I think the explorer.exe part is just my computer however. Any help?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 12, 2009, 01:44:34 PM
Whenever I start danmakufu, nothing happens. The process is up, but the window doesn't appear. Then, whenever I delete the process, it deletes explorer.exe too. I think the explorer.exe part is just my computer however. Any help?

Danmaku needs to be run under Japanese language in Applocale. Have you tried that?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on November 12, 2009, 02:51:27 PM
How would you make bullets that intertwine with another stream? like in Kanako's Cross spell thing...errr like this
Lol sorry for the horrible picture, done with out glasses and in MS paint..

Is it like in Yuugi's midboss spell?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 12, 2009, 04:00:58 PM
Updated spiral thing, still haven't fixed the odd angle problem.

Code: [Select]
task spiral(minx,miny,angle,freq,amp,dens){
    let count = 0;
    let posx = minx;
    let posy = miny;
    while(posx<GetClipMaxX && posy<GetClipMaxY && posx>GetClipMinX && posy>GetClipMinY){
        CreateShot01(minx+(cos(angle)*count),miny+(sin(angle)*count),1,count*4,WHITE05,10);
        CreateShot01(minx+(cos(angle)*count)+(cos(sin(angle)*count*freq)*amp),miny+(sin(angle)*count)+(sin(cos(angle)*count*freq)*amp),1,count*4,WHITE05,10);
        count+=dens;
        posx+=cos(angle)*dens;
        posy+=sin(angle)*dens;
    yield;
    }
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Infy♫ on November 12, 2009, 04:24:31 PM
so how can i change the bitrate of songs in audacity?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 12, 2009, 05:36:18 PM
Project -> Import Audio -> file
On the left where the filename is, click the dropdown arrow.
Set Rate -> choose bitrate
File -> Export as MP3
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: NOVA on November 12, 2009, 09:47:35 PM
Two things.

How do you make a laser get wider as it fires ( i know how to make it longer but not wider)
like master spark style

and

what is the best way to make semi-homing bullet, or at least one that changes angle to the the player at least once or twice durings its flight
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on November 12, 2009, 09:57:57 PM
True homing bullets can be created using object bullets, and one possible code for them is actually on the touhou wiki: http://touhou.wikia.com/wiki/Touhou_Danmakufu:_Object_Bullets (http://touhou.wikia.com/wiki/Touhou_Danmakufu:_Object_Bullets)

To change the size of a laser, I'd also recommend using an object laser and then calling ObjLaser_SetWidth(obj, ObjLaser_GetWidth(obj) + 0.1); in the main part.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 13, 2009, 12:33:20 AM
Hi guys am I not allowed to add enemy IDs to an array or

Code: [Select]
let ar = [];
let enx = 0;
let eny = 0;
if(GetEnemyNum>0){
ascent(i in EnumEnemyBegin..EnumEnemyEnd){
let ene = EnumEnemyGetID(i);
ar = ar ~ ene;
}
let r = ar[rand_int(0, length(ar))];
enx = GetEnemyInfo(r, ENEMY_X);
eny = GetEnemyInfo(r, ENEMY_Y)
}else{
enx = rand(50, 398);
eny = rand(50, 150);
}

(http://i641.photobucket.com/albums/uu134/Nautth/sdgherxjfyhg.jpg)

i r not gud wit arrays wat i do
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Nuclear Cheese on November 13, 2009, 12:39:53 AM
Hi guys am I not allowed to add enemy IDs to an array or

Code: [Select]
let ar = [];
let enx = 0;
let eny = 0;
if(GetEnemyNum>0){
ascent(i in EnumEnemyBegin..EnumEnemyEnd){
let ene = EnumEnemyGetID(i);
ar = ar ~ ene;
}
let r = ar[rand_int(0, length(ar))];
enx = GetEnemyInfo(r, ENEMY_X);
eny = GetEnemyInfo(r, ENEMY_Y)
}else{
enx = rand(50, 398);
eny = rand(50, 150);
}

image

i r not gud wit arrays wat i do

Should be:
ar = ar ~ [ene];

You have to put ene into an array, then concatenate that new array with the existing array.



Also, it should be:
let r = ar[rand_int(0, length(ar) - 1)];

If you random to element length(ar), it'll error.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 13, 2009, 12:43:35 AM
yaaay NC yaaay tyilu
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: NOVA on November 13, 2009, 12:58:29 AM
Code: [Select]
{

task THomingShot (GetX, GetY, 2, 90, RED02, 10);
 {
 
    let obj = Obj_Create(OBJ_SHOT);

   
    Obj_SetPosition   (obj, GetX, GetY);
    Obj_SetSpeed      (obj, 2);
    ObjShot_SetGraphic(obj, RED02);
    ObjShot_SetDelay  (obj, 10);


    let maxTraverse = 0.5; 
    while(! Obj_BeDeleted(obj)) {
        Obj_SetAngle(obj, 90);
        yield;

 
        let dir = atan2(GetPlayerY - Obj_GetY(obj),
                        GetPlayerX - Obj_GetX(obj));

        let diff = dir - angle;
        while(diff >= 180) { diff -= 360; } 
        while(diff < -180) { diff += 360; }

        let diffAbs = (|diff|);
        if(diffAbs < maxTraverse) {

            angle = dir;
        } else {

            angle += maxTraverse * diff / diffAbs;
        }
    }
}

it says i need a parathesis somewhere, or something
what
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 13, 2009, 02:18:37 AM
Code: [Select]
{

task THomingShot (GetX, GetY, 2, 90, RED02, 10);
 {
 
    let obj = Obj_Create(OBJ_SHOT);

   
    Obj_SetPosition   (obj, GetX, GetY);
    Obj_SetSpeed      (obj, 2);
    ObjShot_SetGraphic(obj, RED02);
    ObjShot_SetDelay  (obj, 10);


    let maxTraverse = 0.5; 
    while(! Obj_BeDeleted(obj)) {
        Obj_SetAngle(obj, 90);
        yield;

 
        let dir = atan2(GetPlayerY - Obj_GetY(obj),
                        GetPlayerX - Obj_GetX(obj));

        let diff = dir - angle;
        while(diff >= 180) { diff -= 360; } 
        while(diff < -180) { diff += 360; }

        let diffAbs = (|diff|);
        if(diffAbs < maxTraverse) {

            angle = dir;
        } else {

            angle += maxTraverse * diff / diffAbs;
        }
    }
}

it says i need a parathesis somewhere, or something
what
Okay to answer this question, I need to start somewhere small and work my way up. Bear with me for a bit.  :-X

First let's explain a subroutine. Here's an example of a simple one.

sub CreateRingShot {
    ascent(i in 0..36) {
        CreateShot01(GetX, GetY, 2, i*10, RED01, 10);
    }
}

If you take a look at what's inside the subroutine, it makes 36 bullets on the boss shooting out in a ring. Now, just having that subroutine there isn't going to make the boss actually shoot that ring because all we've done here is define the subroutine. To actually make the boss use that behavior, you have to call the subroutine somewhere in the @MainLoop. Basically, all instances of CreateRingShot; will be replaced with that ascent that spawns the ring. This is usually used to help stay organized.

Now for functions. Functions are more complicated versions of subroutines because they are more flexible. Using the last example, here's an altered version that grants more flexibility:

function CreateRingShot(speed, graphic, delay) {
    ascent(i in 0..36) {
        CreateShot01(GetX, GetY, speed, i*10, graphic, delay);
    }
}

Again, just writing that doesn't make the boss actually do those actions yet since we only defined the function. In fact, as it is now, the speed, graphic, and delay isn't even known yet, right? That's because when you call the function with CreateRingShot, you'll be telling it what speed, graphic, and delay to use at that time. This means you can write something like CreaterRingShot(1, RED22, 5); and it'll make a ring of RED22 bullets delayed for 5 frames with a speed of 1. You can pass in any other variation you want and it'll use what you tell it to use. Just make sure you don't tell it to try to use YELLOW11 as a speed or something or, of course, Danmakufu is gonna yell at you in moonspeak.

And now, tasks. Tasks are even more flexible versions of functions because they can be paused at any time instead of being run all at once in one frame. To pause a task, all you need to do is tell it to yield. When it yields, it'll stop running until the next time it encounters a yield in the @MainLoop. When the script encounters a yield in the @MainLoop, it'll continue any task that hasn't been completed yet from the last time it yielded. Here's an example, again based on what we've been working on before with the ring shot:

task CreateRingShot(speed, graphic, delay) {
    ascent(i in 0..36) {
        CreateShot01(GetX, GetY, speed, i*10, graphic, delay);
        yield;
    }
}

This task is only slightly different from the previous function. All I did was change function to task and add a yield; after each create shot. (This task yields 36 times because the ascent loops 36 times to create 36 shots). Don't forget to put a yield; in the @MainLoop too so that it gets called every frame as well. Otherwise, the tasks that haven't finished yet can't continue. Now, when you call CreateRingShot(1, RED22, 10); the ring won't spawn each bullet all in the same frame, but 1 per frame instead.

Hopefully, you understand a little better why your task is giving you errors. If not, you probably shouldn't even be trying to use tasks yet. Instead, try using subroutines and then working your way up to functions and tasks as you get the hang of them.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye on November 13, 2009, 04:03:39 AM
hi, yeah, another question...how do I get an enemy to move along a path that looks like a complete circle...?
can't quite get it...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on November 13, 2009, 04:04:38 AM
hi, yeah, another question...how do I get an enemy to move along a path that looks like a complete circle...?
can't quite get it...
SetMovePosition02(x+radius*cos(a), y+radius*sin(a), frames);
I think...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on November 13, 2009, 04:08:44 AM
hi, yeah, another question...how do I get an enemy to move along a path that looks like a complete circle...?
can't quite get it...

use SetMovePositionHerminte, its in the Tutorials
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye on November 13, 2009, 04:11:09 AM
use SetMovePositionHerminte, its in the Tutorials

oh, my bad, not used to enemy scripts...I'll umm, check that out then...thanks...

anywho...next question...
How the hell, do I use "GetTimer" to make something happen at a certain point after
the spellcard has started like 30secs into the spellcard attack?
...I don't even understand the parameters of this function...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on November 13, 2009, 06:59:25 AM
oh, my bad, not used to enemy scripts...I'll umm, check that out then...thanks...

anywho...next question...
How the hell, do I use "GetTimer" to make something happen at a certain point after
the spellcard has started like 30secs into the spellcard attack?
...I don't even understand the parameters of this function...
if(GetTimer < a certain number) { variable++; } is what I use to make stuff happen after like, the timer reads 60 secs and under.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye on November 13, 2009, 07:18:22 AM
thanks Always お⑨烏...

last question for now...hopefully...
what the hell is wrong with this script(& it's not a directory issue I know that already, thus no image files...)...?
Code: [Select]
#TouhouDanmakufu
#Title[Pattern003]
#Text[]
#Image[.\system\ArtMirror.png]
#BackGround[.\system\BGMirror.png]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{
  let CSD = GetCurrentScriptDirectory();
  let imgBoss = CSD ~ ".\system\Mirror.png";
  let m = 0;

  @Initialize{
    SetLife(4000);
    SetTimer(66);
    SetInvincibility(180);
    SetScore(666666);
    MagicCircle(false);
    Expert;
    SetMovePosition01(GetCenterX, GetCenterY-150, 1);
    LoadGraphic(imgBoss);
    mainTask;
  }

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

  @DrawLoop{
    SetTexture(imgBoss);
    SetRenderState(ALPHA);
    SetAlpha(250);
    SetGraphicScale(1, 1);
    SetGraphicAngle(0, 0, 0);
    if(GetEnemyLife>2000){SetGraphicRect(0, 44, 47, 75);} //Purple
    if(GetEnemyLife<2000){SetGraphicRect(51, 44, 98, 75);} //Orchid?...
    if(GetEnemyLife<750){SetGraphicRect(102, 44, 149, 75);} //Gray
    }
    DrawGraphic(GetX, GetY);
    m++;
    if(m==30){m=0;}
  }

  @Background{
  }

  @Finalize{
    DeleteGraphic(imgBoss);
  }

  task mainTask{
    wait(90);
    yield;
    movement;
    fire;
  }

  task movement{
    loop{
      SetMovePosition02(GetCenterX+50, GetCenterY-100, 60);
      wait(61);
      SetMovePosition02(GetCenterX, GetCenterY-50, 60);
      wait(61);
      SetMovePosition02(GetCenterX-50, GetCenterY-100, 60);
      wait(61);
      SetMovePosition02(GetCenterX, GetCenterY-150, 60);
      wait(61);
      yield;
    }
  }

  task fire{
    let x = 0;
    let dirf = 0;
    loop{
      while(x<36){
        CreateShotA(5, GetEnemyX+25*cos(dirf), GetEnemyY+25*sin(dirf), 6);
        SetShotDataA(5, 0, 2, dirf, 0.4, 0, 3, WHITE05);
        FireShot(5);
        CreateShotA(5, GetEnemyX+25*cos(dirf), GetEnemyY+25*sin(dirf), 6);
        SetShotDataA(5, 90, 2, dirf, -0.2, 0, 3, WHITE05);
        FireShot(5);
        CreateShotA(5, GetEnemyX+25*cos(dirf), GetEnemyY+25*sin(dirf), 6);
        SetShotDataA(5, 180, 2, dirf, 0.4, 0, 3, WHITE05);
        FireShot(5);
        CreateShotA(5, GetEnemyX+25*cos(dirf), GetEnemyY+25*sin(dirf), 6);
        SetShotDataA(5, 270, 2, dirf, -0.2, 0, 3, WHITE05);
        FireShot(5);
        dirf+=360/36;
        x++;
      }
    x = 0;
    dirf = 0;
    wait(60);
    yield;
    }
  }

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

}
it keeps returning the error below;
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 13, 2009, 07:24:06 AM
thanks Always お⑨烏...

last question for now...hopefully...
what the hell is wrong with this script(& it's not a directory issue I know that already, thus no image files...)...?
Code: [Select]
#TouhouDanmakufu
#Title[Pattern003]
#Text[]
#Image[.\system\ArtMirror.png]
#BackGround[.\system\BGMirror.png]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{
  let CSD = GetCurrentScriptDirectory();
  let imgBoss = CSD ~ ".\system\Mirror.png";
  let m = 0;

  @Initialize{
    SetLife(4000);
    SetTimer(66);
    SetInvincibility(180);
    SetScore(666666);
    MagicCircle(false);
    Expert;
    SetMovePosition01(GetCenterX, GetCenterY-150, 1);
    LoadGraphic(imgBoss);
    mainTask;
  }

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

  @DrawLoop{
    SetTexture(imgBoss);
    SetRenderState(ALPHA);
    SetAlpha(250);
    SetGraphicScale(1, 1);
    SetGraphicAngle(0, 0, 0);
    if(GetEnemyLife>2000){SetGraphicRect(0, 44, 47, 75);} //Purple
    if(GetEnemyLife<2000){SetGraphicRect(51, 44, 98, 75);} //Orchid?...
    if(GetEnemyLife<750){SetGraphicRect(102, 44, 149, 75);} //Gray
    }
    DrawGraphic(GetX, GetY);
    m++;
    if(m==30){m=0;}
  }

  @Background{
  }

  @Finalize{
    DeleteGraphic(imgBoss);
  }

  task mainTask{
    wait(90);
    yield;
    movement;
    fire;
  }

  task movement{
    loop{
      SetMovePosition02(GetCenterX+50, GetCenterY-100, 60);
      wait(61);
      SetMovePosition02(GetCenterX, GetCenterY-50, 60);
      wait(61);
      SetMovePosition02(GetCenterX-50, GetCenterY-100, 60);
      wait(61);
      SetMovePosition02(GetCenterX, GetCenterY-150, 60);
      wait(61);
      yield;
    }
  }

  task fire{
    let x = 0;
    let dirf = 0;
    loop{
      while(x<36){
        CreateShotA(5, GetEnemyX+25*cos(dirf), GetEnemyY+25*sin(dirf), 6);
        SetShotDataA(5, 0, 2, dirf, 0.4, 0, 3, WHITE05);
        FireShot(5);
        CreateShotA(5, GetEnemyX+25*cos(dirf), GetEnemyY+25*sin(dirf), 6);
        SetShotDataA(5, 90, 2, dirf, -0.2, 0, 3, WHITE05);
        FireShot(5);
        CreateShotA(5, GetEnemyX+25*cos(dirf), GetEnemyY+25*sin(dirf), 6);
        SetShotDataA(5, 180, 2, dirf, 0.4, 0, 3, WHITE05);
        FireShot(5);
        CreateShotA(5, GetEnemyX+25*cos(dirf), GetEnemyY+25*sin(dirf), 6);
        SetShotDataA(5, 270, 2, dirf, -0.2, 0, 3, WHITE05);
        FireShot(5);
        dirf+=360/36;
        x++;
      }
    x = 0;
    dirf = 0;
    wait(60);
    yield;
    }
  }

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

}
it keeps returning the error below;

It's an issue with brackets. Yes, seriously. Your @DrawLoop has an extra } before the DrawGraphic.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye on November 13, 2009, 07:31:10 AM
It's an issue with brackets. Yes, seriously. Your @DrawLoop has an extra } before the DrawGraphic.

Woah, got to be even more careful with that then I already was...extra bracket,
this is not my day...oh, thanks Blargel seriously, this was killing me mentally...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Henry on November 13, 2009, 04:06:41 PM
What do you mean reflect? Like create a 2nd image next to it being mirrored? Or are you trying to simply flip/mirror a graphic?
I meant just reflect it.
However, when I use the enemy sprite from SA, I cannot rotate the sprite well :(
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 13, 2009, 07:35:23 PM
I still don't really get it but for mirroring just use the SetGraphicAngle(180,0,0);  to mirror the image.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 14, 2009, 02:57:59 AM
Alright, so here's a question.

Bullets that are spawned and fired at random times, I want all of them to react to something at once. Such as a timer or something.  Is there a way to do this with CreateShotA's/SetShotDataA's?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 14, 2009, 03:07:03 AM
CreateShotA(0, GetX, GetY, delay);
SetShotDataA(0, 0, speed, angle, 0, 0, 0, RED01);
SetShotDataA(0, (Time to do whatever you want) - delay, speed, angle, 0, 0, 0, RED01);
FireShot(0);

Subtract the difference between the time your first bullet was fired and your last bullet fired too, if you are spawning them on different frames, like this:


let time = 0;
let delay = 20;
loop(10){
   CreateShotA(0, GetX, GetY, delay);
   SetShotDataA(0, 0, 3, 180, 0, 0, 0, RED01);
   SetShotDataA(0, 120 - delay - time, 4, 90, 0, 0, 0, BLUE01);
   FireShot(0);
   time++;
   delay-=2;
   yield;
}

All the bullets will shoot downwards at the same time.

What you're doing is much easier to accomplish with true randomness by using object bullets, however.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 14, 2009, 04:53:09 AM
Oh wow, thanks. I can make some really nice patterns with this.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: puremrz on November 14, 2009, 11:54:25 AM
Brainfart: How do you calculate the distance between two objects again?
I'm making something like SetMovePosition03, but for all objects, not bosses alone.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on November 14, 2009, 01:05:16 PM
Brainfart: How do you calculate the distance between two objects again?
I'm making something like SetMovePosition03, but for all objects, not bosses alone.

use the pythagorean theorem a^2+b^2=c^2 or in this case
((objaX-objbX)^2+(objaY-objbY)^2)^0.5
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: puremrz on November 14, 2009, 01:45:45 PM
use the pythagorean theorem a^2+b^2=c^2 or in this case
((objaX-objbX)^2+(objaY-objbY)^2)^0.5

Ah, that helped me indeed (Although someone managed to help me earlier with this), still, thanks for the help. I got it working now, woohoo!
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye on November 14, 2009, 07:36:13 PM
alright new question...

I want my player to have it's option shots change among more then two styles one at a time
each time I press C(& only if I press C & not otherwise)...I'm even having trouble using the
GetKeyState(VK_USER) function which I don't even know if it will help me here...how do I approach this exactly?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on November 14, 2009, 09:30:40 PM
alright new question...

I want my player to have it's option shots change among more then two styles one at a time
each time I press C(& only if I press C & not otherwise)...I'm even having trouble using the
GetKeyState(VK_USER) function which I don't even know if it will help me here...how do I approach this exactly?
if(GetKeyState(VK_USER)==KEY_PUSH) { options++; }
...
if(options==??) { shoot; }
else if(options==???) { shootsomething; }
else { stuff; }
...is how I made my player do that.

Oh wait...
Do you mean "if you are pressing or holding C, make the option do this, otherwise if not not pressing C, do this other thing"?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 14, 2009, 09:32:41 PM
Obviously you want to set double statements like 

If(GetKeyState(VK_USER)==KEY_PUSH && GetKeyState(alltheothers)==KEY_FREE) {  do stuff  }

I hope.

Edit:  On wiki: http://touhou.wikia.com/wiki/Touhou_Danmakufu:_Mathematical_or_Information_Functions#GetKeyState

        KEY_FREE: the key is free
        KEY_PUSH: the key is pushed now
        KEY_HOLD: the key is holding
        KEY_PULL: the key is released now
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye on November 14, 2009, 09:53:58 PM
Oh wait...
Do you mean "if you are pressing or holding C, make the option do this, otherwise if not not pressing C, do this other thing"?
...no I do not...a matter of fact, I mean if I press C & then let go...then my forward shot will now be a spread shot...in other words...press C(while forward shot is activated) to then activate spread shot...

Obviously you want to set double statements like

If(GetKeyState(VK_USER)==KEY_PUSH && GetKeyState(alltheothers)==KEY_FREE) {  do stuff }

I hope.


yeah that's what I was doing but inside a task to avoid making task Option(position) or @MainLoop oh my god fucking huge...so, I guess I will ask how to set the above up in a task so that it would work...cause I tried about 3 ways & umm...yeah, no luck...

oh, & I saw the wiki...very clear that I need to type it...like that, but the do stuff part is working me over...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on November 17, 2009, 05:30:24 AM
Mukyu~! my question is...uhh...what was it >_<;!!!!

ah! thats it!

i know i asked about if and while statements earlier, but, in order for it to work, it needs to be something like
if(lalalala){
stuff;
  }else(if( more stuff)){}
right?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 17, 2009, 05:48:27 AM
if(lalala){
    stuff;
}else{
    morestuff;
}

or

if(lalala){
    stuff;
}else if(popopo){
    morestuff;
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on November 17, 2009, 12:15:53 PM
Ok, umm... so I couldn't really understand what azure and fujiwara were saying about bending lines into circles as effect objects, so I thought up of my own way to do it. Problem is... this would probably be just the same thing as they said, and I'm thinking that this would have some flexibility issues too... anyway... I just wanted to ask that this is already technically the basics of it right? (no I didn't take any ideas from anyone, this was just how I thought of doing it)

Code: [Select]
script_enemy_main {

let frame=0;
let cx=GetCenterX();
let circlepic=GetCurrentScriptDirectory~"circlepic.png";
task circle
{
let timera=GetTimer*60; //set the 2 timer variables that deal with the shrinking of the circle
let timerb=GetTimer*60;
let radius=0; //set the radius as 0 because of the growing effect at the start
let radiusstart=150; //set the radius of wanted circle, may be changed to whatever you want
let circlethickness=30; //set the thinkness or width of the circle, may be changed as wanted
let growcounter=0; //set counter
let growtime=60; //set how long the circle would take to grow, may be changed to anything
let x=GetX; //set where the circle would appear
let y=GetY; //set where the circle would appear
let vertexnum=500; //set the number of vertices, may be changed to whatever
let graphendY=256; //set the bottom of the graphic (I put it here for easier understanding)
let graphendX=32; //set the rightmost part of the graphic (I put it here for easier understanding)
let angle=0; //set the starting angle
let rotatespeed=2; //set how fast it rotates

let circle=Obj_Create(OBJ_EFFECT); //create the circle
ObjEffect_SetTexture(circle, circlepic); //set graphic
ObjEffect_CreateVertex(circle, vertexnum+2); //create vertices (the plus 2 is because it won't be a complete circle without it)
ObjEffect_SetPrimitiveType(circle, PRIMITIVE_TRIANGLESTRIP); //set primitive state
ascent(i in 0..vertexnum+2)
{
if(i%2==0){
ObjEffect_SetVertexUV(circle, i, 0, floor(i/2)*((2*graphendY)/vertexnum)); //set locations in the picture (graphendY and graphendX, later, were used to make things clearer)
ObjEffect_SetVertexXY(circle, i, x+radius*cos(floor(i/2)*(720/vertexnum)+angle), y+radius*sin(floor(i/2)*(720/vertexnum)+angle)); //set locations in the game (the center of the circle + the distance in x and y using sine and cosine)
}else{
ObjEffect_SetVertexUV(circle, i, graphendX, floor(i/2)*((2*graphendY)/vertexnum)); //set locations in the picture
ObjEffect_SetVertexXY(circle, i, x+(radius+circlethickness)*cos(floor(i/2)*(720/vertexnum)+angle), y+(radius+circlethickness)*sin(floor(i/2)*(720/vertexnum)+angle));  //set locations in the game

}
}
while(Obj_BeDeleted(circle)==false)
{
yield;
angle+=rotatespeed;
timerb--; //remove if you don't want the circle to shrink
x=GetX; //change to whereever you want the circle to be
y=GetY; //change to whereever you want the circle to be
ascent(i in 0..vertexnum+2)
{
if(i%2==0){
ObjEffect_SetVertexXY(circle, i, x+radius*cos(floor(i/2)*(720/vertexnum)+angle), y+radius*sin(floor(i/2)*(720/vertexnum)+angle)); //set location
}else{
ObjEffect_SetVertexXY(circle, i, x+(radius+circlethickness)*cos(floor(i/2)*(720/vertexnum)+angle), y+(radius+circlethickness)*sin(floor(i/2)*(720/vertexnum)+angle)); //set location
}
}
growcounter++; //handle growing
if(growcounter<=growtime)
{
radius+=radiusstart/growtime; //growth
}else{
radius=radiusstart*(timerb/timera)-1; //shrinking
}
}
}

@Initialize
{
SetLife(1);
SetTimer(60);
LoadGraphic(circlepic);
SetMovePosition02(cx,120,50);
}

@MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
frame++;
yield;
if(frame==1)
{
circle;
}
}

@Finalize
{
DeleteGraphic(circlepic);
}

@DrawLoop
{
}
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 17, 2009, 05:01:39 PM
Ok, umm... so I couldn't really understand what azure and fujiwara were saying about bending lines into circles as effect objects, so I thought up of my own way to do it. Problem is... this would probably be just the same thing as they said, and I'm thinking that this would have some flexibility issues too... anyway... I just wanted to ask that this is already technically the basics of it right? (no I didn't take any ideas from anyone, this was just how I thought of doing it)

Code: [Select]
script_enemy_main {

let frame=0;
let cx=GetCenterX();
let circlepic=GetCurrentScriptDirectory~"circlepic.png";
task circle
{
let timera=GetTimer*60; //set the 2 timer variables that deal with the shrinking of the circle
let timerb=GetTimer*60;
let radius=0; //set the radius as 0 because of the growing effect at the start
let radiusstart=150; //set the radius of wanted circle, may be changed to whatever you want
let circlethickness=30; //set the thinkness or width of the circle, may be changed as wanted
let growcounter=0; //set counter
let growtime=60; //set how long the circle would take to grow, may be changed to anything
let x=GetX; //set where the circle would appear
let y=GetY; //set where the circle would appear
let vertexnum=500; //set the number of vertices, may be changed to whatever
let graphendY=256; //set the bottom of the graphic (I put it here for easier understanding)
let graphendX=32; //set the rightmost part of the graphic (I put it here for easier understanding)
let angle=0; //set the starting angle
let rotatespeed=2; //set how fast it rotates

let circle=Obj_Create(OBJ_EFFECT); //create the circle
ObjEffect_SetTexture(circle, circlepic); //set graphic
ObjEffect_CreateVertex(circle, vertexnum+2); //create vertices (the plus 2 is because it won't be a complete circle without it)
ObjEffect_SetPrimitiveType(circle, PRIMITIVE_TRIANGLESTRIP); //set primitive state
ascent(i in 0..vertexnum+2)
{
if(i%2==0){
ObjEffect_SetVertexUV(circle, i, 0, floor(i/2)*((2*graphendY)/vertexnum)); //set locations in the picture (graphendY and graphendX, later, were used to make things clearer)
ObjEffect_SetVertexXY(circle, i, x+radius*cos(floor(i/2)*(720/vertexnum)+angle), y+radius*sin(floor(i/2)*(720/vertexnum)+angle)); //set locations in the game (the center of the circle + the distance in x and y using sine and cosine)
}else{
ObjEffect_SetVertexUV(circle, i, graphendX, floor(i/2)*((2*graphendY)/vertexnum)); //set locations in the picture
ObjEffect_SetVertexXY(circle, i, x+(radius+circlethickness)*cos(floor(i/2)*(720/vertexnum)+angle), y+(radius+circlethickness)*sin(floor(i/2)*(720/vertexnum)+angle));  //set locations in the game

}
}
while(Obj_BeDeleted(circle)==false)
{
yield;
angle+=rotatespeed;
timerb--; //remove if you don't want the circle to shrink
x=GetX; //change to whereever you want the circle to be
y=GetY; //change to whereever you want the circle to be
ascent(i in 0..vertexnum+2)
{
if(i%2==0){
ObjEffect_SetVertexXY(circle, i, x+radius*cos(floor(i/2)*(720/vertexnum)+angle), y+radius*sin(floor(i/2)*(720/vertexnum)+angle)); //set location
}else{
ObjEffect_SetVertexXY(circle, i, x+(radius+circlethickness)*cos(floor(i/2)*(720/vertexnum)+angle), y+(radius+circlethickness)*sin(floor(i/2)*(720/vertexnum)+angle)); //set location
}
}
growcounter++; //handle growing
if(growcounter<=growtime)
{
radius+=radiusstart/growtime; //growth
}else{
radius=radiusstart*(timerb/timera)-1; //shrinking
}
}
}

@Initialize
{
SetLife(1);
SetTimer(60);
LoadGraphic(circlepic);
SetMovePosition02(cx,120,50);
}

@MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
frame++;
yield;
if(frame==1)
{
circle;
}
}

@Finalize
{
DeleteGraphic(circlepic);
}

@DrawLoop
{
}
}

Hmmm, it looks a bit chaotic.  My tutorial isn't that hard to understand, is it?
From what I see, you're getting the basics right, but I don't see why you take the long route to do some things, like set the individual X and Y parameters for the circle instead of Obj_SetPosition(id#,GetX,GetY);. It would get some of those annoying variables out of the way.  But aside from those things, you pretty much have it down.  Also, what's that "floor" variable doing there?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 17, 2009, 05:25:24 PM
>floor
>variable

wut
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 17, 2009, 08:03:55 PM
Useful post as always, Drake

floor() is a function that will take whatever number you input in it and round to the integer less than or equal to that number.

floor(3.1) = 3
floor(2) = 2
floor(1.5) = 1
floor(8.99999999) = 8

ceil() works the opposite way, converting to the nearest integer greater than or equal to that number.

ceil(3.1) = 4
ceil(2) = 2
ceil(1.5) = 2
ceil(8.999999999) = 9

round() does exactly what you think it does.

round(3.1) = 3
round(2) = 2
round(1.5) = 2
round(8.99999999) = 9

truncate() or trunc() cuts off (truncates) any decimal portion of a real number, converting it to an integer. It works the exact same way as floor(), pretty much.

trunc(3.1) = 3
trunc(2) = 2
trunc(1.5) = 1
trunc(8.9999999) = 8

The more you know

Edit: weeeee
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 17, 2009, 09:07:22 PM
And by ciel, I'm sure Naut means ceil.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 17, 2009, 10:52:31 PM
Consider it a fit of stupidity.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on November 18, 2009, 03:18:31 AM
Hmmm, it looks a bit chaotic.  My tutorial isn't that hard to understand, is it?
From what I see, you're getting the basics right, but I don't see why you take the long route to do some things, like set the individual X and Y parameters for the circle instead of Obj_SetPosition(id#,GetX,GetY);. It would get some of those annoying variables out of the way.  But aside from those things, you pretty much have it down.  Also, what's that "floor" variable doing there?

I put the X and Y variables there to show that it can be placed anywhere and not just on the boss and to show that you can move it around while it exists... floor's there because I only made one ascent, for both the inner and outer vertices of the circle, so the odd numbers will have the same angle as their even pairs.

Where exactly am I making things harder for myself/taking the long route??? I placed most of the variables there just to make things clearer and more flexible without prying in the code too much...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on November 18, 2009, 04:52:49 AM
I just realized something.

Usually when you make a script, as you test it, it becomes harder and harder to tell what's a cheap shot and what's not. For instance the random train spell I made is easy enough, but I'm sure if someone randomly picked it up they would be cheapshotted a ton of times because they don't know the pattern.

So what's the solution? In order to pick out these things and properly balance these things, you'd have put your mind into a state where you won't remember exactly what you made and won't be alert to these things.

In other words.


(http://img42.imageshack.us/img42/6730/zunandhisbeer.png)



:V The secret to everything :V
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 18, 2009, 11:05:27 AM
Drake, I didn't understand a thing of the spellcircle slingshot effect code. Therefor reasking it again =.=. I am a failure in math so this is the following I want to achieve by math (else I could take the long road)

- My spellcircle has starting size: 80.
- I want it to grow to 180 with an accelerating speed.
- When it reaches close to 180 I want it to deaccelerate
- At size 180 it should start shrinking with acceleration untill it reaches it's final size: 150

HOW ?!
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on November 18, 2009, 12:11:17 PM
I FAILED at trying to make my circle bend... but this was just too awesome to not show anyone... (that weird thing actually moves and keeps on creating more weird stuff, but still stays circular...)

I tried to do this just because of boredom and curiosity, so no need to explain to me how it works if you wanna explain... I was just bored :V and who knows... I may actually use this weird bending effect sometime in the future...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 18, 2009, 02:22:14 PM
Drake, I didn't understand a thing of the spellcircle slingshot effect code. Therefor reasking it again =.=. I am a failure in math so this is the following I want to achieve by math (else I could take the long road)

- My spellcircle has starting size: 80.
- I want it to grow to 180 with an accelerating speed.
- When it reaches close to 180 I want it to deaccelerate
- At size 180 it should start shrinking with acceleration untill it reaches it's final size: 150

HOW ?!


Nvm I got it:
let c = 17;

inside loop:
if(c>0 && switch == 0){ size += c*cos(360/size); c-=0.5; if(c==0){switch=1;}}
if(c<15 && switch == 1){ size -= c*cos(360/size); c+=0.5; if(c==15){switch=2;}} 

Probably not the most efficient or beautiful method but for a math-failure like me it felt like the top of the mountain.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 18, 2009, 04:37:22 PM
When I have the time I'll make an object bullet of which will be possible to substitute with the circle radius. I can't really understand what you're doing right now so :V

EDIT: I'll expand on it later. There should be an equation you can use so you don't have to manually test speeds like I did.

let obj = Obj_Create(OBJ_SHOT);
let radius = 80;
let maxradius = 180;
let finalradius = 150;
let speed = 3;
let accspeed = -0.04569;
Obj_SetX(obj,GetCenterX);Obj_SetSpeed(obj,0);
Obj_SetAngle(obj,270);ObjShot_SetGraphic(obj,WHITE01);
while(!Obj_BeDeleted(obj)){
    Obj_SetY(obj,GetCenterY+radius);
    radius+=speed;
    speed+=accspeed;
    if(radius>=maxradius){Obj_Delete(obj);}
    if(radius<=finalradius && speed<=0){speed=0;accspeed=0;}
    yield;
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on November 18, 2009, 05:19:12 PM
Drake, I didn't understand a thing of the spellcircle slingshot effect code. Therefor reasking it again =.=. I am a failure in math so this is the following I want to achieve by math (else I could take the long road)

- My spellcircle has starting size: 80.
- I want it to grow to 180 with an accelerating speed.
- When it reaches close to 180 I want it to deaccelerate
- At size 180 it should start shrinking with acceleration untill it reaches it's final size: 150

HOW ?!

I think I see what you're trying to do. You want it to start at 0, accelerate to 180, and then decelerate as it closes in on 150, which it stops at. 
You're going to have to use a bit of trigonometry for this one.  What you're looking for is sine.  I can't do the entire math in my head, but from what I already know, what you want to do is A*sin(X*F).

A -being the top speed (magnitude).  X-being the angle you'll get the sine of, and F, being how "quick" the acceleration and deceleration will be altogether.
Then, increase the value of X by a set amount of frames. There's math behind it, and you'll need it.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 18, 2009, 07:59:30 PM
I think I see what you're trying to do. You want it to start at 0, accelerate to 180, and then decelerate as it closes in on 150, which it stops at. 
You're going to have to use a bit of trigonometry for this one.  What you're looking for is sine.  I can't do the entire math in my head, but from what I already know, what you want to do is A*sin(X*F).

A -being the top speed (magnitude).  X-being the angle you'll get the sine of, and F, being how "quick" the acceleration and deceleration will be altogether.
Then, increase the value of X by a set amount of frames. There's math behind it, and you'll need it.
Correct. And if there is one thing I hate myself for is math :V I need it indeed but blending it into danmakufu is hard. I started messing with parabola formulas and all kind of stuff. ( I didn't even knew I had to use sinus ) I just ended up with cos and by some random luck it worked out. Yay me ( horrible presentation though )

@Drake be on IRC if you can so we can discuss stuff about Ijiyatsu
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Infy♫ on November 19, 2009, 04:10:47 PM
how can i give some score when a player captures a nonspell, but without making dnh think its a spell?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 19, 2009, 04:16:34 PM
AddScore(number);


@Finalize{
   if((GetMissCountInThisSpell + GetBomBCountInThisSPell)==0){
     AddScore(100000);
   }else{
     DrawText("You suck", GetPlayerX, GetPlayerY - 30, 12, 255);
     PlaySE(GetCurrentScriptDirectory~"Hawhaw.wav");
   }
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on November 20, 2009, 04:55:56 AM
How would you put SetGraphicRects in a task and how would you call it? Ive tried a code like this:
Code: [Select]
task animation1(start,endframe){
let anim = 0;
if(anim<5){SetGraphicRect(0, 229, 34, 300);}
if(anim>=5 && anim<10){SetGraphicRect(34, 229, 34, 300);}
if(anim>=10 && anim<15){SetGraphicRect(68, 229, 68, 300);}
if(anim>=15 && anim<20){SetGraphicRect(102, 229, 102, 300);}
if(anim==endframe){
start = 0;}
if(start>0){
anim++;}}

And when called, it does nothing...any ideas?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 20, 2009, 05:02:51 AM
I haven't tried this, but from my knowledge of how Danmakufu works, you aren't allowed to control graphics in the @MainLoop. Since most scripts run yield; in the @MainLoop, the tasks are counted as running there as well, and therefore things that control graphics wouldn't work either.

I think your best bet is to just write a bunch of conditionals in the @DrawLoop unless you don't wanna use tasks in the @MainLoop anymore. I may be wrong though.

EDIT: Perhaps putting a yield; in @DrawLoop will work too? I know @DrawLoop ignores bullet functions and @MainLoop ignores drawing functions... But this way, each task will need two yields to wait one frame.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 20, 2009, 05:05:12 AM
Not sure about tasks and yields, but if you call a drawing function in DrawLoop it'll work fine.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 20, 2009, 05:16:53 AM
Blargel is correct, you must sacrifice the use of @MainLoop tasks for @DrawLoop tasks to work. This tends to be why you don't see them very often at all.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 20, 2009, 08:09:08 AM
How would you put SetGraphicRects in a task and how would you call it? Ive tried a code like this:
Code: [Select]
task animation1(start,endframe){
let anim = 0;
if(anim<5){SetGraphicRect(0, 229, 34, 300);}
if(anim>=5 && anim<10){SetGraphicRect(34, 229, 34, 300);}
if(anim>=10 && anim<15){SetGraphicRect(68, 229, 68, 300);}
if(anim>=15 && anim<20){SetGraphicRect(102, 229, 102, 300);}
if(anim==endframe){
start = 0;}
if(start>0){
anim++;}}

And when called, it does nothing...any ideas?

Actually you know what? Besides the problem with tasks running only in either MainLoop or DrawLoop, isn't your task only going through once and stopping? I mean, as far as I can tell, it makes a variable called anim set to 0, checks if anim is less than 5 (which it is so it runs SetGraphicRect(0, 229, 34, 300);), checks anim against a bunch of other if statements that won't be true, checks if start is greater tan 0, and then ends. It doesn't loop, nor does it even yield once.

EDIT: Stupid solution go!
Make a child enemy that has no hitbox, sets its position to the parent enemy, and handles drawing the parent enemy's graphic. Since this child enemy doesn't need to shoot bullets, you can put yield; inside the @DrawLoop instead of the @MainLoop to uses tasks to handle animation more easily. Meanwhile, the parent enemy has yield; in the @MainLoop like usual and handles all the danmaku creation and other things that might be needed.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 20, 2009, 04:31:40 PM
Oh my god that is so unnecessary
i guess it would work, but really
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Nimble on November 21, 2009, 02:12:15 PM
Can I make object shot in player spell has delay effect act like enemy shot?

I try on custom bullet shot and it delay by show it graphic until it fire out, not bullet cloud.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: CK Crash on November 21, 2009, 03:17:05 PM
ObjShot_SetDelay(id,frames);

Keep in mind that if you use a task for each object shot, the task will continue while the shot is still delaying. You may want to loop yield until the delay is over.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Nimble on November 21, 2009, 04:18:35 PM
It happen like this when I delay it.
(http://www.pocketonline.net/g2engine/d/37520-1/untitled.JPG)

Edit ->
Normal delay that I want.
(http://www.pocketonline.net/g2engine/d/37594-1/untitled_001.JPG)
Any advice?

ObjShot_SetDelay(id,frames);

work as upper image.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: I Am A Fruit on November 22, 2009, 03:37:56 AM
Can anyone tell me how to use custom danmaku?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on November 22, 2009, 05:02:42 AM
Can anyone tell me how to use custom danmaku?

I'll be assuming you mean custom shots/
First, you will need a shot sheet with the bullets you want to fire.
Second, you will need to make a .txt with #UserShotData in the first line.
Third, you will need to load the Shot Sheet.
Before i go on, here is an example:
Code: [Select]
#UserShotData \\Defines as Shot Data

ShotImage = ".\img\shot.png" \\Loads the image

ShotData{//Opens the ShotData data
id = 1337 //Id used to fire the bullet
rect = ( 0, 0, 64, 64) //Rect, or location, where the bullet is located on the sheet. (left, up, right down)
render = ALPHA //"Just use it"
delay_color = ( 128, 128, 128 ) //Color of the delay that will shot up (red, blue, yellow)
angular_velocity = 0 //Decides if the bullet rotates, negative for counterclockwise, vice versa
} //Closes the Shot Data

Then in the script you want to call the bullet in, call:
LoadUserShotData in the Initalize, such as if we named the ShotData shot.txt:
LoadUserShotData(GetCurrentScriptDirectory~"shot.txt");

Then call the bullet with the Id you have specified...

*faints*

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on November 22, 2009, 05:07:12 AM
I'll be assuming you mean custom shots/
First, you will need a shot sheet with the bullets you want to fire.
Second, you will need to make a .txt with #UserShotData in the first line.
Third, you will need to load the Shot Sheet.
Before i go on, here is an example:
Code: [Select]
#UserShotData \\Defines as Shot Data

ShotImage = ".\img\shot.png" \\Loads the image

ShotData{\\Opens the ShotData data
id = 1337 \\Id used to fire the bullet
rect = ( 0, 0, 64, 64) \\Rect, or location, where the bullet is located on the sheet. (left, up, right down)
render = ALPHA \\"Just use it"
delay_color = ( 128, 128, 128 ) \\Color of the delay that will shot up (red, blue, yellow)
angular_velocity = 0 \\Decides if the bullet rotates, negative for counterclockwise, vice versa
} \\Closes the Shot Data

Then in the script you want to call the bullet in, call:
#LoadUserShotData in the Initalize, such as if we named the ShotData shot.txt:
#LoadUserShotData(GetCurrentScriptDirectory~"shot.txt");

Then call the bullet with the Id you have specified...

*faints*
All your \\ replace by //
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 22, 2009, 08:57:50 AM
I wouldn't use 1337 as a number as danmakufu only allows a range from 1 to 255 :V
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on November 22, 2009, 10:37:40 AM
Is there a short and non-tedious way of turning a value into an array by digit? example... turning 123456 into [1, 2, 3, 4, 5, 6] ???
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on November 22, 2009, 11:35:08 AM
Okay, I cannot test if this works, but if I understand it correctly, it just might.

Create an array at the beginning of your script:

Code: [Select]
let test=[];
Then include the following task:

Code: [Select]
task Tconvert(X){
  let array = [];
  let array2 = [0];
  let array3 = [];

  while(X>=1){
    array2[0]=X;
    X=floor(X/10);
    array2[0]=array2[0]-10*X;
    array=array ~ array2;
  }

  descent(i in (length(array))..0) {
    array2[0]=array[i];
    array3=array3~array;
  }
  test=array3;
}


In theory, this should convert your number X into the array "test". There might be some mistakes, though. In praticular I am not shure if the descent shouldn't be descent(i in (length(array)-1)..(-1)) instead, but as I said, I cannot test it.

If it won't work, I' sorry.  :-\
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on November 22, 2009, 12:43:09 PM
thanks iryan, I'm not sure if that works, but I found another way of doing it, so nevermind ;D

I have a different question now... I'm trying to make items and I'm wondering why this won't work:
Code: [Select]
let itempic="lib\system\items.png";
LoadGraphic(itempic);

task item(type, x, y)
{
let counter=0;
let xpos=x;
let ypos=y;
let obj=Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(obj, itempic);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(obj, 4);
if(type=="POWER_S")
{
ObjEffect_SetVertexUV(obj, 0, 0, 0);
ObjEffect_SetVertexUV(obj, 1, 16, 0);
ObjEffect_SetVertexUV(obj, 2, 0, 16);
ObjEffect_SetVertexUV(obj, 3, 16, 16);
}
if(type=="POINT")
{
ObjEffect_SetVertexUV(obj, 0, 16, 0);
ObjEffect_SetVertexUV(obj, 1, 32, 0);
ObjEffect_SetVertexUV(obj, 2, 16, 16);
ObjEffect_SetVertexUV(obj, 3, 32, 16);
}
if(type=="COLLECT")
{
ObjEffect_SetVertexUV(obj, 0, 32, 0);
ObjEffect_SetVertexUV(obj, 1, 48, 0);
ObjEffect_SetVertexUV(obj, 2, 32, 16);
ObjEffect_SetVertexUV(obj, 3, 48, 16);
}
if(type=="POWER_L")
{
ObjEffect_SetVertexUV(obj, 0, 48, 0);
ObjEffect_SetVertexUV(obj, 1, 64, 0);
ObjEffect_SetVertexUV(obj, 2, 48, 16);
ObjEffect_SetVertexUV(obj, 3, 64, 16);
}
if(type=="POWER_F")
{
ObjEffect_SetVertexUV(obj, 0, 96, 0);
ObjEffect_SetVertexUV(obj, 1, 112, 0);
ObjEffect_SetVertexUV(obj, 2, 96, 16);
ObjEffect_SetVertexUV(obj, 3, 112, 16);
}
while(Obj_BeDeleted(obj)==false)
{
yield;
counter++;
if(counter<20)
{
ypos-=2;
}else{
ypos++;
}
ObjEffect_SetVertexXY(obj, 0, xpos-8, ypos-8);
ObjEffect_SetVertexXY(obj, 1, xpos+8, ypos-8);
ObjEffect_SetVertexXY(obj, 2, xpos-8, ypos+8);
ObjEffect_SetVertexXY(obj, 3, xpos+8, ypos+8);
if(((xpos-GetPlayerX)^2+(ypos-GetPlayerY)^2)^0.5<=10)
{
if(type=="POWER_S")
{
SetCommonData("power", GetCommonData("power")+1);
}
if(type=="POWER_L")
{
SetCommonData("power", GetCommonData("power")+10);
}
if(type=="POWER_F")
{
SetCommonData("power", 100);
}
if(type=="POINT")
{
AddScore(5000*(GetGraze/100)/((GetPlayerY-GetClipMinY-120)/50));
AddPoint(1);
}
if(type=="COLLECT")
{
SetCommonData("collect", GetCommonData("collect")+1);
}
Obj_Delete(obj);
}
}
}

and an enemy with the code... which works if it doesn't call the task
Code: [Select]
script_enemy_main {

#include_function ".\enemy1anim.txt"
#include_function "lib\items.txt"
let frame = 0;
let frame2 = 0;
let item = 0;

@Initialize {

SetLife(50);
SetDamageRate(180, 100);
          LoadUserShotData("lib\SHOT_REPLACE\shot_all.dnh");
}

@MainLoop{

SetCollisionA(GetX, GetY, 16);
SetCollisionB(GetX, GetY, 6);

frame ++;
frame2 ++;

if(frame == 1){
if(GetX<GetCenterX)
{
SetMovePositionHermite(GetClipMaxX+100,GetY+rand(-100,100),300,270,300,0,300);
}else{
SetMovePositionHermite(GetClipMinX-100,GetY+rand(-100,100),300,90,300,180,300);
}
}

if(frame2>20 && frame2%10==0){
PlaySE(GetCurrentScriptDirectory~"sound\Shot1.wav");
CreateShotA(1, GetX, GetY, 10);
SetShotDataA_XY(1, 0, rand(-3, 3), rand(-1, -3), rand(-0.01, 0.01), rand(0.01, 0.05), rand(-3, 3), rand(2, 4), 3);
FireShot(1);
}


if(GetY > GetClipMaxY || GetX>GetClipMaxX || GetX<GetClipMinX || GetY<GetClipMinY){
VanishEnemy();
item = 1;
}


}

@DrawLoop {
anim2;
}

@Finalize {
if(item == 0){
item("POWER_S", GetX, GetY);
}
}
}
}

I already checked and all the directories are pointed to the right area...

everytime the game loads an enemy that loads that function, it crashes... it doesn't give me an error... it just crashes... (I'm gonna put in the code for the item collection line later)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Nimble on November 22, 2009, 03:38:48 PM
You set task name and variable with same name =w=/
task item(type, x, y)
let item = 0;
Set task name to other like itemdrop(type,x ,y) instead.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 22, 2009, 07:56:38 PM
Is there anyway for Enemy Enumeration to keep selecting the same enemy until it dies, instead of switching between new enemies as they spawn? I've tried a couple different things (like putting whiles inside of whiles, hoo boy) and they have all yielded very interesting error messages, so I'll ask here in case anybody has already solved this problem.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 22, 2009, 08:56:04 PM
You can use enemy IDs outside the enumeration loop. Make a variable currentenm and set it to -1. If currentenm == -1, run the enumeration loop and select one enemy, then keep the value gotten from EnumEnemyGetID in currentenm. This value isn't -1, so it keeps skipping the loop. Do your other stuff, and each frame if GetEnemyInfo(currentenm,ENEMY_LIFE)==false, set currentenm to -1.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 22, 2009, 09:09:53 PM
let enemy = -1;

Code: [Select]
if(GetEnemyInfo(enemy, ENEMY_LIFE)==false){
enemy=-1;
}
if(GetEnemyNum>0 && enemy==-1){
if(!IsBossExisting){
ascent(i in EnumEnemyBegin..EnumEnemyEnd) {
enemy=EnumEnemyGetID(i);
i=EnumEnemyEnd;
}
}else{
i = EnumEnemyBegin;
enemy=EnumEnemyGetID(i);
}
ex = GetEnemyInfo(enemy, ENEMY_X);
ey = GetEnemyInfo(enemy, ENEMY_Y);
}else{
ex = vv + 100*cos(osc);
ey = 0;
}

Errors:

(http://i641.photobucket.com/albums/uu134/Nautth/wooppp.jpg)



And...

Code: [Select]
if(GetEnemyInfoDefault(enemy, ENEMY_LIFE, 1)==1){
enemy=-1;
}
if(GetEnemyNum>0 && enemy==-1){
if(!IsBossExisting){
ascent(i in EnumEnemyBegin..EnumEnemyEnd) {
enemy=EnumEnemyGetID(i);
i=EnumEnemyEnd;
}
}else{
i = EnumEnemyBegin;
enemy=EnumEnemyGetID(i);
}
ex = GetEnemyInfo(enemy, ENEMY_X);
ey = GetEnemyInfo(enemy, ENEMY_Y);
}else{
ex = vv + 100*cos(osc);
ey = 0;
}

...Just doesn't do anything.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 23, 2009, 04:19:27 AM
Here, have a code block that controls my homing lasers. Hope you can get what I did with just my poorly commented code. It's an extract from a giant task that controls the whole object bullet with some irrelevant parts cut out so using the code as is will probably not work.

Code: [Select]
//choose target closest to it
let target = -1;
let targetX = 0;
let targetY = 0;
let closestDistance = 65535;
ascent(enemy in EnumEnemyBegin..EnumEnemyEnd){
  let enemyID = EnumEnemyGetID(enemy);
  let enemyX = GetEnemyInfo(enemyID, ENEMY_X);
  let enemyY = GetEnemyInfo(enemyID, ENEMY_Y);
  let enemyLife = GetEnemyInfo(enemyID, ENEMY_LIFE);
  let enemyDistance = GetDistance(Obj_GetX(obj), Obj_GetY(obj), enemyX, enemyY);
  if(enemyDistance < closestDistance && enemyLife > 0){
    closestDistance = enemyDistance;
    target = enemyID;
    targetX = enemyX;
    targetY = enemyY;
  }
}
//change behavior per frame based on conditions until deleted
while(!Obj_BeDeleted(obj)){

  //if there is a target
  if(GetEnemyInfoDefault(target, ENEMY_LIFE, 0) > 0){
    //logic on what to do if the enemy is alive goes here
  }

  else {
    //logic on what to do if the enemy is dead goes here
  }

  yield;
}

EDIT: Note that you can stick the block that chooses a target in the place that gets run if the target is dead, and it'll choose another target if the enemy is dead already and continue running.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on November 23, 2009, 10:22:59 AM
You set task name and variable with same name =w=/
task item(type, x, y)
let item = 0;
Set task name to other like itemdrop(type,x ,y) instead.

I feel like such an idiot... thanks!

I have a different problem now... it's not showing anything when it's called...

itemcode
Code: [Select]
let itempic="lib\system\items.png";
LoadGraphic(itempic);

task itemdrop(type, x, y)
{
let counter=0;
let collection=0;
let xpos=x;
let ypos=y;
let obj=Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(obj, itempic);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(obj, 4);
if(type=="POWER_S")
{
ObjEffect_SetVertexUV(obj, 0, 0, 0);
ObjEffect_SetVertexUV(obj, 1, 16, 0);
ObjEffect_SetVertexUV(obj, 2, 0, 16);
ObjEffect_SetVertexUV(obj, 3, 16, 16);
}
if(type=="POINT")
{
ObjEffect_SetVertexUV(obj, 0, 16, 0);
ObjEffect_SetVertexUV(obj, 1, 32, 0);
ObjEffect_SetVertexUV(obj, 2, 16, 16);
ObjEffect_SetVertexUV(obj, 3, 32, 16);
}
if(type=="COLLECT")
{
ObjEffect_SetVertexUV(obj, 0, 32, 0);
ObjEffect_SetVertexUV(obj, 1, 48, 0);
ObjEffect_SetVertexUV(obj, 2, 32, 16);
ObjEffect_SetVertexUV(obj, 3, 48, 16);
}
if(type=="POWER_L")
{
ObjEffect_SetVertexUV(obj, 0, 48, 0);
ObjEffect_SetVertexUV(obj, 1, 64, 0);
ObjEffect_SetVertexUV(obj, 2, 48, 16);
ObjEffect_SetVertexUV(obj, 3, 64, 16);
}
if(type=="POWER_F")
{
ObjEffect_SetVertexUV(obj, 0, 96, 0);
ObjEffect_SetVertexUV(obj, 1, 112, 0);
ObjEffect_SetVertexUV(obj, 2, 96, 16);
ObjEffect_SetVertexUV(obj, 3, 112, 16);
}
while(Obj_BeDeleted(obj)==false)
{
yield;
counter++;
if(counter<20)
{
ypos-=2;
}else{
ypos++;
}
ObjEffect_SetVertexXY(obj, 0, xpos-8, ypos-8);
ObjEffect_SetVertexXY(obj, 1, xpos+8, ypos-8);
ObjEffect_SetVertexXY(obj, 2, xpos-8, ypos+8);
ObjEffect_SetVertexXY(obj, 3, xpos+8, ypos+8);
if(((xpos-GetPlayerX)^2+(ypos-GetPlayerY)^2)^0.5<=10)
{
if(type=="POWER_S")
{
SetCommonData("power", GetCommonData("power")+1);
}
if(type=="POWER_L")
{
SetCommonData("power", GetCommonData("power")+10);
}
if(type=="POWER_F")
{
SetCommonData("power", 100);
}
if(type=="POINT")
{
AddScore(5000*(GetGraze/100)/((GetPlayerY-GetClipMinY-120)/50));
AddPoint(1);
}
if(type=="COLLECT")
{
SetCommonData("collect", GetCommonData("collect")+1);
}
Obj_Delete(obj);
}
if(GetPlayerY<GetClipMinY+120)
{
collection=1;
}
if(collection==1)
{
xpos+=5*cos(atan2(GetPlayerY-ypos, GetPlayerX-xpos));
ypos+=5*sin(atan2(GetPlayerY-ypos, GetPlayerX-xpos));
}
}
}

enemy code
Code: [Select]
script_enemy_main {

#include_function ".\enemy1anim.txt"
#include_function "lib\items.txt"
let frame = 0;
let frame2 = 0;
let item = 0;

@Initialize {

SetLife(50);
SetDamageRate(180, 100);
          LoadUserShotData("lib\SHOT_REPLACE\shot_all.dnh");
}

@MainLoop{

SetCollisionA(GetX, GetY, 16);
SetCollisionB(GetX, GetY, 6);

frame ++;
frame2 ++;

if(frame == 1){
if(GetX<GetCenterX)
{
SetMovePositionHermite(GetClipMaxX+100,GetY+rand(-100,100),300,270,300,0,300);
}else{
SetMovePositionHermite(GetClipMinX-100,GetY+rand(-100,100),300,90,300,180,300);
}
}

if(frame2>20 && frame2%10==0){
PlaySE(GetCurrentScriptDirectory~"sound\Shot1.wav");
CreateShotA(1, GetX, GetY, 10);
SetShotDataA_XY(1, 0, rand(-3, 3), rand(-1, -3), rand(-0.01, 0.01), rand(0.01, 0.05), rand(-3, 3), rand(2, 4), 3);
FireShot(1);
}


if(GetY > GetClipMaxY || GetX>GetClipMaxX || GetX<GetClipMinX || GetY<GetClipMinY){
VanishEnemy();
item = 1;
}


}

@DrawLoop {
anim2;
}

@Finalize {
if(item == 0){
itemdrop("POWER_S", GetX, GetY);
}
}
}
}

all the directories and paths are right... I checked... when the enemy dies... nothing comes out...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 23, 2009, 10:25:40 AM
You're calling LoadGraphic in the wrong place. Put it in the @Initialize of every enemy that's gonna drop items instead of in the separate file.

Alternatively, call it in the @Initialize of the stages you'll be making so you only need to write it once.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on November 23, 2009, 11:24:51 AM
You're calling LoadGraphic in the wrong place. Put it in the @Initialize of every enemy that's gonna drop items instead of in the separate file.

Alternatively, call it in the @Initialize of the stages you'll be making so you only need to write it once.

still nothing appearing...  :-\
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 23, 2009, 12:13:14 PM
Oh, I know why. And you're not gonna like the reason.

When the enemy calls the task, it keeps going until it reaches a yield right? Well the damn task won't continue until the enemy script encounters another yield, which is usually in @MainLoop. However... the enemy is dead. You CAN'T continue the task so it's just floating there waiting for the enemy to tell it to yield. This means that the object is being created and the VertexUV points are being set, but the VertexXY points aren't. Danmakufu doesn't know where to put draw it so it just doesn't.

This is very similar to the problem I had where the enemies stopped processing something that needed to be processed after they died. I had a stupid work around for that where I made the enemies have 10,000 more hp than they should have and "died" (which means they stopped shooting bullets and drawing their graphics) when the hp reached under 10,000 but the yield and other necessary functions for processing were left running.

If you don't like that solution, you'll need to make some sort of god enemy script that spawns all the items for you from conditions managed by common data or something. Maybe there's an easier solution, I dunno.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on November 23, 2009, 01:04:44 PM
Oh, I know why. And you're not gonna like the reason.

When the enemy calls the task, it keeps going until it reaches a yield right? Well the damn task won't continue until the enemy script encounters another yield, which is usually in @MainLoop. However... the enemy is dead. You CAN'T continue the task so it's just floating there waiting for the enemy to tell it to yield. This means that the object is being created and the VertexUV points are being set, but the VertexXY points aren't. Danmakufu doesn't know where to put draw it so it just doesn't.

This is very similar to the problem I had where the enemies stopped processing something that needed to be processed after they died. I had a stupid work around for that where I made the enemies have 10,000 more hp than they should have and "died" (which means they stopped shooting bullets and drawing their graphics) when the hp reached under 10,000 but the yield and other necessary functions for processing were left running.

If you don't like that solution, you'll need to make some sort of god enemy script that spawns all the items for you from conditions managed by common data or something. Maybe there's an easier solution, I dunno.

ah thanks... now I get it... thanks again...  ;D
I was able to make a master item enemy... nice...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Azure Lazuline on November 23, 2009, 03:02:54 PM
Hm, the problem about making a "master enemy" is that homing shots will still aim at it. Perhaps we can make some sort of standard for player characters, so we can set which enemies shots should aim at/home in to?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 23, 2009, 07:22:53 PM
HEY DRAKE

You seriously messed up the effect coordinates and such. I fixed them for you. But even then it gives the wrong image. And that is because you were setting the vertex and loading the UV mapping before any image is loaded >.<

Put LoadGraphic below the 'case checking' code. And below that the vertex mapping/setting. And it should run fine. Pull me on IRC if you still mess up :V I'll send you the txt.

Code: [Select]
    LoadGraphic(objface);

    ObjEffect_SetTexture(obj,objface);

    ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
    ObjEffect_CreateVertex(obj, 4);

    ObjEffect_SetVertexXY(obj, 0, -200, -256); //The same vertices for every cutin
    ObjEffect_SetVertexUV(obj, 0, 0, 0);

    ObjEffect_SetVertexXY(obj, 1, 200, -256);
    ObjEffect_SetVertexUV(obj, 1, 400, 0);

    ObjEffect_SetVertexXY(obj, 2, -200, 256);
    ObjEffect_SetVertexUV(obj, 2, 0, 512);

    ObjEffect_SetVertexXY(obj, 3, 200, 256);
    ObjEffect_SetVertexUV(obj, 3, 400, 512);
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: NOVA on November 23, 2009, 11:58:57 PM
Is there a command for random that sticks to whole integers?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 24, 2009, 12:02:10 AM
rand_int

Also thanks Hele. A few more problems arose, but only because I wasn't using finished portraits in the first place.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: ChaoStar on November 25, 2009, 01:09:07 AM
I was trying out object bullets for the first time, and I have no idea what went wrong. I get no error message, just a danmakufu freeze.

Code: [Select]
script_enemy_main{

let CSD = GetCurrentScriptDirectory;

let imgBoss = CSD ~ "img\ExRumia.png";


@Initialize{
SetLife(1000);
SetTimer(600);
SetInvincibility(30);
SetMovePosition01(GetCenterX,GetCenterY,5);
LoadGraphic(imgBoss);


mainTask;
}

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

@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(64,1,127,64);
SetGraphicScale(01,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);
}

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

@Finalize{
DeleteGraphic(imgBoss);

}

task mainTask{
yield;
mainFire;
movement;
}

task movement{
SetMovePosition01(GetCenterX,120,5);

yield;

}


task mainFire{
let count = 0;
loop{
spock(GetEnemyX,GetEnemyY,3,sin(count)*30+90,RED31,0);
yield;
}

}

task spock(x,y,v,dir,graphic,delay){
let obj = Obj_Create(OBJ_SHOT);

Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,graphic);
Obj_SetAngle(obj,dir);
ObjShot_SetGraphic(obj,graphic);
ObjShot_SetDelay(obj,delay);
ObjShot_SetBombResist(obj,true);

while(!Obj_BeDeleted(obj)){
if(Obj_GetY(obj) > GetClipMaxY){
Obj_SetAngle(obj,-dir);

yield;
}
}
}


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

It's part of a plural, btw.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on November 25, 2009, 01:21:24 AM
Finished.
Code: [Select]
#TouhouDanmakufu
#Title[HI]
#ScriptVersion[2]
script_enemy_main{

let CSD = GetCurrentScriptDirectory;

let imgBoss = CSD ~ "img\ExRumia.png";


@Initialize{
SetLife(1000);
SetTimer(600);
SetInvincibility(30);
SetMovePosition01(GetCenterX,GetCenterY,5);
LoadGraphic(imgBoss);


mainTask;
}

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

@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(64,1,127,64);
SetGraphicScale(01,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);
}

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

@Finalize{
DeleteGraphic(imgBoss);

}

task mainTask{
yield;
mainFire;
movement;
}

task movement{
SetMovePosition01(GetCenterX,120,5);

yield;

}


task mainFire{
let count = 0;
spock(GetX,GetY,3,sin(count)*30+90,RED31,10);
loop(1) { yield; }
mainFire;
}

task spock(x,y,v,dir,graphic,delay){
let obj = Obj_Create(OBJ_SHOT);

Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj, v);
Obj_SetAngle(obj,dir);
ObjShot_SetGraphic(obj,graphic);
ObjShot_SetDelay(obj,delay);
ObjShot_SetBombResist(obj,true);

while(!Obj_BeDeleted(obj)){
if(Obj_GetY(obj) > GetClipMaxY){
Obj_SetAngle(obj,-dir);
}
yield;
}
}
}


function wait(w){
loop(w){yield;}
}
}
I THINK you forgot a }.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 25, 2009, 05:09:42 AM
Code: [Select]
#TouhouDanmakufu
#Title[HI]
#ScriptVersion[2]
script_enemy_main{

   let CSD   = GetCurrentScriptDirectory;

   let imgBoss = CSD ~ "img\ExRumia.png";


   @Initialize{
      SetLife(1000);
      SetTimer(600);
      SetInvincibility(30);
      SetMovePosition01(GetCenterX,GetCenterY,5);
      LoadGraphic(imgBoss);

         
      mainTask;
   }

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

   @DrawLoop{
      SetTexture(imgBoss);
      SetRenderState(ALPHA);
      SetAlpha(255);
      SetGraphicRect(64,1,127,64);
      SetGraphicScale(01,1);
      SetGraphicAngle(0,0,0);
      DrawGraphic(GetX,GetY);
   }

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

   @Finalize{
      DeleteGraphic(imgBoss);

   }

   task mainTask{
      loop{ //loop causes it to constantly run. Without it, it only runs once.
         mainFire;
         SetMovePosition01(GetCenterX+rand(-50,50),120+rand(-20,20),5); //Just planted "movement" here and changed it because calling this every few frames with the same movement is redundant.
         loop(50){yield;} //You definitely do not want everything run every frame.
      }
   }

//movement task deleted for simplicity

   task mainFire{
      let count = 0;
      loop(20){
         spock(GetEnemyX,GetEnemyY,3,count+90,RED31,0); //sin gets the y position of the angle on a circle of radius 1. Read up on your trig, maybe?
         count+=3; //I'm guessing you want this too.
         yield;  //stops a frame before firing the next spock, just gives a different effect
      }
     
   }

   task spock(x,y,v,dir,graphic,delay){
      let obj = Obj_Create(OBJ_SHOT);
   
      Obj_SetPosition(obj,x,y);
      Obj_SetSpeed(obj, v);
      Obj_SetAngle(obj,dir);
      ObjShot_SetGraphic(obj,graphic);
      ObjShot_SetDelay(obj,delay);
      ObjShot_SetBombResist(obj,true);

      while(!Obj_BeDeleted(obj)){
         if(Obj_GetY(obj) > GetClipMaxY){
            Obj_SetAngle(obj,-dir); //yay for bouncing
         }
         yield;
      }
   }
}


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

On first glance I was wondering what you were doing, then realized you were imitating Hele's tutorial. This should work regardless.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 25, 2009, 09:46:17 AM
Is there anyway for Enemy Enumeration to keep selecting the same enemy until it dies, instead of switching between new enemies as they spawn? I've tried a couple different things (like putting whiles inside of whiles, hoo boy) and they have all yielded very interesting error messages, so I'll ask here in case anybody has already solved this problem.

I actually took a look at the Roukanken player script (you would have won the $10 bet btw) and specifically the 4 enemy enumeration thingies. The way you had it, the lasers will all target the newest enemy that spawned, so if there's a continuous stream of enemies being spawned, it'll keep jumping targets. If you change the 4 ascents into descents though, the target will now be the oldest enemy spawned so the laser won't jump targets until the enemy is killed or vanished.

You should probably refine the targeting a bit though because the laser is still strangely jumpy if there's too many enemies being vanished/destroyed.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: NOVA on November 25, 2009, 09:59:08 AM
what is the function for finding the x y position of a BULLET?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 25, 2009, 10:07:57 AM
There is no way unless it is an object bullet, which is more of an advanced technique to use for bullet pattern creation. If you know how to use an object bullet, the function is Obj_GetX(objID) and Obj_GetY(objID).

To learn how to use object bullets, you should take a look at the tutorials thread to see if it can help you.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 25, 2009, 03:44:07 PM
Okay now I have a problem.

I currently have an options menu that lets you change stuff around and save it in a common data .dat file. For example, if you want to change polarities with C, CTRL, or SHIFT+Z.

However, let's say Person A saves a replay with his options as CTRL. If he gives the replay to someone whose options are set to SHIFT+Z, then obviously when the replay tells the script that it's pressing ctrl, it won't change the player's polarity and the replay will desync. Is there any way for replays to save and load their own common data to fix this? (Did I even explain this clearly?)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 25, 2009, 05:04:12 PM
I honestly don't think so. You can't make a hardcoded detection program change in different conditions, unless you somehow create a different replay system included in the game, somehow.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on November 25, 2009, 05:59:39 PM
The replay file will save the state you chose in your makeshift menu. As long as you're getting commondata in the player script which you've set in the main script, then the replay will mimic this action. So if I transferred a replay to somebody else's computer that had me choose "c" as my polar shift button in the makeshift menu, then the replay will show that and save the data accordingly when it plays on somebody else's computer.

So essentially, you should have to force the player to choose what polar state they want everytime they play the game. Which is not a big deal, methinks. Otherwise, no, it's not really possible to do unless you transfer the .dat file with the .rpy file, and correctly put them into their respective folders... Which isn't really worth doing.

I'll keep thinking about it though, you might be able to set some odd commondata and use if(IsReplay==true && GetCommonData("dicksdicksdicks")=="CTRL"){ doshit; } statements to get it working, but I dunno.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 25, 2009, 06:21:34 PM
The replay file will save the state you chose in your makeshift menu. As long as you're getting commondata in the player script which you've set in the main script, then the replay will mimic this action. So if I transferred a replay to somebody else's computer that had me choose "c" as my polar shift button in the makeshift menu, then the replay will show that and save the data accordingly when it plays on somebody else's computer.

So essentially, you should have to force the player to choose what polar state they want everytime they play the game. Which is not a big deal, methinks.
I realized that already, but something like that really does belong in an options menu rather than being selected every time you wanna play. If I were some random gamer who was ignorant of the flaws of Danmakufu, I'd wonder why the options menu sucked so much.

Quote
Otherwise, no, it's not really possible to do unless you transfer the .dat file with the .rpy file, and correctly put them into their respective folders... Which isn't really worth doing.
Actually, if there's no real solution to this, I was thinking that whoever is sharing replays should just post what settings they used so that the replay viewers can match the settings before viewing. Which is almost as bad. :V

Quote
I'll keep thinking about it though, you might be able to set some odd commondata and use if(IsReplay==true && GetCommonData("dicksdicksdicks")=="CTRL"){ doshit; } statements to get it working, but I dunno.
I was thinking something similar to that before posting. I can't really think of a way to use IsReplay to detect which switching type the replay is using though. :x

I honestly don't think so. You can't make a hardcoded detection program change in different conditions, unless you somehow create a different replay system included in the game, somehow.
I was also seriously considering constructing my own replay player, but I realized that if I saved the replay, it'd be in the common data and therefore unsharable without sharing unlock data as well.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Azure Lazuline on November 25, 2009, 06:42:39 PM
When the game starts, you can set it so if you're holding shift then set the controls to shift-Z, if you're holding Ctrl then set it to that, otherwise default to C. It might be a little awkward at first, but it's not hard at all (if you forget, then you can just hold the button and hit backspace), and if you're worried about having a menu slow it down, then that's the best way around it. Just make sure to have it mentioned on the character select screen.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: ChaoStar on November 25, 2009, 11:34:45 PM
My background is black! It's not supposed to be black! Help me, onii-sama!

Code: [Select]
script_enemy_main{

let CSD = GetCurrentScriptDirectory;

let imgBoss = CSD ~ "img\ExRumia.png";

let back = CSD ~ "img\white.png";

@Initialize{
SetLife(4000);
SetTimer(600);
SetScore(350000);
SetInvincibility(30);
SetMovePosition01(GetCenterX,GetCenterY,5);
LoadGraphic(back);
LoadGraphic(imgBoss);

CutIn(YOUMU,"Night Sign: Black Butterfly",NULL,0,0,0,0);


mainTask;
}

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

@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(64,1,127,64);
SetGraphicScale(01,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);
}

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

@Finalize{
DeleteGraphic(imgBoss);

}

task mainTask{
yield;
mainFire;
movement;
}

task movement{
SetMovePosition01(GetCenterX,120,5);

yield;

}


task mainFire{
let x = 0;
let dir = 0;
loop{
while(x<25){
SetShotColor(0,0,0);
CreateShotA(1,GetX,GetY,30);
SetShotDataA(1,60,2,dir,-0.2,0,0,RED22);

FireShot(1);
SetShotColor(255,255,255);

dir+=360/25;
x++;
}
x = 0;
dir = 0;
wait(50);

yield;
}
}



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

btw, the png file is a 1x1 white file
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: NOVA on November 26, 2009, 12:37:16 AM
There is no way unless it is an object bullet, which is more of an advanced technique to use for bullet pattern creation. If you know how to use an object bullet, the function is Obj_GetX(objID) and Obj_GetY(objID).

To learn how to use object bullets, you should take a look at the tutorials thread to see if it can help you.

so then you cant have a bullet shot by a bullet shoot a bullet?
without a task, that is
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 26, 2009, 01:28:58 AM
Yes you can. Bullets fired from FireShot is a CreateShotA as well; there's no reason why you can't add bullets onto it as well.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Janitor Morgan on November 26, 2009, 07:29:57 AM
How would I go about manipulating an object bullet so that it bursts into more bullets if the boss collides with it? I figured Obj_IsIntersected(obj) would help, but apparently not...

Code: [Select]
task cloudshot(x, y, z) {
let obj = Obj_Create(OBJ_SHOT);
let killtime = 0;
Obj_SetPosition(obj, x, y);
ObjShot_SetGraphic(obj, WHITE03);
ObjShot_SetBombResist(obj, true);
ObjShot_SetDelay(obj, z);

while(!Obj_BeDeleted(obj)) {
if(killtime == 210+z) {
ObjShot_FadeDelete(obj);
}
if(Obj_IsIntersected(obj) == true) {
loop(5) {
CreateShot12(x, y, rand(-1, 1), rand(0.5, 1), 0, -0.05, 2, 2, WHITE05, 10);
}
PlaySE(GetCurrentScriptDirectory~"sfx\se_kira00.wav");
ObjShot_FadeDelete(obj);
}
killtime++;
yield;
}
}

It looks like Obj_IsIntersected(obj) applies to the player, not the boss. :-\
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 26, 2009, 07:45:18 AM
Put the next bullet behavior after the while!bedeleted loop. After the object's deleted, it will run that code. Obj_IsIntersected takes the boss' shot-hitbox width, and any object that is in the same x-range will have the statement true. It looks like it's doing it from the player because you're shooting the boss, so the bullets are directly underneath it and the code activates.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Janitor Morgan on November 26, 2009, 08:02:34 AM
I'm not quite sure I understand. You say the intersection check should go after the loop, like this, right?

Code: [Select]
while(!Obj_BeDeleted(obj)) {
if(killtime == 210+z) {
ObjShot_FadeDelete(obj);
}

killtime++;
yield;
}
if(Obj_IsIntersected(obj) == true) {
loop(5) {
CreateShot12(x, y, rand(-1, 1), rand(-1, -0.5), 0, 0.02, 2, 2, WHITE05, 10);
}
PlaySE(GetCurrentScriptDirectory~"sfx\se_kira00.wav");
ObjShot_FadeDelete(obj);
}

I tried this, enlarging the boss' hitboxes just to be sure, to no avail. It did stop the WHITE03s from bursting into WHITE05s when colliding with the player, though; they just kill me now.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 26, 2009, 08:21:34 AM
IsIntersected checks if an object is colliding with another object. What you should do is check if the object's distance is a certain distance from the enemy. In case you aren't sure how to do that, here's how you do that.

Code: [Select]
let distanceToBoss = ((Obj_GetX(obj)-GetX)^2 + (Obj_GetY(obj)-GetY)^2)^0.5
if(distanceToBoss < 64){
    do stuff;
}

I separated the giant formula into a variable for clarity's sake. You don't have to do that obviously.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 26, 2009, 07:29:52 PM
I was just explaining what IsIntersected does.

Code: [Select]
   while(!Obj_BeDeleted(obj)) {
      if(killtime == 210+z) {
         ObjShot_Delete(obj);   //Using FadeDelete with other shots spawning looks weird
      }

      killtime++;
      yield;
   }
   PlaySE(GetCurrentScriptDirectory~"sfx\se_kira00.wav");
   loop(5) {
      //CreateShot12(x, y, rand(-1, 1), rand(-1, -0.5), 0, 0.02, 2, 2, WHITE05, 10);
      //do something else
   }

This is what you do. Even still, you can't fire enemy bullets as your own. It's either CreatePlayerShot01 or object bullets.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 26, 2009, 07:45:19 PM
My background is black! It's not supposed to be black! Help me, onii-sama!

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

You did it wrong. fixed for you.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Janitor Morgan on November 26, 2009, 08:26:00 PM
Ah, I see now. Combining your clarification and Blargel's post, and making a small addition...

Code: [Select]
while(!Obj_BeDeleted(obj)) {
      if(killtime == 210+z) {
      trigger = 0;
          ObjShot_FadeDelete(obj);
      }
let distanceToBoss = ((Obj_GetX(obj)-GetX)^2 + (Obj_GetY(obj)-GetY)^2)^0.5;
if(distanceToBoss < 48){
    Obj_Delete(obj); //Using FadeDelete with other shots spawning looks weird
}

      killtime++;
      yield;
    }
   if(trigger == 1) {
    PlaySE(GetCurrentScriptDirectory~"sfx\se_kira00.wav");
    loop(5) {
      CreateShot12(x, y, rand(-1, 1), rand(-1, -0.5), 0, 0.02, 2, 2, WHITE05, 10);
      //do something else
    }
   }

(http://img214.imageshack.us/img214/781/scriptpicture.png)

That works excellently. Thanks, guys!
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on November 27, 2009, 03:25:41 PM
ah thanks... now I get it... thanks again...  ;D
I was able to make a master item enemy... nice...

Just realized that these master enemies won't work because when spell cards end and items are dropped, the master enemy will die because of the shift, so the item drop won't appear... is there a way to make the enemy not die when there's a shift from a spell to a non-spell or even spell to death?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 27, 2009, 03:35:59 PM
Ack, that really sucks. Hmmmm...

How about making the stage itself spawn the effect objects? Or maybe the player?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 27, 2009, 04:30:18 PM
You guys don't need to make a new item script, I already made one argargagargragar
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: KrackoCloud on November 30, 2009, 12:06:13 AM
Okay, I'm still relatively new at this, so...
Could someone show me how to create patterns similar to Rumia's Demarcation or Suwako's Mishaguji-Sama? That kind of stuff, yeah.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Janitor Morgan on November 30, 2009, 02:38:33 AM
Okay, I'm still relatively new at this, so...
Could someone show me how to create patterns similar to Rumia's Demarcation or Suwako's Mishaguji-Sama? That kind of stuff, yeah.

Creating things similar to Demarcation requires some knowledge of how the CreateShotA series of functions works:

CreateShotA(id, x-position, y-position, delay);
SetShotDataA(id, frame, speed, angle, turn speed, acceleration, minimum/maximum speed, graphic);
FireShot(id);

What SetShotDataA does is tell the bullet what it will do once it's fired. The "frame" parameter is especially important. For example, take the following code:

Code: [Select]
ascent(i in 0..20) {
CreateShotA(i, GetX, GetY, 10);
SetShotDataA(i, 0, 2, GetAngleToPlayer+i*18, 0, 0, 2, RED11);
SetShotDataA(i, 60, 2, GetAngleToPlayer+i*18-90, -1, 0, 2, RED11);
SetShotDataA(i, 90, 2, NULL, 0, 0, 2, RED11);
FireShot(i);
}

Twenty bullets are created at the boss's position. The first SetShotDataA function tells the bullets to fire in a circle as soon as they're created with a speed of 2. Sixty frames later, the bullets will begin turning, and thirty frames after that (frame 90 after shooting), the bullets will travel at whatever angle they had at the time.

To make it look similar to Rumia's Demarcation, simply create another ascent loop, but in the second SetShotDataA function, change the -90 and -1 to +90 and 1, respectively. This will create a mirrored ring of bullets that will intersect with the other one.

Does that help? I can go into SetShotDataA in more detail if you'd like.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on November 30, 2009, 02:58:57 AM
Creating things similar to Demarcation requires some knowledge of how the CreateShotA series of functions works:

CreateShotA(id, x-position, y-position, delay);
SetShotDataA(id, frame, speed, angle, turn speed, acceleration, minimum/maximum speed, graphic);
FireShot(id);

What SetShotDataA does is tell the bullet what it will do once it's fired. The "frame" parameter is especially important. For example, take the following code:

Code: [Select]
ascent(i in 0..20) {
CreateShotA(i, GetX, GetY, 10);
SetShotDataA(i, 0, 2, GetAngleToPlayer+i*18, 0, 0, 2, RED11);
SetShotDataA(i, 60, 2, GetAngleToPlayer+i*18-90, -1, 0, 2, RED11);
SetShotDataA(i, 90, 2, NULL, 0, 0, 2, RED11);
FireShot(i);
}

Twenty bullets are created at the boss's position. The first SetShotDataA function tells the bullets to fire in a circle as soon as they're created with a speed of 2. Sixty frames later, the bullets will begin turning, and thirty frames after that (frame 90 after shooting), the bullets will travel at whatever angle they had at the time.

To make it look similar to Rumia's Demarcation, simply create another ascent loop, but in the second SetShotDataA function, change the -90 and -1 to +90 and 1, respectively. This will create a mirrored ring of bullets that will intersect with the other one.

Does that help? I can go into SetShotDataA in more detail if you'd like.
This also applies to Misyaguzi-sama, doesn't it?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 30, 2009, 03:09:56 AM
Yes, but a few angle changes and only the last two Sets are used.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Janitor Morgan on November 30, 2009, 03:15:03 AM
This also applies to Misyaguzi-sama, doesn't it?

Yes, it does.

I haven't played MoF yet, so I had to go look it up. colonvee
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: KrackoCloud on November 30, 2009, 04:52:45 AM
Creating things similar to Demarcation requires some knowledge of how the CreateShotA series of functions works:

CreateShotA(id, x-position, y-position, delay);
SetShotDataA(id, frame, speed, angle, turn speed, acceleration, minimum/maximum speed, graphic);
FireShot(id);

What SetShotDataA does is tell the bullet what it will do once it's fired. The "frame" parameter is especially important. For example, take the following code:

Code: [Select]
ascent(i in 0..20) {
CreateShotA(i, GetX, GetY, 10);
SetShotDataA(i, 0, 2, GetAngleToPlayer+i*18, 0, 0, 2, RED11);
SetShotDataA(i, 60, 2, GetAngleToPlayer+i*18-90, -1, 0, 2, RED11);
SetShotDataA(i, 90, 2, NULL, 0, 0, 2, RED11);
FireShot(i);
}

Twenty bullets are created at the boss's position. The first SetShotDataA function tells the bullets to fire in a circle as soon as they're created with a speed of 2. Sixty frames later, the bullets will begin turning, and thirty frames after that (frame 90 after shooting), the bullets will travel at whatever angle they had at the time.

To make it look similar to Rumia's Demarcation, simply create another ascent loop, but in the second SetShotDataA function, change the -90 and -1 to +90 and 1, respectively. This will create a mirrored ring of bullets that will intersect with the other one.

Does that help? I can go into SetShotDataA in more detail if you'd like.

Oh hey, it works. Thanks!

It's fine, you've said plenty. Actually, I already knew some of that ShotA stuff.
It's just that, you know. The knowledge and the application of processes (for lots of things in general) are usually very different things.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on November 30, 2009, 10:26:57 AM
People underestimate the usage of CreateShotA. It is godly because it gives allmost all posibilities with parameters. If Object Bullets would have the same functions then object bullets would be godly. And same goes for createshotA, if it was complex programmable then it would be even more godly.

Unless your name is Blargel and insert custom complex functions into your game.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 30, 2009, 01:09:14 PM
Unless your name is Blargel and insert custom complex functions into your game.

Actually I don't even need those complex custom functions I wrote to make objects behave like ShotAs. I can imitate whatever behavior I want with object bullets and tasks. :D

The only difference is, ShotA is easier to think with, but once someone gets used to controlling the behavior of an object bullet, you can easily surpass the flexibility of a ShotA.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: ChaoStar on November 30, 2009, 01:19:24 PM
I have no idea what's wrong. Help me, onii-sama!

Code: [Select]
#TouhouDanmakufu[Player]
#ScriptVersion[2]
#Menu[Kaguya Houraisan]
#Text[Lunatic Princess. Designed by ChaoStar.]
#Image[.\KaguyaProfile.png]
#ReplayName[Short player name]


script_player_main{

let CSD = GetCurrentScriptDirectory;

let imgPlayer = CSD ~ "KaguyaSheet.png";

let frodo = 0; //frodo is for frames.

let kirk = 0; //kirk is for count.

let ImpossibleRequest = 1;

  @Initialize{
LoadPlayerShotData(GetCurrentScriptDirectory~"Kaguya_shotdata.txt");
LoadGraphic(imgPlayer);
SetPlayerLifeImage(imgPlayer,45,34,59,47);
SetItemCollectLine(128);
SetSpeed(4.6, 1.8);
mainTask;

}

@MainLoop{
SetIntersectionCircle(GetPlayerX,GetPlayerY,0);
if(GetKeyState(VK_USER)==KEY_PUSH){ImpossibleRequest++; if(ImpossibleRequest==6){ImpossibleRequest=1;}}
yield;


}

@Missed{
}

@Spellcard{
}

@DrawLoop{
  SetTexture(imgPlayer);
SetGraphicRect(24,54,64,95);
  DrawGraphic(GetPlayerX(), GetPlayerY());
}

@Finalize{
}



task mainTask{
loop{
if(ImpossibleRequest==1){JewelBranch;} else if(ImpossibleRequest==2){FireCape;} else if(ImpossibleRequest==3){dostuff;} else if(ImpossibleRequest==4){dostuff;} else if(ImpossibleRequest==5){dostuff;}
yield;
}
}

task dostuff{
loop{
yield;
}
}

task JewelBranch;
loop{
redFire;
greenFire;
blueFire;
pinkFire;
yellowFire;
yield;
}

task redFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*3+270,2.6,1,1); kirk += 13;}}frodo++;
}


task greenFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*10+270,2.6,1,3); kirk += 3;}frodo++;
}


task blueFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*30+270,2.6,1,2); kirk += 3;}frodo++;
}

task pinkFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*90+270,2.6,1,4); kirk += 3;}frodo++;
}

task yellowFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,3,sin(kirk)*60+270,2.6,1,5); kirk += 1;}frodo++;
}

task fireLoveLaser{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,270,4,3,6);} frodo++;
}

task FireCape{
loop{
fireLoveLaser;
//fireball;
yield;
}
}










}

script_spell ScriptName{
  @Initialize{
  }
  @MainLoop{
  }
  @Finalize{
  }
}

http://i880.photobucket.com/albums/ac9/Zrathgar/Screenshot2009-11-30at81527AM.png
is the error
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on November 30, 2009, 01:31:05 PM
I spotted two errors:

One, your JewelBranch task had a ; instead of a {
Two, your redFire task has an extra }

The error was being caused because it couldn't find FireCape, and the reason it couldn't find FireCape is because you had two extra } compared to {.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: ChaoStar on November 30, 2009, 02:49:00 PM
Grah. Now something unexpected happened, and I can't seem to figure it out. uuu~

http://i880.photobucket.com/albums/ac9/Zrathgar/Screenshot2009-11-30at94713AM.png

which came from:

Code: [Select]
#TouhouDanmakufu[Player]
#ScriptVersion[2]
#Menu[Kaguya Houraisanfailure]
#Text[Lunatic Princess. Designed by ChaoStar.]
#Image[.\KaguyaProfile.png]
#ReplayName[Short player name]


script_player_main{

let CSD = GetCurrentScriptDirectory;

let imgPlayer = CSD ~ "KaguyaSheet.png";

let frodo = 0; //frodo is for frames.

let kirk = 0; //kirk is for count.

let ImpossibleRequest = 1;

  @Initialize{
LoadPlayerShotData(GetCurrentScriptDirectory~"Kaguya_shotdata.txt");
LoadGraphic(imgPlayer);
SetPlayerLifeImage(imgPlayer,45,34,59,47);
SetItemCollectLine(128);
SetSpeed(4.6, 1.8);
mainTask;

}

@MainLoop{
SetIntersectionCircle(GetPlayerX,GetPlayerY,0);
if(GetKeyState(VK_USER)==KEY_PUSH){ImpossibleRequest++; if(ImpossibleRequest==6){ImpossibleRequest=1;}}
yield;


}

@Missed{
}

@Spellcard{
}

@DrawLoop{
  SetTexture(imgPlayer);
SetGraphicRect(24,54,64,95);
  DrawGraphic(GetPlayerX(), GetPlayerY());
}

@Finalize{
}



task mainTask{
loop{
if(ImpossibleRequest==1){JewelBranch;} else if(ImpossibleRequest==2){FireCape;} else if(ImpossibleRequest==3){dostuff;} else if(ImpossibleRequest==4){dostuff;}else if(ImpossibleRequest==5){dostuff;}
yield;
}
}

task dostuff{
loop{
yield;
}
}

task JewelBranch{
loop{
redFire;
greenFire;
blueFire;
pinkFire;
yellowFire;
yield;
}
}

task redFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*3+270,2.6,1,1); kirk += 13;}frodo++;
}


task greenFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%10==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*10+270,2.6,1,3); kirk += 3;}frodo++;
}


task blueFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%10==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*30+270,2.6,1,2); kirk += 3;}frodo++;
}

task pinkFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%10==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*90+270,2.6,1,4); kirk += 3;}frodo++;
}

task yellowFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%10==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,3,sin(kirk)*60+270,2.6,1,5); kirk += 1;}frodo++;
}

task fireLoveLaser{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,270,4,3,6);} frodo++;
}

task FireCape{
loop{
fireLoveLaser;
//fireball;
yield;
}

}



}

script_spell ScriptName{
  @Initialize{
  }
  @MainLoop{
  }
  @Finalize{
  }
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on November 30, 2009, 03:43:04 PM
I don't know exactly what it is supposed to look like, but by skimming over you script, I noticed that you have included if(frodo%1==0) several times. Frodo being a variable that, as far as I can tell, has only integers as values, this condition is always true. Should the problem be that Kaguya fires too rapidly, it may stem from this.  :-\

If that's not the problem, please elaborate what exactly doesn't work as intended there so we can help you.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: ChaoStar on November 30, 2009, 04:16:48 PM
I don't know exactly what it is supposed to look like, but by skimming over you script, I noticed that you have included if(frodo%1==0) several times. Frodo being a variable that, as far as I can tell, has only integers as values, this condition is always true. Should the problem be that Kaguya fires too rapidly, it may stem from this.  :-\

If that's not the problem, please elaborate what exactly doesn't work as intended there so we can help you.

No. It operates correctly in the pre-alpha version, before I added the variables and such.

old script( can also be found in my scripts thread )
Code: [Select]
#TouhouDanmakufu[Player]
#ScriptVersion[2]
#Menu[Kaguya Houraisan]
#Text[Lunatic Princess. Designed by ChaoStar.]
#Image[.\KaguyaProfile.png]
#ReplayName[Short player name]


script_player_main{

let CSD = GetCurrentScriptDirectory;

let imgPlayer = CSD ~ "KaguyaSheet.png";

let frodo = 0; //frodo is for frames.

let kirk = 0; //kirk is for count.

  @Initialize{
LoadPlayerShotData(GetCurrentScriptDirectory~"Kaguya_shotdata.txt");
LoadGraphic(imgPlayer);
SetPlayerLifeImage(imgPlayer,45,34,59,47);
SetItemCollectLine(128);
SetSpeed(4.6, 1.8);
mainTask;

}

@MainLoop{
SetIntersectionCircle(GetPlayerX,GetPlayerY,0);
yield;


}

@Missed{
}

@Spellcard{
}

@DrawLoop{
  SetTexture(imgPlayer);
SetGraphicRect(24,54,64,95);
  DrawGraphic(GetPlayerX(), GetPlayerY());
}

@Finalize{
}



task mainTask{
loop{
redFire;
greenFire;
blueFire;
pinkFire;
yellowFire;
yield;
}


task redFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*3+270,2.6,1,1); kirk += 13;}}frodo++;
}


task greenFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*10+270,2.6,1,3); kirk += 3;}frodo++;
}


task blueFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*30+270,2.6,1,2); kirk += 3;}frodo++;
}

task pinkFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*90+270,2.6,1,4); kirk += 3;}frodo++;
}

task yellowFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,3,sin(kirk)*60+270,2.6,1,5); kirk += 1;}frodo++;
}

//task redFocus{
//if((GetKeyState(VK_SLOWMOVE) == KEY_PUSH || GetKeyState(VK_SLOWMOVE) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY+5,6,270,3,1,1);} else {redFire;}frodo++;
//}



}

script_spell ScriptName{
  @Initialize{
  }
  @MainLoop{
  }
  @Finalize{
  }
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on November 30, 2009, 04:42:44 PM
Hmm, I think I'm on to something again!


   task mainTask{
   loop{
   if(ImpossibleRequest==1){JewelBranch;} else if(ImpossibleRequest==2){FireCape;} else if(ImpossibleRequest==3){dostuff;} else if(ImpossibleRequest==4){dostuff;}else if(ImpossibleRequest==5){dostuff;}
   yield;
      }
   }

   task JewelBranch{
      loop{
   redFire;
   greenFire;
   blueFire;
   pinkFire;
   yellowFire;   
   yield;
      }
   }

The number of times the task JewelBranch runs per frame increases by 1 every frame. After a couple of seconds, the task JewelBranch is run several hundred times per frame, thus giving you the cluster of bullets and the extreme slowdown you're experiencing.

Or at least I believe so. Keep in mind that I am the loser who cannot run danmakufu because he hasn't bought a new PC yet.  :V


...and I still don't see the sense of a condition that reads if(true=true)...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on November 30, 2009, 04:51:13 PM
I cannot run Danmakufu because it still crashes every time I try to load something.

Yes, I already tried running it through config.exe...
Yes, I have AppLocale...

And yet...

Also, I had a really odd spell card idea: A card based on the Bubbler LV3 from Cave Story.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on November 30, 2009, 04:52:27 PM
Yeah, just get rid of the loop and yield in JewelBranch.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on December 01, 2009, 12:23:17 AM
Something's wrong; the Sanae player scripts refuse to show up during player selection...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Janitor Morgan on December 01, 2009, 01:21:39 AM
Something's wrong; the Sanae player scripts refuse to show up during player selection...

Does the script you're trying to run say
Code: [Select]
#Player[REIMU,MARISA]near the top? If so, change everything inside the brackets to FREE -- that should fix it.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on December 01, 2009, 01:31:10 AM
Actually, no, Sakuya showed up just fine.

(Turns out I should have thought of pressing left or right sooner  :-\)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Mounting Jaggis on December 01, 2009, 09:29:56 AM
Too lazy to check 50 pages, does anyone have the translation of the config? I want to know what everything else does. I can't seem to find one anywhere, not even on the wiki.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on December 01, 2009, 10:05:38 AM
How do you check what player you're using in a script, mostly used for conditional dialogues...

using
GetPlayerType(_____)? and what do I put in the blank? menu name or replay name?
also, how about
GetPlayerScriptName()?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Nimble on December 01, 2009, 01:04:10 PM
I using item spawning system like in 東方意地奴 ~ Touhou Ijiyatsu and got some ... funny problem.

If I cast spellcard (bomb) everything stop except of effect (include item) during casting. How can I stop them too?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: ChaoStar on December 01, 2009, 03:02:39 PM
Code: [Select]
#TouhouDanmakufu[Player]
#ScriptVersion[2]
#Menu[Kaguya Houraisan]
#Text[Lunatic Princess. Designed by ChaoStar.]
#Image[.\KaguyaProfile.png]
#ReplayName[Short player name]


script_player_main{

let CSD = GetCurrentScriptDirectory;

let imgPlayer = CSD ~ "KaguyaSheet.png";

let frodo = 0; //frodo is for frames.

let kirk = 0; //kirk is for count.

let ImpossibleRequest = 1;


  @Initialize{
LoadPlayerShotData(GetCurrentScriptDirectory~"Kaguya_shotdata.txt");
LoadGraphic(imgPlayer);
SetPlayerLifeImage(imgPlayer,45,34,59,47);
SetItemCollectLine(128);
SetSpeed(4.6, 1.8);
mainTask;

}

@MainLoop{
SetIntersectionCircle(GetPlayerX,GetPlayerY,0);
if(GetKeyState(VK_USER)==KEY_PUSH){ImpossibleRequest++; if(ImpossibleRequest==6){ImpossibleRequest=1;}}
yield;


}

@Missed{
}

@Spellcard{
}

@DrawLoop{
  SetTexture(imgPlayer);
SetGraphicRect(24,54,64,95);
  DrawGraphic(GetPlayerX(), GetPlayerY());
}

@Finalize{
}



task mainTask{
loop{
if(ImpossibleRequest==1){JewelBranch;} else if(ImpossibleRequest==2){FireCape;} else if(ImpossibleRequest==3){DragonNecklace;} else if(ImpossibleRequest==4){StoneBowl}else if(ImpossibleRequest==5){CowryShell;}
yield;
}
}

task dostuff{
loop{
yield;
}
}



task JewelBranch{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*3+270,2.6,1,1); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*10+270,2.6,1,3); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*30+270,2.6,1,2); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*90+270,2.6,1,4); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,3,sin(kirk)*60+270,2.6,1,5); kirk += 13;}frodo++;
}


task FireCape{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%3==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,8,rand_int(250,290),10,3,6); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*20+250,4.5,1,7); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*30+290,4.5,1,7); CreatePlayerShot01(GetPlayerX+rand_int(-30,30),GetPlayerY+rand_int(-30,30),1,270+rand_int(-10,10),4.5,1,6); kirk += 13;} frodo++;
}

task DragonNecklace{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%3==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY,7,sin(kirk)*30+250,2.8,5,8); CreatePlayerShot01(GetPlayerX,GetPlayerY,7,sin(kirk)*30+290,2.8,5,11); CreatePlayerShot01(GetPlayerX,GetPlayerY,9,atan2(GetEnemyY-GetPlayerY, GetEnemyX-GetPlayerX),2.8,5,9); CreatePlayerShot01(GetPlayerX,GetPlayerY,7,sin(kirk)*30+rand_int(200,340),2.8,5,10); kirk += 13;} frodo++;
}

task StoneBowl{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%3==0) {BuddhaBullet(GetPlayerX,GetPlayerY,2.5,270+kirk,2.5,255,13); BuddhaBullet(GetPlayerX,GetPlayerY,2.5,235+kirk,2.5,255,13); BuddhaBullet(GetPlayerX,GetPlayerY,2.5,190+kirk,2.5,255,13); BuddhaBullet(GetPlayerX,GetPlayerY,2.5,145+kirk,2.5,255,13); BuddhaBullet(GetPlayerX,GetPlayerY,2.5,100+kirk,2.5,255,13); BuddhaBullet(GetPlayerX,GetPlayerY,2.5,55+kirk,2.5,255,13); CreatePlayerShot01(GetPlayerX,GetPlayerY,2.5,10+kirk,2.5,255,13); BuddhaBullet(GetPlayerX,GetPlayerY,2.5,-35+kirk,2.5,255,13); kirk += 13;} frodo++;
}


task CowryShell{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%3==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk)*10+270,6,1,14); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk+180)*10+270,6,1,15); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk+180)*30+270,2.5,1,2); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk+180)*35+270,2.5,1,2); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk+180)*40+270,2.5,1,2); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk+180)*45+270,2.5,1,2); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk+180)*50+270,2.5,1,2);kirk += 13;} frodo++;
}

task BuddhaBullet(x,y,v,dir,damage,penetration,graphic){
let obj = Obj_Create(OBJ_SHOT);

Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,v);
Obj_SetAngle(obj,dir);
ObjShot_SetGraphic(obj,graphic);
ObjShot_SetBombResist(obj,true);
ObjShot_SetDamage(obj, damage);
ObjShot_SetPenetration(obj, penetration);
while(!Obj_BeDeleted(obj)){
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD)){
ObjShot_SetDamage(obj,1+picard);
picard += 0.1;

}


yield;

}
}


}

script_spell ScriptName{
  @Initialize{
  }
  @MainLoop{
  }
  @Finalize{
  }
}

There's an error with Picard on line 106, and I don't know what I did wrong~ Help me, onii-sama!
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Janitor Morgan on December 01, 2009, 03:11:26 PM
Doesn't look like you defined that variable anywhere.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on December 01, 2009, 08:13:33 PM
Whenever I try to use the Expanded Shot Replace script, it doesn't work properly. What might be wrong?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on December 01, 2009, 08:44:22 PM
Whenever I try to use the Expanded Shot Replace script, it doesn't work properly. What might be wrong?

What is "not proper" ?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on December 01, 2009, 08:48:35 PM
Script fails...

Code: [Select]
#TouhouDanmakufu
#Title[Force Round]
#Text[Based on something I can't remeber the name of]
#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(40);
SetScore(1000);
SetMovePosition01(GetCenterX,GetCenterY,5);
LoadGraphic(imgBoss);
shotinit;
mainTask;
let xmax = 3;
}

@MainLoop{

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{
yield;
fire;
}

task fire{
let x = 0;
let dirmod = 0;
xmax++;
while(x<xmax){
homingshot(GetX+25*cos(GetAngleToPlayer+dirmod),GetY+25*sin(GetAngleToPlayer+dirmod),0,0,YELLOW214,0);
dirmod+=360/xmax;
x++;
}
x=0;
dirmod=0;
wait(45);
}

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

task homingshot(x,y,v,dir,graphic,delay){
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,v);
Obj_SetAngle(obj,dir);
ObjShot_SetGraphic(obj,graphic);
ObjShot_SetDelay(obj,delay);

while(Obj_BeDeleted(obj)==false){
Obj_SetAngle(obj,atan2(GetPlayerY - Obj_GetY(obj), GetPlayerX - Obj_GetX(obj)));
ObjShot_SetGraphic(obj,YELLOW214);
Obj_SetSpeed(obj,1);
wait(30);
yield;
}
}
}
This pattern is supposed to produce slow-moving aimed large stars.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on December 01, 2009, 09:03:34 PM
First thing, move let xmax = 3; to where CSD and imgBoss are. Doesn't look to be the problem because it yields first, but still. Where/how exactly does it fail...?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on December 01, 2009, 09:25:31 PM
"#include_function(で(two kanji)するフ(more katakana)[file path](more japanese text)".

Can't find any of the other characters...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on December 01, 2009, 09:41:15 PM
Oh. Your syntax is wrong. Just get rid of the semicolon at the end of include_function.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on December 01, 2009, 09:47:44 PM
"#include_function(で(two kanji)するフ(more katakana)[file path](more japanese text)".

Can't find any of the other characters...
Just screenshot it and we'll see.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on December 01, 2009, 10:00:53 PM
Fixed the syntax.

(Epic fail on my part)

This still occurs, though.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on December 01, 2009, 10:15:14 PM
nice job covering the actual error lol
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on December 01, 2009, 10:19:46 PM
Let's try this again.

(http://i50.tinypic.com/2m7x3xj.png)

There.

...Perchance I should have veiled up my name there.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on December 01, 2009, 10:45:16 PM
Let's try this again.

(http://i50.tinypic.com/2m7x3xj.png)

There.

...Perchance I should have veiled up my name there.
Touhou Danmakufu can't find the "shot_replace.dnh" in libExpandedShotData folder. (Did I say that properly?)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on December 01, 2009, 10:53:45 PM
OH, THAT'S IT?

I had Expanded Shot Replace outside of lib.

Figures, except it's only firing one set of stars...

And I should probably change the stars to something less... jerky.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on December 01, 2009, 11:27:04 PM
It only fires one set because
-On Initialize, mainTask is run
-mainTask waits a frame and tells fire to run
-fire shoots bullets
And that's it. Make a loop in mainTask like

Code: [Select]
   task mainTask{
      loop{
         loop(20){yield;}
         fire;
      }
   }
or something. Also remember to reset xmax, or after a while it'll start shitting stars like IaMP.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on December 01, 2009, 11:50:56 PM
It's a survival card (hence the lack of hitbox), so it's supposed to get more aggressive over time.

But I think I'll scrap the idea...

How would I get bullets to move sort of like the white squares always floating around bosses?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: ChaoStar on December 02, 2009, 03:14:33 AM
MY BOMB IT DOES NOT ACTIVATE. Help me Onii-sama  :'(

Code: [Select]
#TouhouDanmakufu[Player]
#ScriptVersion[2]
#Menu[Kaguya Houraisan]
#Text[Lunatic Princess. Designed by ChaoStar.]
#Image[.\KaguyaProfile.png]
#ReplayName[Short player name]


script_player_main{

let CSD = GetCurrentScriptDirectory;

let imgPlayer = CSD ~ "KaguyaSheet.png";

let frodo = 0; //frodo is for frames.

let kirk = 0; //kirk is for count.

let ImpossibleRequest = 1;


  @Initialize{
LoadPlayerShotData(GetCurrentScriptDirectory~"Kaguya_shotdata.txt");
LoadGraphic(imgPlayer);
SetPlayerLifeImage(imgPlayer,45,34,59,47);
SetItemCollectLine(128);
SetSpeed(4.6, 1.8);
mainTask;

}

@MainLoop{
SetIntersectionCircle(GetPlayerX,GetPlayerY,0);
if(GetKeyState(VK_USER)==KEY_PUSH){ImpossibleRequest++; if(ImpossibleRequest==6){ImpossibleRequest=1;}}
yield;


}

@Missed{
}

@Spellcard{
    UseSpellCard("EternityManipulation", 0);
}

@DrawLoop{
  SetTexture(imgPlayer);
SetGraphicRect(24,54,64,95);
  DrawGraphic(GetPlayerX(), GetPlayerY());
}

@Finalize{
}



task mainTask{
loop{
if(ImpossibleRequest==1){JewelBranch;} else if(ImpossibleRequest==2){FireCape;} else if(ImpossibleRequest==3){DragonNecklace;} else if(ImpossibleRequest==4){StoneBowl}else if(ImpossibleRequest==5){CowryShell;}
yield;
}
}

task dostuff{
loop{
yield;
}
}



task JewelBranch{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-10,6,sin(kirk)*3+270,2.6,1,1); CreatePlayerShot01(GetPlayerX,GetPlayerY-10,6,sin(kirk)*10+270,2.6,1,3); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*30+270,2.6,1,2); CreatePlayerShot01(GetPlayerX,GetPlayerY-10,6,sin(kirk)*90+270,2.6,1,4); CreatePlayerShot01(GetPlayerX,GetPlayerY-10,3,sin(kirk)*60+270,2.6,1,5); kirk += 13;}frodo++;
}


task FireCape{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%3==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,8,rand_int(250,290),10,3,6); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*20+250,4.5,1,7); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*30+290,4.5,1,7); CreatePlayerShot01(GetPlayerX+rand_int(-30,30),GetPlayerY+rand_int(-30,30),1,270+rand_int(-10,10),4.5,1,6); kirk += 13;} frodo++;
}

task DragonNecklace{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%3==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY,7,sin(kirk)*30+250,2.8,5,8); CreatePlayerShot01(GetPlayerX,GetPlayerY,7,sin(kirk)*30+290,2.8,5,11); CreatePlayerShot01(GetPlayerX,GetPlayerY,9,atan2(GetEnemyY-GetPlayerY, GetEnemyX-GetPlayerX),1.5,1,9); CreatePlayerShot01(GetPlayerX,GetPlayerY,7,sin(kirk)*30+rand_int(200,340),2.8,5,10); kirk += 13;} frodo++;
}

task StoneBowl{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%3==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY,2.5,135+kirk,1,255,13); CreatePlayerShot01(GetPlayerX,GetPlayerY,2.5,180+kirk,1,255,13); CreatePlayerShot01(GetPlayerX,GetPlayerY,2.5,225+kirk,1,255,13); CreatePlayerShot01(GetPlayerX,GetPlayerY,2.5,270+kirk,1,255,13); CreatePlayerShot01(GetPlayerX,GetPlayerY,2.5,315+kirk,1,255,13); CreatePlayerShot01(GetPlayerX,GetPlayerY,2.5,360+kirk,1,255,13); CreatePlayerShot01(GetPlayerX,GetPlayerY,2.5,405+kirk,1,255,13); CreatePlayerShot01(GetPlayerX,GetPlayerY,2.5,450+kirk,1,255,13); kirk += 13;} frodo++;
}


task CowryShell{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%3==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk)*10+270,6,1,14); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk+180)*10+270,6,1,15); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk+180)*30+270,2.5,1,2); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk+180)*35+270,2.5,1,2); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk+180)*40+270,2.5,1,2); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk+180)*45+270,2.5,1,2); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk+180)*50+270,2.5,1,2);kirk += 13;} frodo++;
}




}

script_spell EternityManipulation{
let img_spell = GetCurrentScriptDirectory()~"KaguyaSheet.png";

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


task run{
SetPlayerInvincibility(540);
ForbidShot(true);
loop(26){
let dir = rand(-180, 180);
ascent(samwise in 0..25){
CreatePlayerShot01(GetPlayerX,GetPlayerY-10,7,dir+(samwise*(360/25)),3.5,255,15);
}
wait(120);
yield;
end();
}
}


@Initialize{
LoadGraphic(img_spell);
run();
}

@MainLoop{
CollectItems();
yield;
}

@Finalize{
DeleteGraphic(img_spell);
}

}

No error, but when I press X, no bombs.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on December 02, 2009, 03:23:39 AM
Read the damn tutorial.

@Spellcard{
   UseSpellCard("EternityManipulation", 0);
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on December 02, 2009, 04:34:43 AM
I wouldn't use 1337 as a number as danmakufu only allows a range from 1 to 255 :V

Sorry for bringing this up so late in the post, but actually I have a bullet id at 300 and it fires.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on December 02, 2009, 05:17:06 AM
Okay,different question:

If I want to use CutIn without a boss cut-in image (as in Resurrection Butterfly or Cat's Walk), what should CutIn's arguments be?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on December 02, 2009, 05:25:41 AM
Sorry for bringing this up so late in the post, but actually I have a bullet id at 300 and it fires.
Anything over 255 counts as 255.

So CreateShot(blah blah, 9001); would fire the bullet with id 255.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Janitor Morgan on December 02, 2009, 05:31:05 AM
Okay,different question:

If I want to use CutIn without a boss cut-in image (as in Resurrection Butterfly or Cat's Walk), what should CutIn's arguments be?

Code: [Select]
CutIn(YOUMU, "card name here", "", 0, 0, 0, 0);
Leaving the second set of quotations blank will produce no image.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on December 02, 2009, 06:21:12 AM
I get an error starting at the CutIn line in this script:

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(40);
SetScore(1000);
SetMovePosition01(GetCenterX,GetCenterY,5);
LoadGraphic(imgBoss);
shotinit;
CutIn(KOAMU,"Danmaku Upgrade "\"Alpha Shock"\","",0,0,0,0);
mainTask;
}

@MainLoop{

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{
loop{
yield;
fire;
}
}

task fire{
let n = 0;
let dx = 0;
//YELLOW01 is 16 px tall and the play field is 480 px tall
//create two lightning bolts from 1/3 and 2/3 the width of the screen, starting at the top
while(n<480/16){
//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(448/3+dx,16*n,0,0,YELLOW01,0);
lightning(448*2/3+dx,16*n,0,0,YELLOW01,0);
}else{
lightning(448/3+dx,16*n,0,180,YELLOW01,0);
lightning(448*2/3+dx,16*n,0,180,YELLOW01,0);
}
wait(5);
dx=rand_int(-8,8)
n++;
}
n = 0;
dx = 0;
wait(45);
//create a lightning bolt starting from the top middle
while(n<480/16){
//bullets in the middle chain will appear to split and move both left and right
lightning(448/2+dx,16*n,0,180,YELLOW01,0);
lightning(448/2+dx,16*n,0,0,YELLOW01,0);
wait(5);
dx=rand_int(-8,8)
n++;
}
n = 0;
dx = 0;
wait(45);
}

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);
Obj_SetSpeed(shard,v);
wait(10);
Obj_SetSpeed(shard,3);
}

}

Keep in mind, it's woefully unfinished.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on December 02, 2009, 06:30:31 AM
KOUMA, silly.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Janitor Morgan on December 02, 2009, 06:32:01 AM
I think he's missing a quotation mark just before Alpha, as well.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on December 02, 2009, 06:34:12 AM
KOUMA, silly.

...oops.
Turns out that wasn't the only thing...
(http://i47.tinypic.com/wr0xed.png)
I was missing a quotation mark, but after the Shock rather than before Alpha.Or maybe it WAS supposed to be in that place. Good thing I had Naut's Black Hole card as a reference.
Didn't stop this though.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on December 02, 2009, 07:18:11 AM
...oops.
Turns out that wasn't the only thing...

error image

Another error the wiki doesn't have... This one has something to do with ).

I think he's missing a quotation mark just before Alpha, as well.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on December 02, 2009, 07:24:57 AM
(runs the spell card) Hey, no errors.

What's this?
Straight lines... too many bullets... OH NO (dies)

...Still needs some work.

A little bit of work later...

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);
SetDamageRate(25,25);
SetMovePosition01(GetCenterX,GetCenterY-60,5);
SetEnemyMarker(true);
SetInvincibility(50);
LoadGraphic(imgBoss);
shotinit;
CutIn(KOUMA,"Danmaku Upgrade "\""Alpha Shock"\","",0,0,0,0);
mainTask;
}

@MainLoop{

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{
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,16);
loop{
fire;
wait(240);
}
}

task fire{
let n = 0;
let dx = 0;
let xa = (448/4)+dx;
let xb = (448*3/4)+dx;
let xc = (448/2)+dx;
//YELLOW01 is 16 px tall and the play field is 480 px tall
//create two lightning bolts from 1/3 and 2/3 the width of the screen starting at the top
while(n<480/16){
//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+dx,16*n,0,0,YELLOW01,0);
lightning(xb+dx,16*n,0,0,YELLOW01,0);
}else{
lightning(xa+dx,16*n,0,180,YELLOW01,0);
lightning(xb+dx,16*n,0,180,YELLOW01,0);
}
wait(5);
dx=rand_int(-8,8);
xa+=dx;
xb+=dx;
n++;
}
n = 0;
dx = 0;
xa = (448/4);
xb = (448*3/4);
wait(90);
//create a lightning bolt starting from the top middle
while(n<480/16){
//bullets in the middle chain will have the opposite system from that above
if(floor(n/2) < n/2){
lightning(xc+dx,16*n,0,180,YELLOW01,0);
}else{
lightning(xc+dx,16*n,0,0,YELLOW01,0);
}
wait(5);
dx=rand_int(-8,8);
n++;
}
n = 0;
dx = 0;
xc = (448/2);
wait(90);
}

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);
Obj_SetSpeed(shard,v);
wait(45);
Obj_SetSpeed(shard,1);
}

}

Now all I need to do is figure out how to get the center bolt staggered so that it appears halfway in between the two outer bolts. Currently, the middle one starts on the 2nd side bolt iteration and then syncs.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: ChaoStar on December 02, 2009, 12:55:44 PM
Read the damn tutorial.

@Spellcard{
   UseSpellCard("EternityManipulation", 0);
}

I did. Also, it still does not work.
http://www.shrinemaiden.org/forum/index.php?topic=3218.msg182213#msg182213
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye on December 02, 2009, 02:56:49 PM
that's cause it's suppose to be typed like this...

@SpellCard{
  UseSpellCard("EternityManipulation", 0);
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on December 02, 2009, 07:22:00 PM
Seriously people. Danmakufu is CASE SENSETIVE

People should read first instead of hitting the "reply" button rapidly.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on December 02, 2009, 07:45:47 PM
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(5);
LoadGraphic(imgBoss);
shotinit;
CutIn(KOUMA,"Danmaku Upgrade "\""Alpha Shock"\","",0,0,0,0);
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,16);
mainTask;
}

@MainLoop{

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{
loop{
fire;
wait(100);
centerbolt;
wait(100);
}
}

task fire{
let n = 0;
let dx = 0;
let xa = (448/4)+dx;
let xb = (448*3/4)+dx;
let xc = (448/2)+dx;
wait(200);
//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+dx,12*n,0,0,YELLOW01,n);
lightning(xb+dx,12*n,0,0,YELLOW01,n);
}else{
lightning(xa+dx,12*n,0,180,YELLOW01,n);
lightning(xb+dx,12*n,0,180,YELLOW01,n);
}
wait(1);
dx=rand_int(-8,8);
xa+=dx;
xb+=dx;
n++;
}

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

}

task centerbolt{
let n = 0;
let dx = 0;
let xc = (448/2)+dx;
wait(200);
//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);
}

}

Okay, I've made some improvements and it's playable, except for the fact that the boss is invinvicle. For some reason, Sanae A's homeing works but does no damage, but Reimu A's does not.

Is something wrong with the SetInvincibility or the SetCollision?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on December 02, 2009, 07:48:45 PM
Collision goes in the mainloop. And your invincibility is 5 frames ( which is not even half a second ) are you sure with this?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on December 02, 2009, 10:48:45 PM
I thought it might have been calculating invincibility time in seconds, so I changed it to 5.

Now it is set to 80.

Also, that worked.

Now to figure out how to work in the "critical timer" sound...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Cabble on December 02, 2009, 11:32:40 PM
I know you can use GetAngleToPlayer, but is there a GetAngleToEnemy?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on December 02, 2009, 11:56:39 PM
From the player to the enemy?

That should just be GetAngleToPlayer+180.  :V
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Cabble on December 03, 2009, 12:30:06 AM
Nope. I'm doing from the sides t the enemy.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on December 03, 2009, 01:03:53 AM
atan2(GetX-[x-coordinate of point],GetY-[y-coordinate of point]) should work. If it doesn't, switch the GetX and coordinate in both arguments.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Azure Lazuline on December 03, 2009, 01:06:38 AM
Switch X and Y. atan2(destY-sourceY,destX-sourceX);
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on December 03, 2009, 01:12:52 AM
Switch X and Y. atan2(destY-sourceY,destX-sourceX);
If it doesn't, switch the GetX and coordinate in both arguments.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: CK Crash on December 03, 2009, 02:18:55 AM
Seriously people. Danmakufu is CASE SENSETIVE

People should read first instead of hitting the "reply" button rapidly.
You spelled sensitive wrong :V
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on December 03, 2009, 04:02:15 AM
You spelled sensitive wrong :V

Do keep in mind that Helepolis is not a native English speaker.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on December 03, 2009, 04:12:33 AM
Do keep in mind that Helepolis is not a native English speaker.
He knows.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on December 03, 2009, 01:51:43 PM
Making spelling mistakes in posts does not makes one's PC crash. Only one's brain. Neverless, the idea is clear. It is just that too many people quickly jump to the forums saying:

" HELP THIS DOESN'T WORK "

I can fully understand the idea of being a newcomer or newbie scripter and that error backtracking is generally hard. I have seen various pms and posts where people do not even check if you type a  (   or a {  correctly. They also never count the ammount of ( 's and { ' s they are opening.

Same goes for standard function names such as CreateShot01 where if you type the 's' in lower case, Danmakufu will bitch on you instantly.

The best way of learning Danmakufu is to first try check your spelling, upper/lower cases, variable names, semicolons etc etc. If you REALLY REALLY cannot find the problem and almost about to tear your hair out, then logically you are FREE to post it on the forum.

Remember that it is not a shame to make errors. But it is a bigger shame if you quickly jump to the forums due to the following attitude:
- I am too lazy to detect the error, the experts will find it out.
- I don't care about error messages as long as my script works.
- I don't want to read tutorials, FAQs because they rob my time.

I got 0 tolerance for these kind of attitude and don't expect help from me if I sense it in your post.


Oh yea, last thing. On IRC: Do not ask if you may ask a question. Just ask the question. This is not some classroom where you need to raise your finger to request permission. Throw in your problem/question and patiently wait if someone replies or reacts. I hardly seen anyone being ignored because lately we got alot of activity in the #danmakufu channel. Ofcourse please remember that people might be idle there. So patience is requested.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Infy♫ on December 04, 2009, 05:50:54 PM
HALP IT DONT WORK
@MainLoop (
CreateShot01(GetAngleToPlayer;
if(2 = 1){
apple = 23

now for some serious questions;
fog is still a big problem.
could you tell me what causes problems with fog?
like too big textures or something? or maybe a certain distance of the camera?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Stuffman on December 05, 2009, 02:31:58 AM
Quote
@MainLoop (
CreateShot01(GetAngleToPlayer;
if(2 = 1){
apple = 23
You capitalized the L in mainloop, you're not supposed to do that :V

Seriously though, fog is a constant source of headaches. It just plain doesn't work well.

Known issues with SetFog:
- Extremely large polygons, larger than about 3000 pixels in either dimension, will break it. This is common with the polygons people use for floors and such that are supposed to stretch out forever. They need to be trimmed and the stage needs to loop rather quickly to get around this.
- ADD filter basically doesn't work with fog at all. You tend to get solid colored polygons whenever you use ADD in fog.
- Fog has issues with camera movement, in that it typically shifts a bit as you move the camera and thus it snaps back into place when you loop the stage. The only reliable workaround to this appears to be to move the entire stage, rather than the camera.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on December 05, 2009, 02:51:17 AM
- Extremely large polygons, larger than about 3000 pixels in either dimension, will break it. This is common with the polygons people use for floors and such that are supposed to stretch out forever. They need to be trimmed and the stage needs to loop rather quickly to get around this.

If the image you're tiling takes up the whole .png (as in, from the very far edge of the image file to the other), then you can just keep scrolling the SetGraphicRect, since it will be infinitely tiled. Other than a really large open area (which I wouldn't recommend due to Danmakufu's lolsy processing of images), you shouldn't really need an image that takes up over 3000x3000 pixels on the screen at any given time, so... :/
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on December 05, 2009, 03:20:34 AM
asdafasf SetFog D:
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Infy♫ on December 05, 2009, 12:42:31 PM
I also have another problem concerning 3D graphics. In stage 1 of the demo i made, you could see a sea, right? well. I wanted to make it look like water but that failed! when I lowered the alpha the texture simply became darker (even though things were drawn underneath it)
any solutions? the texture is a .png
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on December 05, 2009, 01:34:39 PM
That's strange because I was able to alpha out the leaves of a tree as it approached the camera so that they wouldn't look awkward as they block the view and suddenly disappear. Perhaps you're coding it incorrectly?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on December 05, 2009, 06:59:53 PM
Some people say that altering alpha using ObjEffect_SetVertexColor will only darken the image. Because the image is produced using vertices and not as a solid object you can't use Obj_SetAlpha, so I'm not sure how to get around that. Does this happen solely because it uses alpha blending? I haven't had any problems with it before, so...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on December 05, 2009, 07:04:09 PM
Additive drawing cannot be made more opaque ( transparant ) use SetColour for this. This problem generally occurs with @BackGround and @DrawLoop. I have no idea how 3D textures behave with the alpha/add type. I need to investigate this more.

Effect Objects: I notified Drake about this case before as well. Object Effects seem to be functioning weird. 

Obj_SetVertexColor(obj,vertex,alpha,red,green,blue);    <--- even in this code it makes it sometimes darker instead of opaque. But in my spellcircle code, that doesn't occur.

But 3D stage drawing is not done by Effect Objects ( unless you spawn those ).
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Cabble on December 05, 2009, 08:08:50 PM
Okay, I'm using AppLocale with japanese support, however there are 2 things:

It won't create a shortcut
It can't have the line #Player[FREE] in the script or danmakufu will crash
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on December 05, 2009, 10:00:53 PM
No-shortcutting is just a bug that happens on a few systems. I have it too. There's another, easier way.

http://alcahest.perso.sfr.fr/perso/apploc/applocale.html

This will tell you how to get rid of the popup in the beginning, and also how to make programs run in japanese locale just by right-clicking them.


The problem with #Player[FREE] is more than likely one of the players interfering with code. Find the names of all your player scripts, and try #Player[playername] and run with Applocale until one crashes. Then fix whatever could be the problem or post it here.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Cabble on December 06, 2009, 03:52:10 AM
Thanks. It ended up being the CtC marisa, and the program works fine.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Nonnie Grey on December 06, 2009, 03:53:17 AM
Got a somewhat silly novice question that's mostly out of curiosity.

What's the difference between a task and a function? I've seen them both used in the intermediate tutorial thread, but I can't really see any difference. Maybe I'm not looking hard enough?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on December 06, 2009, 04:37:43 AM
The way i see it, functions are used for long streams of code, while tasks are a sort of "orginazation" way of coding. Such as you have to include a function for the Shot Replace, because how it replaces the default IDs with the regulars, such as RED12
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Mounting Jaggis on December 06, 2009, 05:08:50 AM
Actually the difference between task and function is that function takes in an input. For example if you have a shooting task like this:
Code: [Select]
task shoot{
     let x = 0;
     let dir = 0;
     while(x < 15){
          CreateShot(Blah,blah,blah)
          x++;
          dir += 360/15;
     }
}

It will always shoot 15 evenly spread bullets in a circle. But changing "task shoot" to "function shoot(density)" let's you shoot any amount you want without having to rewrite the numbers you want to change. You have to change the code to this:
Code: [Select]
function shoot(density){
     let x = 0;
     let dir = 0;
     while(x < density){
          CreateShot(Blah,blah,blah)
          x++;
          dir += 360/density;
     }
}

Then call shoot with shoot(#) and insert any number you want to shoot any amount of bullet you want and they will still be evenly spread out. There are other things you can do with functions but this is the simplest thing next to wait(w). So if you call shoot(25) then shoot(50) it will first shoot 25 bullets in a circle then 50 by using the same code.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on December 06, 2009, 05:11:02 AM
Actually the difference between task and function is that function takes in an input. For example if you have a shooting task like this:
Code: [Select]
task shoot{
     let x = 0;
     let dir = 0;
     while(x < 15){
          CreateShot(Blah,blah,blah)
          x++;
          dir += 360/15;
     }
}

It will always shoot 15 evenly spread bullets in a circle. But changing "task shoot" to "function shoot(density)" let's you shoot any amount you want without having to rewrite the numbers you want to change. You have to change the code to this:
Code: [Select]
function shoot(density){
     let x = 0;
     let dir = 0;
     while(x < density){
          CreateShot(Blah,blah,blah)
          x++;
          dir += 360/density;
     }
}

Then call shoot with shoot(#) and insert any number you want to shoot any amount of bullet you want and they will still be evenly spread out. There are other things you can do with functions but this is the simplest thing next to wait(w). So if you call shoot(25) then shoot(50) it will first shoot 25 bullets in a circle then 50 by using the same code.

you can also have a task like

task   RedBullet(x,y){
CreateShot01(x,y,3,RED03,0);
}

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Azure Lazuline on December 06, 2009, 05:28:58 AM
Wrong.

Subroutines take no inputs, while functions and tasks both do. Functions are always run in a single frame, while tasks can use yield; to stall for a frame, then continue running.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on December 06, 2009, 05:44:27 AM
Wrong.

Subroutines take no inputs, while functions and tasks both do. Functions are always run in a single frame, while tasks can use yield; to stall for a frame, then continue running.

tasks are run in a single frame and they can use yield;, But functions can assist in the way things work, as i referenced to, the shot replace you need to call #include_function, which is different when you call a task. But also, functions can be called from a seperate file, while tasks cannot
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Azure Lazuline on December 06, 2009, 05:56:19 AM
Uh... #include_function just loads a file, which can contain variable declarations, tasks, and subroutines in addition to functions.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on December 06, 2009, 06:36:39 AM
Azure is right.

All three are just methods of packing code into bundles, and #include_function just loads any information from the called file into the class (script_enemy_main, etc) that it's called in. Subroutines are for simple things that are static; they do the same thing every time. The entire thing is run in one frame. Functions are also run in one frame, but they can take arguments that can be used in the span of that block/frame. Tasks take arguments as well, but they can be suspended by using yield, which stops the block and continues running other things as if the block had ended. Therefore, the arguments called in a task can be used in every frame that the block is run.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye on December 06, 2009, 07:02:53 AM
umm...okay question, is there a way to have it so that when I press VK_USER(C) that the SetVertexUV's coordinates(for the options) change(the ones in task Option(position))?

Another question, should I just have it so that when I press C that it just changes it's VertexColor instead...?

Last question, ohhhh...& how does the task that look like this;

task Shot Type(x, y, graphic){}

work exactly(looking at player tutorial only help a tad bit)?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on December 06, 2009, 09:50:28 AM
About the subroutines, functions, and tasks question:
http://www.shrinemaiden.org/forum/index.php?topic=3218.msg162097#msg162097

For Lawence Codye: You'll need to store the id of the object effect that is displaying the options where it can be accessed in the @MainLoop. Then, somewhere in the player script's @MainLoop, you can do

if(GetKeyState(VK_USER)==KEY_PUSH){
    do stuff to change the effect object;
}


As for using SetVertexUV or SetVertexColor, that really depends on you.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Nonnie Grey on December 06, 2009, 10:26:50 AM
About the subroutines, functions, and tasks question:
http://www.shrinemaiden.org/forum/index.php?topic=3218.msg162097#msg162097

Guess I really wasn't looking hard enough. ^_^* Thanks for the input, all.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye on December 06, 2009, 11:34:51 AM
wow...guess I wasn't paying much attention to previous posts that day...ouch...
well, thanks Blargel...& with that another question remains...

Now you say that I'll need to store the id somewhere where @MainLoop can access it...would right before @Initialize in the script_player_main be an acceptable location...?

& I'd have to use SetVertexUV to define the coordinates/Vertexes of the graphic on the sheet(file) I want Danmakufu to display, right...?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on December 06, 2009, 12:07:46 PM
Question specific for the 3D stage crafters.

Is it me or there seem to be a weird way that Danmakufu places 3D objects in stages. ( not effect objects, just 3D drawing in @BackGround ).

Look at this:
   makemuur(GetCenterX-768,0,f,90); 
   makemuur(GetCenterX+768,0,f,90);

The above are functions to save endless blocks of scripting. First parameter places the wall on the X-axis, second on on the Y-axis, the third one on the Z-axis (aka scrolling technique) and the last parameter is something I added to flip/tilt the wall flexible. Basically I am creating two walls exactly on the opposite side ( minus and plus 768. ) However, this is how it looks ingame.

(http://i46.tinypic.com/15qx8br.png)

This is a reversed view ( I am flying backwards ). As you can see, the walls don't even allign proper with eachother. Why is this happening?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on December 06, 2009, 12:56:52 PM
Question specific for the 3D stage crafters.

Is it me or there seem to be a weird way that Danmakufu places 3D objects in stages. ( not effect objects, just 3D drawing in @BackGround ).

Look at this:
   makemuur(GetCenterX-768,0,f,90); 
   makemuur(GetCenterX+768,0,f,90);

The above are functions to save endless blocks of scripting. First parameter places the wall on the X-axis, second on on the Y-axis, the third one on the Z-axis (aka scrolling technique) and the last parameter is something I added to flip/tilt the wall flexible. Basically I am creating two walls exactly on the opposite side ( minus and plus 768. ) However, this is how it looks ingame.

(http://i46.tinypic.com/15qx8br.png)

This is a reversed view ( I am flying backwards ). As you can see, the walls don't even allign proper with eachother. Why is this happening?


is it possible that the walls are placed this way
___________________  <-- black stuff
|                            |  <-- walls
|       floor               |
|                            |
|                            |

                                 <-- empty space and black stuff
       floor

___________________

and in the first one
you're facing this way
___________________   <--black stuff
|                            |  <--walls
|        floor              |
|                            |
|                \           |
                   \
                  \ \|           <--empty space and black stuff
       floor       \|

___________________

then reversing it
___________________  <--black stuff
|                            |  <--walls
|         floor             |
|    |\                     |
|    |\ \                   |
        \
         \
          floor                <--empty space and black stuff

___________________

that way?

since what I'm seeing is in the first picture, the wall doesn't reach the end of the floor, but in the next, the wall does. (what do you mean by reversed view anyway... rotate by 180 degrees?)

now you say that I'll need to store the id somewhere where @MainLoop can access it...would right before @Initialize in the script_player_main be an acceptable location...?

& I'd have to use SetVertexUV to define the coordinates/Vertexes of the graphic on the sheet(file) I want Danmakufu to display, right...?

Before @Initialize is where most people declare id's for objects that they use in the whole script and not just for one part, usually it's where they also declare variables...

SetVertexUV is to define the coordinates on the file you're taking pictures from, yes...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on December 06, 2009, 01:36:16 PM
Oh, I forgot to mention one last fundamental difference between subroutines, functions, and tasks. Functions are the ONLY ones that can return values. For example:

function GetDistance(x1, y1, x2, y2){
    return ((x1-x2)^2+(y1-y2)^2)^0.5;
}


Then, you can do let distanceToPlayer = GetDistance(GetX, GetY, GetPlayerX, GetPlayerY); and the variable will now hold the value that was returned. Of course you can also do stuff like this:

function ObjShot_Create(x, y, speed, angle, graphic, delay){
    let obj = Obj_Create(OBJ_SHOT);
    Obj_SetPosition(obj, x, y);
    Obj_SetSpeed(obj, speed);
    Obj_SetAngle(obj, angle);
    ObjShot_SetGraphic(obj, graphic);
    ObjShot_SetDelay(obj, delay);
    return obj;
}


And then you can go let obj = ObjShot_Create(GetX, GetY, 3, GetAngleToPlayer, RED01, 10); so that you don't have to type out the individual Obj_SetStuff functions every time.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye on December 06, 2009, 01:41:03 PM
Oh, I forgot to mention one last fundamental difference between subroutines, functions, and tasks. Functions are the ONLY ones that can return values. For example:

function GetDistance(x1, y1, x2, y2){
    return ((x1-x2)^2+(y1-y2)^2)^0.5;
}


Then, you can do let distanceToPlayer = GetDistance(GetX, GetY, GetPlayerX, GetPlayerY); and the variable will now hold the value that was returned. Of course you can also do stuff like this:

function ObjShot_Create(x, y, speed, angle, graphic, delay){
    let obj = Obj_Create(OBJ_SHOT);
    Obj_SetPosition(obj, x, y);
    Obj_SetSpeed(obj, speed);
    Obj_SetAngle(obj, angle);
    ObjShot_SetGraphic(obj, graphic);
    ObjShot_SetDelay(obj, delay);
    return obj;
}


And then you can go let obj = ObjShot_Create(GetX, GetY, 3, GetAngleToPlayer, RED01, 10); so that you don't have to type out the individual Obj_SetStuff functions every time.

actually...that'll help big time...thanks Blargel, & Kylesky...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on December 06, 2009, 02:06:59 PM
Kylesky it is exacly as I wrote it. It is a reversed view meaning the camera is turned 180 degree to show the backside where the alligning is not proper. Same goes for the front side aswell, also not alligned proper.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on December 06, 2009, 02:20:46 PM
Question specific for the 3D stage crafters.

Is it me or there seem to be a weird way that Danmakufu places 3D objects in stages. ( not effect objects, just 3D drawing in @BackGround ).

Look at this:
   makemuur(GetCenterX-768,0,f,90); 
   makemuur(GetCenterX+768,0,f,90);

The above are functions to save endless blocks of scripting. First parameter places the wall on the X-axis, second on on the Y-axis, the third one on the Z-axis (aka scrolling technique) and the last parameter is something I added to flip/tilt the wall flexible. Basically I am creating two walls exactly on the opposite side ( minus and plus 768. ) However, this is how it looks ingame.

(http://i46.tinypic.com/15qx8br.png)

This is a reversed view ( I am flying backwards ). As you can see, the walls don't even allign proper with eachother. Why is this happening?

GetCenterX is the x-center of the 2D playing field, not the x-center of the 3D space.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on December 06, 2009, 02:23:59 PM
GetCenterX is the x-center of the 2D playing field, not the x-center of the 3D space.

oh yeah... forgot about that... *hits head*
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on December 06, 2009, 03:27:35 PM
Let me try to add raw numbers then instead of using functions like GetCenter / GetClip

Edit: Yup, you are right Blargel. Using GetClip / GetCenter is not funny. Danmakufu places them totally wrong. Note to self: use raw numbers for 3D drawing.

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on December 06, 2009, 05:46:59 PM
This:
FadeOutMusic("bgm\bgm.mp3", 6);

...??
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on December 06, 2009, 07:07:15 PM
There... is no function to fade out music...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on December 06, 2009, 07:09:23 PM
There... is no function to fade out music...
Eh, wut? It works with my scripts.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Stuffman on December 06, 2009, 11:35:42 PM
Actually that function does exist, but it never worked any time I tried to use it.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on December 07, 2009, 04:38:28 AM
Eh, wut? It works with my scripts.
Actually that function does exist, but it never worked any time I tried to use it.

Try placing the music in a task of its own, and put in a bunch of yields until you want the music to stop, and then put the actual function. This works for me.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye on December 07, 2009, 02:57:11 PM
For Lawence Codye: You'll need to store the id of the object effect that is displaying the options where it can be accessed in the @MainLoop. Then, somewhere in the player script's @MainLoop, you can do

okay...umm how do I do this?...& I'm not asking where as I already know that...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on December 07, 2009, 03:59:45 PM
okay...umm how do I do this?...& I'm not asking where as I already know that...

Code: [Select]
script_player_main{
//declare stuff
//declare options

let optiona=Obj_Create(OBJ_EFFECT);
//etc

task Option(position){
//things about your option
}
task optionmove(whatever)
{
//do whatever
}

  @Initialize{
//load stuff
  }


  @MainLoop{
yield;
//everything else you need

  if((GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD)){
//optiona do whatever...
//OR
//what do you want the option to do or task that makes the option do something, etc.
//optionmove(whatever)
  }


  @Missed{
//put anything you may want to put here
  }
  @SpellCard{
//put spell cards
  }


  @DrawLoop{
//draw stuff
}

  @Finalize{
//delete stuff
  }

}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye on December 07, 2009, 08:12:20 PM
umm, yeah...thanks kylesky, even though I'm trying something different now...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: KrackoCloud on December 07, 2009, 11:44:39 PM
I can use SetShotKillTime to delete ShotA bullets, but... they just kinda disappear. What do I use to make them show a deletion animation? You know, like when they kinda have a little "poof" out and whatnot, rather than simply vanish.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: nintendonut888 on December 08, 2009, 12:24:03 AM
Hiyo. I can't get Danmakufu to run (or maybe it's just CtC, but I can't get anything to open). I have what I think is the latest version, run it with applocale, and it always brings up a "this program has stopped working" window with no explanation why. Any help? D: I use Vista if that makes a difference.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on December 08, 2009, 02:33:29 AM
I can use SetShotKillTime to delete ShotA bullets, but... they just kinda disappear. What do I use to make them show a deletion animation? You know, like when they kinda have a little "poof" out and whatnot, rather than simply vanish.

Unfortunately, there's no good way to do a nice effect for a randomly disappearing ShotA bullet. With object shots, you can do fade deleting, but for ShotA, the best thing you can do is to AddShot a delayed bullet in one frame before the one that's deleting is getting deleted. This second bullet can have SetShotKillTime on it for 0 frames so that as soon as the delay effect is gone, the bullet disappears. In this way, the bullet you want to delete will seem to sort of fade/shrink away.

As an example:
CreateShotA(0, GetX, GetY, 10);
SetShotDataA(0, 0, 3, 90, 0, 0, 0, RED22);
//put more SetShotDataA if you need it
SetShotKillTime(0, 120);
CreateShotA(1, 0, 0, 20);
SetShotDataA(1, 0, 0, 0, 0, 0, 0, RED22);
SetShotKillTime(1, 0);
AddShot(119, 0, 1, 0);
FireShot(0);


No idea about the next question though.
*passes the microphone to the next person*
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: nintendonut888 on December 08, 2009, 02:38:38 AM
Well, I definitely confirmed that it's Danmakufu itself that won't run, because I went to the site and downloaded version 0.12m or whatever the latest version is, ran it with applocale and it brought up the same crash scenario. :(
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on December 08, 2009, 03:05:07 AM
Well, I definitely confirmed that it's Danmakufu itself that won't run, because I went to the site and downloaded version 0.12m or whatever the latest version is, ran it with applocale and it brought up the same crash scenario. :(
I've probably said this too many times already but try running the game with config.exe

Works for me anyways
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: nintendonut888 on December 08, 2009, 03:18:08 AM
How? The thing is in Japanese.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: nintendonut888 on December 08, 2009, 03:31:33 AM
Wait, it worked. o_O For some reason.

Unfortunately, now I can't get Concealed the Conclusion to run because of two indecipherable error messages. I think one of them mentioned FLAN. Should I get screenshots of them?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on December 08, 2009, 03:34:33 AM
please, it would be helpfull
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on December 08, 2009, 03:44:22 AM
Wait, it worked. o_O For some reason.

Unfortunately, now I can't get Concealed the Conclusion to run because of two indecipherable error messages. I think one of them mentioned FLAN. Should I get screenshots of them?
heh

Also CtC is all kinds of messed up so yeah please post them
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: nintendonut888 on December 08, 2009, 03:45:32 AM
(http://img43.imageshack.us/img43/1024/error1m.jpg)

(http://img29.imageshack.us/img29/3922/error2s.jpg)

Far as I can see the only difference between them are a 4 digit number on the first line.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on December 08, 2009, 03:51:44 AM
Does it come up as soon as you run the script?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: nintendonut888 on December 08, 2009, 03:52:52 AM
Yep. As soon as I try and select a shot type it brings them up.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on December 08, 2009, 03:55:40 AM
What might help, move your CtC folder to the desktop, put the th_dnh folder on the desktop, then take a new screenshot of the error, that way this will shorten the folder directory of the error, letting us see which file is corrupted
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: nintendonut888 on December 08, 2009, 04:01:54 AM
I did that, it shortened the directory, but it turns out that the only thing cut off in it is a "]". :V

Does this mean there's a problem with my copy of CtC?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on December 08, 2009, 04:04:07 AM
Not sure, what is the last file name? right before the cut off?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: nintendonut888 on December 08, 2009, 04:14:25 AM
Here's the same two images with the full directory shown:

(http://img36.imageshack.us/img36/3571/error3s.jpg)

(http://img6.imageshack.us/img6/6268/error4d.jpg)

Looks like they actually are a bit different.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on December 08, 2009, 04:18:49 AM
How strange, My copy of CtC has no such line...yet mine runs perfectly
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: KrackoCloud on December 08, 2009, 04:58:26 AM
Unfortunately, there's no good way to do a nice effect for a randomly disappearing ShotA bullet. With object shots, you can do fade deleting, but for ShotA, the best thing you can do is to AddShot a delayed bullet in one frame before the one that's deleting is getting deleted. This second bullet can have SetShotKillTime on it for 0 frames so that as soon as the delay effect is gone, the bullet disappears. In this way, the bullet you want to delete will seem to sort of fade/shrink away.

*insert example scripting stuffs*

Mm... Is the object bullet fade-delete some kinda function? Or do you also have to go through some extra process?

EDIT: Nevermiiind. I found it.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: nintendonut888 on December 08, 2009, 06:42:32 AM
Thank you people for your help, CtC runs now. :D
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: nintendonut888 on December 09, 2009, 12:21:27 AM
Eh heh, hello again. This is probably the last question I'll ask here: I'm trying to get a Vsynch patch to work on Danmakufu, but it brings up this error message:

(http://img692.imageshack.us/img692/9940/error5.jpg)

Any ideas? CtC has a dreadful amount of input lag.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on December 09, 2009, 12:23:12 AM
You don't have the proper dll file in the folder~

There should be a th_dnh.dll or something there.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on December 09, 2009, 12:25:13 AM
Vsynch? What exactly does that do? I find Danmakufu to be the most input lag-free of any touhou-esque program, be it actually touhou or otherwise, so far.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: nintendonut888 on December 09, 2009, 12:29:41 AM
You don't have the proper dll file in the folder~

There should be a th_dnh.dll or something there.

?!

That's weird. That's not there nor in any of the versions of Danmakufu I received. o_O

Vsynch? What exactly does that do? I find Danmakufu to be the most input lag-free of any touhou-esque program, be it actually touhou or otherwise, so far.

Then we must be playing very different Danmakufus. :V The input lag is almost as bad as PCB.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on December 09, 2009, 12:42:40 AM
For some reason I find that all non default player characters seem to have some input lag (so anyone beside the default 4). Sounds strange but it really does feel that way.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: nintendonut888 on December 09, 2009, 12:48:57 AM
Are you sure there's supposed to be a th_dnh.dll? I redownloaded the thing from the official Danmakufu site and it still didn't have it. There's a similar file called vpatch_th_dnh.dll, but I suppose that's different...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on December 09, 2009, 01:05:38 AM
There are no .dll's with Danmakufu. I think input lag has something to do with how your keyboard/computer communicate with Danmakufu, since I've never had input lag on any of the five computers I've installed Danmakufu on (3 Vista, 2 XP, considerably varying specs, from single to quad core, etc).
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: nintendonut888 on December 09, 2009, 01:26:46 AM
And that lag should be fixed by the vsynch patch, but I can't get it to work because supposedly I need a dll which according to you doesn't exist. :\

And to give you an idea of how bad the lag is, I'm missing power items because it takes so long for the game to respond to my button presses.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on December 09, 2009, 06:00:33 AM
Alrighty, 3D question time.

So I've made myself a cool little scenario -- river, rock walls, whatever, etc. Now I'm looking for a little garnish. I was thinking about adding falling leaves to the background, and have them fall in 3D. My problem is, I've no idea how to manage them. Each leaf will have three angle variables (the angle values in SetGraphicAngle), three angular velocity variables, since I want them to be randomly spinning in different directions, but not constantly changing their rotation. Thus, variables. Three coordinate variables to manage where they are at any given time (the DrawGraphic3D parameters), and three more variables to manage their movement along the three dimentional plane (again, random, but not constantly changing). So that's a total of twelve variables to manage one falling leaf. And I was looking to have about a dozen or more leaves on the screen at a time... Which makes for a huge mess.

I'm trying to avoid that mess. My first thought was tasks, but Draw functions do not work in tasks, regardless of yield; positions or whatever (I've never had them work, ever). My second idea was to have them spawn as seperate enemies, but @BackGround doesn't work in enemy scripts that aren't bosses (Danmakufu erred on all the 3D functions when I tried it). So am I doomed to use a rediculusly large amount of variables/arrays/whatever to track each leaf (and when it drifts off the screen, reuse the variables for a new leaf), or is there some better way to do this?

Yes, I want the leaves to be in 3D, but I will settle for object effect leaves if there is no better way to manage them... I'm just looking for the 3D effect.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on December 09, 2009, 06:56:15 AM
ang = [[...],[...],[...]];
angv = [[...],[...],[...]];
pos = [[...],[...],[...]];
move = [[...],[...],[...]]; lolwat

and have the i'th leaf take all of the i'th positions in each arrays/dimension...? I see what you mean, I'm not sure how you could do it otherwise. Object effects might be a bit processor-heavy so I don't want to resort to that yet.

And uh, when the leaf is off-screen change all the related i'th values to -1000 or something. Check if the values are at -1000 and spawn another leaf if they are. I guess.

In any case this would be nice to figure out because I was planning to have cherry petals for Stage 1 as well.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on December 09, 2009, 07:20:22 AM
Arrays is the first thing I thought of. A 2-dimensional array would work fine. Tasks to handle the array would work fine too because you can (and should) do all the variable management in the @MainLoop, not in @DrawLoop. Here's my suggestion to allow easier organization. (None of this was tested in Danmakufu and so the code may contain errors.)

First, put this in before @Initialize so that it's accessible everywhere.

Code: [Select]
let LeafProperties = [];

// If your camera is moving instead of your
// background, you'll need to change these
// according to your camera's movement
let LeafMinDeleteX = -500;
let LeafMaxDeleteX = 500;
let LeafMinDeleteY = -50;
let LeafMinDeleteY = 1000;
let LeafMinDeleteZ = -1000;
let LeafMaxDeleteZ = 400;

//These are optional but help with organization.
//They're mostly to help you remember which array
//element refers to what property of each leaf.
//So LeafProperties[2][XVEL] will refer to
//the 3rd leaf's x velocity.
let XPOS = 1;
let YPOS = 2;
let ZPOS = 3;
let XVEL = 4;
let YVEL = 5;
let ZPOS = 6;
let XANGLE = 7;
let YANGLE = 8;
let ZANGLE = 9;
let XANGLEVEL = 10;
let YANGLEVEL = 11;
let ZANGLEVEL = 12;

Next, your task to make and manage a leaf will look something like this:
Code: [Select]
task MakeBackgroundLeaf (xPos, yPos, zPos, xVel, yVel, zVel, xAngleVel, yAngleVel, zAngleVel){
    // I ignored the starting graphic angles since
    // no one's gonna notice if they spawn off screen.
    LeafProperties = LeafProperties ~ [xPos, yPos, zPos, xVel, yVel, zVel, 0, 0, 0, xAngleVel, yAngleVel, zAngleVel];

    let indx = length(LeafProperties) - 1; // Don't name it "index" 'cause Danmakufu sucks. :V
    while( // while the position is not off-camera
        LeafProperties[indx][XPOS]>LeafMinDeleteX &&
        LeafProperties[indx][XPOS]<LeafMaxDeleteX &&
        LeafProperties[indx][YPOS]>LeafMinDeleteY &&
        LeafProperties[indx][YPOS]<LeafMaxDeleteY &&
        LeafProperties[indx][ZPOS]>LeafMinDeleteZ &&
        LeafProperties[indx][ZPOS]<LeafMaxDeleteZ
    ){
        // update the information for drawing
        // Danmakufu can't change values two dimensions deep so remake the whole array.
        LeafProperties[indx] = [
            LeafProperties[indx][XPOS] + LeafProperties[indx][XVEL], // First element is XPOS
            LeafProperties[indx][YPOS] + LeafProperties[indx][YVEL], // Second element is YPOS
            LeafProperties[indx][ZPOS] + LeafProperties[indx][ZVEL], // Third element is ZPOS
            LeafProperties[indx][XVEL], // Fourth element is XVEL which doesn't change
            LeafProperties[indx][YVEL], // Fifth element is YVEL which doesn't change
            LeafProperties[indx][ZVEL], // Sixth element is ZVEL which doesn't change
            LeafProperties[indx][XANGLE] + LeafProperties[indx][XANGLEVEL], // Seventh element is XANGLE
            LeafProperties[indx][YANGLE] + LeafProperties[indx][YANGLEVEL], // Eighth element is YANGLE
            LeafProperties[indx][ZANGLE] + LeafProperties[indx][ZANGLEVEL], // Ninth element is ZANGLE
            LeafProperties[indx][XANGLEVEL], // Tenth element is XANGLEVEL which doesn't change
            LeafProperties[indx][YANGLEVEL], // Eleventh element is YANGLEVEL which doesn't change
            LeafProperties[indx][ZANGLEVEL] // Twelfth element is ZANGLEVEL which doesn't change
        ];

        // store the values temporarily in case the indx
        // number changes due to deletion of previous leaves
        // in other tasks.
        let tempInfo = LeafProperties[indx];
        yield;

        // find the corresponding leaf again in the array.
        while(tempInfo != LeafProperties[indx]){
            indx--;
        }
    }
    LeafProperties = erase(LeafProperties, indx);
}

And there you have your task managing your individual leaf. Make a task that calls it every couple of frames or so and you'll be fine. Now to actually draw the leaves, you need to put this in @BackGround.
Code: [Select]
SetTexture(imgLeaf); // or whatever
SetGraphicRect(0, 0, 32, 32); // or whatever :V
SetGraphicScale(1, 1); // or whatever :V :V
SetAlpha(255); // or whatever :V :V :V
ascent(i in 0..length(LeafProperties)){
    SetGraphicAngle(LeafProperties[i][XANGLE], LeafProperties[i][YANGLE], LeafProperties[i][ZANGLE]);
    DrawGraphic3D(LeafProperties[i][XPOS], LeafProperties[i][YPOS], LeafProperties[i][ZPOS]);
}

Wasn't that fun? Remember, I didn't test any of this in Danmakufu, but this will work in theory. You can also call the make leaves function like 20 times in @Initialize with randomized numbers so that the stage starts with falling leaves already midfall. Something like.
Code: [Select]
loop(20){ // has 20 starting leaves when the stage starts
    MakeBackgroundLeaf(
        rand(-500, 500),
        rand(0, 1000),
        rand(-1000, 400),
        rand(-1, 1),
        rand(-1, 1),
        rand(-1, 1),
        rand(-3, 3),
        rand(-3, 3),
        rand(-3, 3)
    );
}

Have fun~

EDIT: Fixed a glaring mistake that I just noticed.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on December 09, 2009, 10:53:07 AM
Ohhhh!!! this is a lot like the snowflakes I made for a stage...

inside a txt file I have this... (I hope it's easy to understand... those are basically arrays for each snowflake... this makes 9 snowflakes but it's easy to make more by just adding to the arrays)
Code: [Select]
let rotxarr=[rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359)];
let rotyarr=[rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359)];
let rotzarr=[rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359)];
let rotxbarr=[rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3)];
let rotybarr=[rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3)];
let rotzbarr=[rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3)];
let typearr=[rand_int(1, 8), rand_int(1, 8), rand_int(1, 8), rand_int(1, 8), rand_int(1, 8), rand_int(1, 8), rand_int(1, 8), rand_int(1, 8), rand_int(1, 8)];
let xarr=[-rand(210, 1000), -rand(300, 700), -rand(100, 500), -rand(210, 600), -rand(150, 800), -rand(500, 890), -rand(40, 100), -rand(50, 300), -rand(60, 300)];
let yarr=[rand(150, 220), rand(150, 220), rand(150, 220), rand(150, 220), rand(150, 220), rand(150, 220), rand(150, 220), rand(150, 220), rand(150, 220), rand(150, 220)];
let zarr=[rand(0, 600), rand(0, 600), rand(0, 600), rand(0, 600), rand(0, 600), rand(0, 600), rand(0, 600), rand(0, 600), rand(0, 600)];
let xmovarr=[-rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2)];
let ymovarr=[-rand(0.5, 2), -rand(0.5, 2), -rand(0.5, 2), -rand(0.5, 2), -rand(0.5, 2), -rand(0.5, 2), -rand(0.5, 2), -rand(0.5, 2), -rand(0.5, 2)];
let zmovarr=[-rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2)];

sub snowflake
{
ascent(i in 0..9)
{
let rotx=rotxarr[i]; //setting variables for each individual snowflake
let roty=rotxarr[i];
let rotz=rotxarr[i];
let rotxb=rotxbarr[i];
let rotyb=rotybarr[i];
let rotzb=rotzbarr[i];
let type=typearr[i];
let x=xarr[i];
let y=yarr[i];
let z=zarr[i];
let xmov=xmovarr[i];
let ymov=ymovarr[i];
let zmov=zmovarr[i];
SetTexture(a_img_snow);
if(type<=3) //I had different snowflakes so I randomized them instead of just using one flake design
{
SetGraphicRect(type*89-89, 0, type*89, 86);
}else if(type<=6){
SetGraphicRect((type-4)*89, 86, (type-3)*89, 172);
}else{
SetGraphicRect((type-7)*89, 172, (type-6)*89, 259);
}
SetGraphicScale(1, 1);
SetGraphicAngle(rotx, roty, rotz);
DrawGraphic3D(x, y, z);
rotxarr[i]=rotx+rotxb;
rotyarr[i]=roty+rotyb;
rotzarr[i]=rotz+rotzb;
xarr[i]=x+xmov;
yarr[i]=y+ymov;
zarr[i]=z+zmov;
if(y<4) //if the flake has reached underground, return it to a random position at the top
{
yarr[i]=rand(150, 220);
xarr[i]=-rand(100, 1000);
zarr[i]=rand(0, 1000);
}
}
}

then just load the graphic in your script, use #include_function and put snowflake; somewhere in @BackGround...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Zengar Zombolt on December 09, 2009, 12:08:13 PM
And that lag should be fixed by the vsynch patch, but I can't get it to work because supposedly I need a dll which according to you doesn't exist. :\
Except that the .dll should be included with the Vsync patch, not Danmakufu. So, it should be in the zip with all the other dll files.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on December 09, 2009, 12:16:27 PM
Kyle's version is easier to use and will work for most similar applications to falling 2D images in a 3D background like leaves and snowflakes. However, one thing I wanna nitpick about is the handling of logic in @DrawLoop. Try going to config.exe and selecting that 1/3 option in the left side of the first tab and seeing what happens to your snowflakes. :V

EDIT: Also, my code is longer and therefore manlier.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on December 09, 2009, 02:05:26 PM
Kyle's version is easier to use and will work for most similar applications to falling 2D images in a 3D background like leaves and snowflakes. However, one thing I wanna nitpick about is the handling of logic in @DrawLoop. Try going to config.exe and selecting that 1/3 option in the left side of the first tab and seeing what happens to your snowflakes. :V

EDIT: Also, my code is longer and therefore manlier.

can you just describe what happens since I never opened config.exe, ever... and whenever I try to open it, nothing comes out... dunno why...

EDIT: my code is shorter, therefore not as manly? so using loop and ascent which makes codes shorter aren't manly either? *must type 100kb code*
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on December 09, 2009, 02:17:40 PM
The option I'm talking about is actually how many times the @DrawLoop is run per second. The first option which it defaults to is full frames. The second option is 1/2, meaning the @DrawLoop runs 30 times every second (and therefore the framerate is choppier, but some drawing processing power is saved). The third option is 1/3, meaning the @DrawLoop runs 20 times every second (and therefore the framerate is even choppier, but even more processing power is saved). The last option is variable, meaning the @DrawLoop runs as often as it can as long as framerate can be kept at around 60fps, with a minimum of 20 frames per second.

If anyone with a crappier computer changes these settings so they can run the games a bit faster, your snowflakes are gonna fall at 1/2, 1/3, or a variable speed.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on December 09, 2009, 02:29:49 PM
*understands* wow... then that'll be sucky... but then again... it's really just the background... what's really important is the stage and boss themselves :V, the background sometimes tends to fall back 2nd... (therefore the black screen background commonly used in danmakufu ;D)

sad though that all the hard work to make backgrounds(especially 3D ones) sometimes goes unnoticed, or barely noticed
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Jaimers on December 09, 2009, 03:20:07 PM
Donut, I figured out what your doing wrong.
Your using a compressed version of th_dnh.exe, you have to uncompress it first with UPX.
Replace the exe with the exe in the attachement and it should work.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: nintendonut888 on December 09, 2009, 09:48:03 PM
Thank you. That was indeed the problem. Being able to control my movements instantly makes this game more likable. Now there's just the issue of it spawning bullets on top of me way more often than any game should, the ludicrously short death invulnerability times, the fact that I have no idea what determines when you can gather Hakurei... :V

BTW, when does extra open? Do I need to 1cc with all shot types? I thought I read once you only needed to do it with three.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on December 09, 2009, 09:57:53 PM
Thank you. That was indeed the problem. Being able to control my movements instantly makes this game more likable. Now there's just the issue of it spawning bullets on top of me way more often than any game should, the ludicrously short death invulnerability times, the fact that I have no idea what determines when you can gather Hakurei... :V

BTW, when does extra open? Do I need to 1cc with all shot types? I thought I read once you only needed to do it with three.
You also need 1cc the game while doing a full twist back layout aka no one really knows. Although you could poke around in the code to unlock it I guess...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on December 09, 2009, 10:02:43 PM
Extra unlocks once you 1CC at least Normal with all four shot types. Nobody knows for Phantasm, however.

You get Hakurei points by grazing, mainly. You can get them at all times by grazing unfocused, but if the text showing how much you have is green, then you can get it while grazing unfocused too. If you bomb or die, your text turns yellow and you're unable to collect while focused for a while. Also, if you don't die on any boss pattern and have enough Hakurei points, you'll get a Final Spell.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on December 10, 2009, 12:34:25 AM
so do exactly what I was trying to avoid



alright
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Frazer on December 10, 2009, 05:55:27 AM
Is it possible to make a boss use a kind of recovery effect on themselves (i.e. restoring part of their health in the middle of a spell card)? I tried doing something such as

SetLife(GetLife+5);

But this causes Danmakufu to crash.

So is it actually possible for an enemy/boss to recover their health? If so, how is it performed?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on December 10, 2009, 06:03:40 AM
Is it possible to make a boss use a kind of recovery effect on themselves (i.e. restoring part of their health in the middle of a spell card)? I tried doing something such as

SetLife(GetLife+5);

But this causes Danmakufu to crash.

So is it actually possible for an enemy/boss to recover their health? If so, how is it performed?

Isn't there an AddLife(...); function?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Stuffman on December 10, 2009, 06:10:00 AM
Yep. Use AddLife. Though I also wonder why that SetLife command makes Danmakufu faceplant.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on December 10, 2009, 08:22:50 AM
As far as I can tell, only one instance of SetLife is allowed to be run because that's what it uses to determine the length of life bars for a plural boss.

...Except that's not true either :V
It takes the first instance of SetLife in each script before any of the scripts are run, meaning if you have some conditionals that change how much life the enemy starts with (for different difficulties for example), you'll end up with messed up life bars sometimes. This is also true if the first instance of SetLife is in a comment, which I find really bizarre because IT'S IN A FREAKING COMMENT.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye on December 10, 2009, 03:37:57 PM
okay...umm, what's the purpose of...or what exacly does MULTIPLY: multiplicative blend  in Object Effects?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on December 10, 2009, 03:43:37 PM
okay...umm, what's the purpose of...or what exacly does MULTIPLY: multiplicative blend  in Object Effects?

when I tried doing multiply in drawing (drawloop, not object effects, but I think the same principle applies), it's like a mix between subtract and add... so basically... it's both Dark and bright/shiny... it's just weird and hard to explain... it's like a dark shadow-like version of the basic Alpha... (hope this helps)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on December 10, 2009, 05:13:38 PM
http://en.wikipedia.org/wiki/Blend_modes

Alpha isn't mentioned there, but if it isn't obvious already, alpha just makes the top image show as it normally does and covers the bottom image.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Gc on December 10, 2009, 05:24:46 PM
Quick explanation of render modes:
(bg color + object color = result)

ALPHA: Default render mode. Draw the image exactly as it is in the image file over the background.

ADD: Add the overlaying hex values
255,000,000 + 000,255,000 = 255,255,000
063,127,191 + 191,127,063 = 255,255,255

SUBTRACT: Opposite of ADD, subtract the overlaying hex values
255,255,000 - 255,000,000 = 000,255,255
255,255,255 - 063,127,191 = 191,127,063 <-- invert colors when on white

MULTIPLY (starting to understand ?) : Multiply the overlaying hex values
no math example because I am lazy

edit: f u blargel
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye on December 10, 2009, 06:17:03 PM
when I tried doing multiply in drawing (drawloop, not object effects, but I think the same principle applies), it's like a mix between subtract and add... so basically... it's both Dark and bright/shiny... it's just weird and hard to explain... it's like a dark shadow-like version of the basic Alpha... (hope this helps)
umm...it helped me...not enough, thanks though...
Quick explanation of render modes:
(bg color + object color = result)

MULTIPLY (starting to understand ?) : Multiply the overlaying hex values
no math example because I am lazy
...meh...no matter...I have this...
http://en.wikipedia.org/wiki/Blend_modes
wow, wikipedia, really...no, no, this helped me figure it out...
edit: f u blargel
lol...wow...well thank you guys...& I will never need to know what ALPHA blend is, ever...!
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on December 10, 2009, 08:41:24 PM
Okay, even though an unfortunate series of events has me still unable to run danmakufu, I didn't stop scripting stuff. No, I don't want you to playtest it for me, relax.  :P  Instead, I have a question:

I know that the size of a bullet hitbox is determined by the size of the image, not the size of the sprite inside the image. I think the hitbox of a bullet a circle/ an ellipse where the maximum horizontal radius is determined by the width and the vertical radius by the height of the image. However, how exactly is the relation between these?

Is the vertical diameter equal to half the width of the image? Two thirds? Or is it maybe a quadratic or, dare I say, logarithmic relation?

Thanks in advance.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on December 10, 2009, 08:51:20 PM
Ellipse. Width-radius of image's width and height-radius of image's height.

EDIT: v
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on December 10, 2009, 08:52:24 PM
^ ...Half of the...
Edit: It's actually closer to three quarters or two thirds, now that I think about it.

Approximately. I kinda wish it was logarithmic, since there is absolutely no use for logs in danmakufu.


Fuck it all, I'll Alwaysthe9 edit this fucker:

After some more unecessary thought, now I don't think it's an ellipse. Think of the Tenshi boulders from Johnny Walker's Tenshi mini-stage. Huge horizontal hitbox, small vertical hitbox, at least when compared to the image. I'd say it's a perfect circle.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on December 10, 2009, 09:00:07 PM
Muchas graci?s.

Now to hope that bullets done with MS PAINT will only look like crap and not like utter crap.  :V
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on December 10, 2009, 09:01:47 PM
Make sure to ADDitive blend the shit out of them, hides our MSPaint skills so that people don't explode from awesomeness.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Azure Lazuline on December 10, 2009, 09:19:06 PM
The hitbox is a circle (diameter is somewhere around 2/3 width or height, whichever is smaller). I had a 32x128 bullet before, and only the center had collision. Lasers I believe are rectangular, though.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Frazer on December 10, 2009, 11:14:31 PM
Just realized that the problem is in fact NOT the AddLife/SetLife functions. Something else is causing the problem.

I shall look over it.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on December 11, 2009, 04:11:31 AM
Does having a lot of scripts in your script folder slow danmakufu down? It seems to for me although I don't really have any concrete evidence for it...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on December 11, 2009, 04:19:09 AM
It only slows the time it takes danmakufu to archive those scripts (load them in a menu). Doesnt affect anything else. Not unloading images/music in your scripts may affect things over time, if you keep danmakufu open for a while, but I think that's the only thing that could.

Also, 149 pages of scripts when I try to load up the single manu. Takes ages to load (this is what lead me to my previous conclusion). I only use directory nowadays...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on December 11, 2009, 04:34:38 AM
It only slows the time it takes danmakufu to archive those scripts (load them in a menu). Doesnt affect anything else. Not unloading images/music in your scripts may affect things over time, if you keep danmakufu open for a while, but I think that's the only thing that could.

Also, 149 pages of scripts when I try to load up the single manu. Takes ages to load (this is what lead me to my previous conclusion). I only use directory nowadays...
Yeah that's what I suspected. But the thing is I can't seem to run my Nitori GET DOWN script at 60 fps anymore and the only thing that I can see is different is I have more scripts.

brb testin
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on December 11, 2009, 06:53:21 PM
I moved ALL my scripts to another partition as backup and only keeping DanceContest in there and in a seperate folder Ijiatsu.

I had 10 scripts myself and loading the menus for one minute or more started pissing me off. Especially when you need to test your script 100x because Danmakufu critical errors.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: KomeijiKoishi on December 12, 2009, 04:06:59 PM
Code: [Select]
#TouhouDanmakufu
#Title[China's Punch "Time To Revive The Color"]
#Text[Test script]
#BackGround[User(.\black.png, 1, 1)]
#BGM[script/st6boss2.wav]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {

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

    let count = -120;

    let SMT = 0;
   
    let fire = 0;

    @Initialize {
        SetLife(400);
        SetDamageRate(10, 20);
        SetTimer(256);
        SetInvincibility( 200 );
        LoadGraphic(ImgBoss);

        SetMovePosition02(GetCenterX, GetCenterY-120, 120);
        CutIn(YOUMU, "Non-Spell 2"\", "", 0, 0, 0, 0);
        LoadUserShotData("\lib\SHOT_REPLACE\shot_All.dnh");
        SetGraphicRect(0, 0, 64, 64);
    }

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

    if ((count == 0)){
    particle;
    }


    if ((count == 150)){
    count = 0;
    }
   
    count++;
    SMT++;
    yield;
    }

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

    @Finalize {
      DeleteGraphic(ImgBoss);
    }

   
   task particle{
   let b = 180;
   let bup = 13.3;
   let reverse = 0;
   let lrar = 0;
   let kput = 1;
   let krar = 360/kput;
   
   
   let Length = 30;
   yield;

   let x = 2.3;
   
   let n = 0;
   
   let q = 0;
   
   let RollerX;
   let RollerY;
   let random;
   
   loop{
   
   PlaySE(GetCurrentScriptDirectory~"SE\se_tan01.wav");
    ascent(a in 1..kput+1){
    RollerX = GetClipMinX - 10 + (GetClipMaxX-GetClipMinX) / 150 * count;
    RollerY = GetY - 0 + sin(SMT*11.3) * 80;
   CreateLaserA(1, RollerX, RollerY, 400, 8, 41, 20);
   SetLaserDataA(1, 0, 0, (a*krar+b), 0, 0, 0);
   SetShotKillTime(2, 120); 
   FireShot(1);
   TheshotUp(RollerX, RollerY, 0, (a*krar+b)+120, 42, 20);
   TheshotUp(RollerX, RollerY, 0, (a*krar+b)-120, 43, 20);



    }
   if (reverse == 0){
   if (bup > -0.7){
   bup += 0;
   }
   else{
   reverse++;
   }
   }
   else{
   if (bup > 120){
   bup -= 0;
   }
   else{
   reverse--;
   }
   }
   b += bup;
   if (Length > -200){
   Length -= 0;
   }
   
   loop(1){
   yield;
   }
   }
   }

 




    task TheshotUp(x, y, v, angle, graphic, delay){
        let obj = Obj_Create(OBJ_SHOT);
      let a = 0;
      let b = 0;
      let dir = angle;
        Obj_SetX(obj, x);
        Obj_SetY(obj, y);
        Obj_SetSpeed(obj, v);
        Obj_SetAngle(obj, angle);
        ObjShot_SetGraphic(obj, graphic);
        ObjShot_SetDelay(obj, delay);
   Obj_SetAutoDelete(obj, false);
        while (!Obj_BeDeleted(obj)){
      if (count == 150){
   Obj_SetAutoDelete(obj, true);
        Obj_SetSpeed(obj, 2);
     }
      a++;
      b++;
      yield;
      }
}

    task TheshotCircle(x, y, v, angle, graphic, delay){
        let obj = Obj_Create(OBJ_SHOT);
      let a = 0;
      let b = 0;
      let dir = angle;
        Obj_SetX(obj, x);
        Obj_SetY(obj, y);
        Obj_SetSpeed(obj, v);
        Obj_SetAngle(obj, angle);
        ObjShot_SetGraphic(obj, graphic);
        ObjShot_SetDelay(obj, delay);
      ObjShot_SetBombResist(obj, true);
        while (!Obj_BeDeleted(obj)){
      if (a == 120){
        Obj_SetSpeed(obj, v*8);
     }
      a++;
      b++;
      yield;
      }
}

}

How can I make the lasers stop flickering around?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on December 12, 2009, 05:43:46 PM
Code: [Select]
   SetLaserDataA(1, 0, 0, (a*krar+b), 0, 0, 0);

The angular velocity of your lasers is (a*krar+b).

(a*krar+b) = (1..n)*360 + 180

So yeah, an angular velocity of a high value is going to raep your eyes anywhere, anytime. I am not shure what you tried to accomplish with this, but whatever it may be, in this statement lies the error.  ;)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: KomeijiKoishi on December 12, 2009, 05:53:22 PM
Code: [Select]
   SetLaserDataA(1, 0, 0, (a*krar+b), 0, 0, 0);

The angular velocity of your lasers is (a*krar+b).

(a*krar+b) = (1..n)*360 + 180

So yeah, an angular velocity of a high value is going to raep your eyes anywhere, anytime. I am not shure what you tried to accomplish with this, but whatever it may be, in this statement lies the error.  ;)
I want the lasers to point in different directions. If you have played the script, you should see why.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on December 12, 2009, 06:03:25 PM
In that case, why not give each laser a different starting angle, then? For exampe, what if you exchange
Code: [Select]
SetLaserDataA(1, 0, 0, (a*krar+b), 0, 0, 0);for 
Code: [Select]
SetLaserDataA(1, 0, (a*krar+b), 0, 0, 0, 0);?

Also, you should make the SetShotKillTime refer to the laser, which means replacing the argument 2 with 1. Otherwise you will eventuall have 95% of the screen covered with lasers.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: KomeijiKoishi on December 12, 2009, 06:17:07 PM
In that case, why not give each laser a different starting angle, then? For exampe, what if you exchange
Code: [Select]
SetLaserDataA(1, 0, 0, (a*krar+b), 0, 0, 0);for 
Code: [Select]
SetLaserDataA(1, 0, (a*krar+b), 0, 0, 0, 0);?

Also, you should make the SetShotKillTime refer to the laser, which means replacing the argument 2 with 1. Otherwise you will eventuall have 95% of the screen covered with lasers.

I just found the problem (working more often with lasers should do it). That's the result:

Code: [Select]
#TouhouDanmakufu
#Title[China's Punch "Time To Revive The Color"]
#Text[Test script]
#BackGround[User(.\black.png, 1, 1)]
#BGM[script/st6boss2.wav]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {

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

    let count = -120;

    let SMT = 0;
   
    let fire = 0;

    @Initialize {
        SetLife(400);
        SetDamageRate(10, 20);
        SetTimer(256);
        SetInvincibility( 200 );
        LoadGraphic(ImgBoss);

        SetMovePosition02(GetCenterX, GetCenterY-120, 120);
        CutIn(YOUMU, "Non-Spell 2"\", "", 0, 0, 0, 0);
        LoadUserShotData("\lib\SHOT_REPLACE\shot_All.dnh");
        SetGraphicRect(0, 0, 64, 64);
    }

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

    if ((count == 0)){
    particle;
    }


    if ((count == 90)){
    count = 0;
    }
   
    count++;
    SMT++;
    yield;
    }

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

    @Finalize {
      DeleteGraphic(ImgBoss);
    }

   
   task particle{
   let b = 180;
   let bup = 13.3;
   let reverse = 0;
   let lrar = 0;
   let kput = 1;
   let krar = 360/kput;
   
   
   let Length = 30;
   yield;

   let x = 2.3;
   
   let n = 0;
   
   let q = 0;
   
   let RollerX;
   let RollerY;
   let random;
   
   loop{
   
   PlaySE(GetCurrentScriptDirectory~"SE\se_tan01.wav");
    ascent(a in 1..kput+1){
    RollerX = GetClipMinX - 10 + (GetClipMaxX-GetClipMinX) / 90 * count;
    RollerY = GetY - 0 + sin(SMT*6.3) * 80;
   CreateLaserA(1, RollerX, RollerY, 800, 8, 41, 40);
   SetLaserDataA(1, 0, (a*krar+b), 0, 0, 0, 0);
   SetShotKillTime(1, 90); 
   FireShot(1);
    CreateLaserA(1, RollerX, RollerY, 800, 8, 42, 40);
   SetLaserDataA(1, 0, (a*krar+b)+120, 0, 0, 0, 0);
   SetShotKillTime(1, 90); 
   FireShot(1);
    CreateLaserA(1, RollerX, RollerY, 800, 8, 43, 40);
   SetLaserDataA(1, 0, (a*krar+b)-120, 0, 0, 0, 0);
   SetShotKillTime(1, 90); 
   FireShot(1);
   TheshotUp(RollerX, RollerY, 0, (a*krar+b)+60, 41, 20);
   TheshotUp(RollerX, RollerY, 0, (a*krar+b)+180, 42, 20);
   TheshotUp(RollerX, RollerY, 0, (a*krar+b)-60, 43, 20);



    }
   if (reverse == 0){
   if (bup > -0.7){
   bup += 0;
   }
   else{
   reverse++;
   }
   }
   else{
   if (bup > 120){
   bup -= 0;
   }
   else{
   reverse--;
   }
   }
   b += bup;
   if (Length > -200){
   Length -= 0;
   }
   
   loop(3){
   yield;
   }
   }
   }

 




    task TheshotUp(x, y, v, angle, graphic, delay){
        let obj = Obj_Create(OBJ_SHOT);
      let a = 0;
      let b = 0;
      let dir = angle;
        Obj_SetX(obj, x);
        Obj_SetY(obj, y);
        Obj_SetSpeed(obj, v);
        Obj_SetAngle(obj, angle);
        ObjShot_SetGraphic(obj, graphic);
        ObjShot_SetDelay(obj, delay);
   Obj_SetAutoDelete(obj, false);
        while (!Obj_BeDeleted(obj)){
      if (count == 90){
   Obj_SetAutoDelete(obj, true);
        Obj_SetSpeed(obj, 2);
     }
      a++;
      b++;
      yield;
      }
}

    task TheshotCircle(x, y, v, angle, graphic, delay){
        let obj = Obj_Create(OBJ_SHOT);
      let a = 0;
      let b = 0;
      let dir = angle;
        Obj_SetX(obj, x);
        Obj_SetY(obj, y);
        Obj_SetSpeed(obj, v);
        Obj_SetAngle(obj, angle);
        ObjShot_SetGraphic(obj, graphic);
        ObjShot_SetDelay(obj, delay);
      ObjShot_SetBombResist(obj, true);
        while (!Obj_BeDeleted(obj)){
      if (a == 120){
        Obj_SetSpeed(obj, v*8);
     }
      a++;
      b++;
      yield;
      }
}

}

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on December 12, 2009, 10:19:10 PM
http://www.shrinemaiden.org/forum/index.php?topic=4016.msg193389#msg193389
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on December 12, 2009, 11:03:29 PM
Please tell me that you can change the ALPHA value of an effect object retroactively...

 :-X
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Azure Lazuline on December 13, 2009, 12:53:01 AM
ObjEffect_SetVertexColor(obj,vertex,alpha,r,g,b);

You have to set it for each vertex individually, since Obj_SetAlpha doesn't work for effects.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: CK Crash on December 13, 2009, 01:25:11 AM
Best way to do it if you don't plan on using blending is:

ascent(i in 0..4){ObjEffect_SetVertexColor(obj,i,alpha,255,255,255);}

Effect objects are a pain :(
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on December 13, 2009, 04:39:00 AM
Does having a lot of scripts in your script folder slow danmakufu down? It seems to for me although I don't really have any concrete evidence for it...
Holy shit I am a moron. I just realized I had my power settings on "power saver" mode. I switched it to "high performance" and BAM, 60 glorious fps.

Derpity derp derp
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye on December 14, 2009, 02:37:20 PM
more & more questions...I mean, I did something like this...
Code: [Select]
task mainTask{
loop{
if(Season==1){FireSign("First");}
else if(Season==2){WaterSign("Fifth");}
if(Season2==1){FireSign("Second");}
else if(Season2==2){WaterSign("Sixth");}
if(Season3==1){FireSign("Third");}
else if(Season3==2){WaterSign("Seventh");}
if(Season4==1){FireSign("Fourth");}
else if(Season4==2){WaterSign("Eighth");}
yield;
}
}

task FireSign(position){
let hfire = Obj_Create(OBJ_EFFECT);
Obj_SetAlpha(hfire, 200);
ObjEffect_SetTexture(hfire, imgSprite);
ObjEffect_SetRenderState(hfire, ALPHA);
ObjEffect_SetLayer(hfire, 1);
ObjEffect_SetPrimitiveType(hfire, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(hfire, 4);
ObjEffect_SetVertexUV(hfire, 0, 106, 152);
ObjEffect_SetVertexUV(hfire, 1, 119, 152);
ObjEffect_SetVertexUV(hfire, 2, 119, 165);
ObjEffect_SetVertexUV(hfire, 3, 106, 165);
if(position=="First"){
            while(!Obj_BeDeleted(hfire)){
               ObjEffect_SetVertexXY(hfire,0,GetPlayerX-oxp2-

7,GetPlayerY+oyp3-7);
               ObjEffect_SetVertexXY(hfire,1,GetPlayerX-

oxp2+7,GetPlayerY+oyp3-7);
               ObjEffect_SetVertexXY(hfire,2,GetPlayerX-

oxp2+7,GetPlayerY+oyp3+7);
               ObjEffect_SetVertexXY(hfire,3,GetPlayerX-oxp2-

7,GetPlayerY+oyp3+7);
               if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH ||

GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
                  if(count%6 == 3){
                     i=2;
                     while(i<=2){
                         CreatePlayerShot01(GetPlayerX()-

oxp2, GetPlayerY()+oyp3-7, 20, 275, 4.0, 1, 1);
                         i++
                     }
                  }
              }else{
                 if(count%8 == 4){
                    i=2;
                    while(i<=2){
                       CreatePlayerShot01(GetPlayerX()-

oxp2, GetPlayerY()+oyp3-7, 20, 275, 4.0, 1, 1);
                       i++;
                    }
                 }
              }
              yield;
         }
}if(position=="Second"){
         while(!Obj_BeDeleted(hfire)){
            ObjEffect_SetVertexXY(hfire,0,GetPlayerX+oxp2-

7,GetPlayerY+oyp3-7);
            ObjEffect_SetVertexXY

(hfire,1,GetPlayerX+oxp2+7,GetPlayerY+oyp3-7);
            ObjEffect_SetVertexXY

(hfire,2,GetPlayerX+oxp2+7,GetPlayerY+oyp3+7);
            ObjEffect_SetVertexXY(hfire,3,GetPlayerX+oxp2-

7,GetPlayerY+oyp3+7);
            if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH ||

GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
               if(count%6 == 3){
                  i=2;
                  while(i<=2){
                      CreatePlayerShot01(GetPlayerX()

+oxp2, GetPlayerY()+oyp3-7, 20, 265, 4.0, 1, 1);
                      i++
                  }
               }
            }else{
               if(count%8 == 4){
                  i=2;
                  while(i<=2){
                     CreatePlayerShot01(GetPlayerX()

+oxp2, GetPlayerY()+oyp3-7, 20, 265, 4.0, 1, 1);
                     i++;
                  }
               }
           }
           yield;
         }
}if(position=="Third"){
         while(!Obj_BeDeleted(hfire)){
            ObjEffect_SetVertexXY(hfire,0,GetPlayerX-oxp-

7,GetPlayerY+oyp2-7);
            ObjEffect_SetVertexXY(hfire,1,GetPlayerX-

oxp+7,GetPlayerY+oyp2-7);
            ObjEffect_SetVertexXY(hfire,2,GetPlayerX-

oxp+7,GetPlayerY+oyp2+7);
            ObjEffect_SetVertexXY(hfire,3,GetPlayerX-oxp-

7,GetPlayerY+oyp2+7);
            if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH ||

GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
               if(count%6 == 3){
                  i=2;
                  while(i<=2){
                      CreatePlayerShot01(GetPlayerX()-

oxp, GetPlayerY()+oyp2-7, 20, 276, 4.0, 1, 1);
                      i++
                  }
               }
           }else{
              if(count%8 == 4){
                 i=2;
                 while(i<=2){
                   CreatePlayerShot01(GetPlayerX()-

oxp, GetPlayerY()+oyp2-7, 20, 276, 4.0, 1, 1);
                    i++;
                 }
              }
           }
           yield;
}
}if(position=="Fourth"){
while(!Obj_BeDeleted(hfire)){
ObjEffect_SetVertexXY(hfire,0,GetPlayerX+oxp-

7,GetPlayerY+oyp2-7);
ObjEffect_SetVertexXY

(hfire,1,GetPlayerX+oxp+7,GetPlayerY+oyp2-7);
ObjEffect_SetVertexXY

(hfire,2,GetPlayerX+oxp+7,GetPlayerY+oyp2+7);
ObjEffect_SetVertexXY(hfire,3,GetPlayerX+oxp-

7,GetPlayerY+oyp2+7);
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH ||

GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
if(count%6 == 3){
i=2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()

+oxp, GetPlayerY()+oyp2-7, 20, 264, 4.0, 1, 1);
i++
}
}
}else{
if(count%8 == 4){
i=2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()

+oxp, GetPlayerY()+oyp2-7, 20, 264, 4.0, 1, 1);
                     i++;
                  }
            }
            }
            yield;
         }
}
}

task WaterSign(position){
let hwater = Obj_Create(OBJ_EFFECT);
Obj_SetAlpha(hwater, 200);
ObjEffect_SetTexture(hwater, imgSprite);
ObjEffect_SetRenderState(hwater, ALPHA);
ObjEffect_SetLayer(hwater, 1);
ObjEffect_SetPrimitiveType(hwater, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(hwater, 4);
ObjEffect_SetVertexUV(hwater, 0, 106, 168);
ObjEffect_SetVertexUV(hwater, 1, 119, 168);
ObjEffect_SetVertexUV(hwater, 2, 119, 181);
ObjEffect_SetVertexUV(hwater, 3, 106, 181);
if(position=="Fifth"){
            while(!Obj_BeDeleted(hwater)){
               ObjEffect_SetVertexXY(hwater,0,GetPlayerX-oxp2-

7,GetPlayerY+oyp3-7);
               ObjEffect_SetVertexXY(hwater,1,GetPlayerX-

oxp2+7,GetPlayerY+oyp3-7);
               ObjEffect_SetVertexXY(hwater,2,GetPlayerX-

oxp2+7,GetPlayerY+oyp3+7);
               ObjEffect_SetVertexXY(hwater,3,GetPlayerX-oxp2-

7,GetPlayerY+oyp3+7);
               if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH ||

GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
                  if(count%6 == 3){
                     i=2;
                     while(i<=2){
                         CreatePlayerShot01(GetPlayerX()-

oxp2, GetPlayerY()+oyp3, 20, 265, 3.0, 1, 2);
CreatePlayerShot01(GetPlayerX()-

oxp2, GetPlayerY()+oyp3, 20, 275, 3.0, 1, 2);
                         i++
                     }
                  }
              }else{
                 if(count%8 == 4){
                    i=2;
                    while(i<=2){
                       CreatePlayerShot01(GetPlayerX()-

oxp2, GetPlayerY()+oyp3, 20, 265, 3.0, 1, 2);
CreatePlayerShot01(GetPlayerX()-

oxp2, GetPlayerY()+oyp3, 20, 275, 3.0, 1, 2);
                       i++;
                    }
                 }
              }
              yield;
         }
}if(position=="Sixth"){
         while(!Obj_BeDeleted(hwater)){
            ObjEffect_SetVertexXY(hwater,0,GetPlayerX+oxp2-

7,GetPlayerY+oyp3-7);
            ObjEffect_SetVertexXY

(hwater,1,GetPlayerX+oxp2+7,GetPlayerY+oyp3-7);
            ObjEffect_SetVertexXY

(hwater,2,GetPlayerX+oxp2+7,GetPlayerY+oyp3+7);
            ObjEffect_SetVertexXY(hwater,3,GetPlayerX+oxp2-

7,GetPlayerY+oyp3+7);
            if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH ||

GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
               if(count%6 == 3){
                  i=2;
                  while(i<=2){
                      CreatePlayerShot01(GetPlayerX()-

oxp2, GetPlayerY()+oyp3, 20, 265, 3.0, 1, 2);
CreatePlayerShot01(GetPlayerX()-

oxp2, GetPlayerY()+oyp3, 20, 275, 3.0, 1, 2);
                      i++
                  }
               }
            }else{
               if(count%8 == 4){
                  i=2;
                  while(i<=2){
                     CreatePlayerShot01(GetPlayerX()-

oxp2, GetPlayerY()+oyp3, 20, 265, 3.0, 1, 2);
CreatePlayerShot01(GetPlayerX()-

oxp2, GetPlayerY()+oyp3, 20, 275, 3.0, 1, 2);
                     i++;
                  }
               }
           }
           yield;
         }
}if(position=="Seventh"){
         while(!Obj_BeDeleted(hwater)){
            ObjEffect_SetVertexXY(hwater,0,GetPlayerX-oxp-

7,GetPlayerY+oyp2-7);
            ObjEffect_SetVertexXY(hwater,1,GetPlayerX-

oxp+7,GetPlayerY+oyp2-7);
            ObjEffect_SetVertexXY(hwater,2,GetPlayerX-

oxp+7,GetPlayerY+oyp2+7);
            ObjEffect_SetVertexXY(hwater,3,GetPlayerX-oxp-

7,GetPlayerY+oyp2+7);
            if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH ||

GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
               if(count%6 == 3){
                  i=2;
                  while(i<=2){
                      CreatePlayerShot01(GetPlayerX()-

oxp, GetPlayerY()+oyp2, 20, 265, 3.0, 1, 2);
CreatePlayerShot01(GetPlayerX()-

oxp, GetPlayerY()+oyp2, 20, 275, 3.0, 1, 2);
                      i++
                  }
               }
           }else{
              if(count%8 == 4){
                 i=2;
                 while(i<=2){
                   CreatePlayerShot01(GetPlayerX()-

oxp, GetPlayerY()+oyp2, 20, 265, 3.0, 1, 2);
CreatePlayerShot01(GetPlayerX()-

oxp, GetPlayerY()+oyp2, 20, 275, 3.0, 1, 2);
                    i++;
                 }
              }
           }
           yield;
}
}if(position=="Eighth"){
while(!Obj_BeDeleted(hwater)){
ObjEffect_SetVertexXY(hwater,0,GetPlayerX+oxp-

7,GetPlayerY+oyp2-7);
ObjEffect_SetVertexXY

(hwater,1,GetPlayerX+oxp+7,GetPlayerY+oyp2-7);
ObjEffect_SetVertexXY

(hwater,2,GetPlayerX+oxp+7,GetPlayerY+oyp2+7);
ObjEffect_SetVertexXY(hwater,3,GetPlayerX+oxp-

7,GetPlayerY+oyp2+7);
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH ||

GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
if(count%6 == 3){
i=2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()-

oxp, GetPlayerY()+oyp2, 20, 265, 3.0, 1, 2);
CreatePlayerShot01(GetPlayerX()-

oxp, GetPlayerY()+oyp2, 20, 275, 3.0, 1, 2);
i++
}
}
}else{
if(count%8 == 4){
i=2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()-

oxp, GetPlayerY()+oyp2, 20, 265, 3.0, 1, 2);
CreatePlayerShot01(GetPlayerX()-

oxp, GetPlayerY()+oyp2, 20, 275, 3.0, 1, 2);
                     i++;
                  }
            }
            }
            yield;
         }
}
}

function wait(w){
loop(w){yield;}
}
}
yeah...but when I start a script problems occur in the following order...
1. fps comes crashing down down down...I'm talking all the way to around 9.65fps per say...
2. then when I press USER yes stuff changes but not the way I want it to...
3. what goes right, the graphic changes like it's suppose to...
4. what goes wrong, the shot type changes but then the first shot type is still shooting wth...& when I change it back...graphic changes correctly again but still with the all shot type at once stuff...
5. also when I shoot...let's see the bullets do outrageous damage even though I have it set up not to...they only shoot out of one option & it also causes slightly more slowdown then normal...
I'm certain that it's in this part of the script...as it was working fine until I starting stocking up on the task...which I'm also sure isn't the problem...oh & if I remove the loop{} from mainTask...welp, I get all problems fixed except no switch what-so-ever...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on December 14, 2009, 02:57:49 PM
Well, if you want the previous object to stop shooting, maybe you should put something like

if(Season=!1){ Obj_Delete(hfire); } somewhere in the while statements.  :V




I cannot give you any further information because... ohgodsomuchcode...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye 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...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan 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.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye 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...?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan 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
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis 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.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye 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...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan 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!
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake 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.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on December 15, 2009, 04:05:36 AM
Edit: as usual, I figured it out as I post my problem. Nevermind.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel 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.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake 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".
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut 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
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: TheMasterSpark 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 (http://www.youtube.com/watch?v=cUcLWB-IcdQ#t=0m57s&fmt=22).

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 (http://www.uploadhouse.com/viewfile.php?id=4964943), just for clarity.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut 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.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: TheMasterSpark 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?

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on December 15, 2009, 05:56:09 PM
Oh, you didn't load it.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: TheMasterSpark 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
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake 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.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan 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.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: TheMasterSpark 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. :)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan 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.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: TheMasterSpark 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.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan 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.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: TheMasterSpark 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?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel 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.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova 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?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: NOVA 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.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Hat 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
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel 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.

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan 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?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on December 16, 2009, 04:26:35 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?

not sure about this... but if your starting focusdot variable isn't 0 or anything divisible by 15, try making it
Code: [Select]
if((GetKeyState(VK_SLOWMOVE)==KEY_PUSH||GetKeyState(VK_SLOWMOVE)==KEY_HOLD)&&focusdot<255){ focusdot+=15; focusdot=255;}
if((GetKeyState(VK_SLOWMOVE)==KEY_PULL||GetKeyState(VK_SLOWMOVE)==KEY_FREE)&&focusdot>0){ focusdot-=15; focusdot=0;}
like that? since x (where x is the starting focusdot) isn't divisible by 15 and you add 15 when it's under 255... it probably reached something like... 255+x
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on December 16, 2009, 04:32:01 PM
Not, that's not it. I had already tested it. Also, the code you posted doesn't do what you want it to do.  :V
Thanks, anyways.

Edit:

Oh. Wow. I think I know the problem: I just noticed that there is actually a hardcoded red dot with a darker center that appears every time you focus. Because that one takes longer to fade in then my own dot, first my bright dot fades in and then the darker dot is painted above it.  :o


Daaaaaamn youuuuuu, danmakufuuuuuu!
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on December 16, 2009, 10:32:44 PM
To draw above the default red dot hitbox for player characters (which is the top of layer 3):

Use effect objects, set the layer to 3 or 4 (depending on in you want the hitbox drawn below or about bullets, respectively). Problem with that is that your hitbox will be blurry. Alternatively, create your hitbox as an object shot, which will be easier to spin if you're not comfortable with trig, and will not appear blurred. It will be forcedrawn below most bullets though, with the exception of low priority bullets like XXX03's. Will also no be drawn if ForbidShot is in play...

Code would look something like this:
Code: [Select]
task Hitbox{
let alph = 0;
let spin = rand_int(0, 359);
let spinner = 103;
let hitbox = Obj_Create(OBJ_SHOT);
Obj_SetSpeed(hitbox,0);
Obj_SetCollisionToPlayer(hitbox, false);
ObjShot_SetBombResist(hitbox, true);
ObjShot_SetGraphic(hitbox, 5);
while(!Obj_BeDeleted(hitbox)){//128, 223, 192, 287
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
if(GetKeyState(VK_RIGHT)==KEY_PUSH || GetKeyState(VK_RIGHT)==KEY_HOLD){
if(GetKeyState(VK_DOWN)==KEY_PUSH || GetKeyState(VK_DOWN)==KEY_HOLD){  
Obj_SetPosition(hitbox, GetPlayerX+1, GetPlayerY+1);
}else if(GetKeyState(VK_UP)==KEY_PUSH || GetKeyState(VK_UP)==KEY_HOLD){ 
Obj_SetPosition(hitbox, GetPlayerX+1, GetPlayerY-2);
}else{
Obj_SetPosition(hitbox, GetPlayerX+1, GetPlayerY);}
}else if(GetKeyState(VK_LEFT)==KEY_PUSH || GetKeyState(VK_LEFT)==KEY_HOLD){
            if(GetKeyState(VK_DOWN)==KEY_PUSH || GetKeyState(VK_DOWN)==KEY_HOLD){
Obj_SetPosition(hitbox, GetPlayerX-2, GetPlayerY+1);
            }else if(GetKeyState(VK_UP)==KEY_PUSH || GetKeyState(VK_UP)==KEY_HOLD){
Obj_SetPosition(hitbox, GetPlayerX-2, GetPlayerY-2);
            }else{       
Obj_SetPosition(hitbox, GetPlayerX-2, GetPlayerY);
}
}else if(GetKeyState(VK_DOWN)==KEY_PUSH || GetKeyState(VK_DOWN)==KEY_HOLD){
Obj_SetPosition(hitbox, GetPlayerX, GetPlayerY+1);
}else if(GetKeyState(VK_UP)==KEY_PUSH || GetKeyState(VK_UP)==KEY_HOLD){
Obj_SetPosition(hitbox, GetPlayerX, GetPlayerY-2);
}else{
Obj_SetPosition(hitbox, GetPlayerX, GetPlayerY);
}
}else{
Obj_Delete(hitbox);
}
if(alph<255){
alph+=15;}
spin+=spinner;
if(spinner>3){
spinner-=5;
}
if(spin>=360){
spin-=360;
}
Obj_SetAngle(hitbox, spin);
Obj_SetAlpha(hitbox, alph);
yield;
}
Obj_Delete(hitbox);
}

Hitbox is being called everytime you focus. Note that the drawing is lagged behind the player by one frame, so you'll need to adjust it's position accordingly. Code is taken from my Sanae characters, so you can just play one of them to see how it would look.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Azure Lazuline on December 16, 2009, 10:53:49 PM
You can use SetAutoEffect(false); to remove the hitbox, but it also removes some other things (invincibility circle and such). I'd recommend just using an object, but that can also work if you feel like re-doing the other effects.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: TheMasterSpark on December 17, 2009, 10:17:06 AM
Quote from: Blargel
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.

I do appreciate the offer Blargel, but I think it'd be best to start out the easy way. Once my ambitions become more lofty I might contact you on this matter though..  :D
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on December 18, 2009, 07:56:49 AM
I don't get why this won't show... I'm trying to make a menu and everything in my current script works but that (I'll fix the selection later)... this is the part where I display "game start", "practice start" etc...  It's weird since I'm just doing exactly what I'm doing with the background, but the background displays and this doesn't... (yes, I loaded the image)

I'm also making it
---  ---
---  ---
style instead of
---
---
---
---
style, so the code might look weird

Code: [Select]
task mainmenu
{
let obja=Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(obja, menupic);
ObjEffect_SetPrimitiveType(obja, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_SetLayer(obja, 8);
ObjEffect_CreateVertex(obja, 4);
ObjEffect_SetVertexUV(obja, 0, 1, 1);
ObjEffect_SetVertexUV(obja, 1, 145, 1);
ObjEffect_SetVertexUV(obja, 2, 1, 24);
ObjEffect_SetVertexUV(obja, 3, 145, 24);
ObjEffect_SetVertexXY(obja, 0, GetCenterX-150, GetCenterY+75);
ObjEffect_SetVertexXY(obja, 1, GetCenterX-4, GetCenterY+100);
ObjEffect_SetVertexXY(obja, 2, GetCenterX-150, GetCenterY+75);
ObjEffect_SetVertexXY(obja, 3, GetCenterX-4, GetCenterY+100);
let objb=Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(objb, menupic);
ObjEffect_SetPrimitiveType(objb, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_SetLayer(objb, 8);
ObjEffect_CreateVertex(objb, 4);
ObjEffect_SetVertexUV(objb, 0, 1, 28);
ObjEffect_SetVertexUV(objb, 1, 145, 28);
ObjEffect_SetVertexUV(objb, 2, 1, 52);
ObjEffect_SetVertexUV(objb, 3, 145, 52);
ObjEffect_SetVertexXY(objb, 0, GetCenterX-150, GetCenterY+105);
ObjEffect_SetVertexXY(objb, 1, GetCenterX-4, GetCenterY+130);
ObjEffect_SetVertexXY(objb, 2, GetCenterX-150, GetCenterY+105);
ObjEffect_SetVertexXY(objb, 3, GetCenterX-4, GetCenterY+130);
let objc=Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(objc, menupic);
ObjEffect_SetPrimitiveType(objc, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_SetLayer(objc, 8);
ObjEffect_CreateVertex(objc, 4);
ObjEffect_SetVertexUV(objc, 0, 1, 56);
ObjEffect_SetVertexUV(objc, 1, 145, 56);
ObjEffect_SetVertexUV(objc, 2, 1, 76);
ObjEffect_SetVertexUV(objc, 3, 145, 76);
ObjEffect_SetVertexXY(objc, 0, GetCenterX+4, GetCenterY+75);
ObjEffect_SetVertexXY(objc, 1, GetCenterX+150, GetCenterY+100);
ObjEffect_SetVertexXY(objc, 2, GetCenterX+4, GetCenterY+75);
ObjEffect_SetVertexXY(objc, 3, GetCenterX+150, GetCenterY+100);
let objd=Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(objd, menupic);
ObjEffect_SetPrimitiveType(objd, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_SetLayer(objd, 8);
ObjEffect_CreateVertex(objd, 4);
ObjEffect_SetVertexUV(objd, 0, 1, 94);
ObjEffect_SetVertexUV(objd, 1, 145, 94);
ObjEffect_SetVertexUV(objd, 2, 1, 100);
ObjEffect_SetVertexUV(objd, 3, 145, 100);
ObjEffect_SetVertexXY(objd, 0, GetCenterX+4, GetCenterY+105);
ObjEffect_SetVertexXY(objd, 1, GetCenterX+150, GetCenterY+130);
ObjEffect_SetVertexXY(objd, 2, GetCenterX+4, GetCenterY+105);
ObjEffect_SetVertexXY(objd, 3, GetCenterX+150, GetCenterY+130);
while(Obj_BeDeleted(obja)==false)
{
yield;
}
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on December 18, 2009, 08:14:38 AM
   ObjEffect_SetVertexXY(objb, 0, GetCenterX-150, GetCenterY+105);
   ObjEffect_SetVertexXY(objb, 1, GetCenterX-4, GetCenterY+130);
   ObjEffect_SetVertexXY(objb, 2, GetCenterX-150, GetCenterY+105);
   ObjEffect_SetVertexXY(objb, 3, GetCenterX-4, GetCenterY+130);

That's where your problem is. You're putting vertex 0 and vertex 2 in the same place. Vertex 1 and vertex 3 are also in the same place so the image has 0 width or length.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on December 18, 2009, 08:15:38 AM
   ObjEffect_SetVertexXY(objb, 0, GetCenterX-150, GetCenterY+105);
   ObjEffect_SetVertexXY(objb, 1, GetCenterX-4, GetCenterY+130);
   ObjEffect_SetVertexXY(objb, 2, GetCenterX-150, GetCenterY+105);
   ObjEffect_SetVertexXY(objb, 3, GetCenterX-4, GetCenterY+130);

That's where your problem is. You're putting vertex 0 and vertex 2 in the same place. Vertex 1 and vertex 3 are also in the same place so the image has 0 width or length.

oh.. I didn't see that... oops... I switched the y coordinates... thanks
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Infy♫ on December 18, 2009, 07:01:54 PM
i've got serious problems with music.
i always need to make the music i got louder so you can hear it while playing
but  the programs i use to amplify the songs make certain parts sound very ugly
what can i do?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on December 18, 2009, 07:54:40 PM
I got similar problems. I have to amplify my songs, but the new versions never play on Danmakufu. WTF?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on December 18, 2009, 10:04:23 PM
i've got serious problems with music.
i always need to make the music i got louder so you can hear it while playing
but  the programs i use to amplify the songs make certain parts sound very ugly
what can i do?
I got similar problems. I have to amplify my songs, but the new versions never play on Danmakufu. WTF?


A simple solution is to convert those mp3 into .WAV files. For some reason, Danmakufu plays those a lot louder than its equivalent mp3 counterparts.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on December 18, 2009, 10:10:25 PM
.WAV

.WAV

[size=8].WAV[/size]

But Danmakufu always takes so long to load them. Er, "LOAD" them. seriouslytheydontevenplay
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on December 19, 2009, 02:03:10 AM
WAV + LONG MUSIC FILE = BAD!!!

Unless you want 300 MB bgm files of course.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on December 19, 2009, 02:37:14 AM
Bad Wav!!

:/ Most of my songs are like, 3 mins long. :\
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on December 19, 2009, 04:41:51 AM
I don't see what's the problem. All of my sound effects, music, and other audio I need are in a WAV format, and I don't have any problems.
I think you're overreacting.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on December 19, 2009, 04:49:27 AM
Not everybody can download/upload at a reasonably high rate, so needlessly large files like .wav or .tif are frowned upon due to lol heug load times. Not many people can notice the difference between a compressed .mp3 and lossless .flac anyway, so you should just convert them for downloading ease.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: CK Crash on December 19, 2009, 02:56:24 PM
Set Audacity to export MP3s with a bitrate of 128. WAV files are strictly for sound effects, unless you want 98% of your file size to be your BGM.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Infy♫ on December 19, 2009, 03:44:15 PM
halp!
while i was working on the title screen i discovered a problem. how do i move an effect object on top of another (and back)?
i cant use setlayer because all textures are already in the highest possible layer
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on December 19, 2009, 04:03:43 PM
Casercan. Drawing order. Anything that is drawn latter will appear on top (just like in DrawLoop and BackGround). So to achieve this you need to redraw the images according to the layering effect you want. Because you cannot tell something to be on bottom or top as the image covering your title is Layer 8. And thus the order of drawing is important here.




Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on December 20, 2009, 06:51:24 AM
Im having a problem with this script, it fires the first time, then when its set to fire again, only the first task fires, and then nothing at all.


Code: [Select]
#TouhouDanmakufu
#Title[XXX]
#Text[XXX]
#BackGround[User(.\img\BG.png,0,0)]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
let frame2 = 0;
let obj=Obj_Create(OBJ_SHOT);

let obj2=Obj_Create(OBJ_SHOT);

#include_function ".\Rena Draw2.txt"


   @Initialize{
initalize;
SetLife(3000);
SetTimer(100);
SetMovePosition02(GetCenterX, GetCenterY, 30);
}

   @MainLoop{
frame++;
yield;
if(frame>120){SetCollisionA(GetX, GetY, 32);}
if(frame>120 && frame==180 || frame==360 || frame==540){
Explode01;
Explode02;}

   }@DrawLoop{renadraw;

if(frame<120){
DrawText("XXX", GetClipMinX, GetClipMinY+15, 18, 255);}

DrawText("XXX", GetClipMinX, GetClipMaxY-40, 20, 255);

}

   @Finialize{
DeleteGraphic(BossImage);}

task Explode01{

let bullets = [GREEN01, PURPLE01, WHITE01, GREEN02, PURPLE02, WHITE02, GREEN05, PURPLE05, WHITE05, GREEN31, PURPLE31, WHITE31];

      Obj_SetPosition(obj, GetClipMinX, GetY-60);
      Obj_SetAngle(obj, 0);
      Obj_SetSpeed(obj, 8);
      ObjShot_SetGraphic(obj, YELLOW02);
      ObjShot_SetDelay  (obj, 60);
      ObjShot_SetBombResist (obj, true);

      while(Obj_BeDeleted(obj)==false) {

              if(Obj_GetY(obj)==Obj_GetY(obj2) && Obj_GetX(obj)==Obj_GetX(obj2)){
loop(1000){
CreateShot01(Obj_GetX(obj), Obj_GetY(obj), rand(0.1,5), rand(0,360), bullets[rand_int(0,11)], 0);}

Obj_SetSpeed(obj, rand(0.1,5));
Obj_SetAngle(obj, rand(0,360));
ObjShot_SetGraphic(obj, bullets[rand_int(0,11)]);}


              yield;
       }//End BeDeleted
}//End Task

task Explode02{

let bullets = [GREEN01, PURPLE01, WHITE01, GREEN02, PURPLE02, WHITE02, GREEN05, PURPLE05, WHITE05, GREEN31, PURPLE31, WHITE31];

      Obj_SetPosition(obj2, GetClipMaxX, GetY-60);
      Obj_SetAngle(obj2, 180);
      Obj_SetSpeed(obj2, 8);
      ObjShot_SetGraphic(obj2, YELLOW02);
      ObjShot_SetDelay  (obj2, 60);
      ObjShot_SetBombResist (obj2, true);

      while(Obj_BeDeleted(obj2)==false) {

              if(Obj_GetY(obj)==Obj_GetY(obj2) && Obj_GetX(obj)==Obj_GetX(obj2)){
Obj_SetSpeed(obj2, rand(0.1,5));
Obj_SetAngle(obj2, rand(0,360));
ObjShot_SetGraphic(obj2, bullets[rand_int(0,11)]);}


              yield;
       }//End BeDeleted
}//End Task
}

I am not sure how to fix this.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on December 20, 2009, 05:47:33 PM
I'm getting a lot of errors with this.

Code: [Select]
#include_function ".Rena Draw2.txt"
initalize;
renadraw;

Mind telling me what all of these do? Or am I missing something...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye on December 20, 2009, 05:58:07 PM
...you should probably include "Rena Draw.txt" so that people may be able to find out what

initalize;
renadraw;

...is...cause if they are task, function, etc...might be a problem with them...well...
then there's the include_function ".\Rena Draw2.txt" line which is suppose to probably have a ; at the end...
oh, & in @DrawLoop, you should probably put...

else{DrawText("XXX", GetClipMinX, GetClipMaxY-40, 20, 255);}

instead of just...   DrawText("XXX", GetClipMinX, GetClipMaxY-40, 20, 255);
in the respective place...last thing...task are written like this... task Mytask{} ...see?
...I doubt any of this helped you with your problem with the bullets firing & whatnot...so...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on December 20, 2009, 08:00:03 PM
...you should probably include "Rena Draw.txt"
Yes, even though it won't help the shooting problem.

then there's the include_function ".\Rena Draw2.txt" line which is suppose to probably have a ; at the end...
Nope

else{DrawText("XXX", GetClipMinX, GetClipMaxY-40, 20, 255);}
instead of just...   DrawText("XXX", GetClipMinX, GetClipMaxY-40, 20, 255);
Not if he wants the latter to always be drawn.

last thing...task are written like this... task Mytask{} ...see?
That is how he wrote it.

One thing I did notice was that you wrote Finalize{} "Finialize{}".
I won't be of much help here, though. As a general rule I never usually include object tasks in my MainLoop if it can be helped. Aside from being unorganized, it looks fine to me. You are resetting frame, are you not?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye on December 20, 2009, 08:07:27 PM
...oh, my bad...
That is how he wrote it.

...okay...
but he wrote it as taskMytask{}...
just though he needed to space before the task's name that's all...like this;

task Mytask{}

...guess not...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on December 20, 2009, 08:18:53 PM
Huh? There's not even a task called Mytask in there. Just Explode1 and Explode2, both of which are heavily spaced.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye on December 20, 2009, 08:33:25 PM
 ??? no I knew that...just using Mytask as a place holder of sorts...
...& I didn't know spacing was there cause in order to see it I had to copy/paste it as I was replying just now...which is weird...

oh & I should probably ask a question as oppose to posting what I now know was nonsense here...wow...okay, is it possible to just handle only the SetVertexUV(); portion of an Effect Object task in @MainLoop{} & handle everything else(SetVertexXY();, CreatePlayerShot(); info, any other ObjEffect_ stuff & the option("this"); info)...in a task per say?

asking cause I still trying to get multi shot type options that change apperance when the shot type changes...guess I'll do something else until I or someone else figures this out...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on December 21, 2009, 04:44:38 AM
I fixed my problem with the second task firing, I just put them in a joined task and it worked!!

One thing I did notice was that you wrote Finalize{} "Finialize{}".

It seems to work both ways.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on December 21, 2009, 06:32:38 PM
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. <_<

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.

...None of those worked. Ack.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on December 21, 2009, 08:57:24 PM
I've got a couple questions. What are dnh files, what can I put in them, how can I make them, and how can I properly load them into danmakufu? I've seen it done before, but now I want to get more in-depth.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Infy♫ on December 21, 2009, 09:28:39 PM
i wonder how you can make danmakufu return whole numbers instead of decimal stuff like 0.00000000
i'm using drawtext and it's annoying me.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Azure Lazuline on December 21, 2009, 10:55:56 PM
Code: [Select]
function IntString(number){
   let str = ToString(number);
   let str2 = "";
   let i = 0;
   while (str[i] != '.')
   {
      str2 = str2 ~ [str[i]];
      i++;
   }
   return(str2);
}

Slightly modified from one of Nuclear Cheese's scripts. Just call IntString(number) instead of ToString(number).
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on December 21, 2009, 11:30:22 PM
I've got a couple questions. What are dnh files, what can I put in them, how can I make them, and how can I properly load them into danmakufu? I've seen it done before, but now I want to get more in-depth.

Exactly the same as .txt files. You can put whatever you want in them. You make them by saving them with ".dnh" after the name. Danmakufu will load any file that begins with #TouhouDanmakufu, they don't have to be .txt or .dnh.

They are useless, and a really poor way of preventing people from looking at your scripts, considering you open them the same way as well. I had somebody argue that they are used for "identifying Danmakufu scripts, instead of regular .txt files", but really, I don't think it matters.

Besides, if people want to hide their scripts, just use the Danmakufu archiver.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on December 22, 2009, 03:05:04 AM
...None of those worked. Ack.

Might wanna post up your whole script then. It's pretty hard to solve a problem when we don't have all the details and the best way to give those details is to just tell us what you're trying to accomplish and giving us the script.

I've got a couple questions. What are dnh files, what can I put in them, how can I make them, and how can I properly load them into danmakufu? I've seen it done before, but now I want to get more in-depth.
Exactly the same as .txt files. You can put whatever you want in them. You make them by saving them with ".dnh" after the name. Danmakufu will load any file that begins with #TouhouDanmakufu, they don't have to be .txt or .dnh.

They are useless, and a really poor way of preventing people from looking at your scripts, considering you open them the same way as well. I had somebody argue that they are used for "identifying Danmakufu scripts, instead of regular .txt files", but really, I don't think it matters.

Besides, if people want to hide their scripts, just use the Danmakufu archiver.

Yes, they are the same as .txt files, just with renamed extensions and Danmakufu will load them as if they are normal .txt files. You can name your script with a .penis extension if you really wanted to and Danmakufu will still load it in the script list as long as it has #TouhouDanmakufu as the first line.

I make my scripts .dnh files because my Notepad++ is set to identify them automatically when opening them and load the proper syntax highlighter. In other words, you can just right-click on one, click on Open with... and click on Notepad, and the script will be available to you just like normal.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on December 22, 2009, 03:59:12 PM
Huh...
Thanks alot. That clears a lot of things up.

Alright, new question. I'd like to know where to get this archiver, and if I can compress my scripts and everything within the folder into a single DAT file similar to the ones you find in Touhou games, with the music, sound effects, scripts, everything.
Is there a tool I could use to do it?

I don't really need to, but it will make things look much neater.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on December 22, 2009, 08:17:54 PM
Yes. (http://www.geocities.co.jp/SiliconValley-Oakland/9951/products/th_dnh.html)

東方弾幕風用アーカイバ v0.01c(約50kB)

Make sure you use GetCurrentScriptDirectory~ and .\ to reference all your files, the archiver randomly chooses a new base folder for no apparent reason, so absolute pathnames will brake.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on December 23, 2009, 01:51:52 AM
Are Obj_SPELLs the only thing that can go in tasks for a bomb?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Gc on December 23, 2009, 04:01:53 AM
Code: [Select]
#UserShotData

ShotImage = ".\shot.png"

// Laser bases
ShotData {id = 1  rect = (0,0,16,16)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 2  rect = (16,0,32,16)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 3  rect = (32,0,48,16)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 4  rect = (48,0,64,16)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 5  rect = (64,0,80,16)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 6  rect = (80,0,96,16)  render = ALPHA  delay_color = (191,255,127)}

ShotData {id = 7  rect = (96,0,112,16)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 8  rect = (112,0,128,16)  render = ALPHA  delay_color = (255,191,127)}

ShotData {id = 9  rect = (128,0,144,16)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 10  rect = (144,0,160,16)  render = ALPHA  delay_color = (127,127,127)}

// 21
ShotData {id = 11  rect = (0,16,16,32)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 12  rect = (16,16,32,32)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 13  rect = (32,16,48,32)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 14  rect = (48,16,64,32)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 15  rect = (64,16,80,32)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 16  rect = (80,16,96,32)  render = ALPHA  delay_color = (191,255,127)}

ShotData {id = 17  rect = (96,16,112,32)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 18  rect = (112,16,128,32)  render = ALPHA  delay_color = (255,191,127)}

ShotData {id = 19  rect = (128,16,144,32)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 20  rect = (144,16,160,32)  render = ALPHA  delay_color = (127,127,127)}

// 04
ShotData {id = 21  rect = (0,32,16,48)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 22  rect = (16,32,32,48)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 23  rect = (32,32,48,48)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 24  rect = (48,32,64,48)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 25  rect = (64,32,80,48)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 26  rect = (80,32,96,48)  render = ALPHA  delay_color = (191,255,127)}

ShotData {id = 27  rect = (96,32,112,48)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 28  rect = (112,32,128,48)  render = ALPHA  delay_color = (255,191,127)}

ShotData {id = 29  rect = (128,32,144,48)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 30  rect = (144,32,160,48)  render = ALPHA  delay_color = (127,127,127)}

// 01
ShotData {id = 31  rect = (0,48,16,64)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 32  rect = (16,48,32,64)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 33  rect = (32,48,48,64)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 34  rect = (48,48,64,64)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 35  rect = (64,48,80,64)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 36  rect = (80,48,96,64)  render = ALPHA  delay_color = (191,255,127)}

ShotData {id = 37  rect = (96,48,112,64)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 38  rect = (112,48,128,64)  render = ALPHA  delay_color = (255,191,127)}

ShotData {id = 39  rect = (128,48,144,64)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 40  rect = (144,48,160,64)  render = ALPHA  delay_color = (127,127,127)}

// 12
ShotData {id = 41  rect = (3,64,13,80)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 42  rect = (19,64,29,80)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 43  rect = (35,64,45,80)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 44  rect = (51,64,61,80)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 45  rect = (67,64,77,80)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 46  rect = (83,64,93,80)  render = ALPHA  delay_color = (191,255,127)}

ShotData {id = 47  rect = (99,64,109,80)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 48  rect = (115,64,125,80)  render = ALPHA  delay_color = (255,191,127)}

ShotData {id = 49  rect = (131,64,141,80)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 50  rect = (147,64,157,80)  render = ALPHA  delay_color = (127,127,127)}

// 31
ShotData {id = 51  rect = (3,80,13,96)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 52  rect = (19,80,29,96)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 53  rect = (35,80,45,96)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 54  rect = (51,80,61,96)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 55  rect = (67,80,77,96)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 56  rect = (83,80,93,96)  render = ALPHA  delay_color = (191,255,127)}

ShotData {id = 57  rect = (99,80,109,96)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 58  rect = (115,80,125,96)  render = ALPHA  delay_color = (255,191,127)}

ShotData {id = 59  rect = (131,80,141,96)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 60  rect = (147,80,157,96)  render = ALPHA  delay_color = (127,127,127)}

// 23
ShotData {id = 61  rect = (3,96,13,112)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 62  rect = (19,96,29,112)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 63  rect = (35,96,45,112)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 64  rect = (51,96,61,112)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 65  rect = (67,96,77,112)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 66  rect = (83,96,93,112)  render = ALPHA  delay_color = (191,255,127)}

ShotData {id = 67  rect = (99,96,109,112)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 68  rect = (115,96,125,112)  render = ALPHA  delay_color = (255,191,127)}

ShotData {id = 69  rect = (131,96,141,112)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 70  rect = (147,96,157,112)  render = ALPHA  delay_color = (127,127,127)}

// Amulets
ShotData {id = 71  rect = (1,112,15,128)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 72  rect = (17,112,31,128)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 73  rect = (33,112,47,128)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 74  rect = (49,112,63,128)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 75  rect = (65,112,79,128)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 76  rect = (81,112,95,128)  render = ALPHA  delay_color = (191,255,127)}

ShotData {id = 77  rect = (97,112,111,128)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 78  rect = (113,112,127,128)  render = ALPHA  delay_color = (255,191,127)}

ShotData {id = 79  rect = (129,112,143,128)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 80  rect = (145,112,159,128)  render = ALPHA  delay_color = (127,127,127)}

// Suppositories
ShotData {id = 81  rect = (3,128,13,144)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 82  rect = (19,128,29,144)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 83  rect = (35,128,45,144)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 84  rect = (51,128,61,144)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 85  rect = (67,128,77,144)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 86  rect = (83,128,93,144)  render = ALPHA  delay_color = (191,255,127)}

ShotData {id = 87  rect = (99,128,109,144)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 88  rect = (115,128,125,144)  render = ALPHA  delay_color = (255,191,127)}

ShotData {id = 89  rect = (131,128,141,144)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 90  rect = (147,128,157,144)  render = ALPHA  delay_color = (127,127,127)}

// 12i
ShotData {id = 91  rect = (3,144,13,160)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 92  rect = (19,144,29,160)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 93  rect = (35,144,45,160)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 94  rect = (51,144,61,160)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 95  rect = (67,144,77,160)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 96  rect = (83,144,93,160)  render = ALPHA  delay_color = (191,255,127)}

ShotData {id = 97  rect = (99,144,109,160)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 98  rect = (115,144,125,160)  render = ALPHA  delay_color = (255,191,127)}

ShotData {id = 99  rect = (131,144,141,160)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 100  rect = (147,144,157,160)  render = ALPHA  delay_color = (127,127,127)}

// Marisa's small stars
ShotData {id = 101  rect = (0,160,16,176)  render = ALPHA  delay_color = (255,127,127)  angular_velocity = 2}

ShotData {id = 102  rect = (16,160,32,176)  render = ALPHA  delay_color = (127,127,255)  angular_velocity = 2}

ShotData {id = 103  rect = (32,160,48,176)  render = ALPHA  delay_color = (255,127,255)  angular_velocity = 2}

ShotData {id = 104  rect = (48,160,64,176)  render = ALPHA  delay_color = (127,255,255)  angular_velocity = 2}

ShotData {id = 105  rect = (64,160,80,176)  render = ALPHA  delay_color = (127,255,127)  angular_velocity = 2}

ShotData {id = 106  rect = (80,160,96,176)  render = ALPHA  delay_color = (191,255,127)  angular_velocity = 2}

ShotData {id = 107  rect = (96,160,112,176)  render = ALPHA  delay_color = (255,255,127)  angular_velocity = 2}

ShotData {id = 108  rect = (112,160,128,176)  render = ALPHA  delay_color = (255,191,127)  angular_velocity = 2}

ShotData {id = 109  rect = (128,160,144,176)  render = ALPHA  delay_color = (255,255,255)  angular_velocity = 2}

ShotData {id = 110  rect = (144,160,160,176)  render = ALPHA  delay_color = (127,127,127)  angular_velocity = 2}

// MURASA's dorplets
ShotData {id = 111  rect = (3,176,13,192)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 112  rect = (19,176,29,192)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 113  rect = (35,176,45,192)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 114  rect = (51,176,61,192)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 115  rect = (67,176,77,192)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 116  rect = (83,176,93,192)  render = ALPHA  delay_color = (191,255,127)}

ShotData {id = 117  rect = (99,176,109,192)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 118  rect = (115,176,125,192)  render = ALPHA  delay_color = (255,191,127)}

ShotData {id = 119  rect = (131,176,141,192)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 120  rect = (147,176,157,192)  render = ALPHA  delay_color = (127,127,127)}

// MoF dots
ShotData {id = 121  rect = (0,192,8,200)  render = ALPHA  delay_color = (255,127,127)  angular_velocity = 2}

ShotData {id = 122  rect = (16,192,24,200)  render = ALPHA  delay_color = (127,127,255)  angular_velocity = 2}

ShotData {id = 123  rect = (32,192,40,200)  render = ALPHA  delay_color = (255,127,255)  angular_velocity = 2}

ShotData {id = 124  rect = (48,192,56,200)  render = ALPHA  delay_color = (127,255,255)  angular_velocity = 2}

ShotData {id = 125  rect = (64,192,72,200)  render = ALPHA  delay_color = (127,255,127)  angular_velocity = 2}

ShotData {id = 126  rect = (80,192,88,200)  render = ALPHA  delay_color = (191,255,127)  angular_velocity = 2}

ShotData {id = 127  rect = (96,192,104,200)  render = ALPHA  delay_color = (255,255,127)  angular_velocity = 2}

ShotData {id = 128  rect = (112,192,120,200)  render = ALPHA  delay_color = (255,191,127)  angular_velocity = 2}

ShotData {id = 129  rect = (128,192,136,200)  render = ALPHA  delay_color = (255,255,255)  angular_velocity = 2}

ShotData {id = 130  rect = (144,192,152,200)  render = ALPHA  delay_color = (127,127,127)  angular_velocity = 2}

// 05
ShotData {id = 131  rect = (8,192,16,200)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 132  rect = (24,192,32,200)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 133  rect = (40,192,48,200)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 134  rect = (56,192,64,200)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 135  rect = (72,192,80,200)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 136  rect = (88,192,96,200)  render = ALPHA  delay_color = (191,255,127)}

ShotData {id = 137  rect = (104,192,112,200)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 138  rect = (120,192,128,200)  render = ALPHA  delay_color = (255,191,127)}

ShotData {id = 139  rect = (136,192,144,200)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 140  rect = (152,192,160,200)  render = ALPHA  delay_color = (127,127,127)}

// Sinuate laser bases (UFO)
ShotData {id = 141  rect = (352,256,368,512)  render = ADD  delay_color = (255,127,127)}

ShotData {id = 142  rect = (368,256,384,512)  render = ADD  delay_color = (127,127,255)}

ShotData {id = 143  rect = (384,256,400,512)  render = ADD  delay_color = (255,127,255)}

ShotData {id = 144  rect = (400,256,416,512)  render = ADD  delay_color = (127,255,255)}

ShotData {id = 145  rect = (416,256,432,512)  render = ADD  delay_color = (127,255,127)}

ShotData {id = 146  rect = (432,256,448,512)  render = ADD  delay_color = (191,255,127)}

ShotData {id = 147  rect = (448,256,464,512)  render = ADD  delay_color = (255,255,127)}

ShotData {id = 148  rect = (464,256,480,512)  render = ADD  delay_color = (255,191,127)}

ShotData {id = 149  rect = (480,256,496,512)  render = ADD  delay_color = (255,255,255)}

ShotData {id = 150  rect = (496,256,512,512)  render = ADD  delay_color = (127,127,127)}

/*------------------------*\
| Medium and large bullets |
\*------------------------*/

// Koishi's penormaku
ShotData {id = 151  rect = (0,256,32,288)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 152  rect = (32,256,64,288)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 153  rect = (64,256,96,288)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 154  rect = (96,256,128,288)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 155  rect = (128,256,160,288)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 156  rect = (160,256,192,288)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 157  rect = (192,256,224,288)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 158  rect = (224,256,256,288)  render = ALPHA  delay_color = (127,127,127)}

// Marisa's large stars
ShotData {id = 159  rect = (256,0,288,32)  render = ALPHA  delay_color = (255,127,127)  angular_velocity = 2}

ShotData {id = 160  rect = (288,0,320,32)  render = ALPHA  delay_color = (255,127,255)  angular_velocity = 2}

ShotData {id = 161  rect = (320,0,352,32)  render = ALPHA  delay_color = (127,127,255)  angular_velocity = 2}

ShotData {id = 162  rect = (352,0,384,32)  render = ALPHA  delay_color = (127,255,255)  angular_velocity = 2}

ShotData {id = 163  rect = (384,0,416,32)  render = ALPHA  delay_color = (127,255,127)  angular_velocity = 2}

ShotData {id = 164  rect = (416,0,448,32)  render = ALPHA  delay_color = (255,255,127)  angular_velocity = 2}

ShotData {id = 165  rect = (448,0,480,32)  render = ALPHA  delay_color = (255,255,255)  angular_velocity = 2}

ShotData {id = 166  rect = (480,0,512,32)  render = ALPHA  delay_color = (127,127,127)  angular_velocity = 2}

// 02
ShotData {id = 167  rect = (256,32,288,64)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 168  rect = (288,32,320,64)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 169  rect = (320,32,352,64)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 170  rect = (352,32,384,64)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 171  rect = (384,32,416,64)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 172  rect = (416,32,448,64)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 173  rect = (448,32,480,64)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 174  rect = (480,32,512,64)  render = ALPHA  delay_color = (127,127,127)}

// Yuyuko's butterflies
ShotData {id = 175  rect = (256,64,288,96)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 176  rect = (288,64,320,96)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 177  rect = (320,64,352,96)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 178  rect = (352,64,384,96)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 179  rect = (384,64,416,96)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 180  rect = (416,64,448,96)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 181  rect = (448,64,480,96)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 182  rect = (480,64,512,96)  render = ALPHA  delay_color = (127,127,127)}

// Sakuya's knives
ShotData {id = 183  rect = (256,96,288,128)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 184  rect = (288,96,320,128)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 185  rect = (320,96,352,128)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 186  rect = (352,96,384,128)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 187  rect = (384,96,416,128)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 188  rect = (416,96,448,128)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 189  rect = (448,96,480,128)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 190  rect = (480,96,512,128)  render = ALPHA  delay_color = (127,127,127)}

// Oval bullets
ShotData {id = 191  rect = (264,128,280,160)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 192  rect = (296,128,312,160)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 193  rect = (328,128,346,160)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 194  rect = (360,128,376,160)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 195  rect = (392,128,408,160)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 196  rect = (424,128,440,160)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 197  rect = (456,128,472,160)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 198  rect = (488,128,504,160)  render = ALPHA  delay_color = (127,127,127) }

// Flashes
ShotData {id = 199  rect = (256,160,288,192)  render = ADD  delay_color = (255,127,127)  angular_velocity = 20}

ShotData {id = 200  rect = (288,160,320,199)  render = ADD  delay_color = (255,127,255)  angular_velocity = 20}

ShotData {id = 201  rect = (320,160,352,192)  render = ADD  delay_color = (127,127,255)  angular_velocity = 20}

ShotData {id = 202  rect = (352,160,384,192)  render = ADD  delay_color = (127,255,255)  angular_velocity = 20}

ShotData {id = 203  rect = (384,160,416,192)  render = ADD  delay_color = (127,255,127)  angular_velocity = 20}

ShotData {id = 204  rect = (416,160,448,192)  render = ADD  delay_color = (255,255,127)  angular_velocity = 20}

ShotData {id = 205  rect = (448,160,480,192)  render = ADD  delay_color = (255,255,255)  angular_velocity = 20}

ShotData {id = 206  rect = (480,160,512,192)  render = ADD  delay_color = (127,127,127)  angular_velocity = 20}

// 03
ShotData {id = 207  rect = (256,192,320,256)  render = ADD  delay_color = (255,127,127)  angular_velocity = 20}

ShotData {id = 208  rect = (320,192,384,256)  render = ADD  delay_color = (127,127,255)  angular_velocity = 20}

ShotData {id = 209  rect = (384,192,448,256)  render = ADD  delay_color = (127,255,127)  angular_velocity = 20}

ShotData {id = 210  rect = (448,192,512,256)  render = ADD  delay_color = (255,255,127)  angular_velocity = 20}

/*-----------------*\
| Animating bullets |
\*------------------/

ShotData {
id = 211
render = ADD
delay_color = (255,127,127)
AnimationData {
animation_data = (4,256,256,288,288)
animation_data = (4,256,288,288,320)
animation_data = (4,256,320,288,352)
animation_data = (4,256,352,288,384)
}
}

ShotData {
id = 212
render = ADD
delay_color = (127,127,255)
AnimationData {
animation_data = (4,288,256,320,288)
animation_data = (4,288,288,320,320)
animation_data = (4,288,320,320,352)
animation_data = (4,288,352,320,384)
}
}

ShotData {
id = 213
render = ADD
delay_color = (255,127,255)
AnimationData {
animation_data = (4,320,256,352,288)
animation_data = (4,320,288,352,320)
animation_data = (4,320,320,352,352)
animation_data = (4,320,352,352,384)
}
}

ShotData {
id = 214
render = ADD
delay_color = (127,255,255)
AnimationData {
animation_data = (4,256,384,288,416)
animation_data = (4,256,416,288,48)
animation_data = (4,256,448,288,480)
animation_data = (4,256,480,288,512)
}
}

ShotData {
id = 215
render = ADD
delay_color = (255,255,127)
AnimationData {
animation_data = (4,288,384,320,416)
animation_data = (4,288,416,320,448)
animation_data = (4,288,448,320,480)
animation_data = (4,288,480,320,512)
}
}

ShotData {
id = 216
render = ADD
delay_color = (127,255,127)
AnimationData {
animation_data = (4,320,384,352,416)
animation_data = (4,320,416,352,448)
animation_data = (4,320,448,352,480)
animation_data = (4,320,480,352,512)
}
}

Gives me :

(http://dl.dropbox.com/u/3185156/Danmakufu%20errors/shoterror1.png)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on December 23, 2009, 04:13:13 AM
It says there's an illegal termination in the file or something. I just can't find anything in there.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on December 23, 2009, 04:57:02 AM
Might wanna post up your whole script then. It's pretty hard to solve a problem when we don't have all the details and the best way to give those details is to just tell us what you're trying to accomplish and giving us the script.

...
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);

}

task timecheck{
loop{
if(GetTimer <= 10 && GetTimer > 3){
PlaySE(CSD ~ "Materials/timer1.wav");
wait(60);
}
if(GetTimer <= 3){
PlaySE(CSD ~ "Materials/timer2.wav");
wait(60);
}
yield;
}
}
}
task timecheck is the bit that just won't work properly. Its only purpose is to play sound effects when the timer runs down from 10. The rest of the script is actual danmaku.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on December 23, 2009, 06:02:15 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;

}

@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);

}

task timecheck{
loop{
if(GetTimer <= 10 && GetTimer > 3){
PlaySE(CSD ~ "Materials/timer1.wav");
wait(60);
}
if(GetTimer <= 3){
PlaySE(CSD ~ "Materials/timer2.wav");
wait(60);
}
yield;
}
}
}
task timecheck is the bit that just won't work properly. Its only purpose is to play sound effects when the timer runs down from 10. The rest of the script is actual danmaku.

...I don't even see it being called
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Gc on December 23, 2009, 06:19:20 AM
Code: [Select]
#UserShotData

ShotImage = ".\shot.png"

// Laser bases
ShotData {id = 1  rect = (0,0,16,16)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 2  rect = (16,0,32,16)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 3  rect = (32,0,48,16)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 4  rect = (48,0,64,16)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 5  rect = (64,0,80,16)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 6  rect = (80,0,96,16)  render = ALPHA  delay_color = (191,255,127)}

ShotData {id = 7  rect = (96,0,112,16)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 8  rect = (112,0,128,16)  render = ALPHA  delay_color = (255,191,127)}

ShotData {id = 9  rect = (128,0,144,16)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 10  rect = (144,0,160,16)  render = ALPHA  delay_color = (127,127,127)}

// 21
ShotData {id = 11  rect = (0,16,16,32)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 12  rect = (16,16,32,32)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 13  rect = (32,16,48,32)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 14  rect = (48,16,64,32)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 15  rect = (64,16,80,32)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 16  rect = (80,16,96,32)  render = ALPHA  delay_color = (191,255,127)}

ShotData {id = 17  rect = (96,16,112,32)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 18  rect = (112,16,128,32)  render = ALPHA  delay_color = (255,191,127)}

ShotData {id = 19  rect = (128,16,144,32)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 20  rect = (144,16,160,32)  render = ALPHA  delay_color = (127,127,127)}

// 04
ShotData {id = 21  rect = (0,32,16,48)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 22  rect = (16,32,32,48)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 23  rect = (32,32,48,48)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 24  rect = (48,32,64,48)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 25  rect = (64,32,80,48)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 26  rect = (80,32,96,48)  render = ALPHA  delay_color = (191,255,127)}

ShotData {id = 27  rect = (96,32,112,48)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 28  rect = (112,32,128,48)  render = ALPHA  delay_color = (255,191,127)}

ShotData {id = 29  rect = (128,32,144,48)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 30  rect = (144,32,160,48)  render = ALPHA  delay_color = (127,127,127)}

// 01
ShotData {id = 31  rect = (0,48,16,64)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 32  rect = (16,48,32,64)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 33  rect = (32,48,48,64)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 34  rect = (48,48,64,64)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 35  rect = (64,48,80,64)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 36  rect = (80,48,96,64)  render = ALPHA  delay_color = (191,255,127)}

ShotData {id = 37  rect = (96,48,112,64)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 38  rect = (112,48,128,64)  render = ALPHA  delay_color = (255,191,127)}

ShotData {id = 39  rect = (128,48,144,64)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 40  rect = (144,48,160,64)  render = ALPHA  delay_color = (127,127,127)}

// 12
ShotData {id = 41  rect = (3,64,13,80)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 42  rect = (19,64,29,80)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 43  rect = (35,64,45,80)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 44  rect = (51,64,61,80)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 45  rect = (67,64,77,80)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 46  rect = (83,64,93,80)  render = ALPHA  delay_color = (191,255,127)}

ShotData {id = 47  rect = (99,64,109,80)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 48  rect = (115,64,125,80)  render = ALPHA  delay_color = (255,191,127)}

ShotData {id = 49  rect = (131,64,141,80)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 50  rect = (147,64,157,80)  render = ALPHA  delay_color = (127,127,127)}

// 31
ShotData {id = 51  rect = (3,80,13,96)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 52  rect = (19,80,29,96)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 53  rect = (35,80,45,96)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 54  rect = (51,80,61,96)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 55  rect = (67,80,77,96)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 56  rect = (83,80,93,96)  render = ALPHA  delay_color = (191,255,127)}

ShotData {id = 57  rect = (99,80,109,96)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 58  rect = (115,80,125,96)  render = ALPHA  delay_color = (255,191,127)}

ShotData {id = 59  rect = (131,80,141,96)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 60  rect = (147,80,157,96)  render = ALPHA  delay_color = (127,127,127)}

// 23
ShotData {id = 61  rect = (3,96,13,112)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 62  rect = (19,96,29,112)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 63  rect = (35,96,45,112)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 64  rect = (51,96,61,112)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 65  rect = (67,96,77,112)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 66  rect = (83,96,93,112)  render = ALPHA  delay_color = (191,255,127)}

ShotData {id = 67  rect = (99,96,109,112)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 68  rect = (115,96,125,112)  render = ALPHA  delay_color = (255,191,127)}

ShotData {id = 69  rect = (131,96,141,112)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 70  rect = (147,96,157,112)  render = ALPHA  delay_color = (127,127,127)}

// Amulets
ShotData {id = 71  rect = (1,112,15,128)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 72  rect = (17,112,31,128)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 73  rect = (33,112,47,128)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 74  rect = (49,112,63,128)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 75  rect = (65,112,79,128)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 76  rect = (81,112,95,128)  render = ALPHA  delay_color = (191,255,127)}

ShotData {id = 77  rect = (97,112,111,128)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 78  rect = (113,112,127,128)  render = ALPHA  delay_color = (255,191,127)}

ShotData {id = 79  rect = (129,112,143,128)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 80  rect = (145,112,159,128)  render = ALPHA  delay_color = (127,127,127)}

// Suppositories
ShotData {id = 81  rect = (3,128,13,144)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 82  rect = (19,128,29,144)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 83  rect = (35,128,45,144)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 84  rect = (51,128,61,144)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 85  rect = (67,128,77,144)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 86  rect = (83,128,93,144)  render = ALPHA  delay_color = (191,255,127)}

ShotData {id = 87  rect = (99,128,109,144)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 88  rect = (115,128,125,144)  render = ALPHA  delay_color = (255,191,127)}

ShotData {id = 89  rect = (131,128,141,144)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 90  rect = (147,128,157,144)  render = ALPHA  delay_color = (127,127,127)}

// 12i
ShotData {id = 91  rect = (3,144,13,160)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 92  rect = (19,144,29,160)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 93  rect = (35,144,45,160)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 94  rect = (51,144,61,160)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 95  rect = (67,144,77,160)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 96  rect = (83,144,93,160)  render = ALPHA  delay_color = (191,255,127)}

ShotData {id = 97  rect = (99,144,109,160)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 98  rect = (115,144,125,160)  render = ALPHA  delay_color = (255,191,127)}

ShotData {id = 99  rect = (131,144,141,160)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 100  rect = (147,144,157,160)  render = ALPHA  delay_color = (127,127,127)}

// Marisa's small stars
ShotData {id = 101  rect = (0,160,16,176)  render = ALPHA  delay_color = (255,127,127)  angular_velocity = 2}

ShotData {id = 102  rect = (16,160,32,176)  render = ALPHA  delay_color = (127,127,255)  angular_velocity = 2}

ShotData {id = 103  rect = (32,160,48,176)  render = ALPHA  delay_color = (255,127,255)  angular_velocity = 2}

ShotData {id = 104  rect = (48,160,64,176)  render = ALPHA  delay_color = (127,255,255)  angular_velocity = 2}

ShotData {id = 105  rect = (64,160,80,176)  render = ALPHA  delay_color = (127,255,127)  angular_velocity = 2}

ShotData {id = 106  rect = (80,160,96,176)  render = ALPHA  delay_color = (191,255,127)  angular_velocity = 2}

ShotData {id = 107  rect = (96,160,112,176)  render = ALPHA  delay_color = (255,255,127)  angular_velocity = 2}

ShotData {id = 108  rect = (112,160,128,176)  render = ALPHA  delay_color = (255,191,127)  angular_velocity = 2}

ShotData {id = 109  rect = (128,160,144,176)  render = ALPHA  delay_color = (255,255,255)  angular_velocity = 2}

ShotData {id = 110  rect = (144,160,160,176)  render = ALPHA  delay_color = (127,127,127)  angular_velocity = 2}

// MURASA's dorplets
ShotData {id = 111  rect = (3,176,13,192)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 112  rect = (19,176,29,192)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 113  rect = (35,176,45,192)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 114  rect = (51,176,61,192)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 115  rect = (67,176,77,192)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 116  rect = (83,176,93,192)  render = ALPHA  delay_color = (191,255,127)}

ShotData {id = 117  rect = (99,176,109,192)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 118  rect = (115,176,125,192)  render = ALPHA  delay_color = (255,191,127)}

ShotData {id = 119  rect = (131,176,141,192)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 120  rect = (147,176,157,192)  render = ALPHA  delay_color = (127,127,127)}

// MoF dots
ShotData {id = 121  rect = (0,192,8,200)  render = ALPHA  delay_color = (255,127,127)  angular_velocity = 2}

ShotData {id = 122  rect = (16,192,24,200)  render = ALPHA  delay_color = (127,127,255)  angular_velocity = 2}

ShotData {id = 123  rect = (32,192,40,200)  render = ALPHA  delay_color = (255,127,255)  angular_velocity = 2}

ShotData {id = 124  rect = (48,192,56,200)  render = ALPHA  delay_color = (127,255,255)  angular_velocity = 2}

ShotData {id = 125  rect = (64,192,72,200)  render = ALPHA  delay_color = (127,255,127)  angular_velocity = 2}

ShotData {id = 126  rect = (80,192,88,200)  render = ALPHA  delay_color = (191,255,127)  angular_velocity = 2}

ShotData {id = 127  rect = (96,192,104,200)  render = ALPHA  delay_color = (255,255,127)  angular_velocity = 2}

ShotData {id = 128  rect = (112,192,120,200)  render = ALPHA  delay_color = (255,191,127)  angular_velocity = 2}

ShotData {id = 129  rect = (128,192,136,200)  render = ALPHA  delay_color = (255,255,255)  angular_velocity = 2}

ShotData {id = 130  rect = (144,192,152,200)  render = ALPHA  delay_color = (127,127,127)  angular_velocity = 2}

// 05
ShotData {id = 131  rect = (8,192,16,200)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 132  rect = (24,192,32,200)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 133  rect = (40,192,48,200)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 134  rect = (56,192,64,200)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 135  rect = (72,192,80,200)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 136  rect = (88,192,96,200)  render = ALPHA  delay_color = (191,255,127)}

ShotData {id = 137  rect = (104,192,112,200)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 138  rect = (120,192,128,200)  render = ALPHA  delay_color = (255,191,127)}

ShotData {id = 139  rect = (136,192,144,200)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 140  rect = (152,192,160,200)  render = ALPHA  delay_color = (127,127,127)}

// Sinuate laser bases (UFO)
ShotData {id = 141  rect = (352,256,368,512)  render = ADD  delay_color = (255,127,127)}

ShotData {id = 142  rect = (368,256,384,512)  render = ADD  delay_color = (127,127,255)}

ShotData {id = 143  rect = (384,256,400,512)  render = ADD  delay_color = (255,127,255)}

ShotData {id = 144  rect = (400,256,416,512)  render = ADD  delay_color = (127,255,255)}

ShotData {id = 145  rect = (416,256,432,512)  render = ADD  delay_color = (127,255,127)}

ShotData {id = 146  rect = (432,256,448,512)  render = ADD  delay_color = (191,255,127)}

ShotData {id = 147  rect = (448,256,464,512)  render = ADD  delay_color = (255,255,127)}

ShotData {id = 148  rect = (464,256,480,512)  render = ADD  delay_color = (255,191,127)}

ShotData {id = 149  rect = (480,256,496,512)  render = ADD  delay_color = (255,255,255)}

ShotData {id = 150  rect = (496,256,512,512)  render = ADD  delay_color = (127,127,127)}

/*------------------------*\
| Medium and large bullets |
\*------------------------*/

// Koishi's penormaku
ShotData {id = 151  rect = (0,256,32,288)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 152  rect = (32,256,64,288)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 153  rect = (64,256,96,288)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 154  rect = (96,256,128,288)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 155  rect = (128,256,160,288)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 156  rect = (160,256,192,288)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 157  rect = (192,256,224,288)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 158  rect = (224,256,256,288)  render = ALPHA  delay_color = (127,127,127)}

// Marisa's large stars
ShotData {id = 159  rect = (256,0,288,32)  render = ALPHA  delay_color = (255,127,127)  angular_velocity = 2}

ShotData {id = 160  rect = (288,0,320,32)  render = ALPHA  delay_color = (255,127,255)  angular_velocity = 2}

ShotData {id = 161  rect = (320,0,352,32)  render = ALPHA  delay_color = (127,127,255)  angular_velocity = 2}

ShotData {id = 162  rect = (352,0,384,32)  render = ALPHA  delay_color = (127,255,255)  angular_velocity = 2}

ShotData {id = 163  rect = (384,0,416,32)  render = ALPHA  delay_color = (127,255,127)  angular_velocity = 2}

ShotData {id = 164  rect = (416,0,448,32)  render = ALPHA  delay_color = (255,255,127)  angular_velocity = 2}

ShotData {id = 165  rect = (448,0,480,32)  render = ALPHA  delay_color = (255,255,255)  angular_velocity = 2}

ShotData {id = 166  rect = (480,0,512,32)  render = ALPHA  delay_color = (127,127,127)  angular_velocity = 2}

// 02
ShotData {id = 167  rect = (256,32,288,64)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 168  rect = (288,32,320,64)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 169  rect = (320,32,352,64)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 170  rect = (352,32,384,64)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 171  rect = (384,32,416,64)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 172  rect = (416,32,448,64)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 173  rect = (448,32,480,64)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 174  rect = (480,32,512,64)  render = ALPHA  delay_color = (127,127,127)}

// Yuyuko's butterflies
ShotData {id = 175  rect = (256,64,288,96)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 176  rect = (288,64,320,96)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 177  rect = (320,64,352,96)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 178  rect = (352,64,384,96)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 179  rect = (384,64,416,96)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 180  rect = (416,64,448,96)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 181  rect = (448,64,480,96)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 182  rect = (480,64,512,96)  render = ALPHA  delay_color = (127,127,127)}

// Sakuya's knives
ShotData {id = 183  rect = (256,96,288,128)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 184  rect = (288,96,320,128)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 185  rect = (320,96,352,128)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 186  rect = (352,96,384,128)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 187  rect = (384,96,416,128)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 188  rect = (416,96,448,128)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 189  rect = (448,96,480,128)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 190  rect = (480,96,512,128)  render = ALPHA  delay_color = (127,127,127)}

// Oval bullets
ShotData {id = 191  rect = (264,128,280,160)  render = ALPHA  delay_color = (255,127,127)}

ShotData {id = 192  rect = (296,128,312,160)  render = ALPHA  delay_color = (255,127,255)}

ShotData {id = 193  rect = (328,128,346,160)  render = ALPHA  delay_color = (127,127,255)}

ShotData {id = 194  rect = (360,128,376,160)  render = ALPHA  delay_color = (127,255,255)}

ShotData {id = 195  rect = (392,128,408,160)  render = ALPHA  delay_color = (127,255,127)}

ShotData {id = 196  rect = (424,128,440,160)  render = ALPHA  delay_color = (255,255,127)}

ShotData {id = 197  rect = (456,128,472,160)  render = ALPHA  delay_color = (255,255,255)}

ShotData {id = 198  rect = (488,128,504,160)  render = ALPHA  delay_color = (127,127,127) }

// Flashes
ShotData {id = 199  rect = (256,160,288,192)  render = ADD  delay_color = (255,127,127)  angular_velocity = 20}

ShotData {id = 200  rect = (288,160,320,199)  render = ADD  delay_color = (255,127,255)  angular_velocity = 20}

ShotData {id = 201  rect = (320,160,352,192)  render = ADD  delay_color = (127,127,255)  angular_velocity = 20}

ShotData {id = 202  rect = (352,160,384,192)  render = ADD  delay_color = (127,255,255)  angular_velocity = 20}

ShotData {id = 203  rect = (384,160,416,192)  render = ADD  delay_color = (127,255,127)  angular_velocity = 20}

ShotData {id = 204  rect = (416,160,448,192)  render = ADD  delay_color = (255,255,127)  angular_velocity = 20}

ShotData {id = 205  rect = (448,160,480,192)  render = ADD  delay_color = (255,255,255)  angular_velocity = 20}

ShotData {id = 206  rect = (480,160,512,192)  render = ADD  delay_color = (127,127,127)  angular_velocity = 20}

// 03
ShotData {id = 207  rect = (256,192,320,256)  render = ADD  delay_color = (255,127,127)  angular_velocity = 20}

ShotData {id = 208  rect = (320,192,384,256)  render = ADD  delay_color = (127,127,255)  angular_velocity = 20}

ShotData {id = 209  rect = (384,192,448,256)  render = ADD  delay_color = (127,255,127)  angular_velocity = 20}

ShotData {id = 210  rect = (448,192,512,256)  render = ADD  delay_color = (255,255,127)  angular_velocity = 20}

/*-----------------*\
| Animating bullets |
\*------------------/

ShotData {
id = 211
render = ADD
delay_color = (255,127,127)
AnimationData {
animation_data = (4,256,256,288,288)
animation_data = (4,256,288,288,320)
animation_data = (4,256,320,288,352)
animation_data = (4,256,352,288,384)
}
}

ShotData {
id = 212
render = ADD
delay_color = (127,127,255)
AnimationData {
animation_data = (4,288,256,320,288)
animation_data = (4,288,288,320,320)
animation_data = (4,288,320,320,352)
animation_data = (4,288,352,320,384)
}
}

ShotData {
id = 213
render = ADD
delay_color = (255,127,255)
AnimationData {
animation_data = (4,320,256,352,288)
animation_data = (4,320,288,352,320)
animation_data = (4,320,320,352,352)
animation_data = (4,320,352,352,384)
}
}

ShotData {
id = 214
render = ADD
delay_color = (127,255,255)
AnimationData {
animation_data = (4,256,384,288,416)
animation_data = (4,256,416,288,48)
animation_data = (4,256,448,288,480)
animation_data = (4,256,480,288,512)
}
}

ShotData {
id = 215
render = ADD
delay_color = (255,255,127)
AnimationData {
animation_data = (4,288,384,320,416)
animation_data = (4,288,416,320,448)
animation_data = (4,288,448,320,480)
animation_data = (4,288,480,320,512)
}
}

ShotData {
id = 216
render = ADD
delay_color = (127,255,127)
AnimationData {
animation_data = (4,320,384,352,416)
animation_data = (4,320,416,352,448)
animation_data = (4,320,448,352,480)
animation_data = (4,320,480,352,512)
}
}

Gives me :

(http://dl.dropbox.com/u/3185156/Danmakufu%20errors/shoterror1.png)
Problem has been magically solved by doing I-don't-know-what in the shot data
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Thaws on December 23, 2009, 07:35:21 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;

}

@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);

}

task timecheck{
loop{
if(GetTimer <= 10 && GetTimer > 3){
PlaySE(CSD ~ "Materials/timer1.wav");
wait(60);
}
if(GetTimer <= 3){
PlaySE(CSD ~ "Materials/timer2.wav");
wait(60);
}
yield;
}
}
}
task timecheck is the bit that just won't work properly. Its only purpose is to play sound effects when the timer runs down from 10. The rest of the script is actual danmaku.

You didn't put a yield; in the @MainLoop.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: DgBarca on December 23, 2009, 11:47:46 AM
How to do CreateLaserC with Obj_Laser ? I have tried ObjSinuateLaser and AHGAHGAHGAHGAHGAHGAHGAGAHAG
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Infy♫ on December 23, 2009, 12:08:00 PM
what is the danmakufu archiver, where can i get it?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on December 23, 2009, 12:09:37 PM
How to do CreateLaserC with Obj_Laser ? I have tried ObjSinuateLaser and AHGAHGAHGAHGAHGAHGAHGAGAHAG
Create an object bullet that creates another object bullet of the same bullet graphic and the same angle but without movement speed on top of itself every frame which fade out after a certain amount of time. Should be a close enough simulation, depending on what kinds of bullets you use. If none of the bullets have the right dimensions for what you are planning to do, let everything be object lasers instead so that you can define them yourself.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on December 23, 2009, 01:15:58 PM
How to do CreateLaserC with Obj_Laser ? I have tried ObjSinuateLaser and AHGAHGAHGAHGAHGAHGAHGAGAHAG

Code: [Select]
task SomeSortOfCurvyLaser {
    let obj = Obj_Create(OBJ_SINUATE_LASER);
    Obj_SetPosition(obj, GetX, GetY);
    Obj_SetAngle(obj, 0);
    Obj_SetSpeed(obj, 3);
    ObjShot_SetGraphic(obj, RED02);
    ObjSinuateLaser_SetWidth(obj, 16);
    ObjSinuateLaser_SetLength(obj, 200);
    loop(60){
        Obj_SetAngle(obj, Obj_GetAngle(obj)+2);
    }
}

Yay, curvy laser! Of course you can achieve this effect with just LaserC, but I'm assuming you wanted a more complex behavior so edit this to hell.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on December 23, 2009, 03:12:13 PM
what is the danmakufu archiver, where can i get it?

Right here (http://www.geocities.co.jp/SiliconValley-Oakland/9951/products/th_dnh_archiver.zip), found here (http://www.geocities.co.jp/SiliconValley-Oakland/9951/products/th_dnh.html).
It looks like a file compresser that can put all your scripts, images, sound effects into a single DAT file similar to the one you find in the Touhou Games.




Here's my question, how do I properly use it? Once I compress the stuff, should I just treat the parameters for the files in the DAT archive like a folder, and put the pathway as GetCurrentScriptDirectory~"datfile/mystuff.wav.png"; , or what?

Oh, and how do I uncompress it?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: FurryYunSeong on December 23, 2009, 03:25:20 PM
I personally use .dnh because it looks nice and it prevents Danmakufu from loading those scripts.  I don't know if that's the case with others.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on December 23, 2009, 03:48:57 PM
Alright, new question. I'd like to know where to get this archiver, and if I can compress my scripts and everything within the folder into a single DAT file similar to the ones you find in Touhou games, with the music, sound effects, scripts, everything.
Is there a tool I could use to do it?
Yes. (http://www.geocities.co.jp/SiliconValley-Oakland/9951/products/th_dnh.html)

東方弾幕風用アーカイバ v0.01c(約50kB)

Make sure you use GetCurrentScriptDirectory~ and .\ to reference all your files, the archiver randomly chooses a new base folder for no apparent reason, so absolute pathnames will brake.
what is the danmakufu archiver, where can i get it?
Right here (http://www.geocities.co.jp/SiliconValley-Oakland/9951/products/th_dnh_archiver.zip), found here (http://www.geocities.co.jp/SiliconValley-Oakland/9951/products/th_dnh.html).
It looks like a file compresser that can put all your scripts, images, sound effects into a single DAT file similar to the one you find in the Touhou Games.

FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUU


Here's my question, how do I properly use it? Once I compress the stuff, should I just treat the parameters for the files in the DAT archive like a folder, and put the pathway as GetCurrentScriptDirectory~"datfile/mystuff.wav.png"; , or what?

Compress everything, Danmakufu will read it all as if it was uncompressed. Don't reference things from outside the .dat file (I haven't messed with it personally, but it sounds like a bad idea. Though, the defaults like seSuperNaturalBorder2.wav or whatever should be fine). Again, just make sure you use GetCurrentScriptDirectory and .\ instead of absolute pathnames.


Oh, and how do I uncompress it?

You can't!


I personally use .dnh because it looks nice and it prevents Danmakufu from loading those scripts.

wat
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on December 23, 2009, 04:55:43 PM
Compress everything, Danmakufu will read it all as if it was uncompressed. Don't reference things from outside the .dat file (I haven't messed with it personally, but it sounds like a bad idea. Though, the defaults like seSuperNaturalBorder2.wav or whatever should be fine). Again, just make sure you use GetCurrentScriptDirectory and .\ instead of absolute pathnames.

Oh, I get it. So what, I compress everything within that folder, scripts and all?  Wow, I didn't know danmakufu could recognize files within the dat file like that without me having to point that out... thanks.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on December 24, 2009, 02:45:46 AM
...I don't even see it being called

For good reason; I tried sticking it everywhere I could think of and it would never work right.

Oh, and the slashes in the filename are backwards.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on December 24, 2009, 03:24:40 AM
Actually, now that I think of it, Onthenet used a similar method in his Chen boss, let me rummage through my Danmakufu files, and.....if you don't mind Onthenet, he does this:

This is the timer code, he uses it as a sub, but a function works as well (I think):
Code: [Select]
sub timer
{
if (timerframe == 0)
{
if (GetTimer > 4 && GetTimer <= 10)
{PlaySE(timeo1);}
if (GetTimer <= 4)
{PlaySE(timeo2);}
timerframe = -60;
}
timerframe++;

and he calls it in his MainLoop.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on December 24, 2009, 04:03:24 AM
Actually, now that I think of it, Onthenet used a similar method in his Chen boss, let me rummage through my Danmakufu files, and.....if you don't mind Onthenet, he does this:

This is the timer code, he uses it as a sub, but a function works as well (I think):
Code: [Select]
sub timer
{
if (timerframe == 0)
{
if (GetTimer > 4 && GetTimer <= 10)
{PlaySE(timeo1);}
if (GetTimer <= 4)
{PlaySE(timeo2);}
timerframe = -60;
}
timerframe++;

and he calls it in his MainLoop.

Sub? What?
Title: So, I just started scripting in Danmakufu...
Post by: Kitsumi on December 24, 2009, 05:49:06 PM
After reading Blargel's beginner tutorial and watching a few videos, I still have a few unanswered questions.

1. Can I make multiple spellcards in one file?
2. Do ALL pictures in Danmakufu need to be png/bmp? (I know I can just save them as png in Photoshop, but still just wondering.)
3. Is there a specific library for all the bullets I can use? (I looked in DMKFU wiki, but I recall more bullet types. ;_;)

Sorry for the stupid questions, I've just started to get into programming (ie. Java [DON'T JUDGE ME]).
This is my first spellcard (still working on it), so it isn't very good.
http://www.shrinemaiden.org/forum/index.php?topic=30.msg202#msg202

Thanks for the help!
Title: Re: So, I just started scripting in Danmakufu...
Post by: Helepolis on December 24, 2009, 06:07:07 PM
After reading Blargel's beginner tutorial and watching a few videos, I still have a few unanswered questions.

1. Can I make multiple spellcards in one file?
2. Do ALL pictures in Danmakufu need to be png/bmp? (I know I can just save them as png in Photoshop, but still just wondering.)
3. Is there a specific library for all the bullets I can use? (I looked in DMKFU wiki, but I recall more bullet types. ;_;)

Sorry for the stupid questions, I've just started to get into programming (ie. Java [DON'T JUDGE ME]).
This is my first spellcard (still working on it), so it isn't very good.
http://www.shrinemaiden.org/forum/index.php?topic=30.msg202#msg202

Thanks for the help!

Greetings Kitsumi, before people blast you with master sparks or fantasy seal. Let me warn you that posting such questions fit in our Q&A thread (http://www.shrinemaiden.org/forum/index.php?topic=3218.0) where generally help is offered for such questions.

To answer your questions before this thread gets perhaps locked:

1) Technically yes but it is not advised and looks weird. You need to use 'plural' scripts which is explained in the tutorials ( look for it )
2) My memory slips here but I would stick to PNG and not BPM as PNG is smaller filesize. And I think JPG is ignored by dnh ( could be wrong )
3) The ones on danmakufu wiki are the standard Danmakufu build in bullets which are ugly. If you would do some searching around you can find alot of larger 'user shotscripts' like the Concealed the Conclusion bullets, Hollow world god, Puremrz shotsheet, Expanded shotdata and perhaps even more. They offer various beautiful bullets for your pleasure.

Please post in Q&A thread next time =|
Title: Re: So, I just started scripting in Danmakufu...
Post by: Kitsumi on December 24, 2009, 06:11:01 PM
Whoops, sorry...I swear, I was just in that thread too.  :V
Hopefully mods will delete it soon. Thanks for your quick response.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kilgamayan on December 24, 2009, 06:23:54 PM
Merged into the Q&A thread. I don't want to delete things, others might have your same questions.
Title: Re: So, I just started scripting in Danmakufu...
Post by: Blargel on December 24, 2009, 09:35:25 PM
2. Do ALL pictures in Danmakufu need to be png/bmp? (I know I can just save them as png in Photoshop, but still just wondering.)
2) My memory slips here but I would stick to PNG and not BPM as PNG is smaller filesize. And I think JPG is ignored by dnh ( could be wrong )

As far as I remember, Danmakufu takes most common image types including JPGs and GIFs. PNGs are preferred, however, as they aren't prone to artifacting and support semi-transparency. BMPs are a big no-no as they are huge in file size and create large downloads if you want to share the script. Although JPGs tend to have artifacts, they could be used if you don't need transparency and the quality of the texture doesn't matter for the purpose you are using it for. I haven't tried GIFs in Danmakufu, but judging from how it treats the other formats, I'd assume that you could use them instead of PNGs if you don't need partial transparency.

In short, PNGs are superior. Just use them.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on December 24, 2009, 10:33:38 PM
Sub? What?

A sub is just a function you can call from another script, Taking out the sub and making it a function would work fine as well.  Such as the Shot_Replace,
#include_function"lib\SHOT_REPLACE\shot_replace.txt"
(I think thats it, im posting on a computer without Danmakufu and I fail to remember the actual code)

and shotinit; <-- This is a sub within shot_replace.txt that says to LoadUserShotData.

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on December 25, 2009, 12:19:33 AM
Actually, a "sub", short for subroutine, is nothing but a function that doesn't have any parameters. Putting
sub Stuff{
             do stuff;
             do more stuff;
             do even more stuff;
}

somewhere in your script lets you type Stuff; to do all the stuff specified before, Stuff being your subroutine here.

That is just terminology, however. You can include code stored in another file using the #include_function command just fine, it just isn't called a "sub".  :V

Sorry for nitpicking, but if we don't keep the terminology clear, confusion will arise sooner or later.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kitsumi on December 25, 2009, 01:02:08 AM
Merged into the Q&A thread. I don't want to delete things, others might have your same questions.

Thanks.  :V

As far as I remember, Danmakufu takes most common image types including JPGs and GIFs. PNGs are preferred, however, as they aren't prone to artifacting and support semi-transparency. BMPs are a big no-no as they are huge in file size and create large downloads if you want to share the script. Although JPGs tend to have artifacts, they could be used if you don't need transparency and the quality of the texture doesn't matter for the purpose you are using it for. I haven't tried GIFs in Danmakufu, but judging from how it treats the other formats, I'd assume that you could use them instead of PNGs if you don't need partial transparency.

In short, PNGs are superior. Just use them.

So PNGs are top-tier, got it.
I was planning on making my own boss image, but I need to get scripts and everything done first. I also started making plurals (maybe familiars soon), so I'm well on my way.  :V (but not really...)

Btw, CreateLaserA acts really weird(spawning all over the place and rotating like crazy)...Is it really much better to use than CreateLaser01?


Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on December 25, 2009, 01:08:58 AM
Btw, CreateLaserA acts really weird(spawning all over the place and rotating like crazy)...Is it really much better to use than CreateLaser01?
With CreateLaser01 everything is predetermined, fire here, at this width/length, etc.

With CreateLaserAs you can Make them shrink,grow,move,rotate, Fire more bullets, etc...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on December 25, 2009, 08:34:00 AM
Btw, CreateLaserA acts really weird(spawning all over the place and rotating like crazy)...Is it really much better to use than CreateLaser01?

You probably messed up your parameters for SetLaserDataA. Make sure you know what parameter does what. From the wiki:

7 Parameters
    1) ID
    2) time to modify the motion
    3) angle
    4) angular velocity
    5) variation of the laser length
    6) magnitude of velocity
    7) direction of velocity
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: KrackoCloud on December 25, 2009, 07:59:19 PM
Could someone explain object intersections?
Well, that is, assuming that I already have the right idea for it.
Like, what would I do if I wanted to have a bullet change colors when it passes a laser, for instance?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on December 25, 2009, 08:11:14 PM
Could someone explain object intersections?
Well, that is, assuming that I already have the right idea for it.
Like, what would I do if I wanted to have a bullet change colors when it passes a laser, for instance?

You need to make arrays of all your objects, and test if they are colliding every frame. Once they are colliding, use a counter to make sure that the next frame the action isn't performed again (for example, if you were reflecting bullets, sometimes the bullet will collide two frames in a row, and screw up the reflection).

Something like this, where you put every object bullet or laser inside an array (array = array ~ [obj]; )...



Obj_SetCollisionToObject(obj, true);

while(!Obj_BeDeleted(obj)){

   ascent(j in 0..(length(array) - 1)){
      if(Collision_Obj_Obj(obj, array[j])==true && counter==0){
         ObjShot_SetGraphic(obj, RED02);
         counter++;
      }
   }

yield;
}

It's a big pain in the ass if you're new to arrays/object bullets.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on December 26, 2009, 01:57:58 AM
How do I cut the last place off of an array? For example, to turn [0, 1, 2, 3] into [0, 1, 2]?

I have tried using the respective command from the wiki
   erase(array, length(array)-1);
but when I tell danmakufu to give me the length of the array afterwards, it says that it didn't actually decrease.


Is danmakufu being a jerk or am I just an idiot?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on December 26, 2009, 02:01:32 AM
How do I cut the last place off of an array? For example, to turn [0, 1, 2, 3] into [0, 1, 2]?

I use array = erase(array, length(array)-1);

erase(array, index); just gives you the array with the indexed place removed. I don't actually think it edits the array, it just returns what it would be if you removed that place.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on December 26, 2009, 03:42:40 AM
Ok, when experimenting with players, I stumbled upon a problem,My bomb wont show up, http://pastebin.com/m7013265a (http://pastebin.com/m7013265a) This is the player code, The bomb doesnt want to show up.... help!
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on December 26, 2009, 02:04:17 PM
Ok, when experimenting with players, I stumbled upon a problem,My bomb wont show up, http://pastebin.com/m7013265a (http://pastebin.com/m7013265a) This is the player code, The bomb doesnt want to show up.... help!

Code: [Select]
                ObjEffect_SetVertexXY(obj,0,GetPlayerX-40,GetPlayerY+40);
                ObjEffect_SetVertexXY(obj,1,GetPlayerX+40,GetPlayerY+40);
                ObjEffect_SetVertexXY(obj,2,GetPlayerX-40,GetPlayerY-40);
                ObjEffect_SetVertexXY(obj,3,GetPlayerX+40,GetPlayerY-40);
 
                ObjEffect_SetVertexUV(obj,0,0,0);
                ObjEffect_SetVertexUV(obj,1,0,256);
                ObjEffect_SetVertexUV(obj,2,256,256);
                ObjEffect_SetVertexUV(obj,3,256,0);

                ObjSpell_SetIntersecrionLine(obj,GetPlayerX+40,GetCenterY+40,GetPlayerX-40,GetPlayerY-40,200,0,true);}

This should be in while(Obj_BeDeleted(obj)==false) { } brackets. With a yield;, of course.



Also, muchas gracias Naut. The wiki truly is a mess.  :V
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on December 27, 2009, 12:30:03 AM
Also, muchas gracias Naut. The wiki truly is a mess.  :V

'Tis why we're building another, good sir :V
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on December 27, 2009, 09:10:43 PM
hurp derp I fail at event script

Code: [Select]
script_event name{

  let reimu = GetCurrentScriptDirectory ~ "img\cutins\reimu.png";
  let chen2 = GetCurrentScriptDirectory ~ "img\cutins\chen.png";

@Initialize{
  LoadGraphic(reimu);
  LoadGraphic(chen2);
 }

@MainLoop{
 SetChar(LEFT, reimu);                  //Set the player's character on the left side, with the graphic you've told it to display.
 SetGraphicRect(LEFT, 0, 0, 500, 590);           //The region you're displaying of the graphic for the player character, just like SetGraphicRect.
 MoveChar(LEFT, BACK);                             //Move the player's character into the background, to show she is not speaking.
 SetChar(RIGHT, chen2);                //Set the boss' picture on the right side of the screen.
 SetGraphicRect(RIGHT, 0, 0, 125, 512);           //Set the boundry of the picture you want displayed.
 MoveChar(RIGHT, FRONT);                          //Move the boss' image to the front to show that she is speaking.
 TextOutA("The text you want the character to speak goes here");           //Self explanatory. Danmakufu will not pass this function until a certain amount of time has passed, or the player clicks the shot button.
 MoveChar(RIGHT, BACK);                           //Move the boss to the background, then...
 MoveChar(LEFT, FRONT);                           //Move the player forward, to show that she will now speak.
 TextOutA("More words here");                     //What the player will be speaking.
 End;            //This ends the event.
 }

@Finalize{
 }

}

raymoo and Chen are both on the right ;_;

hurp derp derp nevermind
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on December 28, 2009, 12:28:05 AM
WUT how could they BOTH be on the right. :/
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on December 28, 2009, 12:42:51 AM
His image had a large blank spot on the left.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on December 29, 2009, 01:10:13 AM
I want my object to have a kind of life, similar to the SetLife function for enemy scripts, that when hits zero, disappears. I also want a collision circle similar to SetCollisionA and SetCollisionB, that dissappears a player's shot it you shoot at it.
Can anyone help me with this?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Nuclear Cheese on December 29, 2009, 01:20:44 AM
I want my object to have a kind of life, similar to the SetLife function for enemy scripts, that when hits zero, disappears. I also want a collision circle similar to SetCollisionA and SetCollisionB, that dissappears a player's shot it you shoot at it.
Can anyone help me with this?

Is there any reason you can't use a regular (not boss) enemy script for this?  That sounds like what you really want, honestly.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on December 29, 2009, 01:22:08 AM
Unless you want to do messy complicated collision detection between the player script and the enemy script via common data, I suggest making a familiar or enemy instead of an object for that. What specifically are you trying to accomplish with that kind of object anyway?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on December 29, 2009, 01:45:45 AM
I'll put it in a nutshell. The enemy isn't a boss enemy, it's a child enemy in the stage - many of them spawn at once.
The enemy spawns familiars (the objects), that move around and follow the child enemy. When the child enemy's life hits zero, the familiars dissappear with it.
It's easy enough with just what I have, but I don't know anything to make it have a collisioncircle for the familiars. I could make the actual familiars child enemies themselves and tried that, but when the child enemy that spawns them dies, they don't die and an error comes up. The error is because there are no coordinates for its familiars to follow, where as when they're object effects, they simply disappear with the boss (which is what I want).
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on December 29, 2009, 02:27:01 AM
I find this hilarious because I made an enemy that does that very thing last night.

Alright, I made all my familiars child enemies. At the beginning of the parent enemy, I declare a random number:

let r = rand(0, 100);

This will be the name of the random CommonData we will set. We're setting the name of the CommonData as a random number so that if you plan on spawning more than one of these enemies, they won't use the same coordinates.

In the @MainLoop of the main parent enemy, we'll be setting his coordinates into the CommonData. We'll use a small array so we don't have to set two different CommonDatas.

SetCommonData(ToString(r), [GetX, GetY]);

The name of CommonData has to be a string, so we'll just quickly convert it using ToString.

Now, when we go to spawn a child enemy, how will it know what CommonData to get? We'll use it's argument to pass along the value.

CreateEnemyFromScript("familiar", GetX, GetY, 0, 0, r);

Now the familiar script knows the name of the correct CommonData to get (and not some other enemy's). Getting it is simple, to get the X coordinate, just type:

GetCommonData(ToString(GetArgument))[ 0 ];

Our first element in the CommonData array is the x coordinate of the parent enemy, so we need to get that using [ 0 ]. The y coordinate would be exactly the same, except with [ 1 ], since we're getting the second element in the array. So you're position code would look something like:

SetX(GetCommonDataDefault(ToString(GetArgument), [-9999, -9999])[ 0 ] + 50*cos(angle));
SetY(GetCommonDataDefault(ToString(GetArgument), [-9999, -9999])[ 1 ] + 50*sin(angle));


This would make the familiars rotate around the parent enemy, 50 pixels away. Well, as long as you increase angle, and set it every @MainLoop. The reason why we use GetCommonDataDefault is so that when the parent enemy gets deleted (along with all the CommonData), the child familiars will be thrown off into oblivion instantly, killing them along with the main parent.

Here's the enemy script that I wrote up last night. Note that I'm already transferring a difficulty setting through my argument parameter, so I actually use the angle parameter to transfer the CommonData name.

Code: [Select]
script_enemy_main{

#include_function "script\script_enemy\enemymisc\EnemyControl.txt"
let r = rand(0, 100);
let a = rand(0, 360);

task Attack(Difficulty){
loop(10){yield;}
if(Difficulty==1){
loop(10){
CreateEnemyFromScript("swarm", GetX, GetY, 0, r, Difficulty);
loop(10){yield;}
}
}
if(Difficulty==2){
loop(15){
CreateEnemyFromScript("swarm", GetX, GetY, 0, r, Difficulty);
loop(7){yield;}
}
}
if(Difficulty==3){
loop(20){
CreateEnemyFromScript("swarm", GetX, GetY, 0, r, Difficulty);
loop(5){yield;}
}
}
if(Difficulty==4){
loop(20){
CreateEnemyFromScript("swarm", GetX, GetY, 0, r, Difficulty);
loop(5){yield;}
}
}
loop(150){yield;}
if(GetX<224){
SetMovePosition02(500, GetY, 240);
}
if(GetX>=224){
SetMovePosition02(-50, GetY, 240);
}
}


task Attack2(Difficulty){
if(Difficulty==1){
}
if(Difficulty==2){
loop(50){
CreateShotA(0, GetX + 50*cos(a) + rand(-5, 5), GetY + 50*sin(a) + rand(-5, 5), 10);
SetShotDataA(0, 0, 7, a + rand_int(-20, 20), 0, -0.5, 1.8, BLUE12);
FireShot(0);
CreateShotA(0, GetX + 50*cos(a + 2) + rand(-5, 5), GetY + 50*sin(a + 2) + rand(-5, 5), 10);
SetShotDataA(0, 0, 7, a + rand_int(-20, 20), 0, -0.5, 1.8, BLUE12);
FireShot(0);
a+=12;
loop(5){yield;}
}
}
if(Difficulty==3){
loop(70){
CreateShotA(0, GetX + 50*cos(a) + rand(-5, 5), GetY + 50*sin(a) + rand(-5, 5), 10);
SetShotDataA(0, 0, 7, a + rand_int(-20, 20), 0, -0.5, 2, BLUE12);
FireShot(0);
CreateShotA(0, GetX + 50*cos(a + 2) + rand(-5, 5), GetY + 50*sin(a + 2) + rand(-5, 5), 10);
SetShotDataA(0, 0, 7, a + rand_int(-20, 20), 0, -0.5, 2, BLUE12);
FireShot(0);
a+=10;
loop(4){yield;}
}
}
if(Difficulty==4){
loop(140){
CreateShotA(0, GetX + 50*cos(a) + rand(-5, 5), GetY + 50*sin(a) + rand(-5, 5), 10);
SetShotDataA(0, 0, 7, a + rand_int(-20, 20), 0, -0.5, 2.5, BLUE12);
FireShot(0);
CreateShotA(0, GetX + 50*cos(a + 2) + rand(-5, 5), GetY + 50*sin(a + 2) + rand(-5, 5), 10);
SetShotDataA(0, 0, 7, a + rand_int(-20, 20), 0, -0.5, 2.5, BLUE12);
FireShot(0);
a+=5;
loop(2){yield;}
}
}
}

@Initialize{
SetInvincibility(10);
SetMovePosition03(GetX, 150, 10, 3);
SetLife(130);
Attack(GetArgument);
Attack2(GetArgument);

}

@MainLoop{
DeathCheck;
SetCommonData(ToString(r), [GetX, GetY]); //Set coordinates for the familiar to get.
SetCollisionA(GetX, GetY, 16);
SetCollisionB(GetX, GetY, 4);
yield;
}

@DrawLoop{
DrawBigEnemy;
}

@Finalize{
DeadEnemy(GetX, GetY, 5, 0, 5, 50);  //x, y, points, power, IE, dispersion radius.
}
}

script_enemy swarm{

#include_function "script\script_enemy\enemymisc\EnemyControl.txt"
let a = rand(0, 360);
let radius = 0;
let xvar = rand(0, 90);
let yvar = rand(0, 90);
let maxrad = rand_int(50, 100);
let Difficulty = GetArgument;
let frames = rand_int(2, 30);
let gg = GetAngle;

task Attack{
if(Difficulty==1){
loop(frames){yield;}
loop{
let ran = rand(-90, 90);
CreateShot01(GetX, GetY, 2, GetAngleToPlayer + ran, RED12, 0);
CreateShot01(GetX, GetY, 2, GetAngleToPlayer + ran + 1, RED12, 0);
loop(80){yield;}
}
}
if(Difficulty==2){
loop(frames){yield;}
loop{
let ran = rand(-90, 90);
CreateShot01(GetX, GetY, 2, GetAngleToPlayer + ran, RED12, 0);
CreateShot01(GetX, GetY, 2, GetAngleToPlayer + ran + 1, RED12, 0);
loop(60){yield;}
}
}
if(Difficulty==3){
loop(frames){yield;}
loop{
let ran = rand(-90, 90);
CreateShot01(GetX, GetY, 2, GetAngleToPlayer + ran, RED12, 0);
CreateShot01(GetX, GetY, 2, GetAngleToPlayer + ran + 1, RED12, 0);
let ran = rand(-90, 90);
CreateShot01(GetX, GetY, 2, GetAngleToPlayer + ran, RED12, 0);
CreateShot01(GetX, GetY, 2, GetAngleToPlayer + ran + 1, RED12, 0);
loop(50){yield;}
}
}
if(Difficulty==4){
loop(frames){yield;}
loop{
let ran = rand(-90, 90);
CreateShot01(GetX, GetY, 2.2, GetAngleToPlayer + ran, RED12, 0);
CreateShot01(GetX, GetY, 2.2, GetAngleToPlayer + ran + 1, RED12, 0);
CreateShot01(GetX, GetY, 2.2, GetAngleToPlayer + ran - 1, RED12, 0);
let ran = rand(-90, 90);
CreateShot01(GetX, GetY, 2.2, GetAngleToPlayer + ran, RED12, 0);
CreateShot01(GetX, GetY, 2.2, GetAngleToPlayer + ran + 1, RED12, 0);
CreateShot01(GetX, GetY, 2.2, GetAngleToPlayer + ran - 1, RED12, 0);
loop(40){yield;}
}
}
}

@Initialize{
SetLife(10);
SetDamageRateEx(100, 100, 10, 10);
Attack;
}

@MainLoop{
SetCollisionA(GetX, GetY, 16);
SetCollisionB(GetX, GetY, 4);
DeathCheck;
SetX(GetCommonDataDefault(ToString(gg), [-2000, -2000])[0] + radius*cos(a + xvar));
SetY(GetCommonDataDefault(ToString(gg), [-2000, -2000])[1] + radius*sin(a + yvar));
if(radius<maxrad){
radius++;
}
a+=3;
yield;
}

@DrawLoop{
DrawSmallGreenEnemy;
}

@Finalize{
DeadEnemy(GetX, GetY, 1, 0, 0, 10);  //x, y, points, power, IE, dispersion radius.
}
}

God I hope I explained this clearly :<
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on December 29, 2009, 04:02:05 AM
If I want to draw 2 variables and 2 strings using DrawText, can I do it without using 4 DrawTexts ??? cause it makes danmakufu lag a lot...

I currently have this (I'm making the history thing for my game)

caprate=ToString(GetCommonData("GAME_ST1_CAP_B1E"));
seerate=ToString(GetCommonData("GAME_ST1_SEE_B1E"));

DrawText("history", GetClipMinX+10, GetClipMinY+100, 12, 255);
DrawText(caprate, GetClipMinX+60, GetClipMinY+100, 12, 255);
DrawText("/", GetClipMinX+135, GetClipMinY+100, 12, 255);
DrawText(seerate, GetClipMinX+145, GetClipMinY+100, 12, 255);

The coordinates are still a bit messy... I'll fix them later...

I've tried
DrawText("history" caprate "/" seerate, GetClipMinX+10, GetClipMinY+100, 12, 255);
but that just horribly failed...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on December 29, 2009, 04:04:41 AM
Ahh, you were close.

DrawText("History: " ~ caprate ~ "/" ~ seerate, GetClipMinX+10, GetClipMinY+100, 12, 255);

Use tilde to combine strings.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on December 29, 2009, 04:13:07 AM
Ahh, you were close.

DrawText("History: " ~ caprate ~ "/" ~ seerate, GetClipMinX+10, GetClipMinY+100, 12, 255);

Use tilde to combine strings.

Ohhh... thanks!!! ;D
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: KrackoCloud on December 29, 2009, 04:15:08 AM
You need to make arrays of all your objects, and test if they are colliding every frame. Once they are colliding, use a counter to make sure that the next frame the action isn't performed again (for example, if you were reflecting bullets, sometimes the bullet will collide two frames in a row, and screw up the reflection).

Something like this, where you put every object bullet or laser inside an array (array = array ~ [obj]; )...

*code*


Oh dear. You were right - This is pretty bad.
Alright, so here's a sample code.

Code: [Select]
#TouhouDanmakufu
#Title[Spell Template]
#Text[Description]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
///
#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
///
let sprite = "script\img\ExRumia.png";
let Cutin = "";

let fr1 = 0;
let fr2 = 0;

let ang = 0;

let array = [];

//////////
@Initialize{
shotinit;
        LoadGraphic(sprite);
        SetLife(5000);
        SetDamageRate(100, 100);
        SetTimer(50);
        SetInvincibility(30);
        CutIn(YOUMU, "X Sign "\""X"\", Cutin, 0, 0, 0, 0);
        SetScore(500000);
        SetEnemyMarker(true);
        Concentration01(60);
        MagicCircle(true);
        SetEffectForZeroLife(180, 100, 1);
SetMovePosition02(GetCenterX, GetCenterY - 100, 30);
}
//////////

@MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
fr1++;
fr2++;
if(fr1==30){
laser;
}
if(fr2==30){
shot;
fr2 = 0;
}
yield;
}
//////////
@DrawLoop{
SetColor(255,255,255);
SetRenderState(ALPHA);
SetTexture(sprite);
SetGraphicRect(64,1,127,64);
DrawGraphic(GetX,GetY);
}
@Finalize{
DeleteGraphic(sprite);
}
//////////

task shot{
let counter = 0;

let o1 = Obj_Create(OBJ_SHOT);

  Obj_SetPosition (o1, GetX, GetY);
  Obj_SetAngle (o1, GetAngleToPlayer);
  Obj_SetSpeed (o1, 1);
  ObjShot_SetGraphic (o1, RED01);
  ObjShot_SetDelay (o1, 5);

  ObjShot_SetBombResist (o1, false);
  Obj_SetCollisionToObject (o1, true);

while(!Obj_BeDeleted(o1) ){

ascent(j in 0..(length (array) -1) ){
if(Collision_Obj_Obj (o1, array[j])==true && counter==0){
ObjShot_SetGraphic(o1, BLUE01);
counter++;
}
}

yield;
}

array = array ~ [o1];
}

/////

task laser{

let o2 = Obj_Create(OBJ_LASER);

  Obj_SetPosition (o2, GetClipMinX, GetCenterY);
  Obj_SetAngle (o2, 0);
  Obj_SetSpeed (o2, 3);
  ObjShot_SetGraphic (o2, RED01);
  ObjShot_SetDelay (o2, 10);
  ObjLaser_SetLength (o2, 400);
  ObjLaser_SetWidth (o2, 30);

  Obj_SetCollisionToObject (o2, true);

array = array ~ [o2];
}

/////
}

The problem with this thing is, if you run it, you have to wait, like, maybe 20ish seconds before the color-changes-when-passing-laser kicks in.
I can make it start up faster by increasing the bullet's speed, but that's obviously not a good solution.

The original idea was for something similar to work with sinuates. Unfortunately, no matter how long one waits, it never works with them, whereas you just gotta wait a while before it works for the screen-long laser.

I should probably make a task to erase bullets from the array when they're deleted, but save that for another time. I'm pretty sure that has nothing to do with the problem.

Man. Arrays are the worst. (So far. I'm sure there'll be harder things for me in the future.)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on December 29, 2009, 06:12:39 AM
Took a quick look, but didn't copypaste and test the script. I spotted a few errors that might be causing the delay before the color changing happens:

1.) ascent(j in 0..(length (array) -1) ){ should really just be ascent(j in 0..length(array)){
Remember that ascents stop one number before the defined upper bound, which is just perfect for array handling.

2.) You shouldn't really be adding the shot ids to the array at the very end. It doesn't serve any purpose that I can see and it just eats up memory (although very slowly).

3.) You actually don't need an array at all if you're only going to have one laser. As you may have noticed if you followed what I said in the #2, you'll only be storing one value, a laser object id, in the array. Arrays are for storing multiple values so it's fairly redundant in this case. Instead, you can declare let o2; at the very top and put o2 = Obj_Create(blahblah); in the laser creation task. Then, when you check for collision in the shot task, you can just compare if o1 is colliding with o2. Of course, if you later plan to add more lasers, go ahead and leave the array in there.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Nuclear Cheese on December 29, 2009, 06:18:49 AM
Hey Naut, a quick improvement on your idea:

let r = rand(0, 100);

... and if I want to spawn 500 of them?  Suddenly we're guarenteed overlap, which will cause problems.

A better way to do this is to store an identifier in another common data, such as follows:

r = GetCommonDataDefault("Next_Familiar_ID", 0);
SetCommonData("Next_Familiar_ID", r + 1);


This way, regardless of how many get spawned, we'll never have overlap.

Plus, using rand runs the risk of overlap regardless - there's nothing preventing rand from throwing the same number twice in a row.



Also, it might just be me, but I'd find it better to define a prefix on the Common Data name you're using, such as:

let common_data_name = "familiar_" + r;

... and use that, rather than just the number itself.  Wouldn't make a difference by itself, but I think it's more structured, and less likely to interact with another script in a bad way.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on December 29, 2009, 06:57:13 AM
rand(0, 100); has a one in one hundred million chance of producing the same number twice in a row.

You're probably thinking of rand_int(0, 100);

But yes, your idea would've guaranteed no duplicates. Honestly, I was just tired of dealing with CommonData so I settled on random numbers without thinking about it... Making a full game is so CommonData heavy that I'm sick of it now. And I've barely skimmed the surface. </minor rant>
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: KrackoCloud on December 29, 2009, 07:16:59 AM
Took a quick look, but didn't copypaste and test the script. I spotted a few errors that might be causing the delay before the color changing happens:

1.) ascent(j in 0..(length (array) -1) ){ should really just be ascent(j in 0..length(array)){
Remember that ascents stop one number before the defined upper bound, which is just perfect for array handling.

2.) You shouldn't really be adding the shot ids to the array at the very end. It doesn't serve any purpose that I can see and it just eats up memory (although very slowly).

3.) You actually don't need an array at all if you're only going to have one laser. As you may have noticed if you followed what I said in the #2, you'll only be storing one value, a laser object id, in the array. Arrays are for storing multiple values so it's fairly redundant in this case. Instead, you can declare let o2; at the very top and put o2 = Obj_Create(blahblah); in the laser creation task. Then, when you check for collision in the shot task, you can just compare if o1 is colliding with o2. Of course, if you later plan to add more lasers, go ahead and leave the array in there.

All right. I've kept the array since the original idea was for multiple sinuate lasers. Unfortunately, although your advice has helped for the screenlong laser, and even works for bullets, the sinuates are still being jerks.

Well, if worst comes, I can always just makes streams of bullets :U
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Nuclear Cheese on December 30, 2009, 12:35:49 AM
rand(0, 100); has a one in one hundred million chance of producing the same number twice in a row.

You're probably thinking of rand_int(0, 100);

But yes, your idea would've guaranteed no duplicates. Honestly, I was just tired of dealing with CommonData so I settled on random numbers without thinking about it... Making a full game is so CommonData heavy that I'm sick of it now. And I've barely skimmed the surface. </minor rant>

Yeah, you're right, I was thinging rand_int.

Sounds like you're really using the hell out of Common Data ...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on December 30, 2009, 01:08:23 AM
Yeah, you're right, I was thinging rand_int.

Sounds like you're really using the hell out of Common Data ...

I agree. This is probably one of the rare times I use it.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on December 30, 2009, 07:48:17 PM
Config.exe is pissing me off. No matter what type of compatiblity I use or any setting in Applocal, it refuses to show up. Though it is visible inside taskmanager as a running task.

What the hell, I want to adjust options so dnh runs smoother on my laptop. Currently the fps is like 30-40 =.=
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: P♂ zeal on December 30, 2009, 08:02:23 PM
my fps is weird too. Either I let it run free and get like 50 windowed[40 with lag] and 78 fullscreen[50 with lag]
or I limit it and get 50 windowed and fullscreen.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on December 30, 2009, 09:22:34 PM
Config.exe is pissing me off. No matter what type of compatiblity I use or any setting in Applocal, it refuses to show up. Though it is visible inside taskmanager as a running task.

What the hell, I want to adjust options so dnh runs smoother on my laptop. Currently the fps is like 30-40 =.=

Tip from Gamecubic:

Run it as win2k without Applocal. Result => it works. Hooray.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: puremrz on December 30, 2009, 09:38:33 PM
Guys, I'm trying to make some stuff with object bullets:
(http://i32.photobucket.com/albums/d49/puremrz/shiny.png)

It goes like this: The enemy shoots familiars that have all sorts of shapes on them. The shapes rotate and grow over time and bounce with their core around the screen a few times before vanishing offscreen.
So far I managed to make this with a circle. But making anything else I want (triangles, squares, stars, two triangles on top of each other, etc), is breaking my mind!
I couldn't get further than making a framework with a bullet for each edge, but the lining in between those points is giving me a headache.
I tried using Pythagoras' nice equation, but combining that with the motion and rotation of the shapes just won't work.

Can you help me with this? I'm probably doing it completely wrong if I get two pages of text just to make 1 star... >_>;
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on December 30, 2009, 09:47:04 PM
So you're making the familiars out of bullets? That's what I'm seeing from your screenshot. Or are you making object effects with vertices?

Also, post code.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: puremrz on December 30, 2009, 09:54:29 PM
I'm making invisible familiars that only act as the center of the shapes and keep them together.
This is the script for those familiars. The rest of the script is only a summon of the familiars.

Code: [Select]
#TouhouDanmakufu
#Title[Tomoko Familiar 1]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{

let shot1=0;
let bullet1=[];
let angle=0;
let bounce=0;
let radius=0;
let speed=1;
let bullets=15;
let rotatespeed=0;
let random=rand_int(0,1);
if(random==0){ rotatespeed=0.3; }
if(random==1){ rotatespeed=-0.3; }

let frame=0;
let time=0;
let miny=GetClipMinY; let maxy=GetClipMaxY; let minx=GetClipMinX; let maxx=GetClipMaxX;
let cx=GetCenterX; let cy=GetCenterY;

@Initialize{
SetLife(1);
MagicCircle(false);
SetAngle(rand(0,360));
SetSpeed(speed);
}

@MainLoop{

if(time==0){
let color=rand_int(61,70);
loop(bullets){
shot1=(Obj_Create(OBJ_SHOT));
Obj_SetPosition(shot1,GetX+radius*cos(angle),GetY+radius*sin(angle));
Obj_SetAngle(shot1,angle+360/20);
Obj_SetAutoDelete(shot1,false);
ObjShot_SetBombResist(shot1,true);
ObjShot_SetGraphic(shot1,color);
angle+=360/bullets;
bullet1=bullet1~[shot1];
}
}

let i=0;
while (i<length(bullet1)){
Obj_SetPosition(bullet1[i],GetX+radius*cos(angle),GetY+radius*sin(angle));
Obj_SetAngle(bullet1[i],angle+360/bullets);
angle+=360/bullets;
i++;
}
angle+=rotatespeed;


if(bounce<3){
if(GetX<=minx){ SetAngle(180-GetAngle); SetX(GetX+1); SetSpeed(speed); bounce+=1; }
if(GetX>=maxx){ SetAngle(180-GetAngle); SetX(GetX-1); SetSpeed(speed); bounce+=1; }
if(GetY<=miny){ SetAngle(-GetAngle); SetY(GetY+1); SetSpeed(speed); bounce+=1; }
if(GetY>=maxy){ SetAngle(-GetAngle); SetY(GetY-1); SetSpeed(speed); bounce+=1; }
}

if(GetX<=minx-300 || GetX>=maxx+300 || GetY<=miny-300 || GetY>=maxy+300){
let i=0;
while (i<length(bullet1)){
Obj_Delete(bullet1[i]);
i++
}
VanishEnemy;
}

if(radius<150){ radius+=0.2; }

time++;
frame++;

}

@DrawLoop{
}

@Finalize{
}

}

Yeah, no tasks.  8)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Nuclear Cheese on December 31, 2009, 12:59:51 AM
Guys, I'm trying to make some stuff with object bullets:

It goes like this: The enemy shoots familiars that have all sorts of shapes on them. The shapes rotate and grow over time and bounce with their core around the screen a few times before vanishing offscreen.
So far I managed to make this with a circle. But making anything else I want (triangles, squares, stars, two triangles on top of each other, etc), is breaking my mind!
I couldn't get further than making a framework with a bullet for each edge, but the lining in between those points is giving me a headache.
I tried using Pythagoras' nice equation, but combining that with the motion and rotation of the shapes just won't work.

Can you help me with this? I'm probably doing it completely wrong if I get two pages of text just to make 1 star... >_>;

If you need to create a line of bullets between two points, you just need to interpolate between the two points.  Use something like the following pseudocode:

Code: (pseudocode ... not real code) [Select]
let number_of_bullets = 9; // Number of bullets on the line

// First point
let x1 = first_x_position;
let y1 = first_y_position;

// Second point
let x2 = second_x_position;
let y2 = second_y_position;

// Loop counter from 0 to number_of_bullets (count up by 1 each time)
for (counter = 0 to number_of_bullets)
{
   let position_fraction = counter / number_of_bullets;

   // calculate next bullet's position
   let x = (x1 * position_fraction) + (x2 * (1 - position_fraction));
   let y = (y1 * position_fraction) + (y2 * (1 - position_fraction));

   // create the next bullet
   Create_Bullet(x, y, ...);
}

(remember, this isn't actual code/script ... it's just a quick pseudo-code to give you the idea)

This'll create number_of_bullets on a line between (x1, y1) and (x2, y2), including the endpoints.  To exclude the endpoints, start counter at 1 and go up to nmber_of_bullets-1 instead.



Yeah, no tasks.  8)

HELL YEAH! :dragonforce:
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on December 31, 2009, 07:57:56 AM
Following up on NC's post, after you make the bullets, you still want to rotate them around the invisible familiar right? To do that, you'll need to figure out what the angle is from the familiar to the bullet and the distance. Since the bullets are objects, you have Obj_GetX, and Obj_GetY to help you with the calculations.

Angle can be found with let angle = atan2(y2-y1, x2-x1);
Distance can be found with let distance = ((x2-x1)^2+(y2-y1)^2)^0.5;
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on December 31, 2009, 03:05:39 PM
Ok, so i"ve made this spellcard and stuff.

So when I tried it out this, it crashes.
Code: (Bleh. it just crashes, no script error or anything.) [Select]
#TouhouDanmakufu[Stage]
#Title[I don't know why it's crashing.]
#Text[It just crashes.]
//Background[IceMountain]
#PlayLevel[Wut]
#BGM[]
#Player[FREE]
#ScriptVersion[2]

script_stage_main{

 let GCSD = GetCurrentScriptDirectory;
 function Wait(let frames){
   loop(frames){yield;}
 }
 function WaitForZeroEnemy{
  while(GetEnemyNum != 0){yield;}
 }
 function WaitForNoEvent {
  while(OnEvent) { yield; }
 }
 task stage6 {
  Wait(1);
  CreateEnemyBossFromFile(GCSD~"theattack.txt", GetCenterX, GetClipMinY-50, 0, 0, 0);
  Wait(360);
  Clear;
 }

 @Initialize{
  stage6;
  LoadGraphic(EFamiliar);
 }
 @MainLoop{
  yield;
 }
 let EFamiliar = GCSD~"img\enemy_option.png";
 let rotateoptioncircle = 0; let rotateoptioncirclea = 0;
 @Background{
  rotateoptioncircle -= rotateoptioncirclea; rotateoptioncirclea+=1/4;
  if(rotateoptioncircle >= 360) { rotateoptioncircle -= 360; } if(rotateoptioncirclea >= 360) { rotateoptioncirclea -= 360; }
  SetTexture(EFamiliar);
  SetGraphicRect(0,0,75,75);
  SetGraphicAngle(0, 0, rotateoptioncircle);
  SetGraphicScale(5, 5);
  SetRenderState(ALPHA);
  SetAlpha(255);
  SetColor(255, 255, 255);
  DrawGraphic(GetCenterX, GetCenterY);
 }
 @Finalize{
  LoadGraphic(EFamiliar);
 }
}

Code: (theattack.txt) [Select]
#TouhouDanmakufu
#Title[Works here, though.]
#Text[]
#Image[]
#BackGround[IceMountain]
#Player[FREE]
#ScriptVersion[2]

//Don't worry about having the images.
script_enemy_main {
    let BossImage = "script\img\ExRumia.png";
    let EFamiliar = GetCurrentScriptDirectory~"img\enemy_option.png";
    let CutInGraphic = GetCurrentScriptDirectory~"img\cut.png";
    let bossname = "????????? ?? ?????";
    let Spell = 1;
    let SpellName = "「???」";
@Initialize {
SetLife(500000); SetDamageRate(0, 0); SetTimer(68);
SetEnemyMarker(true); MagicCircle(true); SetInvincibility(180);
LoadGraphic(BossImage); LoadGraphic(EFamiliar);
TMain;
SetInvincibility(480);
SetEffectForZeroLife(60, 55, 3); //LastSpell;
SetShotAutoDeleteClip(10, 10, 10, 10);
}

@MainLoop {
if(GetTimer > 0) { SetLife(630); }
SetCommonData("StuffLife", GetEnemyLife);
SetCommonData("StuffTime", GetTimer);
if(Spell <= 1) {
if(show) { ascent(i in 0..7) { SetCollisionA(GetPlayerX+50*cos(i*360/7), GetPlayerY+50*sin(i*360/7), 10); } }
}
yield;
}

let animation = 0;
let rotate = 0; let rotatea = 0;
let alpha = 0;
let x = 0;
let count = 0;
let show = 0;
@DrawLoop {
if(!show){
if(count<270) {
count++;
if(x<=20) { x+=1/6; }
if(alpha < 255) { alpha+=255/120; }
if(count==210) { alpha=255; } if(count>210) { x+=1/4; alpha-=255/60; }
SetFontColor(255, 255, 255, 0, 0, 155);
DrawText("Blue text! THIS IS A COPY", GetCenterX-100+x, GetCenterY+150-10, 15, alpha);
SetFontColor(255, 255, 255, 155, 0, 155);
DrawText("Purple text! OF YUYUKO", GetCenterX-100-x, GetCenterY+150+10, 10, alpha);
}
}
SetFontColor(255, 255, 255, 0, 0, 155);
DrawText(bossname, 40, 36, 12, 255);
}

@Finalize {
PlaySE("se\se_enep01.wav");
DeleteCommonData("StuffLife");
DeleteCommonData("StuffTime");
SetShotAutoDeleteClip(200, 200, 200, 200);
SetShotColor(255, 255, 255);
DeleteGraphic(BossImage); DeleteGraphic(EFamiliar);
}

task TMain {
suika;
SetMovePosition02(GetCenterX, GetCenterY, 1);
loop(120){yield;}
loop(4) { Concentration02(45); PlaySE("se\se_ch00.wav"); loop(30){yield;} } Concentration02(90); PlaySE("se\se_ch00.wav"); loop(45){yield;}
show = 1;
SetText(SpellName); SetScore(10000000); //SetDurableSpellCard;
loop(30) { yield; }
loop(150) { yield; }
PlaySE("se\se_option.wav"); ascent(i in 0..6) { CreateEnemyFromScript("one", GetX, GetY, 0, 0, i*360/6); }
while(GetCommonData("StuffLife")>400 && GetCommonData("StuffTime")>50) { yield; } attack1;
while(GetCommonData("StuffLife")>300 && GetCommonData("StuffTime")>40) { yield; } SetDamageRate(9, 3); attack2;
}
task suika {
task CreateShotR(x, y, delay) {
let obj = Obj_Create(OBJ_SHOT); let c = -delay;
Obj_SetPosition(obj, x, y);
ObjShot_SetGraphic(obj, BLUE05);
ObjShot_SetDelay(obj, delay);
ObjShot_SetBombResist(obj, 1);
Obj_SetCollisionToPlayer(obj, 0);
while(!Obj_BeDeleted(obj)) {
Obj_SetY(obj, Obj_GetY(obj)-2);
c++; if(c==0) { Obj_Delete(obj); }
yield;
}
}
loop {
loop(10) { CreateShotR(GetX+rand(-15, 15), GetY+rand(-10, 30), rand_int(15, 25)); }
loop(5) { yield; }
}
}
task attack1 {
let graphic = [BLUE03, BLUE02, BLUE01, BLUE04, BLUE05];
let num = 3; let a = GetAngleToPlayer;
loop {
a = GetAngleToPlayer;
ascent(i in 0..num) {
PlaySE("se\se_lazer01.wav");
CreateShot01(GetX, GetY, 5, a+i*360/num, graphic[0], 10);
loop(30) { CreateShot01(GetX, GetY, rand(4, 5), a+i*360/num+rand(-2, 2), graphic[1], 10); }
loop(60) { CreateShot01(GetX, GetY, rand(3, 5), a+i*360/num+rand(-3, 3), graphic[2], 10); }
loop(25) { CreateShot01(GetX, GetY, rand(1, 5), a+i*360/num+rand(-3, 3), graphic[3], 10); }
loop(70) { CreateShot01(GetX, GetY, rand(1, 5), a+i*360/num+rand(-7, 7), graphic[4], 10); }
}
loop(60) { yield; }
}
}
task attack2 {
loop {
ascent(i in -17..18) { ascent(j in 0..6) { CreateShot01(GetX, GetY, 1/3, GetAngleToPlayer+i*1+j*360/6, RED02, 0); PlaySE("se\se_tan02.wav"); } }
loop(180) { yield; }
}
}
}

script_enemy one {
let EFamiliar = GetCurrentScriptDirectory~"img\enemy_option.png";
@Initialize {
SetLife(9999);
TMain;
//LoadGraphic(EFamiliar);
}

@MainLoop {
SetLife(9999);
SetMovePosition02(GetCenterX+radius*cos(a), GetCenterY+radius*sin(a), 1);
yield;
}

let rotate = 0;
@DrawLoop {
rotate += 7; if(rotate >= 360) { rotate -= 360; }
SetTexture(EFamiliar);
SetGraphicRect(0,0,75,75);
SetGraphicAngle(0, 0, rotate);
SetGraphicScale(1, 1);
SetRenderState(ADD);
SetAlpha(255);
SetColor(255, 255, 255);
DrawGraphic(GetX, GetY);
}

@Finalize {
SetShotColor(255, 255, 255);
//DeleteGraphic(EFamiliar);
}

let radius = 0; let a = GetArgumentDefault(0); let delay = 3;
task TMain {
radiusinc;
ainc;
unr;
atak1;
while(GetCommonData("StuffLife")>100 && GetCommonData("StuffTime")>10) { yield; }
PlaySE("se\se_option.wav"); CreateEnemyFromScript("two", GetPlayerX, GetPlayerY, 0, 0, GetArgument);
}
task radiusinc {
while(radius<225) {
radius+=2;
yield;
}
loop {
CreateShot01(GetX, GetY, 4, a, BLUE22, 0); PlaySE("se\se_kira01.wav");
loop(delay) { yield; }
}
}
let spin = 0.75;
task ainc {
loop {
a+=spin; if(a>=360) { a-=360; }
yield;
}
}
task unr {
while(GetCommonData("StuffLife")>400 && GetCommonData("StuffTime")>30) { yield; }
while(radius > 150) { radius-=1/4; yield; }
spin = 5.5; delay = 1;
}
task atak1 {
while(GetCommonData("StuffLife")>200 && GetCommonData("StuffTime")>20) { yield; }
loop {
CreateShot01(GetX, GetY, 2, GetAngleToPlayer, RED03, 0); PlaySE("se\se_tan02.wav");
loop(240) { yield; }
}
}
}

script_enemy two {
let EFamiliar = GetCurrentScriptDirectory~"img\enemy_option.png";
@Initialize {
SetLife(9999);
TMain;
//LoadGraphic(EFamiliar);
}

@MainLoop {
SetLife(9999);
SetMovePosition02(GetPlayerX+radius*cos(a), GetPlayerY+radius*sin(a), 1);
yield;
}

let rotate = 0;
@DrawLoop {
rotate += 7; if(rotate >= 360) { rotate -= 360; }
SetTexture(EFamiliar);
SetGraphicRect(0,0,75,75);
SetGraphicAngle(0, 0, rotate);
SetGraphicScale(1, 1);
SetRenderState(SUBTRACT);
SetAlpha(255);
SetColor(255, 255, 255);
DrawGraphic(GetX, GetY);
}

@Finalize {
SetShotColor(255, 255, 255);
//DeleteGraphic(EFamiliar);
}

let radius = 0; let a = GetArgumentDefault(0);
task TMain {
ainc;
unr;
}
let spin = 5.5;
task ainc {
loop {
a-=spin; if(a>=360) { a-=360; }
yield;
}
}
task unr {
while(GetCommonData("StuffLife")>400 && GetCommonData("StuffTime")>20) { yield; }
while(radius < 100) { radius+=1; yield; }
atak1;
}
task atak1 {
while(GetCommonData("StuffLife")>100 && GetCommonData("StuffTime")>20) { yield; }
loop {
ascent(i in -5..6) { CreateShot01(GetX, GetY, 3/4, a+i*30, RED22, 0); } PlaySE("se\se_tan02.wav");
loop(240) { yield; }
}
}
}
Does it have to do with the familiars spawning familiars?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: puremrz on December 31, 2009, 04:46:29 PM
Thanks for the help guys.
There was still one thing missing, but I figured that out on my own somehow :V

(http://i32.photobucket.com/albums/d49/puremrz/todayisgood.png)

With this framework, I can easily make squares and other shapes too. Yay!
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 01, 2010, 12:09:06 PM
Ahh, you were close.

DrawText("History: " ~ caprate ~ "/" ~ seerate, GetClipMinX+10, GetClipMinY+100, 12, 255);

Use tilde to combine strings.
DrawText("Seconds:" ~ frame/60 ~ "frame" ~ time, GetClipMinX,GetClipMinY+60,20,255);
I do not see what I am doing wrong...
I get an error at this message, its in my post at the Error Message Thread
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on January 01, 2010, 02:13:58 PM
DrawText("Seconds:" ~ frame/60 ~ "frame" ~ time, GetClipMinX,GetClipMinY+60,20,255);
I do not see what I am doing wrong...
I get an error at this message, its in my post at the Error Message Thread

if the variables frame and time are values, you should use ToString(frame/60) and ToString(time) I think...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: durdur on January 02, 2010, 09:00:11 AM
Ummm hello ^^...I've been reading these forums for quite a while and, finally, i decided to make an account *yay*

I have already dabbled a bit with danmakufu by reading the tutorials, and even downloaded some of the stuff you guys make (really nice btw!)

However, some of the scripts i try to run require CtC bullets. I tried to get the bullets from the forums and from the game itself, but i couldn't find them.

So...i guess my question is: can someone explain to me how to get the CtC bullets? (lolnubquestion) i don't even know if people are allowed to ask for the bullets, so sorry if it is >.<

Also, thanks in advance~
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 02, 2010, 09:05:38 AM
So...i guess my question is: can someone explain to me how to get the CtC bullets? (lolnubquestion) i don't even know if people are allowed to ask for them, so sorry if it is >.<

Also, thanks in advance~

Welcome to the forum. And I can understand your question because Stuffman forgot to link the CtC bullets to the FAQ/resource thread. I'll notify him.

You are obviously looking for this: http://www.shrinemaiden.org/forum/index.php?topic=369.0 Download it and place it in your root of danmakufu. That should be working out.

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: durdur on January 02, 2010, 09:12:13 AM
thanks Hele ^^

Hmm i did find that post somewhere but didn't pay attention to it because of the 0 reply count...oh well  :P

Didn't expect such a quick reply... thanks for that too!
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 02, 2010, 03:20:25 PM
I am going to spare you the details how much I fail in math ( oh wait, I already said it ).

Iryan once helped me out with a code to create a fountain effect effect for my afro boss. But now I need the similar type of code again, except I want to bullets to halt for a while etc. CreateShotA would help out, but it is not. SetShotData_XY cannot use NULL for the X-speed, Y-speed, X-acc and Y-acc. Also even if I do this:

CreateShotA(1,GetEnemyX,GetEnemyY,10);   
SetShotDataA_XY(1,0,5*cos(rand(240,270)),5*sin(rand(240,270)),0,0.1,0,rand_int(2,3),RED01);   <--- fountain
SetShotDataA(1,60,0,NULL,0,0,0,RED01);    <--- halt + maintain angle
SetShotDataA_XY(1,90,5*cos(rand(240,270)),5*sin(rand(240,270)),0,0.1,0,rand_int(2,3),RED01); <---- FFF cannot maintain angles here cause you cannot store it. Also this makes bullets 'rejump' making it look bad.

Thus Naut adviced me to use Object Bullets because you can get angle to perform calculation. Though yea, he he he--- How? Can someone explain me a bit step by step how create an arching Object Bullet:
(http://i49.tinypic.com/jaucjm.png)

Aside the chunk of code I kind of hope to understand a bit what is going on. So bit detailed explanation ( if not much asked ) is welcome.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Thaws on January 02, 2010, 04:11:31 PM
CreateShotA(1,GetEnemyX,GetEnemyY,10);   
SetShotDataA_XY(1,0,5*cos(rand(240,270)),5*sin(rand(240,270)),0,0.1,0,rand_int(2,3),RED01);   <--- fountain
SetShotDataA(1,60,0,NULL,0,0,0,RED01);    <--- halt + maintain angle
SetShotDataA_XY(1,90,5*cos(rand(240,270)),5*sin(rand(240,270)),0,0.1,0,rand_int(2,3),RED01); <---- FFF cannot maintain angles here cause you cannot store it. Also this makes bullets 'rejump' making it look bad.

Thus Naut adviced me to use Object Bullets because you can get angle to perform calculation. Though yea, he he he--- How? Can someone explain me a bit step by step how create an arching Object Bullet:
(http://i49.tinypic.com/jaucjm.png)

I think it'd be easier to just use a task for each object bullet.
Code: [Select]
task whatever
{
let ac = *y-acceleration*;
let xv = 5*cos(rand(240,270));
let yv = 5*sin(rand(240,270)); //x,y velocity

let obj=Obj_Create(OBJ_SHOT);
//set you object angle/speed/graphic to whatever


loop(*frames you want the bullet to move for before halting*)
{
//The first thing to do is to relocate the bullet according to its velocity
Obj_SetPosition(obj, Obj_GetX(obj)+xv, Obj_GetY(obj)+yv);
//Then you change the y-velocity according to the acceleration
yv += ac;
yield;
}

loop(*Length of frames the bullet halts*)
{yield;}

//Then just let the bullet fall until it is deleted
while(!Obj_BeDeleted(obj))
{
Obj_SetPosition(obj, Obj_GetX(obj)+xv, Obj_GetY(obj)+yv);
yv += ac;
yield;
}


Didn't test this, I hope I'm understanding what you want to do and it works.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 02, 2010, 04:37:48 PM
Iryan once helped me out with a code to create a fountain effect effect for my afro boss.
Hi there.  :V

Code: [Select]
task whatever{
let flyangle=rand(240,270);
let ac = *y-acceleration*;
let xv = 5*cos(flyangle);
let yv = 5*sin(flyangle); //x,y velocity

let obj=Obj_Create(OBJ_SHOT);

//set you object angle/graphic to whatever, but the speed to zero

loop(*frames you want the bullet to move for before halting*) {

//The first thing to do is to relocate the bullet according to its velocity

Obj_SetPosition(obj, Obj_GetX(obj)+xv, Obj_GetY(obj)+yv);

//Then you change the y-velocity according to the acceleration

yv += ac;

yield;
}

loop(*Length of frames the bullet halts*) {yield;}

//Then just let the bullet fall until it is deleted

while(!Obj_BeDeleted(obj)){
Obj_SetPosition(obj, Obj_GetX(obj)+xv, Obj_GetY(obj)+yv);
yv += ac;
yield;
}


FIXXED!!!1111eleven!

Also, improved the formatting. Because I'm a nitpicking jerk.  :V
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 02, 2010, 05:01:36 PM
Ok, so i"ve made this spellcard and stuff.

So when I tried it out this, it crashes.
Code: (Bleh. it just crashes, no script error or anything.) [Select]
#TouhouDanmakufu[Stage]
<snip>

 @Finalize{
  LoadGraphic(EFamiliar);
 }

Code: (theattack.txt) [Select]
#TouhouDanmakufu
#Title[Works here, though.]
#Text[]
#Image[]
#BackGround[IceMountain]
#Player[FREE]
#ScriptVersion[2]

<snip>
Does it crash upon loading the stage or whenever you try to spawn the boss?

I could of course be wrong, but it strikes me that spawning a familiar with a #BackGround[IceMountain] of himself inside another script could be a bad idea.
Having a LoadGraphic in @Finalize, likewise, although that shouldn't arise until the end of the stage.

I would test around with this, but danmakufu hates me right now. It crashes on pretty much everything, including beating a script of any kind, loading a stage and/or looking at it weirdly. :-X
Gonna try and screw around with the compatibility settings and stuff...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 02, 2010, 05:01:46 PM
Now I understand why I couldn't come anywhere close it. I was fooling around with sin / cos and Obj_SetAngle. But you are using Obj_SetPosition which has like XY also two parameters. Clever.

However, the bullets are like falling sideways ( if I use pellets or ovals ). How can I make the bullet angle cooperate as well ?

Code became eventually this:
Code: [Select]
    task sproeibullet(x,y,kleur,delay){

let obj=Obj_Create(OBJ_SHOT);

    let flyangle=rand(240,270);
    let ac = 0.1;
    let xv = 5*cos(flyangle);
    let yv = 5*sin(flyangle); //x,y velocity

Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,0);
ObjShot_SetGraphic(obj,kleur);
ObjShot_SetDelay(obj,delay);

    loop(60){
      Obj_SetPosition(obj, Obj_GetX(obj)+xv, Obj_GetY(obj)+yv);
      yv += ac;
      yield;
    }
loop(60){yield;}
    while(!Obj_BeDeleted(obj)){
      Obj_SetPosition(obj, Obj_GetX(obj)+xv, Obj_GetY(obj)+yv);
Obj_SetAngle(obj,flyangle);
      yv += ac;
      yield;
}
    }

Edit - frikken forum, why does it overthrow the order of tabbing when using code tags =.=
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 02, 2010, 05:16:16 PM

However, the bullets are like falling sideways ( if I use pellets or ovals ). How can I make the bullet angle cooperate as well ?
Obj_SetAngle() and to the rescue!


Code: [Select]
    task sproeibullet(x,y,kleur,delay){

let obj=Obj_Create(OBJ_SHOT);

    let flyangle=rand(240,270);
    let ac = 0.1;
    let xv = 5*cos(flyangle);
    let yv = 5*sin(flyangle); //x,y velocity

Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,0);
ObjShot_SetGraphic(obj,kleur);
ObjShot_SetDelay(obj,delay);

    loop(60){
      yv += ac;

      Obj_SetAngle(obj, 180+ atan(yv/xv)); //This one line here!

      Obj_SetPosition(obj, Obj_GetX(obj)+xv, Obj_GetY(obj)+yv);


      yield;
    }
loop(60){yield;}
    while(!Obj_BeDeleted(obj)){
      Obj_SetPosition(obj, Obj_GetX(obj)+xv, Obj_GetY(obj)+yv);

      Obj_SetAngle(obj, 180+ atan(yv/xv)); //This same line here!

      yv += ac;
      yield;
}
    }
I tested this very code using RED32s, and it looked fine to me.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 02, 2010, 05:31:38 PM
Oh frikken brilliant. Right so let me try to grasp this:

Basically you are using the same math you used for the SetShotDataA_XY. XY used  X-velocity and Y-velocity as a seperate parameter, in this case I can do the same by giving the same parameters to the object task:

sproeibullet(x,y,xspeed,yspeed,kleur,delay)

Then it is basically the same thing, the angle being throw by 'flyangle' is used to calculate xv and yv where cos is used for the x and sin for the y ( logic trig )

And 'ac' is simply the acceleration rate which is added everytime to 'yv' because obviously we want the vertical velocity to increase over time ( in this case, per frame ) Eventually it is a simple matter of using 'SetPosition' adding the xv and yv to  Obj_GetX and Y.

Basically, I could write out the math code also like this no: 

sproeibullet(GetEnemyX,GetEnemyY,5*cos(240),5*sin(240),RED32,10);   where  the 3rd and 4th are the velocity parameters for x and y ( just like ShotA_XY )

?? Did I understood it all correctly, teacher ??
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on January 02, 2010, 05:38:52 PM
whenever you try to spawn the boss

This.

Also, screw-up on LoadGraphic instead of DeleteGraphic :V

EDIT: HOLY FREAK THANKS I WAS SCREWING OVER THIS THING FOR SO LONG ~_~
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 02, 2010, 05:48:55 PM
?? Did I understood it all correctly, teacher ??
Correct!  8)

You still fail the class because I can't find an appropriate picture of Keine right now, though.  :V

This.
I can assume you did test the #Background issue, yes? Other than that, I cannot spot anything that might be causing the crashes right now. Nothing I understand, at least.  :V
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on January 02, 2010, 11:57:29 PM
the #Background issue
Thanks! I can't believe #BackGround was causing all this... ~_~
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: kite216 on January 03, 2010, 03:07:49 AM
This question has probably been asked and answered before but i cnat seem to find anything on it. Im running windows vista and i have applocale and i jsut downloaded danmakufu. now i had it a relaly long time ago on this computer and it worked fine with applocale but now since i've just downloaded it again, i had deleted the previous version a while ago, when it opens up i jsut get the application window open then it says th_dnh.exe (the program) has stopped working. My options are clsoe the program, or check online for a solution and clsoe the program. Is there any way to fix this?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on January 03, 2010, 03:29:59 AM
I'm not to familiar with AppLocale, but I don't think there's enough information to figure out the problem. I can suggest the usual stuff like, "Are you sure you're choosing Japanese?"  but that's about it. Have you taken a look at this thread (http://www.shrinemaiden.org/forum/index.php?topic=4138.0) yet?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Nimono on January 03, 2010, 03:39:11 AM
This question has probably been asked and answered before but i cnat seem to find anything on it. Im running windows vista and i have applocale and i jsut downloaded danmakufu. now i had it a relaly long time ago on this computer and it worked fine with applocale but now since i've just downloaded it again, i had deleted the previous version a while ago, when it opens up i jsut get the application window open then it says th_dnh.exe (the program) has stopped working. My options are clsoe the program, or check online for a solution and clsoe the program. Is there any way to fix this?
For some reason, the program refuses to run on Windows 7 unless you right-click the link to Danmakufu and select "Run as Administrator". I'm positive this will work for you, too.


Question of my own: I've recently been informed that there is a second type of object laser, the sinuate laser that curves like CreateLaserC. (heck yes this is so freaking win) I have problems with it, though...

You know the stereotypical thin, homing laser that most shmups these days seem to have? (As far as I know, at least...) I'm trying to create that. It actually works surprisingly well, but...there's a few problems.

Code: [Select]
let shotCount = -1;
let bNextShot = false;
let optionx = 0;
let optiony = 0;
let optionx2 = 0;
let optiony2 = 0;
let optionx3 = 0;
let optiony3 = 0;
let optionx4 = 0;
let optiony4 = 0;
let oang = 115;
let oang2 = 65;
let oang3 = 155;
let oang4 = 25;
let ooffset = 39;
let angle = 270;
let rot = 0;
let IsShooting = false;
task Laser(x, y, angle, power, l, w, g, a, s, loc)
{
let maxTraverse = 5;
let rev = false;
let Time = 0;
let Fall = Obj_Create(OBJ_SINUATE_LASER);
ObjShot_SetDamage(Fall, power);
Obj_SetPosition(Fall, x, y);
ObjShot_SetPenetration(Fall, 1000000);
ObjShot_SetGraphic(Fall, g);
Obj_SetSpeed(Fall, s);
Obj_SetAngle(Fall, angle);
Obj_SetAlpha(Fall, a);
ObjSinuateLaser_SetWidth(Fall, w);
ObjSinuateLaser_SetLength(Fall, l);
while(!Obj_BeDeleted(Fall))
{
ObjSinuateLaser_SetLength(Fall, l);
if(Time >= 5)
{
Obj_SetAngle(Fall, angle);
let dir;
dir = atan2(GetEnemyY - Obj_GetY(Fall), GetEnemyX - Obj_GetX(Fall));
// difference between 'dir' and 'angle'
let diff = dir - angle;
while(diff >= 180) { diff -= 360; }    // adjust the range
while(diff < -180) { diff += 360; }
let diffAbs = (|diff|);
if(diffAbs < maxTraverse)
{
// if the difference is small,
// the bullet turns to the enemy
angle = dir;
}
else
{
// otherwise, the bullet turns 'maxTraverse' degrees
if(loc == "left")
{
angle += (|maxTraverse * diff / diffAbs|);
}
else
{
angle -= (|maxTraverse * diff / diffAbs|);
}
}
if(Time >= 10 && maxTraverse < 25)
{
maxTraverse++;
}
}
if(GetKeyState(VK_SHOT) == KEY_HOLD)
{
l+=10;
}
if((Obj_GetX(Fall) >= GetEnemyX-10 && Obj_GetX(Fall) <= GetEnemyX+10 && Obj_GetY(Fall) >= GetEnemyY-10 && Obj_GetY(Fall) <= GetEnemyY+10) && GetEnemyNum >= 1)
{
l-=10;
Obj_SetSpeed(Fall, 0);
}
else
{
Obj_SetSpeed(Fall, s);
}
Time++;
yield;
}
}
@MainLoop
{
rot += 5;
optionx = GetPlayerX+ooffset*cos(oang);
optiony = GetPlayerY+ooffset*sin(oang);
optionx2 = GetPlayerX+ooffset*cos(oang2);
optiony2 = GetPlayerY+ooffset*sin(oang2);
optionx3 = GetPlayerX+ooffset*cos(oang3);
optiony3 = GetPlayerY+ooffset*sin(oang3);
optionx4 = GetPlayerX+ooffset*cos(oang4);
optiony4 = GetPlayerY+ooffset*sin(oang4);
if((GetKeyState(VK_SHOT)==KEY_PUSH || GetKeyState(VK_SHOT)==KEY_HOLD) && shotCount==-1)
{
shotCount = 0;
bNextShot = false;
}
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD)
{
if(ooffset > 21)
{
ooffset-=3;
}
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && !IsShooting)
{
Laser(optionx, optiony, 90, 4.0, 10, 15, 12, 190, 8, "left");
Laser(optionx2, optiony2, 90, 4.0, 10, 15, 12, 190, 8, "right");
Laser(optionx3, optiony3, 105, 4.0, 10, 15, 12, 190, 8, "left");
Laser(optionx4, optiony4, 75, 4.0, 10, 15, 12, 190, 8, "right");
IsShooting = true;
}
}
else
{
if(ooffset < 39)
{
ooffset+=3;
}
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && !IsShooting)
{
Laser(optionx, optiony, 90, 2.0, 10, 15, 12, 190, 8, "left");
Laser(optionx2, optiony2, 90, 2.0, 10, 15, 12, 190, 8, "right");
Laser(optionx3, optiony3, 90, 2.0, 10, 15, 12, 190, 8, "left");
Laser(optionx4, optiony4, 90, 2.0, 10, 15, 12, 190, 8, "right");
IsShooting = true;
}
}
if(shotCount%2 == 0)
{
//CreatePlayerShot01(GetPlayerX-8, GetPlayerY, 20, 270, 2.4, 1, 1);
//CreatePlayerShot01(GetPlayerX+8, GetPlayerY, 20, 270, 2.4, 1, 1);
}

if(shotCount >= 0)
{
shotCount++;
}
if(shotCount == 30)
{
shotCount=-1;
}
if(GetKeyState(VK_SHOT) != KEY_PUSH && GetKeyState(VK_SHOT) != KEY_HOLD)
{
IsShooting = false;
}

SetIntersectionCircle(GetPlayerX, GetPlayerY, 0);
yield;
}

For some reason, a length of 10 is too long for the laser, as once the laser reaches the enemy, where it shrinks, it...well, it shows a random series of images from my shot graphics sheet. :/ Second, when I hold down the shot key, which is what makes it extend, the graphics start out really compressed in size and very slowly get bigger to the correct size they should be. Finally, when they're SUPPOSED to shrink after letting go of shot, the lasers seem to immediately vanish into garbled areas. What am I doing wrong, if anything? Does the graphic need to be a certain size? Does the laser itself need to be?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 03, 2010, 01:38:39 PM
I am looking for an oval shaped movement pattern for the boss. I tried: SetMovePosition03(x+r*cos(dir),y+r*sin(dir),weight,frames);   but makes the boss look like it has parkinson.

Then I noticed the 'SetMovePositionHermite' function though the parameters are making no sense to me.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 03, 2010, 02:32:57 PM
That function is way too difficult for mortals to understand. My idea for a workaround would be to just use SetX and SetY.

Code: [Select]
task ellipse{
    let dir=270;
    let rx=150;
    let ry=75;

    loop{
        dir++;
        SetX(x+rx*cos(dir));
        Sety(y+ry*sin(dir));
        yield;
    }
}

...or something like that.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 03, 2010, 03:00:34 PM
That function is way too difficult for mortals to understand.

Dohohohoho.   

/me spawns a spear the gungnir

But seriously, what does it exactly do. Or what can it do.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on January 03, 2010, 03:23:33 PM
Dohohohoho.   

/me spawns a spear the gungnir

But seriously, what does it exactly do. Or what can it do.

from what's written in the wiki (and because I've used it from time-to-time), it seems like it's making the enemy move in a curve where the arguments mean:
Code: [Select]
7 arguments:
 1) X-coordinate //x-coordinate where the enemy will go to
 2) Y-coordinate //y-coordinate where the enemy will go to
 3) distance to curve from beginning point //until how far from the starting place the starting curve will last
 4) angle at beginning point //at what angle the boss starts to move from the starting place
 5) distance to curve to ending point //how far from the ending spot the enemy will start to curve
 6) angle at ending point //from what angle the enemy will arrive at the ending point
 7) frames //how long it'll take

basically it's like... if
SetX(GetCenterX);
SetY(GetClipMinY+100);
SetMovePositionHermite(GetClipMinX-100, GetClipMaxY-100, 100, 90, 100, 180, 100);
will make something like

_____________
|                  |
|        B        |
|        |        |
|        |        |
|        |        |
|        /        |
|<----          |
|___________| (<---  maybe the 3rd and 5th arguments are a little off in that picture)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 03, 2010, 03:25:11 PM
Sounds more like a function for stage enemies.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on January 03, 2010, 03:28:35 PM
Sounds more like a function for stage enemies.

I actually used it for stage enemies :P


EDIT: I noticed something about Sinuate Lasers... if you make something like this
Code: [Select]
task tentacle
{
let obj=Obj_Create(OBJ_SINUATE_LASER);
Obj_SetPosition(obj, GetX+50*cos(Obj_GetAngle(obj)), GetY+50*sin(Obj_GetAngle(obj)));
Obj_SetSpeed(obj, 10);
Obj_SetAngle(obj, 0);
ObjShot_SetGraphic(obj, BLUE01);
ObjSinuateLaser_SetLength(obj, 100);
ObjSinuateLaser_SetWidth(obj, 20);
while(Obj_BeDeleted(obj)==false)
{
yield;
Obj_SetAngle(obj, Obj_GetAngle(obj)+1);
Obj_SetPosition(obj, GetX+50*cos(Obj_GetAngle(obj)), GetY+50*sin(Obj_GetAngle(obj)));
}
}
to make a laser that spins around the boss, the laser appears much thiner than what you declared at ObjSinuateLaser_SetWidth, but the hitbox is a bit larger than the graphic (although still of course smaller than what you declared)... should it really be like this? I have a feeling that this is a stupid question with a really basic explanation to why the laser's like that... (that bit of code actually makes a laser that spins around the boss 50 pixels away, but with a width of about 1 pixel...)

I know that you could just spawn the laser in a different spot to make the same thing, but I'm showing this code because what if you want the laser to continue circling the boss while the boss is moving?... (there's probably a way to do that other than this code, I'm sure...) and actually... if you make the boss move, it generates a normal portion of the laser, but looks really weird in contrast to the other parts that are still 1 pixel thick...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Hat on January 04, 2010, 04:50:33 PM
INCOMING HEADACHE

Code: [Select]
#TouhouDanmakufu
#Title[FUCK]
#Text[ASSBALLS]
#Player[FREE]
#ScriptVersion[2]
#BGM[]

script_enemy_main {
#include_function "lib\ExtendedShotDatav4\shot_replace.dnh"
    let ImgBoss = "script\img\ExRumia.png";
let pos_draw_a = GetX;
let f = -120;

task derf{
let angle = rand(0, 360);
ascent(a in 0..30){
CreateShot01(GetX, GetY, 3, angle + a*(360/30), ORANGE12, 10);
}
}

task bamf(let i){
let angle = rand_int(0, 18);
loop(10){
ascent(x in 0..20){
yams(i, angle+x*18);
}
loop(3){yield;}
}
}

task yams(let i, let a){
let a_i = [[GetCenterX-175 , GetCenterY-150],[GetCenterX+175 , GetCenterY-150]];
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, a_i[i][0], a_i[i][1]);
Obj_SetSpeed(obj, 10);
Obj_SetAngle(obj, a);
ObjShot_SetGraphic(obj, RED43);
ascent(b in 0..33){Obj_SetSpeed(obj, 10-b*0.3); yield;}
Obj_SetSpeed(obj, 0);
loop(30){yield;}
Obj_SetSpeed(obj, 2);
loop(60){
let anglep = atan2(GetPlayerY-Obj_GetY(obj), -Obj_GetX(obj)+GetPlayerX);
let angleb = Obj_GetAngle(obj);
if(angleb >= 0){
if(anglep > angleb + 1 || anglep <= angleb - 180){Obj_SetAngle(obj, angleb + 1);}
if(anglep < angleb - 1 && anglep > angleb - 180){Obj_SetAngle(obj, angleb - 1);}
} else if(angleb < 0){
if(anglep < angleb - 1 || anglep > angleb + 180){Obj_SetAngle(obj, angleb - 1);}
if(anglep > angleb + 1 && anglep <= angleb + 180){Obj_SetAngle(obj, angleb + 1);}
} else if(angleb == 0){angleb+=0.1;}
while(angleb > 180){angleb -= 360;}
while(angleb < -180){angleb += 360;}
if(anglep <= angleb+1 && anglep >= angleb-1){Obj_SetAngle(obj, anglep);}
yield;
}
}

    @Initialize {
        SetLife(2000);
SetInvincibility(60);
        SetTimer(99);
        SetScore(1000000);

        SetMovePosition02(GetCenterX, GetClipMinY + 120, 120);
        CutIn(YOUMU, "Yam Sign "\""Attack of the fucking yams"\", "", 0, 0, 0, 0);

        LoadGraphic(ImgBoss);
        SetTexture(ImgBoss);
ShotInit;
    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 16);
if(f%20==0 && f>=0){derf;}
if(f%80==0 && f>=0){bamf(0);}
if(f%85==0 && f>=0){bamf(1);}
f++;
yield;
    }

    @DrawLoop {
if(GetX==pos_draw_a){
SetGraphicRect(0, 0, 64, 64);
        DrawGraphic(GetX, GetY);
}
if(GetX<pos_draw_a){
SetGraphicRect(128, 0, 192, 64);
DrawGraphic(GetX, GetY);
}
if(GetX>pos_draw_a){
SetGraphicRect(192, 0, 256, 64);
DrawGraphic(GetX, GetY);
}
pos_draw_a = GetX;
    }

    @Finalize {
        DeleteGraphic(ImgBoss);
    }
}

Okay. I apologize for the general disorganization and abysmal use of tabbing, but just... try this stupid thing (shot replace v4 required, or you can just change RED43 to whatever). A hitboxless character is strongly advised, or something like that. Anyway. As you can see, my lovely bullets curve towards the player in a highly sensual manner... except for one fun little thing. The first bullet in each wave lags behind the rest by a little, so the 'beams' (which, as it strikes me now, look very shinki-esque) have a little deformity. I've tried everything, and nothing I do can even address the little head. I normally debug my cards by exaggerating various things and seeing what breaks, but I cannot break the head on this at all. It just stays in the same place, and makes the whole card look really shitty.

Obviously, this is a work in progress.

EDIT: It's slightly hard to see in this form, so my suggestion would be to replace RED43 with TEAL12I, and set the loop(30){yield;} in yams() to something much bigger. Maybe to 120? Enough so that you can see, I dunno.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on January 04, 2010, 06:54:13 PM
Quick easy solution: Set the first bullet's alpha to 0 and turn off collision detection to the player.
Hard solution: Figure out what's wrong with your math. :V
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 04, 2010, 07:12:07 PM
INCOMING HEADACHE
<snip>

OK. I have absolutely no idea why, but after tinkering around, I found that moving the loop(3){yield;} in bamf before the ascent rather than behind it fixes the error.

Code: [Select]
task bamf(let i){
let angle = rand_int(0, 18);
loop(10){
loop(3){yield;}
ascent(x in 0..20){
yams(i, angle+x*18);
}
}
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Hat on January 05, 2010, 12:03:57 AM
\o/

Thanks, Iryan. XD I never thought the problem would be in bamf... -_- Thanks aplenty!
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: professor_scissors on January 05, 2010, 07:18:05 AM
A friend of mine is trying to get Danmakufu to work on 32-bit Windows XP, and is having a bit of a technical problem. Every script, whether it's a single, a plural, or a stage, fatally crashes the game about when it's supposed to give the "Stage Clear" message, every time. This is using scripts that never produce this error on my machine (tested on Vista and on 7). Version is 0.12, any possible solutions?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: KrackoCloud on January 06, 2010, 03:02:59 AM
How can I create something similar to the lasers in say, Subterrnean Animsim, Stage 3? - Basically, lasers that shoot, stop so you can read them, and then resume moving.

Laser01 has no Set Data function, and sinuates shrink when they stop or slow down.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on January 06, 2010, 03:06:20 AM
Isn't there a Laser0A function?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fetch()tirade on January 06, 2010, 03:33:28 AM
There's CreateLaserA, but not 0A.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: KrackoCloud on January 06, 2010, 03:35:26 AM
I thought it was only for screen-long lasers, not the bullet-like ones.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Gc on January 06, 2010, 03:40:20 AM
Make a basic object laser, set speed, hide source glow ?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on January 06, 2010, 03:45:35 AM
Nah, you can use CreateLaserAs, but that may actually be your only option. I'd advise ascenting the SetLaserDataA like this:

CreateLaserA(0, GetX, GetY, 50, 10, RED01, 0);
ascent(j in 0..30){
   SetLaserDataA(0, j, NULL, 0, 0, j*0.2, GetAngleToPlayer);
}
decent(j in 0..30){
   SetLaserDataA(0, 30 + (30 - j), NULL, 0, 0, j*0.1 + 3, GetAngleToPlayer);
}
FireShot(0);


I'm not even sure how Object lasers would work in that regard, but setting an invisible base as well as an angle and speed seems to be an option as well. Plus it's probably less of a headache than the CreateLaserA method, haha!
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on January 06, 2010, 10:56:45 AM
Just cause I have nothing better to do, here's the gist of the object version. Tested quickly in Danmakufu. May have some strange bugs if I wasn't careful enough.:

task PausingLaser(x, y, speed, angle, graphic, delay, length, width, timebeforepausing, pausetime){
    // Set up initial values.
    let obj = Obj_Create(OBJ_LASER);
    Obj_SetPosition(obj, x, y);
    Obj_SetAngle(obj, angle);
    ObjShot_SetGraphic(obj, graphic);
    ObjShot_SetDelay(obj, delay);
    ObjLaser_SetLength(obj, 0); // Set length to zero initially so the laser can grow out of the spawn point.
    ObjLaser_SetWidth(obj, width);
    ObjLaser_SetSource(obj, false);
    loop(delay){yield;} // Wait for the delay time.

    // Set up variables to control acceleration and deceleration
    let vel = speed;
    let accel = speed/timebeforepausing * -1;

    // Grow the laser out of the start position
    while(ObjLaser_GetLength(obj)<length){
        ObjLaser_SetLength(obj, ObjLaser_GetLength(obj)+vel);
        // Some extra logic to pause the laser while it's growing if the pause time happens in
        // this while loop and make the speed not accelerate past the original speed.
        if(vel<=speed){
            vel += accel;
        }
        if(vel<=0){
            loop(pausetime){yield;}
            accel *= -1;
        }
        yield;
    }
    ObjLaser_SetLength(obj, length);
    while(!Obj_BeDeleted(obj)){
        Obj_SetPosition(obj, Obj_GetX(obj)+cos(angle)*vel, Obj_GetY(obj)+sin(angle)*vel);
        if(vel<=speed){
            vel += accel;
        }
        if(vel<=0){
            loop(pausetime){yield;}
            accel *= -1;
        }
        yield;
    }
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Louchan on January 06, 2010, 08:42:19 PM
Hello, I'm new here and to Danmakufu as well, and I would like some help.
I just got Danmakufu from the official website and I've changed my computer's language to Japanese, but the program just won't work. It crashes as soon as I start it. What's wrong?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Hat on January 07, 2010, 12:50:19 AM
What's your computer's specs? Sometimes it haet older computer models.

Also, try using Applocale. It saves headaches in the long run. Google it, it's a microsoft thing.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on January 07, 2010, 01:14:51 AM
My advice is to change your computer's language back to English (or whatever language you usually use) and follow the advice in the AppLocale Tutorial (http://www.shrinemaiden.org/forum/index.php?topic=4138.0).
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 07, 2010, 02:38:22 AM
Is there a way to have Obj Bullets bounce off other bullets not of that id?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on January 07, 2010, 02:46:39 AM
Yes? ID should not matter.

let obj = Obj_Create(OBJ_SHOT);
ObjectArray = ObjectArray ~ [obj];

//...etc;

while(!Obj_BeDeleted(obj)){
   ascent(j in 0..length(ObjectArray)){
      if(Collision_Obj_Obj(obj, j)){
         //do shit;
      }
   }
yield;
}

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fetch()tirade on January 07, 2010, 02:58:15 AM
When attempting to create a shot and or laser that would bounce off the walls several times before disappearing, is it easier to change the angle of the shot using Obj_SetAngle or just making another shot entirely? Here's a sample of the code below, where the shot changes once before leaving the screen.

Quote

   task lolshot(x,y,v,dir,graphic,delay){
      let obj = Obj_Create(OBJ_SHOT);

      Obj_SetPosition(obj,x,y);
      Obj_SetSpeed(obj,v);
      Obj_SetAngle(obj,dir);
      ObjShot_SetGraphic(obj,graphic);
      ObjShot_SetDelay(obj,delay);
      ObjShot_SetBombResist(obj,true);

      while(!Obj_BeDeleted(obj)){
         if(Obj_GetY(obj) < GetClipMinY){
            CreateShot01(Obj_GetX(obj),Obj_GetY(obj),3,atan2(-sin(Obj_GetAngle(obj)),cos(Obj_GetAngle(obj))),AQUA23,0);
            Obj_Delete(obj);
         }
         if(Obj_GetY(obj) > GetClipMaxY){
            CreateShot01(Obj_GetX(obj),Obj_GetY(obj),3,atan2(-sin(Obj_GetAngle(obj)),cos(Obj_GetAngle(obj))),AQUA23,0);
            Obj_Delete(obj);
         }
         if(Obj_GetX(obj) < GetClipMinX){
            CreateShot01(Obj_GetX(obj),Obj_GetY(obj),3,atan2(sin(Obj_GetAngle(obj)),-cos(Obj_GetAngle(obj))),AQUA23,0);
            Obj_Delete(obj);
         }
         if(Obj_GetX(obj) > GetClipMaxX){
            CreateShot01(Obj_GetX(obj),Obj_GetY(obj),3,atan2(sin(Obj_GetAngle(obj)),-cos(Obj_GetAngle(obj))),AQUA23,0);
            Obj_Delete(obj);
         }
         yield;

      }
   }

In this excerpt, the shots are changing direction as expected, but they aren't disappearing. I can't set the kill time arbitrarily, so what do I do? I'm looking for four bounces.

Quote

   task lolshot(x,y,v,dir,graphic,delay){
      let obj = Obj_Create(OBJ_SHOT);

      Obj_SetPosition(obj,x,y);
      Obj_SetSpeed(obj,v);
      Obj_SetAngle(obj,dir);
      ObjShot_SetGraphic(obj,graphic);
      ObjShot_SetDelay(obj,delay);
      ObjShot_SetBombResist(obj,true);

      while(!Obj_BeDeleted(obj)){
         if(Obj_GetY(obj) < GetClipMinY){
            Obj_SetAngle(obj,atan2(-sin(Obj_GetAngle(obj)),cos(Obj_GetAngle(obj))));
         }
         if(Obj_GetY(obj) > GetClipMaxY){
            Obj_SetAngle(obj,atan2(-sin(Obj_GetAngle(obj)),cos(Obj_GetAngle(obj))));
         }
         if(Obj_GetX(obj) < GetClipMinX){
            Obj_SetAngle(obj,atan2(sin(Obj_GetAngle(obj)),-cos(Obj_GetAngle(obj))));
         }
         if(Obj_GetX(obj) > GetClipMaxX){
            Obj_SetAngle(obj,atan2(sin(Obj_GetAngle(obj)),-cos(Obj_GetAngle(obj))));
         }
         yield;

      }
   }
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on January 07, 2010, 03:23:23 AM
Quote

   task lolshot(x,y,v,dir,graphic,delay){
      let obj = Obj_Create(OBJ_SHOT);
     
      let counter = 0;

      Obj_SetPosition(obj,x,y);
      Obj_SetSpeed(obj,v);
      Obj_SetAngle(obj,dir);
      ObjShot_SetGraphic(obj,graphic);
      ObjShot_SetDelay(obj,delay);
      ObjShot_SetBombResist(obj,true);

      while(!Obj_BeDeleted(obj)){
         if(counter<4){
            if(Obj_GetY(obj) < GetClipMinY){
               let position = GetClipMinY - Obj_GetY(obj);
               Obj_SetY(obj, GetClipMinY + position);
               Obj_SetAngle(obj, 0 - Obj_GetAngle(obj));
               counter++;
            }
            if(Obj_GetY(obj) > GetClipMaxY){
               let position = Obj_GetY(obj) - GetClipMaxY;
               Obj_SetY(obj, GetClipMaxY - position);
               Obj_SetAngle(obj, 0 - Obj_GetAngle(obj));
               counter++;
            }
            if(Obj_GetX(obj) < GetClipMinX){
               let position = GetClipMinX - Obj_GetX(obj);
               Obj_SetY(obj, GetClipMinX + position);
               Obj_SetAngle(obj, 180 - Obj_GetAngle(obj));
               counter++;
            }
            if(Obj_GetX(obj) > GetClipMaxX){
               let position = Obj_GetX(obj) - GetClipMaxX;
               Obj_SetY(obj, GetClipMaxX - position);
               Obj_SetAngle(obj, 180 - Obj_GetAngle(obj));
               counter++;
            }
            yield;
         }
      }
   }

Fixed your reflecting code too, you needed to make up for the distance the bullet may have passed the clip, for a true "reflection". Also, I replaced your reflection calculations with a much more simplistic version.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fetch()tirade on January 07, 2010, 03:55:15 AM
lol

Tried it. It crashed. Not only that, the shots didn't bounce. I'll come back to this later, I guess.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: durdur on January 07, 2010, 04:37:28 AM
Hello ^^ i have a question: what can be done about lag while running scripts with danmakufu? in some cases (mainly during stages) the fps lowers to almost 20 ;_; Is there a way to improve this besides migrating to another computer?

Thanks in advance, again~ 
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on January 07, 2010, 05:06:11 AM
If it happens frequently then you probably should move to another computer anyways...

Open up config.exe, and wherever the 1/2 and 1/3 are, click one of those. It should speed things up, even if it starts looking a tad choppy.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Tarokarr on January 07, 2010, 05:12:40 AM
Code: [Select]
task lolshot(x,y,v,dir,graphic,delay){
let obj = Obj_Create(OBJ_SHOT);
     
let counter = 0;

Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,v);
Obj_SetAngle(obj,dir);
ObjShot_SetGraphic(obj,graphic);
ObjShot_SetDelay(obj,delay);
ObjShot_SetBombResist(obj,true);

while(!Obj_BeDeleted(obj)){
if(counter<4){
if(Obj_GetY(obj) < GetClipMinY){
let position = GetClipMinY - Obj_GetY(obj);
Obj_SetY(obj, GetClipMinY + position);
Obj_SetAngle(obj, 0 - Obj_GetAngle(obj));
counter++;
}
if(Obj_GetY(obj) > GetClipMaxY){
let position = Obj_GetY(obj) - GetClipMaxY;
Obj_SetY(obj, GetClipMaxY - position);
Obj_SetAngle(obj, 0 - Obj_GetAngle(obj));
counter++;
}
if(Obj_GetX(obj) < GetClipMinX){
let position = GetClipMinX - Obj_GetX(obj);
Obj_SetX(obj, GetClipMinX + position);
Obj_SetAngle(obj, 180 - Obj_GetAngle(obj));
counter++;
}
if(Obj_GetX(obj) > GetClipMaxX){
let position = Obj_GetX(obj) - GetClipMaxX;
Obj_SetX(obj, GetClipMaxX - position);
Obj_SetAngle(obj, 180 - Obj_GetAngle(obj));
counter++;
}
}
yield;
}
}

fixed the yield: don't just yield in an if-statement inside a while-loop  :V
fixed the borders: Use SetX-Functions for GetClipMaxX and GetClipMinX.

And btw... Hi to all, I guess?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on January 07, 2010, 06:18:28 AM
S'what I get for not testing the code
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Louchan on January 07, 2010, 11:31:42 AM
What's your computer's specs? Sometimes it haet older computer models.

Also, try using Applocale. It saves headaches in the long run. Google it, it's a microsoft thing.
Windows Vista Home Premium.
... Um, I'm not sure what else to write down.

My advice is to change your computer's language back to English (or whatever language you usually use) and follow the advice in the AppLocale Tutorial (http://www.shrinemaiden.org/forum/index.php?topic=4138.0).
Okay, I'll try it out.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Nimono on January 07, 2010, 07:08:33 PM
Windows Vista Home Premium.
... Um, I'm not sure what else to write down.

Try right-clicking the .exe and selecting Run as Administrator, if the option appears on Vista. It does for 7, where the game also crashes if you try to run it normally, but running as Administrator seems to always fix it. But of course, I've never truly used Vista, so I don't know if that option is there...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Lawence Codye on January 08, 2010, 08:56:11 AM
Try right-clicking the .exe and selecting Run as Administrator, if the option appears on Vista. It does for 7, where the game also crashes if you try to run it normally, but running as Administrator seems to always fix it. But of course, I've never truly used Vista, so I don't know if that option is there...

it does exist...I use Vista Home Premium so I know this helps it work, however Applocale is needed for it to run at all on Vista Home Premium.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on January 09, 2010, 06:27:11 AM
Does anyone know what Danmakufu returns when you divide a number by 0? ??? I'm just curious... Doubt this'll really be of any use... I tried doing something like:

frame++;
if(frame==100/0)
{
do stuff;
}

nothing happens
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Stuffman on January 09, 2010, 06:38:46 AM
Offhand, if it doesn't spit one of those moonrune errors at you, it'll probably just ignore it like it would ignore a draw command for a picture that wasn't loaded, or something like that.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on January 09, 2010, 06:50:12 AM
Does anyone know what Danmakufu returns when you divide a number by 0? ???

  @DrawLoop {
   DrawText(ToString(1/0), 180, 240, 50, 255);
  }

(http://i641.photobucket.com/albums/uu134/Nautth/snapshot029b.jpg)

Took me longer to upload the damn image than it did to write the script. We're getting pretty lazy nowadays, aren't we?

EDIT: Also, this is not the universal output for dividing by zero. Many of Danmakufu's internal functions have defaults for dividing by zero. For example, the function atan2(y, x) is defined as:

function atan2(y, x){
   if(y==0){
      if(x<0){
         return 180
      }else{
         return 0
      }
   }else{
      return 2*atan(((x^2 + y^2)^0.5 - x)/y)
   }
}


Or something like that. The point is that the function is defined seperately if y = 0, since the function is supposed to divide by y. Yet, when you just type in ToString(1/0), it comes out as dsfglf. Kind of odd that some things are defined as numbers, whereas others get weird text gibberish?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Stuffman on January 09, 2010, 07:02:43 AM
But does it say 1.#INF00 or 1.#INFOO, or possibly even 1.#INFO0? This is important.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on January 09, 2010, 07:05:34 AM
But does it say 1.#INF00 or 1.#INFOO, or possibly even 1.#INFO0? This is important.

Also, taking the logarithm of a negative number or getting the squareroot of a negative number will yield:

-1.#IND00
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on January 09, 2010, 07:32:18 AM
Kind of odd that some things are defined as numbers, whereas others get weird text gibberish?

That IS weird...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fetch()tirade on January 10, 2010, 12:53:00 AM
I want to make a value that would change the colors of the shots randomly. I was thinking that I could first define a certain set of numbers as those colors (say 601, a large number to avoid conflicts in the script,  = RED01, and so on). Then I could define the value as equal to rand_int(601,604) or however many different colors, and then it would select a different graphic when it loops. Is that at all possible? If so, how?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Stuffman on January 10, 2010, 12:59:43 AM
Make it an array.

let COLORS=[RED01,ORANGE01,etc];

Then just access random colors with COLORS[rand_int(etc,etc)]. You could use it in SetShotDataAs and stuff.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fetch()tirade on January 10, 2010, 01:19:15 AM
Oh okay. Thanks.

EDIT: Is there a square root function? I'm trying to make a distance formula, but I need the last part.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on January 10, 2010, 05:11:55 AM
Take the value to the half power. Or just download my common functions package (http://www.mediafire.com/download.php?2tnwzwjyzyz).[/self-promotion]
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on January 10, 2010, 06:19:26 AM
[/self-promotion]
:V

Oh, what is the shot way down there at the bottom left of the img\Shot.png? Is it the delay thing??

EDIT: ww I changed the ice shards to cards because they look better. w
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Azure Lazuline on January 10, 2010, 03:20:43 PM
This isn't so much of a problem as it is one that I already solved, but I can see someone potentially breaking a few keyboards over this, so I'm saying it anyway.

In the header, the script title doesn't have a built-in character limit, so it can be however long you want. However, in one case, I accidentally deleted the end bracket, which made the entire script into the title. Loaded up DMF, went into the script menu, and it crashed. No problem though, I noticed the error and fixed it... but it still crashed. Even after entirely deleting the script, it still crashed.

Turns out DMF archives script names for faster access, so it was loading the archived one, coming across the name, and blowing up. I had to delete script_index.dat to get everything to work again.

Maybe this could be added to a sticky thread somewhere? I know it's not going to be a common occurrence, but listing all possible reasons for an error (especially weird ones like this) is always welcome.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: CK Crash on January 10, 2010, 04:04:09 PM
Azure, maybe it could be added to a troubleshooting page on the DMF wiki?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on January 10, 2010, 06:26:58 PM
In a stage script, is there a way to keep the child enemies from dying when the boss enemy dies?
I'm not talking about child enemies the boss spawns or from the boss's script, but the ones spawned in the stage script, separate from the boss. They somehow automatically die if the enemy boss dies, and I want to get rid of that.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on January 10, 2010, 06:51:02 PM
In a stage script, is there a way to keep the child enemies from dying when the boss enemy dies?
I'm not talking about child enemies the boss spawns or from the boss's script, but the ones spawned in the stage script, separate from the boss. They somehow automatically die if the enemy boss dies, and I want to get rid of that.
This is just a guess but try ending the boss with VanishEnemy
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on January 10, 2010, 08:49:56 PM
In a stage script, is there a way to keep the child enemies from dying when the boss enemy dies?
I'm not talking about child enemies the boss spawns or from the boss's script, but the ones spawned in the stage script, separate from the boss. They somehow automatically die if the enemy boss dies, and I want to get rid of that.

All enemies and bullets are deleted when a spellcard ends, save for the boss. There is no way around this. You may respawn enemies and bullets the frame after if you wish, lol.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on January 11, 2010, 01:11:30 AM
There is no way around this, lol.

(http://i694.photobucket.com/albums/vv301/Mokou/face_st08an.png)
Danmakufu gets harder and harder to work with. Everytime I manage to do something new it always, ALWAYS comes back at me with an obstacle. How annoying...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on January 11, 2010, 01:34:45 AM
Well the thing is when a boss dies that's supposed to be the end of the stage right? If it's a midboss or something, you could make the rest of the stage part of a spellcard.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on January 11, 2010, 09:34:11 AM
What are you trying to accomplish? There's almost always a workaround to every limitation that Danmakufu has, even if it's very roundabout.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 11, 2010, 02:07:26 PM
Couldn't you just have the supposed boss enemy be a regular non-boss enemy? I mean, a special sprite and a magic circle ought to be enough to distinguish it from the regular enemies, and you can call CutIn in non-boss enemies.

For every attack, you'd have a singular enemy script with the same framework and which you can call with CreateEnemyFromFile. To make the transition from one boss attack to the next work properly, you'd have to use Set/GetCommonData to keep track of the boss' position and the animation data of the magic circle. This is somewhat tedious, but it seems to be possible.

If you declare a spell card, it won't end until a boss enemy dies, so you'll have to use SetText(""); in the @Finalize. I have no idea how to work around the lack of spell card bonus score, though. I mean, you can add the score manually, but the effect that usually occurs when you capture something won't occur until a boss dies.

Other than this last issue, right now I can't think of anything that cannot be worked around. If you consider that one negligible and if you are dedicated enough to type out the workarounds for the rest... well, go for it!

...  :V
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Infy♫ on January 11, 2010, 04:14:20 PM
how do I recreate the scope collision detection things from PoFV?
especially the one of medicine looks difficult to make
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on January 11, 2010, 05:31:05 PM
Effect Objects?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on January 11, 2010, 08:08:01 PM
Couldn't you just have the supposed boss enemy be a regular non-boss enemy? I mean, a special sprite and a magic circle ought to be enough to distinguish it from the regular enemies, and you can call CutIn in non-boss enemies.

I was thinking about doing that. By the way, I make my own cutins, I don't like Danmakufu's system. The magic circle and the scores, too. I make them all myself. The bonus score would be extremely easy. The only thing I have left to find out is if enemies die when the child enemy declares a spellcard and then dies. If they don't, then this might be the answer I'm looking for. If they do die, well... it's impossible without reprogramming Danmakufu.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 11, 2010, 08:19:03 PM
I was thinking about doing that. By the way, I make my own cutins, I don't like Danmakufu's system. The magic circle and the scores, too. I make them all myself. The bonus score would be extremely easy.
...thought so.  :V
Quote
The only thing I have left to find out is if enemies die when the child enemy declares a spellcard and then dies. If they don't, then this might be the answer I'm looking for. If they do die, well... it's impossible without reprogramming Danmakufu.
Well, to test this, I made a script that spawns the same non-boss enemy two times, which has a CutIn and a SetScore,  with two seconds in between each spawn. Neither of them dies when I kill the other one, so...  :V

I don't think you really have a problem anymore. Besides the position saving with the common data, anyways.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 11, 2010, 11:05:43 PM
This isnt so much a question dealing with Danmaku in Danmakufu but, when I run Danmakufu, it opens up twice, and then one closes and I use the window not closed, why is this?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: ChaoStar on January 12, 2010, 02:05:16 PM
This isnt so much a question dealing with Danmaku in Danmakufu but, when I run Danmakufu, it opens up twice, and then one closes and I use the window not closed, why is this?

Maybe you're clicking too much?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on January 12, 2010, 02:34:27 PM
Maybe you're clicking too much?
Yeah, probably that. Except sometimes I click just once.

P.S. There are only 5 impossible requests.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on January 13, 2010, 03:41:19 AM
I think I'm having a problem with the Shot Replace V4.

Every time I attempt to call it, something amiss happens.

I have it saved in lib\ExpandedShotDatav4\.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Gc on January 13, 2010, 03:48:25 AM
I think I'm having a problem with the Shot Replace V4.

Every time I attempt to call it, something amiss happens.

I have it saved in lib\ExpandedShotDatav4\.
#include_function |lib\ExpandedShotDatav4\shot_replace.dnh" before @Initialize
then ShotInit; in @Initialize ?

(I should really get to making that readme...)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Nimble on January 13, 2010, 03:13:30 PM
Some bullet questions again.
(http://images.torrentmove.com/iw/183untitled.jpg)
How can I create spiral bullet stream like this?

And how can I create bullet that bounch on each side?
From Naut's Tutorial I can make them bounch in X but when I try in Y, the bullet act very odd.
(I want them to bounching around permanently until spell brake.)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 13, 2010, 03:55:19 PM
Some bullet questions again.
(http://images.torrentmove.com/iw/183untitled.jpg)
How can I create spiral bullet stream like this?
Either with object bullets or with ShotA bullets.

for object bullets,

x, y = starting coordinates
v = speed in stream direction
ang = stream direction
delta = phase of the bullet. Putting 90 and 270 here will do what you want to do.
phi = speed of direction change
ampli = maximum velocity at a right angle to the stream direction
graph = bullet graphic
Code: [Select]
    task TBullet(x, y, v, ang, delta, phi, ampli, graph){

       let obj=Obj_Create(OBJ_SHOT);

       Obj_SetPosition(obj, x, y);
       Obj_SetAngle(obj, ang);
       Obj_SetSpeed(obj, 0);
       ObjShot_SetGraphic(obj, graph);
       ObjShot_SetDelay  (obj, 0);

       while(Obj_BeDeleted(obj)==false) {

           delta+=phi;

           Obj_SetX(obj, Obj_GetX(obj) + v*cos(ang) + ampli*sin(delta)*cos(ang+90) );
           Obj_SetY(obj, Obj_GetY(obj) + v*sin(ang) + ampli*sin(delta)*sin(ang+90) );

           Obj_SetAngle(obj, ang+90-atan( v/(ampli*sin(delta)) ) );
           yield;
       }
    }

Hmm, I gotta use a variation of that code somewhere...  :V
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on January 13, 2010, 03:56:27 PM
Some bullet questions again.
(http://images.torrentmove.com/iw/183untitled.jpg)
How can I create spiral bullet stream like this?

And how can I create bullet that bounch on each side?
From Naut's Tutorial I can make them bounch in X but when I try in Y, the bullet act very odd.
(I want them to bounching around permanently until spell brake.)

For your first question, to make the bullets curve like that, change the angle by using cos(variable) and increment the variable every frame. Use -cos to make it start the other way. For example, in that image, the blue bullets might be using cos while the red ones use -cos so that they crisscross each other. I believe the bullets are also just being shot at 3 different angles.

For your second question, use 180-Obj_GetAngle(obj) for when the bullets bounce off the left and right, and use 360-Obj_GetAngle(obj) for when the bullets bounce off the top and bottom.

EDIT: Lol, ninja'd
EDIT: Lol, extraneous calculations for SetX and SetY that are completely unnecessary. :V
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 13, 2010, 04:03:10 PM
For your second question, use 180-Obj_GetAngle(obj) for when the bullets bounce off the left and right, and use 360-Obj_GetAngle(obj) for when the bullets bounce off the top and bottom.

or just use -Obj_GetAngle(obj)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 13, 2010, 04:09:43 PM
EDIT: Lol, extraneous calculations for SetX and SetY that are completely unnecessary. :V
D'OH!
*facepalm*

Apparently, it is true that my mind makes everything unneccessarily complicated...


...but my version offers more flexibility on how exactly you want the bullet to flow, and you can do other awesome stuff with it. I am so gonna use a variation of this bullet in the project I am working on (not the one for the contest).  :V
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on January 13, 2010, 06:59:55 PM
#include_function |lib\ExpandedShotDatav4\shot_replace.dnh" before @Initialize
then ShotInit; in @Initialize ?

(I should really get to making that readme...)
:V Oh, I just had it capitalized incorrectly.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on January 14, 2010, 03:49:13 AM
Sorry for double-post, but I can't say I'm sure if this would get noticed.
Code: [Select]
task redshot{
let red = Obj_Create(OBJ_SHOT);
Obj_SetPosition(red,GetX,GetY);
Obj_SetSpeed(red,0);
Obj_SetAngle(red,0);
ObjShot_SetGraphic(red,RED01);
wait(120);
Obj_SetAngle(red,atan2(GetPlayerY-Obj_GetY(red),GetPlayerX-Obj_GetX(red)));
Obj_SetSpeed(red,1);
}
The intended effect is to have the bullets pause for 2 seconds and then move directly towards the player. Instead, they just hang there (but it added so much stress, I'm making it part of the card. Who says mistakes are all bad?)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on January 14, 2010, 03:54:12 AM
Your wait function is probably oddly defined, or you're missing yield; in your @MainLoop. Switch wait(120); with loop(120){yield;}, if both of those checks didnt do anything.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on January 14, 2010, 04:06:38 AM
Your wait function is probably oddly defined, or you're missing yield; in your @MainLoop. Switch wait(120); with loop(120){yield;}, if both of those checks didnt do anything.

Huh, none of those worked...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on January 14, 2010, 04:07:39 AM
poooooaaassstt sssscrrrraaaapppttt
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on January 14, 2010, 04:16:23 AM
Code: [Select]
#TouhouDanmakufu
#Title[Assault Wall "Geisterwand"]
#Text[Boxed in by bullets!]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{

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

@Initialize{
SetLife(1000);
SetDamageRate(0,0);
SetTimer(90);
SetScore(1000);
SetMovePosition01(GetCenterX,GetCenterY-90,5);
LoadGraphic(imgBoss);
ShotInit;
CutIn(KOUMA,"Assault Wall "\""Geisterwand"\","",0,0,0,0);
mainTask;
}

@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{
//randomly choose a type of wall at the start
let walltype = rand_int(1,4);
wait(120);
yield;
//Cast Geisterwand Defense
Ghost;
loop{
alternative(walltype)
case(1){
blue;
}
case(2){
red;
}
case(3){
yellow;
}
case(4){
green;
}
others{yield}
wait(90);
walltype = rand_int(1,4);
yield;
}
}

task blue{
let startside = rand_int(1,3);
alternative(startside)
case(1){
CreateEnemyFromScript("BlueWall",0,rand_int(0,480),0,0,1);
}
case(2){
CreateEnemyFromScript("BlueWall",rand_int(0,448),0,0,0,2);
}
case(3){
CreateEnemyFromScript("BlueWall",448,rand_int(0,480),0,0,1);
}
others{}
yield;
}

task red{
let startside = rand_int(1,3);
alternative(startside)
case(1){
CreateEnemyFromScript("RedWall",0,rand_int(0,480),0,0,1);
}
case(2){
CreateEnemyFromScript("RedWall",rand_int(0,448),0,0,0,2);
}
case(3){
CreateEnemyFromScript("RedWall",448,rand_int(0,480),0,0,3);
}
others{}
yield;
}

task yellow{
let startside = rand_int(1,3);
alternative(startside)
case(1){
CreateEnemyFromScript("YlwWall",0,rand_int(0,480),0,0,1);
}
case(2){
CreateEnemyFromScript("YlwWall",rand_int(0,448),0,0,0,2);
}
case(3){
CreateEnemyFromScript("YlwWall",448,rand_int(0,480),0,0,1);
}
others{}
yield;
}

task green{
let startside = rand_int(1,3);
alternative(startside)
case(1){
CreateEnemyFromScript("GreenWall",0,rand_int(0,480),0,0,1);
}
case(2){
CreateEnemyFromScript("GreenWall",rand_int(0,448),0,0,0,2);
}
case(3){
CreateEnemyFromScript("GreenWall",448,rand_int(0,480),0,0,1);
}
others{}
yield;
}

sub Ghost{
CreateEnemyFromScript("maceFam",GetEnemyX,GetEnemyY,0,0,0);
CreateEnemyFromScript("maceFam",GetEnemyX,GetEnemyY,0,0,60);
CreateEnemyFromScript("maceFam",GetEnemyX,GetEnemyY,0,0,120);
CreateEnemyFromScript("maceFam",GetEnemyX,GetEnemyY,0,0,180);
CreateEnemyFromScript("maceFam",GetEnemyX,GetEnemyY,0,0,240);
CreateEnemyFromScript("maceFam",GetEnemyX,GetEnemyY,0,0,300);
}

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

}

//Travels in a straight line and lays down a wall of bullets
//After 2 seconds, bullets will fly at whatever the player's position was when the bullet was planted
script_enemy BlueWall{

let CSD = GetCurrentScriptDirectory;
let imgFam = CSD ~ "Materials\Graphics\DMF_fam.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";
let frame = 0;
let startside = GetArgument;

@Initialize{
SetLife(500);
SetDamageRate(50,0);
LoadGraphic(imgFam);
ShotInit;
maintask;

}

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

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

@Finalize{
DeleteGraphic(imgFam);
}

function wait(n){
loop(n){yield}
}

task maintask{
wall;
alternative(startside)
case(1){
SetMovePosition02(448,rand_int(0,480),90);
}
case(2){
SetMovePosition02(rand_int(0,448),480,90);
}
case(3){
SetMovePosition02(0,rand_int(0,480),90);
}
wait(90);
VanishEnemy;
}

task wall{
loop{
CreateShotA(1,GetX,GetY,0);
SetShotDataA(1,0,0,GetAngleToPlayer,0,0,0,BLUE01);
SetShotDataA(1,120,1,NULL,0,0,0,BLUE01);
FireShot(1);
wait(5);
yield;
}
}
}

//Travels in a straight line and lays down a wall of bullets
//After 2 seconds, bullets will fly directly at the player
script_enemy RedWall{

let CSD = GetCurrentScriptDirectory;
let imgFam = CSD ~ "Materials\Graphics\DMF_fam.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";
let frame = 0;
let startside = GetArgument;

@Initialize{
SetLife(500);
SetDamageRate(50,0);
LoadGraphic(imgFam);
ShotInit;
maintask;

}

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

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

@Finalize{
DeleteGraphic(imgFam);
}

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

task maintask{
wall;
alternative(startside)
case(1){
SetMovePosition02(448,rand_int(0,480),90);
}
case(2){
SetMovePosition02(rand_int(0,448),480,90);
}
case(3){
SetMovePosition02(0,rand_int(0,480),90);
}
wait(90);
VanishEnemy;
}

task wall{
loop{
redshot;
wait(5);
yield;
}
}

task redshot{
let red = Obj_Create(OBJ_SHOT);
Obj_SetPosition(red,GetX,GetY);
Obj_SetSpeed(red,0);
Obj_SetAngle(red,0);
ObjShot_SetGraphic(red,RED01);

while(!Obj_BeDeleted(red)){
wait(120);
Obj_SetAngle(red,atan2(GetPlayerY-Obj_GetY(red),GetPlayerX-Obj_GetX(red)));
Obj_SetSpeed(red,1);
yield;
}
}
}

//Moves in a straight line and leaves a wall of bullets
//Bullets left by YlwWall do not move, ever
script_enemy YlwWall{

let CSD = GetCurrentScriptDirectory;
let imgFam = CSD ~ "Materials\Graphics\DMF_fam.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";
let frame = 0;
let startside = GetArgument;

@Initialize{
SetLife(500);
SetDamageRate(50,0);
LoadGraphic(imgFam);
ShotInit;
maintask;

}

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

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

@Finalize{
DeleteGraphic(imgFam);
}

function wait(n){
loop(n){yield}
}

task maintask{
wall;
alternative(startside)
case(1){
SetMovePosition02(448,rand_int(0,480),90);
}
case(2){
SetMovePosition02(rand_int(0,448),480,90);
}
case(3){
SetMovePosition02(0,rand_int(0,480),90);
}
wait(90);
VanishEnemy;
}

task wall{
loop{
ylwshot;
wait(5);
yield;
}
}

task ylwshot{
let ylw = Obj_Create(OBJ_SHOT);
Obj_SetPosition(ylw,GetX,GetY);
Obj_SetSpeed(ylw,0);
Obj_SetAngle(ylw,0);
ObjShot_SetGraphic(ylw,YELLOW01);
wait(120);
yield;
}
}

//Travels in a straight line and leaves a wall of bullets
//After 2 seconds, bullets explode into randomly angled lasers
script_enemy GreenWall{

let CSD = GetCurrentScriptDirectory;
let imgFam = CSD ~ "Materials\Graphics\DMF_fam.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";
let frame = 0;
let startside = GetArgument;

@Initialize{
SetLife(500);
SetDamageRate(50,0);
LoadGraphic(imgFam);
ShotInit;
maintask;

}

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

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

@Finalize{
DeleteGraphic(imgFam);
}

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

task maintask{
wall;
alternative(startside)
case(1){
SetMovePosition02(448,rand_int(0,480),90);
}
case(2){
SetMovePosition02(rand_int(0,448),480,90);
}
case(3){
SetMovePosition02(0,rand_int(0,480),90);
}
wait(90);
VanishEnemy;
}

task wall{
loop{
greenshot;
wait(5);
yield;
}
}

task greenshot{
let lasangle = rand_int(0,359);
let green = Obj_Create(OBJ_SHOT);
Obj_SetPosition(green,GetX,GetY);
Obj_SetAngle(green,0);
ObjShot_SetGraphic(green,GREEN01);
ObjShot_SetDelay(green,0);
while(!Obj_BeDeleted(green)){
wait(120);
loop(5){
CreateLaser01(Obj_GetX(green),Obj_GetY(green),2,lasangle,20,5,GREEN21,0);
lasangle = rand_int(0,359);
}
ObjShot_FadeDelete(green);
}
}
}

//Geisterwand Mace Shield
script_enemy maceFam{

let CSD = GetCurrentScriptDirectory;
let imgFam = CSD ~ "Materials\Graphics\GeisterwandSprite.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";
let dir = GetArgument;
let r = 50;
let spin = GetArgument+87;
let frame = 0;

@Initialize{
SetLife(1);
SetDamageRate(0,0);
LoadGraphic(imgFam);
ShotInit;
maintask;

}

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

@DrawLoop{
SetTexture(imgFam);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,spin);
SetGraphicRect(0,0,30,31);
DrawGraphic(GetX,GetY);

spin+=5;

}

@Finalize{
DeleteGraphic(imgFam);
}

task maintask{
yield;
move;
}

task move{
loop{
//shoot direction of movement and 30 degrees off every 15 frames
if(frame == 7){
CreateShot01(GetX,GetY,3,dir+90,WHITE12I,0);
frame = 0;
}
SetMovePosition03(GetEnemyX+3*r*cos(dir),GetEnemyY+3*r*sin(dir),20,10);
dir+=5;
frame++;
yield;
}
}

function wait(n){
loop(n){yield;}
}
}
Here's the whole thing. EDIT: Forgot the .png at the end of the filename.
Updated. GreenWall is supposed to shoot lasers in 5 random directions after 2 seconds.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 14, 2010, 02:14:41 PM
I don't know if this is the source of the problem, but it very well could be:

In your task, you create a variable to refer to the object id.

The name of this variable is red. Why is this a problem?
Quote
task red{
<snip>
   }
You define a variable that has the same name as a defined task. Defining two different things under the same name usually causes problems. I suggest to change every instance of red inside your redshot task to something else, like obj or gooseberry or something, maybe this will fix the problem, maybe it won't, but it is defeinitely worth a try.  ;)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Nimble on January 14, 2010, 03:23:33 PM
Thank you so much, at first I try -angle in Y but it don't bounce. Now it bounce perfectly.

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fetch()tirade on January 15, 2010, 03:05:15 AM
I'm trying to make lasers spawn lasers. So I'd create two different ones using CreateLaserblah(1,blah) twice and then use AddShot, right?

Question 1: The first one would be fired from a specific point, so the x and y are covered, but what about the second? What would I put in there?

Question 2: I'm what I'm actually attempting involves having the lasers that come from the first lasers do the same (make more lasers) over and over again, and when they do so, they disappear. Would I just have to create as many CreateLasers it takes to reach the end of the screen, or could I make a loop for that?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 15, 2010, 05:14:52 AM
I'm trying to make lasers spawn lasers. So I'd create two different ones using CreateLaserblah(1,blah) twice and then use AddShot, right?

Question 1: The first one would be fired from a specific point, so the x and y are covered, but what about the second? What would I put in there?

Question 2: I'm what I'm actually attempting involves having the lasers that come from the first lasers do the same (make more lasers) over and over again, and when they do so, they disappear. Would I just have to create as many CreateLasers it takes to reach the end of the screen, or could I make a loop for that?
Answer 1: To make the Laser spawn from the "master laser" just put 0,0 for X and YAnswer 2: I would actually ascent the id and frames after creation for that...ascent(i in 1..how many you want){CreateLaserA(1,blah)   AddShot(10*i,1,i,0);CreateLaserA(i,blah)l
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 15, 2010, 05:52:07 AM
Sorry for the Double Post,
For some reason, the scripts decides to skip @BackGround, I can not get it to show up! I know the image loads because I can put the code in DrawLoop and it shows up.
http://www.mediafire.com/?jjmritjkz55  Sorry for putting the code like this, code box or quote box do not want to work for me for some reason
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on January 15, 2010, 05:55:52 AM
If you don't add SetScore, danmakufu doesn't register it as a spell card, and it skips @BackGround.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 15, 2010, 05:59:22 AM
If you don't add SetScore, danmakufu doesn't register it as a spell card, and it skips @BackGround.
seriously?! wtf...  Im sorry that was a rude comment to make, thank you
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 15, 2010, 04:46:41 PM
Pfff, don't worry about it. Everybody went through that. When I was a newbie in Dnh I was breaking my mind why my background didn't show up. I compared a spellcard included with mine and just started deleting the lines 1 by 1. After 30min of trial & error I ended up in @initialize with SetScore.

:V You got to love those good old days.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 15, 2010, 04:50:52 PM
Wow. I stumbled upon the same problem a few days ago and came to the conclusion that I'd just have to make a stage script for every boss with an animated background...

...guess that won't be neccessary.  :V

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on January 15, 2010, 05:40:15 PM
Although! I am not sure how to eliminate the message of spell card bonus when a spell is captured. Only thing I can think of is upon Finalize, store the bonus in a variable, fail the card and implement the bonus manually. I don't want to do this.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 15, 2010, 05:45:18 PM
The way I would see how you would do that would make a variable = true; then, in MainLoop, if the player dies, set it to false, and in the finalize, if(variable = true){AddScore(bonus);}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on January 15, 2010, 06:14:44 PM
I don't know if this is the source of the problem, but it very well could be:

In your task, you create a variable to refer to the object id.

The name of this variable is red. Why is this a problem?You define a variable that has the same name as a defined task. Defining two different things under the same name usually causes problems. I suggest to change every instance of red inside your redshot task to something else, like obj or gooseberry or something, maybe this will fix the problem, maybe it won't, but it is defeinitely worth a try.  ;)

Didn't work, although I have no idea why I was using an object-bullet for yellow when I could have used a stationary CreateShot01.

Hey, I found the problem! The enemies were being Vanished before the instructions could be carried out!
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 15, 2010, 06:49:54 PM
Did another small test run;

If I copy your redshot task in a minimalist boss script and use it, the bullet works just fine (although I don't know if you wanted the bullets to re-aim at the player every 121 frames).

I'll tinker around a little more to see where the problem might be...


Edit: I think it just might be possible to fix the problem by replacing the wait(120) with a loop(120){yield; }. Danmakufu might just be stupid enough to not remember the wait function after the enemy during whose script it was defined was destroyed. If so, it would naturally either give you an error message or just cancel the task where the error through the undefined function occured.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on January 15, 2010, 06:52:34 PM
The way I would see how you would do that would make a variable = true; then, in MainLoop, if the player dies, set it to false, and in the finalize, if(variable = true){AddScore(bonus);}
I mean the really crappy text that pops up. It isn't a graphic either so you can't just black it.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 15, 2010, 06:55:43 PM
I mean the really crappy text that pops up. It isn't a graphic either so you can't just black it.

What if you blanc out the font.png ?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on January 15, 2010, 06:57:37 PM
Now that my bullets work, I'll be doing some graphics and editing in a couple more types.

But now the graphics unexpectedly cut out! AGH!

(Oh, how I fixed it: I changed every instance of Wait 90 in the movetask to Wait 210, and made them unhittable.)

EDIT: Ah, here we go. The new White type (All other types work properly) is giving me problems:
Code: [Select]
//Travels in a straight line and lays down a wall of bullets
//WhiteWall fires lasers perpendicular to the path
script_enemy WhiteWall{

let CSD = GetCurrentScriptDirectory;
let imgFam = CSD ~ "Materials\Graphics\DMF_faml.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";
let frame = 0;
let startside = GetArgument;

@Initialize{
SetLife(500);
SetDamageRate(50,0);
LoadGraphic(imgFam);
ShotInit;
maintask;

}

@MainLoop{
yield;
}

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

@Finalize{
DeleteGraphic(imgFam);
}

function wait(n){
loop(n){yield}
}

task maintask{
wall;
alternative(startside)
case(1){
SetMovePosition02(448,rand_int(0,480),90);
}
case(2){
SetMovePosition02(rand_int(0,448),480,90);
}
case(3){
SetMovePosition02(0,rand_int(0,480),90);
}
wait(210);
VanishEnemy;
}

task wall{
loop(18){
white;
wait(5);
yield;
}
}

task white{
let angle = GetAngle;
let wht = Obj_Create(OBJ_SHOT);
Obj_SetPosition(wht,GetX,GetY);
Obj_SetSpeed(wht,0);
ObjShot_SetGraphic(WHITE01);
Obj_SetAngle(wht,0);
ObjShot_SetDelay(wht,0);
while(!Obj_BeDeleted(wht)){
wait(120);
CreateLaserA(1,Obj_GetX(wht),Obj_GetY(wht),500,8,WHITE47,10);
SetLaserDataA(1,0,angle+90,0,0,0,0);
CreateLaserA(2,Obj_GetX(wht),Obj_GetY(wht),500,8,WHITE47,10);
SetLaserDataA(2,0,angle-90,0,0,0,0);
SetLaserDataA(1,20,angle+90,0,0,500,angle+90);
SetLaserDataA(2,20,angle+90,0,0,500,angle-90);
FireShot(1);
FireShot(2);
Obj_Delete(wht);
}
}
}

White is defined after Green in the code from earlier.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on January 15, 2010, 09:15:16 PM
Not necessarily a question, but Danmakufu slows down when a certain number of object effects are drawn. It may take quite a few in number, but after you do backgrounds/spell patterns/ special effects, and all the other proper things you need to do to make a custom game, the number of spare object effects and actual bullets you can use without slowing the frame rate down to 45/40 fps is severely limited. After looking into the Touhou games with the same exact effects, I couldn't help but think that the Danmakufu game engine needs some tuning up.
I mean, try doing this in Danmakufu. (http://img684.imageshack.us/img684/7157/effectf.jpg)
Doing something like that would make it run at 50fps, at the very most, and if you make it as simple as possible. Just try experimenting with the little white box-stars by turning the bullets into points. You'll see it slow down just from the player "obsorbing" them.  Can't something be done about this? A newer game engine perhaps?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Magical Girl Satori~ on January 15, 2010, 09:50:58 PM
How can you get Danmakufu to work on windows 7?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on January 15, 2010, 10:03:34 PM
How can you get Danmakufu to work on windows 7?
There's a separate thread for this.

As an actual question, I seem to be failing to understand how Created Laser As and Created Laser Bs are supposed to be deleted.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 15, 2010, 10:08:41 PM
SetShotKillTime(ID, time after creation);
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on January 15, 2010, 10:17:08 PM
Oh, I forgot about that function!
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Magical Girl Satori~ on January 15, 2010, 10:28:48 PM
oh, where?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on January 15, 2010, 10:37:01 PM
oh, where?

It should have "AppLocale" in the title
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Magical Girl Satori~ on January 15, 2010, 10:54:31 PM
Oh, yeah, that one. I tried it and it didnt work. I followed the tutorial correctly though. o-o
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on January 16, 2010, 03:57:04 AM
Is there some kind of function like set_color or shot_color for shot replace scripts? so it would be like... make a shot graphic that's grayscale then just use that to make different colored bullets? it would make things a LOT easier...
(someone should really add a list of shot replace script functions on the wiki :P)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on January 16, 2010, 04:06:11 AM
SetShotColor(red,green,blue)

There's a weakness though; if you're firing more than one bullet at the same time and they're supposed to be different colors, they'll all come out the one set with SetShotColor.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on January 16, 2010, 04:07:38 AM
There's a weakness though; if you're firing more than one bullet at the same time and they're supposed to be different colors, they'll all come out the one set with SetShotColor.
*cough* Here's an old snippet of code from some time back...
Code: (...Unless I'm doing something totally different from what you're trying to do...) [Select]
//...
task attack1 {
let a = 0; let b = 0;
loop {
loop(15) {
PlaySE("se\se_kira01.wav");
SetShotColor(255, 255, 255);
ascent(i in 0..6) { CreateShot01(GetX, GetY, 3, GetAngleToPlayer+a+i*360/6, PURPLE02, 0); }
SetShotColor(55, 55, 55);
ascent(i in 0..9) { CreateShot01(GetX, GetY, 2, GetAngleToPlayer+b+i*360/9, WHITE01, 0); }
a-=17; b-=9;
loop(2) { yield; }
}
SetMovePosition02(GetPlayerX, GetClipMinY+100+rand(-50, 50), 10);
}
}
//...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on January 16, 2010, 04:13:45 AM
There's a weakness though; if you're firing more than one bullet at the same time and they're supposed to be different colors, they'll all come out the one set with SetShotColor.

well not really...
Code: [Select]
SetShotColor(100, 100, 255);
CreateShot01(GetX, GetY, 3, GetAngleToPlayer, 1, 30);
SetShotColor(100, 255, 255);
CreateShot01(GetX, GetY, 3, GetAngleToPlayer+10, 1, 30);
it works...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on January 16, 2010, 04:14:08 AM
*cough* Here's an old snippet of code from some time back...
Code: (...Unless I'm doing something totally different from what you're trying to do...) [Select]
//...
task attack1 {
let a = 0; let b = 0;
loop {
loop(15) {
PlaySE("se\se_kira01.wav");
SetShotColor(255, 255, 255);
ascent(i in 0..6) { CreateShot01(GetX, GetY, 3, GetAngleToPlayer+a+i*360/6, PURPLE02, 0); }
SetShotColor(55, 55, 55);
ascent(i in 0..9) { CreateShot01(GetX, GetY, 2, GetAngleToPlayer+b+i*360/9, WHITE01, 0); }
a-=17; b-=9;
loop(2) { yield; }
}
SetMovePosition02(GetPlayerX, GetClipMinY+100+rand(-50, 50), 10);
}
}
//...
well not really...
Code: [Select]
SetShotColor(100, 100, 255);
CreateShot01(GetX, GetY, 3, GetAngleToPlayer, 1, 30);
SetShotColor(100, 255, 255);
CreateShot01(GetX, GetY, 3, GetAngleToPlayer+10, 1, 30);
it works...
Oh. Right. More than once per frame. Gotcha.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 16, 2010, 07:05:00 AM
Ok, how would I create like a "meter" on a player to show when a certain "thing" is ready to use? I've tried making two object effects, one for the "Meter Box" and one for the "Meter", but the player locks up on me, how would I do this?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on January 16, 2010, 07:19:02 AM
Object effects are the only way I can think of. You're probably doing something wrong. What do you mean by "the player locks up"?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 16, 2010, 07:20:26 AM
Try to select the player in the Script Menu and it crashes danmakufu
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on January 16, 2010, 08:01:43 AM
Make sure you aren't trying to create the object effects in @Initialize. If you're calling the task that makes them in @Initialize, you can just put a yield at the very beginning of the task and it should work.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 16, 2010, 05:02:02 PM
Make sure you aren't trying to create the object effects in @Initialize. If you're calling the task that makes them in @Initialize, you can just put a yield at the very beginning of the task and it should work.
BWAHAHAHAHA it still crashes...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 16, 2010, 05:13:26 PM
Post a script, then we may be able to tell you what's wrong.

Just saying "I have a script, and it doesn't work" will only give you the most general advices.


I remember that danmakufu will crash every time you select a script if the name of a folder in your player directory in has spaces between words. That probably isn't your problem as from your posts it sounds as if you had already tested your player before trying to implement your gauge, but I'll just say it anyways.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 16, 2010, 05:20:46 PM
Ok, here is the Script: WARNING! this is just me testing out how to use Obj_Shots in players, and I had this idea to make it so when the meter is full, You could slow time for a bit.
Code: [Select]
#東方弾幕風[Player]  #ScriptVersion[2]   #Menu[PPL 1]      #Text[PPL 1]      #Image[.imgossimg.png]   #ReplayName[PPL 1]
script_player_main{
let CSD = GetCurrentScriptDirectory();let PPL = CSD~"imgossimg.png";let PPLCut = CSD~"imgossimgCut.png";let frame = 0;let speed = 5;let MeterBox = CSD~"imgMeter Box.png";let Meter = CSD~"imgBar.png";let slow = false;
task   Lagger(x,y){yield;
   let obj=Obj_Create(OBJ_SHOT);   let speedd=0;   let frame1=0;
   Obj_SetPosition(obj,x,y);   ObjShot_SetGraphic(obj,3);   ObjShot_SetDamage(obj,0.1);   ObjShot_SetPenetration(obj,10);   Obj_SetAngle(obj,0);   Obj_SetSpeed(obj,speedd);   Obj_SetAlpha(obj,75);
   while(Obj_BeDeleted(obj)==false){frame1++;   if(frame1>120){speedd+=0.2; Obj_SetSpeed(obj,speedd);   Obj_SetAngle(obj,atan2(GetEnemyY-Obj_GetY(obj),GetEnemyX-Obj_GetX(obj)));}
      yield;}   Obj_Delete(obj);}

task   Da(angle){yield;let obj=Obj_Create(OBJ_SHOT); let speedd=-3; let frame1=0;
   Obj_SetPosition(obj,GetPlayerX,GetPlayerY);   ObjShot_SetGraphic(obj,2);   ObjShot_SetDamage(obj,0.5);   ObjShot_SetPenetration(obj,3);    Obj_SetAngle(obj,angle);   Obj_SetSpeed(obj,speedd);   Obj_SetAlpha(obj,75);
   while(Obj_BeDeleted(obj)==false){frame1++;   if(frame1>60){speedd+=0.2; Obj_SetSpeed(obj,speedd);}      yield;}}
task   SlowMeter{yield;let meter=Obj_Create(OBJ_EFFECT);
        ObjEffect_SetTexture(meter, MeterBox);        ObjEffect_SetPrimitiveType(meter, PRIMITIVE_TRIANGLEFAN);        ObjEffect_CreateVertex(meter, 4);
          ObjEffect_SetVertexXY(meter, 0, GetClipMaxX, GetClipMaxY-150);          ObjEffect_SetVertexUV(meter, 0, 0, 0);           ObjEffect_SetVertexXY(meter, 1, GetClipMaxX+200, GetClipMaxY-150);          ObjEffect_SetVertexUV(meter, 1, 150, 0);
          ObjEffect_SetVertexXY(meter, 2, GetClipMaxX+200, GetClipMaxY);          ObjEffect_SetVertexUV(meter, 2, 150,100);
          ObjEffect_SetVertexXY(meter, 3, GetClipMaxX, GetClipMaxY);          ObjEffect_SetVertexUV(meter, 3, 0, 100);          ObjEffect_SetLayer(meter,8);
   }
task   Bar{yield;let meter=Obj_Create(OBJ_EFFECT);let SlowMeter = 0;let deframe=false;let dframe=120;
        ObjEffect_SetTexture(meter, Meter);        ObjEffect_SetPrimitiveType(meter, PRIMITIVE_TRIANGLEFAN);        ObjEffect_CreateVertex(meter, 4);while(!Obj_BeDeleted(meter)){SlowMeter+=1;   if(SlowMeter==190){SlowMeter=190; slow=true;}   if(GetKeyState(VK_USER)==KEY_PUSH || GetKeyState(VK_USER)==KEY_HOLD){deframe=true;}   if(deframe==true){dframe--;}   if(dframe==0){dframe=0; deframe=false;}
          ObjEffect_SetVertexXY(meter, 0, GetClipMaxX+5, GetClipMaxY-65);          ObjEffect_SetVertexUV(meter, 0, 0, 0);           ObjEffect_SetVertexXY(meter, 1, GetClipMaxX+5+SlowMeter, GetClipMaxY-65);          ObjEffect_SetVertexUV(meter, 1, 150, 0);
          ObjEffect_SetVertexXY(meter, 2, GetClipMaxX+5+SlowMeter, GetClipMaxY-6);          ObjEffect_SetVertexUV(meter, 2, 150,100);
          ObjEffect_SetVertexXY(meter, 3, GetClipMaxX+5, GetClipMaxY-6);          ObjEffect_SetVertexUV(meter, 3, 0, 100);          ObjEffect_SetLayer(meter,8);}}
   @Initialize{   yield;
   SetPlayerLifeImage(PPL, 0, 0, 33, 63);   LoadGraphic(PPL);   LoadGraphic(PPLCut);   LoadGraphic(MeterBox);   LoadGraphic(Meter);   SetSpeed(speed, 2);   LoadPlayerShotData(CSD~"shotdata.txt");   SetItemCollectLine(128);
      }@MainLoop{   yield;    if(frame==20){}   if(GetKeyState(VK_SHOT)==KEY_PUSH || GetKeyState(VK_SHOT)==KEY_HOLD){frame++;   if(frame>300 && frame<400 && frame%2==0){Lagger(GetPlayerX,GetPlayerY);}   if(frame<100 && frame%3==0){ascent(i in 1..11){Da(270-5*i); Da(270+5*i);}}   if(GetKeyState(VK_USER)==KEY_PUSH && slow==true){Slow(1);}else{Slow(0);}   if(frame==500){frame=0;}CreatePlayerShot01(GetPlayerX, GetPlayerY, 18, 270, 0.5, 200, 1);}   SetIntersectionCircle(GetPlayerX, GetPlayerY, 1);   
   }@Missed{}@SpellCard{yield;
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD){UseSpellCard("rawr", true);}else{UseSpellCard("rawr", true);}
CutIn(KOUMA, "Genjutsu -Sakura-", PPLCut);            }@DrawLoop{yield;SetTexture(PPL);SetRenderState(ALPHA);SetGraphicAngle(0,0,0);SetGraphicScale(1.35,1.35);if(GetKeyState(VK_LEFT)==KEY_PUSH || GetKeyState(VK_LEFT)==KEY_HOLD){SetGraphicRect(32,0,69,62);}else if(GetKeyState(VK_RIGHT)==KEY_PUSH || GetKeyState(VK_RIGHT)==KEY_HOLD){SetGraphicAngle(180,0,0); SetGraphicRect(32,0,69,62);}else{SetGraphicRect(0,0,33,63);}
      DrawGraphic(GetPlayerX, GetPlayerY);SlowMeter; Bar;   }@Finalize{DeleteGraphic(PPL);}
}
script_spell   rawr{let Tree = GetCurrentScriptDirectory~"img.png";let petals = GetCurrentScriptDirectory~"ingpetals.png";let obj=Obj_Create(OBJ_SPELL);let obj2=Obj_Create(OBJ_SPELL);let spin = 4;         @Initialize{yield; LoadGraphic(Tree); LoadGraphic(petals); run(); }   @MainLoop{spin++; yield; }   @Finalize{DeleteGraphic(Tree);}      task   run(){yield; SetPlayerInvincibility(150); loop(10){yield;} Fire; loop(140){yield;} End;}      task   Fire{ let posx = GetEnemyX;let posy = GetEnemyY;let fwa = 0;                ObjEffect_SetTexture(obj,Tree);      ObjEffect_SetScale(obj,1,1);      ObjEffect_SetRenderState(obj,255);      ObjEffect_CreateVertex(obj,4);      ObjEffect_SetLayer(obj,1);      ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLEFAN);
   while(Obj_BeDeleted(obj)==false){yield;   posx=GetCenterX;   posy=GetCenterY;
   ObjEffect_SetVertexXY(obj,0,posx-60*2-fwa,posy-60*2-fwa);   ObjEffect_SetVertexUV(obj,0,0,0);   ObjEffect_SetVertexXY(obj,1,posx+60*2+fwa,posy-60*2-fwa);   ObjEffect_SetVertexUV(obj,1,0,512);      ObjEffect_SetVertexXY(obj,2,posx+60*2+fwa,posy+60*2+fwa);   ObjEffect_SetVertexUV(obj,2,512,512);   ObjEffect_SetVertexXY(obj,3,posx-60*2-fwa,posy+60*2+fwa);   ObjEffect_SetVertexUV(obj,3,512,0);ObjSpell_SetIntersecrionCircle(obj,posx,posy,120,20,true);      yield;}}}

EDIT:Well crap, the code box worked, but it messed it all up  >:(
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 16, 2010, 05:36:32 PM
I have quite some trouble reading through that code cluster, but could it be that you placed {} brackets in your object tasks in such a way that the script_player_main part is closed before it gets to @Initialize or something?


Wait...
Quote
#Image[.imgossimg.png]

...shouldn't that be 
Quote
#Image[.\imgossimg.png]
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on January 16, 2010, 05:42:27 PM
The hell is with you and messy code; I can't read anything in there. Do you want us to solve your problem or not?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 16, 2010, 05:48:14 PM
Look, Its not my fault the code is like that, The code box on glitches when I use it  >:(  and you didn't have to be so rude...

Here is the code LIKE IT IS: http://www.mediafire.com/?hwnndz2ztrg (http://www.mediafire.com/?hwnndz2ztrg)
WHAT THE FUCK IS UP WITH THE COLOR FONT THLASDHFLASDOAGEDIT: Fixed

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 16, 2010, 05:53:23 PM
...you have a yield in @Initialize? That could screw things up, I suppose...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 16, 2010, 05:57:20 PM
...you have a yield in @Initialize? That could screw things up, I suppose...
Still Freezes, here, let me put up the graphics and such for you guys,EDIT: Here it is: http://www.mediafire.com/?wannttdyytd
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 16, 2010, 06:23:15 PM
Quote
task   SlowMeter{ ... }
Quote
let SlowMeter = 0;
Defining two different things under the same name is not a good idea, either, although that probably isn't what causes your crashing...

Will tinker a little more after dinner. Unless someone finds the error before I'm done, that is.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 16, 2010, 06:27:41 PM
Defining two different things under the same name is not a good idea, either, although that probably isn't what causes your crashing...

Will tinker a little more after dinner. Unless someone finds the error before I'm done, that is.

oh.... *fixes* ok, it still crashes. but let me try to put it in different places
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 16, 2010, 06:54:10 PM
Your Bar task has no yield; in its while{} brackets.

Also, your slow meter doesn't even have a while{} part, so you'd want to fix that afterwards, too.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on January 17, 2010, 11:57:32 PM
Code: [Select]
#TouhouDanmakufu
#Title[-VOID-]
#Text[It can't be resisted!]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{

let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "Materials\Graphics\PlaceholderBoss.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";

@Initialize{
SetLife(1000);
SetDamageRate(25,15);
SetTimer(40);
SetScore(1000);
SetMovePosition01(GetCenterX,GetCenterY,5);
LoadGraphic(imgBoss);
CutIn(KOUMA,"VOID",0,0,0,0);
ShotInit;
mainTask;
}

@MainLoop{

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(5);
fire(GetX,GetY,GetAngleToPlayer,BLUE02);
SetMovePositionRandom01(150,50,7,0,0,GetCenterX*2,GetCenterY+50);
wait(30);
fire(GetX,GetY,270,BLUE02);
}

task fire(x,y,dir,graphic){
let expand = 0;
let lsr = Obj_Create(OBJ_LASER);
ObjShot_SetBombResist(lsr,true);
ObjShot_SetGraphic(lsr,graphic);
ObjLaser_SetWidth(lsr,5);
ObjLaser_SetLength(lsr,5);
ObjLaser_SetSource(lsr,false);
Obj_SetAngle(lsr,dir);
Obj_SetPosition(lsr,x,y);
Obj_SetSpeed(lsr,0);
while(Obj_BeDeleted(lsr)==false){
if(expand<120){
ObjLaser_SetWidth(lsr,5+expand);
ObjLaser_SetLength(lsr,5+expand);
expand+=2;
wait(1);
}else{
Obj_SetSpeed(lsr,5);
Obj_SetAngle(lsr,dir);
}
if(Obj_GetX(lsr)<0||Obj_GetX(lsr)>GetCenterX*2){
burst(Obj_GetX(lsr),Obj_GetY(lsr));
Obj_Delete(lsr);
}
if(Obj_GetY(lsr)>GetCenterY*2||Obj_GetY(lsr)<0){
burst(Obj_GetX(lsr),Obj_GetY(lsr));
Obj_Delete(lsr);
}
wait(1);
}
}

task burst(x,y){
let pentblast = rand_int(0,359);
ascent(a in 1..60){
ascent(v in 1..4){
CreateShot01(x,y,3*v,360/a,SP02,0);
}
}
}

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

}
The laser will expand to the right size, but not move. And since the whole spellcard relies on them moving...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on January 18, 2010, 04:07:28 AM
Obj_Lasers cannot move with SetSpeed. You have to manually move them with SetPosition every frame:

Obj_SetPosition(obj, Obj_GetX(obj)+cos(Obj_GetAngle(obj))*Obj_GetSpeed(obj), Obj_GetY(obj)+sin(Obj_GetAngle(obj))*Obj_GetSpeed(obj))
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on January 18, 2010, 04:57:15 AM
Hey. Haven't thought about this enough to really post about it (to my standards, means a little less than a week), but I got a lot of other things to accomplish too so whatever. I need to make sure that the red dot doesn't escape the bounded field indicated.

(http://i641.photobucket.com/albums/uu134/Nautth/asdf.jpg)

It needs to stay inside those coordinates, no matter what. I cannot use Obj_IsIntersected. The coordinates are moving every frame. I can get all five coordinates every frame. No, the red dot doesn't actually bounce (it will default to the edge of the rectangle if it goes beyond). How would I make sure that the red dot doesn't escape the rectangle? I have a manual check code in mind but I'd rather not do it that way, I'm hoping there is a more efficient way to get whether or not the red dot has left the area and thus needs to be moved back to the edge of it, some math I can do or whatever.

Any ideas? Thanks in advance.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on January 18, 2010, 06:05:15 AM
I don't see why you can't use Obj_IsIntersected with invisible object lasers that don't do collision with the player. If there's some reason that cannot be explained easily (or quickly) on why you can't use Obj_IsIntersected, the only other way would be manual checks with math. What effect are you trying to accomplish with this sort of set up? Maybe you're overthinking what's needed for that instead.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on January 18, 2010, 06:10:47 AM
shut up blargel i'm doing math



Yep. You can get the distance between the character and the line made by the two corners. Tbh I was never actually taught this, I just used it to shortcut through some questions in grade 12 >_>

The three points make a triangle. First you find the area of the triangle (Yes it's a weird formula):
triarea = abs(0.5*((x1*y2 + x2*y3 + x3*y1) - (y1*x2 + y2*x3 + y3*x1)));

Then you get the base of the triangle with the wall coordinates:
tribase = ((x2-x1)^2 + (y2-y1)^2)^0.5;

Now you can find the height of the triangle, or the distance between the character and the wall:
triheight = 2*triarea/tribase;

If you wanna be really pro you can put it in a single formula lol:
function GetDistToWall(x1,y1,x2,y2,x3,y3){
    return 2 * abs(0.5*((x1*y2+x2*y3+x3*y1)-(y1*x2+y2*x3+y3*x1))) / (((x2-x1)^2 + (y1-y2)^2)^0.5);
}


So if( GetDistToWall(enter, points, here) < 5){  back the fuck up;  } and there you go.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on January 18, 2010, 08:11:22 AM
shut up blargel i'm doing math
D:

Quote
Yep. You can get the distance between the character and the line made by the two corners. Tbh I was never actually taught this, I just used it to shortcut through some questions in grade 12 >_>

The three points make a triangle. First you find the area of the triangle (Yes it's a weird formula):
triarea = abs(0.5*((x1*y2 + x2*y3 + x3*y1) - (y1*x2 + y2*x3 + y3*x1)));

Then you get the base of the triangle with the wall coordinates:
tribase = ((x2-x1)^2 + (y2-y1)^2)^0.5;

Now you can find the height of the triangle, or the distance between the character and the wall:
triheight = 2*triarea/tribase;

If you wanna be really pro you can put it in a single formula lol:
function GetDistToWall(x1,y1,x2,y2,x3,y3){
    return 2 * abs(0.5*((x1*y2+x2*y3+x3*y1)-(y1*x2+y2*x3+y3*x1))) / (((x2-x1)^2 + (y1-y2)^2)^0.5);
}


So if( GetDistToWall(enter, points, here) < 5){  back the fuck up;  } and there you go.

That's a nice solution. If I had to think about it, I'd probably have done about 50 extra unnecessary steps to get the damn distance to the wall.
I'm totally stealing that bit of code and adding it to my library for later use.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on January 18, 2010, 04:16:20 PM
ilu i want your babies drake
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 18, 2010, 05:41:34 PM
Ohyouguys.
I don't care if Drake already solved the problem through another way. I just enjoy solving math problems too much.
Code: [Select]
let anorm;
let n1;
let n2;
let dist;

function GetDist(ox, oy, p1x, p1y, p2x, p2y){

anorm=atan2(p1y-p2y, p1x-p2x)-90;
n1=cos(anorm);
n2=sin(anorm);

// ->n = [cos(anorm), sin(anorm)] = [n1, n2]
// g:  [ox-p1x, oy-p1y]*[n1, n2]=0;

dist= ( (ox-p1x)*cos(anorm)+(oy-p1y)*sin(anorm) )/(( (n1)^2 + (n2)^2 )^0.5) ;

return dist;
}
Hooray for vectors!
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on January 18, 2010, 06:04:19 PM
Obj_Lasers cannot move with SetSpeed. You have to manually move them with SetPosition every frame:

Obj_SetPosition(obj, Obj_GetX(obj)+cos(Obj_GetAngle(obj))*Obj_GetSpeed(obj), Obj_GetY(obj)+sin(Obj_GetAngle(obj))*Obj_GetSpeed(obj))
Seems like a pain, but it's nice to know.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 18, 2010, 06:46:01 PM
Since you math gods are on a roll and steaming I better quickly ask my question:

How can I make an effect object interact with an object bullet? Let's keep it simple first. I got this square/rectangular shape. If the effect object comes near the bullets it will attract them ( like a magnet ).

Now I used this effect before for my items in my stage by using pythogoras formula. But this creates an circular radius to attract blocks. I prefer a rectangular/square to be honest.

Also coding with the player is easy because GetPlayerX/Y are usable. But when using two objects, how do I "emit" their X/Y positions? Do I use commondata which is updated each frame from both objects?

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 18, 2010, 08:00:27 PM
If you have a fixed number of these magnet objects, you just create them inside the main script so you have definite names with which you can refer to them in the Obj_GetStuff functions.

If you spawn more and more of these magnet objects as time goes by, you need an object array inside the main script. Then you can refer to each of the objects using magnet[n], for example. You can make a task or function that creates the object and then inserts the object id into the array.

I once made a code like that. There was another problem I encountered which I couldn't fix, but I think that shouldn't arise here.

Code: [Select]

let obj_x=[Obj_Create(OBJ_EFFECT)];
Obj_Delete(obj_x[0]);
let magnet=[];

task bomber(x, y){

let obj=Obj_Create(OBJ_EFFECT);
obj_x=[obj];

magnet=magnet ~ obj_x;


Obj_SetPosition(obj_x[0], x, y);
//insert the drawing stuff you want here

while(Obj_BeDeleted(obj){ etc }

}
}

If you want mathematical equations on how to program the attraction effects, I'd like you to go a little more into detail about how exactly you want it to work.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 18, 2010, 08:03:00 PM
no no, there is only 1 magnet object. So there is only 1 effect object that will live on the entire spellcard. ( only deactivating / activing itself but that is not a problem now ).

I refuse to use the MainLoop though. I know it is easier for interacting objects with eachother, but I want to pull this off with functions and tasks.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 18, 2010, 08:06:05 PM
Phew, having only one magnet to worry about makes this so much easier.

So, if you refuse to use the main loop, you can still create the object with a definite name (let's call it magnet) directly at the beginning of the script, then make a task that looks exactly like your avarage effect object task with all instances of obj replaced with magnet.

So... how do you want the magnet to work again..?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 18, 2010, 08:12:28 PM
Let me show it with a drawing. ( This shouldn't be hard, I am more like wondering how to use a rectangular collision detection instead circular =| )

(http://i49.tinypic.com/2pu03md.png)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 18, 2010, 08:19:09 PM
If you want every object to do something once it enters a square- or rectangle-formed space arounde the object, than that is not a problem at all as long as the square stays aligned to the regular x and y axes. If it spins, it gets more difficult, but then we could pretty much reuse the code(s) for Naut's problem.

If you want the bullets to be attracted towards the object no matter where they are, I am not shure what the difference between a circular and a rectangular attraction would be, aside maybe from the fact that the horizontal pull may be stronger or weaker than the vertical pull, but that would still be a piece of cake.

So...
Do you want the bullets to form a rectangular shape while being attracted? Because for that to happen you would have to spawn all bullets at the same time or the shape will be royally messed up anyways...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 18, 2010, 08:21:16 PM
If you want every object to do something once it enters a square- or rectangle-formed space arounde the object, than that is not a problem at all as long as the square stays aligned to the regular x and y axes. If it spins, it gets more difficult, but then we could pretty much reuse the code(s) for Naut's problem.

If you want the bullets to be attracted towards the object no matter where they are, I am not shure what the difference between a circular and a rectangular attraction would be, aside maybe from the fact that the horizontal pull may be stronger or weaker than the vertical pull, but that would still be a piece of cake.

So...
Do you want the bullets to form a rectangular shape while being attracted? Because for that to happen you would have to spawn all bullets at the same time or the shape will be royally messed up anyways...

It doesn't matter the bullets have to form a square shape. They can be attracted to the center or w/e. I just want them to be attracted.

The Magnet will not spin, only move around vertical or horizontal.

I want a rectangular / square collision because I perhaps want the magnet to attract from the top as well ( strong pull ) so basically if the bullet enters  this part of the rectangular, it get's pulled.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 18, 2010, 08:27:14 PM
OK...

all bullets drift towards the magnet until they are positioned on the border of a rectangle which is probably the magnet's sprite.
__
|_|

Once they've reached this position, are they attached to and move with the magnet, do they simply vanish, or does something else happen entirely?

Also, can i assume that the magnet is wider than it is high?

*starts working on code*
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 18, 2010, 08:37:09 PM
They don't have to dock with the with the magnet's border. Like I said, they can be pulled to the center. The rectangular / square shape is purely intended for the collision detection. Else I could just use the regular attraction code.

And correct, once they are "Caught" by the magnet, they will be moving alone with the magnet. As long as it stays active ( again this can be easy done with tasking ). I want to get in the pulling first + sticking. Secondary behaviour later.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 18, 2010, 08:55:07 PM
Ah, so the attraction is circular and just the collision detection is that of a rectangle?

Can't you simply give each object a variable that checks wether or not it is attached and one variable each for the relative x and y position towards the magnet after the attachment, then use something like...

let's assume the magnet is 100 pixels long and 60 pixels high, okay?

Code: [Select]
let att=false;
let attx=0;
let atty=0;

if(att==false){
if(Obj_GetX(obj)<(Obj_GetX(magnet)-50)||Obj_GetX(obj)>(Obj_GetX(magnet)+50)){
Obj_SetX(obj, Obj_GetX(obj) + v*cos(atan2(Obj_GetY(magnet)-Obj_GetY(obj), Obj_GetX(magnet)-Obj_GetX(obj))) );
} else{ attx=Obj_GetX(obj)-Obj_GetX(magnet); }
if(Obj_GetY(obj)<(Obj_GetY(magnet)-25)||Obj_GetY(obj)>(Obj_GetY(magnet)+25)){
Obj_SetY(obj, Obj_GetY(obj) + v*sin(atan2(Obj_GetY(magnet)-Obj_GetY(obj), Obj_GetX(magnet)-Obj_GetX(obj))) );
} else{ atty=Obj_GetY(obj)-Obj_GetY(magnet); }
}

if(attx!=0&&atty!=0){
Obj_SetSpeed(obj, 0);
att=true;
if(attx<50&&attx>0){attx=50; }
if(attx>-50&&attx<0){attx=-50; }
if(atty<30&&atty>0){atty=30; }
if(atty>-30&&atty<0){atty=-30; }

}

if(att==true){
Obj_SetPosition(obj, Obj_GetX(magnet)+attx, Obj_GetY(magnet)+atty);
}

The only thing halfway mathematically complicated in here is the circular attraction itself, really. Now to test this out, wait a moment...

Edit: Okay, the code works. The circular attraction is not partiuclarly pretty, I have to admit, but the bullets attach to the magnet exactly the way they should.


So... where do we go from here?
...wait, there's still an error...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 18, 2010, 09:21:06 PM
But where do I declare the Magnet effect object? I assume you all wrote this using the mainloop?   =S
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 18, 2010, 09:22:55 PM
Code: [Select]

script_enemy_main{


let magnet=Obj_Create(OBJ_SHOT);
Obj_SetPosition(magnet, GetCenterX, GetCenterY-64);
Obj_SetAngle(magnet, 80);


task bullet(x, y, v1, v, ang){

let att=false;
let attx=0;
let atty=0;

let obj=Obj_Create(OBJ_SHOT);

Obj_SetPosition(obj, x, y);
Obj_SetAngle(obj, ang);
Obj_SetSpeed(obj, v1);
ObjShot_SetGraphic(obj, RED01);
ObjShot_SetDelay  (obj, 0);

let tangle=0;


while(Obj_BeDeleted(obj)==false){


if(att==false){
if(Obj_GetX(obj)<(Obj_GetX(magnet)-50)||Obj_GetX(obj)>(Obj_GetX(magnet)+50)){
Obj_SetX(obj, Obj_GetX(obj) + v*cos(atan2(Obj_GetY(magnet)-Obj_GetY(obj), Obj_GetX(magnet)-Obj_GetX(obj))) );
} else{ attx=Obj_GetX(obj)-Obj_GetX(magnet); }
if(Obj_GetY(obj)<(Obj_GetY(magnet)-25)||Obj_GetY(obj)>(Obj_GetY(magnet)+25)){
Obj_SetY(obj, Obj_GetY(obj) + v*sin(atan2(Obj_GetY(magnet)-Obj_GetY(obj), Obj_GetX(magnet)-Obj_GetX(obj))) );
} else{ atty=Obj_GetY(obj)-Obj_GetY(magnet); }
}

if(attx!=0&&atty!=0){
  Obj_SetSpeed(obj, 0);
  att=true;
   if(attx<50&&attx>0){attx=50; }
   if(attx>-50&&attx<0){attx=-50; }
   if(atty<30&&atty>0){atty=30; }
   if(atty>-30&&atty<0){atty=-30; }
}

if(att==true){
Obj_SetPosition(obj, Obj_GetX(magnet)+attx, Obj_GetY(magnet)+atty);
}

yield;
}


}


@MainLoop { }

//etc.

There is still an error which I have to fix, though. Please wait warmly until the edit is ready.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 18, 2010, 09:38:51 PM
Oh wow, one never stops learning. I didn't knew you could write the   let magnet = blabla (Obj_Shot)/Effect at the top as global so it can be used to call  Obj_GetX(magnet) inside other tasks.

lololololowwwwwwwwwwwwwww I feel suddenly so stupid XD

( waits warmly for your edit before going to bed )
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 18, 2010, 09:55:32 PM
Moep. Moeeeeeeeeeeeeeeeeeeeep.

I'm too tired and cannot think straight anymore right now. Got up today at 5 in the morning and have to do it again tomorrow, so, no edit for you tonight, sorry.

You can still simply cut the
Code: [Select]
   if(attx<50&&attx>0){attx=50; }
   if(attx>-50&&attx<0){attx=-50; }
   if(atty<30&&atty>0){atty=30; }
   if(atty>-30&&atty<0){atty=-30; }
part from the code I posted, and it should work. It just won't work perfectly. I don't like it if somethng doesn't work perfectly.   :-X

Bah, you'll see for yourself. Maybe someone more competent will have solved this issue by the time I return from work tomorrow. Being in the same time zone shure does help with the correspondence, though.

Good night.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 18, 2010, 10:00:05 PM
I appreciate your time. I'll look into it tommorow. If all fails, we'll just drop back commondata or something and such.

I am also off to bed.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on January 19, 2010, 04:48:23 AM
Alright, finishing up my stage...
Is there a way to load boss enemies, child enemies, and all of their sound effects/images/other files before spawning them within a stage script?

I noticed there's a slight pause just before a boss or child enemy spawns. After they spawn once, though, that pause is gone and you can re-load them hundreds of times without that split-second delay between each one. I want to know if there's a way to load them all without actually spawning them, similar to how ZUN does it in before each Touhou stage. Is there a way to do it in Danmakufu?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on January 19, 2010, 04:59:04 AM
?? (http://www.shrinemaiden.org/forum/index.php?topic=242.msg18301#msg18301)

Loading graphics and sound/music is the only thing you can do.

Well fuck my shit then :(
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on January 19, 2010, 05:01:29 AM
Alright, finishing up my stage...
Is there a way to load boss enemies, child enemies, and all of their sound effects/images/other files before spawning them within a stage script?

I noticed there's a slight pause just before a boss or child enemy spawns. After they spawn once, though, that pause is gone and you can re-load them hundreds of times without that split-second delay between each one. I want to know if there's a way to load them all without actually spawning them, similar to how ZUN does it in before each Touhou stage. Is there a way to do it in Danmakufu?
Spawn them all at the beginning of the script maybe? (and then immediately kill them or something)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Azure Lazuline on January 19, 2010, 05:15:20 AM
CompileEnemyFromFile (http://dmf.shrinemaiden.org/wiki/index.php?title=Stage_Script_Functions#CompileEnemyFromFile)? I never used it, but it should work. Failing that, just call all the enemies off-screen at the beginning and SetLifeZeroToAllEnemy next frame.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on January 19, 2010, 07:01:00 AM
CompileEnemyFromFile(enemyFilePath);

Do it for every enemy you plan to use for that stage. When the stage is over, and nothing is on the screen, don't forget to clear the cache storing the enemy's information so that it doesn't eat up massive amounts of memory in the long run.

ClearByteCodeCash

(Yes, cash, not cache)

As a side note, I don't believe bosses can be compiled beforehand. Also I swear to god clearing the byte code cache crashes my game every so often for no apparent reason. It could be something else, but since it happens right at the end of the stage, it's gotta either be the common data or the clearing of the byte code cache. And I really doubt common data will cause Danmakufu to crash considering how much I used it before. Perhaps ClearByteCodeCash is only supposed to be called in @Finalize and not at the end of a task...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 19, 2010, 12:57:56 PM
Iryan, I approached it on a different way. You are using SetPosition, but I am using SetAngle.

Obj_SetAngle(obj, atan2(Obj_GetY(magnet)-Obj_GetY(obj),Obj_GetX(magnet)-Obj_GetX(obj)));  inside the boxed collision statement and the bullets will change their angle to the magnet.

You can even set two collision boxes, like 1 which attracts the bullet and an inner box that sets the speed to 0, aka stuck to the magnet.

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 19, 2010, 01:56:57 PM
Aha...

Well, I was using Obj_SetPosition so that you could have the magnet merely intefere with the regular movement of the bullet because I thought that was what you wanted to do. Ideally I then would have made the force of attraction increase as then bullet gets closer to the magnet, mimicking how attraction works in real-life physics.

However, yesterday I was merely working on the "properly-getting-stuck-to-the-magnet", and now I am going to make it work properly! FOR SCIENCE!

*goes of to the script folder*

Mmh, seems I was really tired yesterday. I seem to have confused the x and y axes with each other several times...  :V
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on January 19, 2010, 02:01:55 PM

As a side note, I don't believe bosses can be compiled beforehand.

That's fine, all my boss enemies are child enemies, because CreateEnemyBoss was causing too many problems. Too many unwanted default stuff, like clearing the screen of all enemies at boss death.   
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 19, 2010, 02:20:03 PM
Uuuh, Helepolis?

*cough* *cough*

Code: [Select]
let magnet=Obj_Create(OBJ_SHOT);
Obj_SetPosition(magnet, GetCenterX, GetCenterY-64);
Obj_SetAngle(magnet, 80);

let mdx=50; //half the width of the magnet, change value as you please
let mdy=30; //half the width of the magnet, change value as you please

task bullet(x, y, v1, v, ang){

let att=false;
let attx=0;
let atty=0;

let obj=Obj_Create(OBJ_SHOT);

Obj_SetPosition(obj, x, y);
Obj_SetAngle(obj, ang);
Obj_SetSpeed(obj, v1);
ObjShot_SetGraphic(obj, RED01);
ObjShot_SetDelay  (obj, 0);

let tangle=0;


while(Obj_BeDeleted(obj)==false){

tangle=atan2(Obj_GetY(magnet)-Obj_GetY(obj), Obj_GetX(magnet)-Obj_GetX(obj));

if(att==false){
if(Obj_GetX(obj)<(Obj_GetX(magnet)-50)||Obj_GetX(obj)>(Obj_GetX(magnet)+50)){
Obj_SetX(obj, Obj_GetX(obj) + v*cos(tangle) );
} else{ attx=Obj_GetX(obj)-Obj_GetX(magnet); }
if(Obj_GetY(obj)<(Obj_GetY(magnet)-25)||Obj_GetY(obj)>(Obj_GetY(magnet)+25)){
Obj_SetY(obj, Obj_GetY(obj) + v*sin(tangle) );
} else{ atty=Obj_GetY(obj)-Obj_GetY(magnet); }
}

if(attx!=0&&atty!=0){
  Obj_SetSpeed(obj, 0);
  att=true;


if(tangle<atan2(-mdy, -mdx)&&tangle>atan2(-mdy, mdx)){ atty=-mdy;}
if(tangle<atan2(-mdy, mdx)&&tangle>atan2(mdy, mdx)){ attx=mdx;}
if(tangle<atan2(mdy, mdx)&&tangle>atan2(mdy, -mdx)){ atty=mdy;}
if(tangle<atan2(mdy, -mdx)&&tangle>180){ attx=-mdx;}
if(tangle<(-180)&&tangle>atan2(-mdy, -mdx)){ attx=-mdx;}
}

if(att==true){
Obj_SetPosition(obj, Obj_GetX(magnet)+attx, Obj_GetY(magnet)+atty);
}

yield;
}


}

BITCHES!

 8)

Yeah, it really wasn't that difficult, afterall. I was just too tired to tell the x-axis from the y-axis.  :V

On a side note, I'd like to recommend "Skyforger" by Amorphis (http://www.youtube.com/watch?v=QKGm441XmYI). Perfect for listening to while coding something. Just look at the lyrics.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 19, 2010, 02:26:47 PM
I see Iryan. Seems like you were overflowing the science part while I wanted an easy attraction. I'll see the code tonight. Thanks for the help.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on January 19, 2010, 04:40:21 PM
CompileEnemyFromFile(enemyFilePath);

Do it for every enemy you plan to use for that stage.
It's not working too well for me. Maybe I'm not doing it right? Can you give me an example with a stage script and enemy? Something that loads a large sound or image file, to have noticable pause when it spawns without the compileenemyfromfile function.

It doesn't have to do anything. I just want to see what I'm doing wrong.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on January 19, 2010, 08:36:44 PM
It's not working too well for me. Maybe I'm not doing it right? Can you give me an example with a stage script and enemy? Something that loads a large sound or image file, to have noticable pause when it spawns without the compileenemyfromfile function.

It doesn't have to do anything. I just want to see what I'm doing wrong.

I can already tell you what you're doing wrong from that text. You don't load sound or graphics in an enemy script if it's just a regular enemy since they probably won't be accessed in single or plural. CompileEnemyFromFile only compiles the behavior of the enemy, not load the graphics and sounds.  Load all your sounds and graphics that you'll use for the regular enemies at the beginning of the stage and delete them at the end of the stage. For the boss (even if it's how you're doing it with normal enemies), you can leave it how it is if you plan to allow the single or plural scripts that make it up be run separately.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on January 19, 2010, 09:45:00 PM
Load all your sounds and graphics that you'll use for the regular enemies at the beginning of the stage and delete them at the end of the stage.

How will I be doing that? If I put in let image=whatever.png; LoadGraphic(image);/etc in the stage script, will the child enemies correspond with that? Or am I missing some secret here?

My guess is to somehow make the sound and image files common data files in the stage script and then calling them in the child enemies. But I don't know how to properly approach this.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Janitor Morgan on January 20, 2010, 04:13:01 AM
I appear to be having problems getting some images to appear.
Code: [Select]
let ImgBoss = ".\img\stg3enm.png";
let BossCutIn = ".\img\face_03_00.png";

    @Initialize {
SetScore(1000000);
SetLife(1);
SetTimer(60);
Concentration01(80);
SetDurableSpellCard;

LoadGraphic(ImgBoss);
LoadGraphic(BossCutIn);

CutIn(YOUMU, "card name here", BossCutIn, 0, 0, 128, 512);
SetMovePosition02(GetCenterX, GetClipMinY + 120, 120);
    }

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

    @DrawLoop {
SetTexture(ImgBoss);
SetGraphicRect(0, 0, 48, 64);
DrawGraphic(GetX, GetY);       
    }
BossCutIn appears as a large white rectangle, while the boss's sprite doesn't show up at all. I checked the images themselves, as well as Iryan's Parallax Sign script from the last contest that called a large moon as the cutin, and they seem to work fine.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on January 20, 2010, 04:23:50 AM
Try using GetCurrentScriptDirectory instead of .
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Janitor Morgan on January 20, 2010, 04:29:42 AM
That fixed it. Thanks.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on January 20, 2010, 05:00:47 AM
OK, so I recently downloaded Concealed the Conclusion's Spell Card collection somewhere. Now I just can't try the spell card.
//Never mind, I fixed it.

(Plus, some of the Last Words are fucking missing.)
//

EDIT: Oh no, we'll be needing a new topic AGAIN soon!
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on January 20, 2010, 06:59:54 AM
How will I be doing that? If I put in let image=whatever.png; LoadGraphic(image);/etc in the stage script, will the child enemies correspond with that? Or am I missing some secret here?

My guess is to somehow make the sound and image files common data files in the stage script and then calling them in the child enemies. But I don't know how to properly approach this.

You can still put let image = whatever.png; in your enemy scripts. And then you just use SetTexture(image); and all that stuff like usual. The only difference is, you also put let image = whatever.png; inside the stage script too and let the stage do all the loading and deleting.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 20, 2010, 02:47:19 PM
How would someone, re-create Reimu A's Bomb from UFO? Wolud you just make a Obj Spell and just fire them up? I have issues making more than 1 spell obj.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: DgBarca on January 20, 2010, 03:19:41 PM
Actually, I have already did it (http://www.mediafire.com/?yz3itumc2my).
Put the power of the player is a bit...not balanced...ze.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 20, 2010, 05:34:33 PM
Actually, I have already did it (http://www.mediafire.com/?yz3itumc2my).
Put the power of the player is a bit...not balanced...ze.

Curses!, Ill have to take a look at this when I get home....
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on January 20, 2010, 08:11:48 PM
You can still put let image = whatever.png; in your enemy scripts. And then you just use SetTexture(image); and all that stuff like usual. The only difference is, you also put let image = whatever.png; inside the stage script too and let the stage do all the loading and deleting.

I don't see how you can do that. Can you give an example?
Remember, what I'm trying to do is take away that loading time when the enemy spawns. If defining and loading sounds/images in stage scripts make it all happen before the stage starts, I'm fine with it. But if it loads again when the enemies themselves spawn, this is useless for me. I need the stage to run fluently.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 20, 2010, 08:45:17 PM
You put the commands that define the variable names for the file paths both at the beginning of your stage and of your boss script. You know,
Code: [Select]
let BossImg = GetCurrentScriptDirectory~ "BossSprite.png";
let sfx_shot = GetCurrentScriptDirectory~ "Shotsound.wav";
That kind of stuff. That way, you can reference the files in both scripts easily.

You then put the commands that load and delete the files into the @Initialize and @Finalize of only the stage script.
Code: [Select]
LoadGraphic(BossImg);
LoadSE(sfx_shot);

DeleteGraphic(BossImg);
DeleteSE(sfx_shot);
That way you will load all the files at the beginning of the stage and not during the initialization of the boss.

Because they are already loaded you can use them inside the boss script without additional loading, and because you defined the variables for the file path in the boss script you can refer to these loaded files quickly in your code.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 20, 2010, 08:48:55 PM
CreateDebugWindow;  is your biggest friend if you want to know sure if the stuff is loaded or deleted. Blargel adviced me to use it, now I cannot do without it.

If only the bloody window would not keep resizing itself when you exit Dnh.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on January 20, 2010, 08:53:01 PM
I don't see how you can do that. Can you give an example?
Remember, what I'm trying to do is take away that loading time when the enemy spawns. If defining and loading sounds/images in stage scripts make it all happen before the stage starts, I'm fine with it. But if it loads again when the enemies themselves spawn, this is useless for me. I need the stage to run fluently.

Okay I guess my explanation sucks so I'm just gonna write some code.

First the enemy:
Code: [Select]
script_enemy_main {
    let enemySprite = GetCurrentScriptDirection ~ "whatever.png";
    @Initialize{
        // No LoadGraphic here.
        SetLife(200);
        // Whatever else you wanna do.
    }

    @MainLoop{
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 32);
        // Whatever else.
    }

    @DrawLoop{
        // Use DrawLoop as normal.
        SetTexture(enemySprite);
        SetGraphicRect(0, 0, 64, 64);
        DrawGraphic(GetX, GetY);
    }

    @Finalize{
        // No DeleteGraphic here.
        // Everthing else is normal.
    }
}

And now the stage:
Code: [Select]
script_stage_main{
    let enemy1 = GetCurrentScriptDirectory ~ "enemy1.txt";
    let enemy1Sprite = GetCurrentScriptDirectory ~ "whatever.png"; // same whatever.png that the enemy used for its variable enemySprite

    @Initialize{
        LoadGraphic(enemy1Sprite);
        CompileEnemyFromFile(enemy1);
        StageTask;
    }

    @MainLoop{
        yield;
    }

    @BackGround{
    }

    @Finalize{
        DeleteGraphic(enemy1Sprite);
        ClearByteCodeCash;
    }

    task StageTask{
        Wait(60);
        CreateEnemyFromFile(enemy1, GetCenterX, GetClipMinY, 1, 90, 0);
        Wait(60);
        ascent(i in 0..5){
            CreateEnemyFromFile(enemy1, GetCenterX-100+i*50, GetClipMinY, 1, 90, 0);
        }
    }

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

Assuming I wrote this example correctly, if you used to have a lot of different graphics and sound being loaded during the enemy creation which was causing slow down when they were being summoned, that slow down should now be only when you load the stage up during @Initialize and so there won't be anything to load anymore when the enemies get spawned. The downside to this is if you want to allow the enemies to be accessed outside of a stage script, in which case they won't have the graphics and sound loaded and won't display.

EDIT: Also, a handy way to load graphics in one go in a stage is to define the graphics in an array and use an ascent to call LoadGraphic on each one. Since you don't need to reference the images except for loading in the stage, it doesn't matter if you can't really tell which element in the array corresponds to what image.
Code: [Select]
let GCSD = GetCurrentScriptDirectory;
let Graphics = [
    GCSD ~ "graphic1.png",
    GCSD ~ "graphic2.png",
    GCSD ~ "graphic3.png",
    GCSD ~ "graphic4.png",
    GCSD ~ "graphic5.png",
    GCSD ~ "graphic6.png",
    GCSD ~ "graphic7.png",
    GCSD ~ "graphic8.png",
    GCSD ~ "graphic9.png"
];
@Initialize{
    ascent(i in 0..length(Graphics)){
        LoadGraphic(Graphics[i]);
    }
}
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on January 20, 2010, 08:59:36 PM
explanation

What about LoadUserShotData? I just tried what you explained and it worked very nicely. But LoadUserShotData made danmakufu crash when I loaded in @init
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on January 20, 2010, 09:05:03 PM
LoadUserShotData should be called in every enemy. That's the only thing you can't load in a stage script, which actually makes sense if you think about it. This let's you use different shot data for different enemies so that the 255 id limit isn't AS annoying (but it still is annoying  :'()
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on January 20, 2010, 09:14:51 PM
LoadUserShotData should be called in every enemy. That's the only thing you can't load in a stage script, which actually makes sense if you think about it. This let's you use different shot data for different enemies so that the 255 id limit isn't AS annoying (but it still is annoying  :'()

It just couldn't be that easy.... Of course there'd be a catch. There's always, ALWAYS a catch.
Maybe I could get rid of it by loading the png for the shot data, hopefully that will be enough.

On a side note, when I use the debug window, the loaded scripts are on the very right bar, right? Why doesn't compileenemyfromfile function load them into it?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on January 20, 2010, 09:37:31 PM
It just couldn't be that easy.... Of course there'd be a catch. There's always, ALWAYS a catch.
Maybe I could get rid of it by loading the png for the shot data, hopefully that will be enough.

On a side note, when I use the debug window, the loaded scripts are on the very right bar, right? Why doesn't compileenemyfromfile function load them into it?

Nothing is ever easy in Danmakufu, I thought we learned this already. :V

As for the debug window, all I know is that the first tab displays which images and sounds you've loaded or failed to load, and the second tab displays frame rate, number of bullets on the screen, and any information the script is outputting with the OutputDebugString function. I haven't even looked in the other tabs yet. :V
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 20, 2010, 10:11:10 PM
lol. Texture, Sound and Script tabs are like the most important as they show what is currently being inside the memory of dnh. How the hell you never looked into these.

I AM DISAPPOINTED IN YOU BLARGEL =|
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on January 20, 2010, 10:24:18 PM
I have never used the debug window before. Am I a disappointment?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Fujiwara no Mokou on January 21, 2010, 12:09:04 AM
Looks like that did the trick.
Thanks for the help, it's running so smoothly now, there's absolutely no pause whatsoever.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Suikama on January 21, 2010, 03:50:01 AM
I have never used the debug window before. Am I a disappointment?
...there's a debug window?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on January 21, 2010, 04:11:30 AM
I have never used the debug window before. Am I a disappointment?
There's a debug window?
Or what Sonic Zero said
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 21, 2010, 06:17:34 AM
I shall save everyone the pain of my "god teir" and MSPaintastic pictures by ripping sprites to use in my picture!
I want to recreate this sort of

(http://i600.photobucket.com/albums/tt84/Happyhobo810/Plan.jpg)
I would post the script to this but unfortunalty I got mad at it and Deleted it off the face of the Universe...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on January 21, 2010, 06:18:31 AM
lol. Texture, Sound and Script tabs are like the most important as they show what is currently being inside the memory of dnh. How the hell you never looked into these.

I AM DISAPPOINTED IN YOU BLARGEL =|

Oh that's what they do. Explains why I never use then, my stuff never gets big enough for me to become unable to keep track of what's supposed to be loaded already in my head. The first tab is all I need to tell me if the stuff is loaded correctly or not.

I have never used the debug window before. Am I a disappointment?
...there's a debug window?
There's a debug window?
Or what Sonic Zero said
Yes. Use it. It's helpful.

Looks like that did the trick.
Thanks for the help, it's running so smoothly now, there's absolutely no pause whatsoever.

Sweet, glad to help.


I shall save everyone the pain of my "god teir" and MSPaintastic pictures by ripping sprites to use in my picture!
I want to recreate this sort of effect(http://i600.photobucket.com/albums/tt84/Happyhobo810/Plan.jpg)[font='times new roman']I would post the script to this but unfortunalty I got mad at it and Deleted it off the face of the Universe...[/font]
I have no idea what the hell that image is supposed to be depicting.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on January 21, 2010, 06:27:45 AM
oh hey guys I made ellipses just wanted to let you know

task ellipse{
    let a = 0;
    let dist;
    loop(36){
        dist = ((sin(a))^2+(2*cos(a))^2)^0.5;
        CreateShot01(GetEnemyX,GetEnemyY,2/dist,a,YELLOW04,12);
        a += 10;
    }
}


as in, perfect ellipses
you can angle them
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on January 21, 2010, 06:47:52 AM
Yay Drake!


>task


>not sub




 >:(
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on January 21, 2010, 06:54:52 AM
I'm expanding it for my own purposes, you silly
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 21, 2010, 08:41:06 AM
I have no idea what the hell that image is supposed to be depicting.
Looks like splitting bullets.

@Demonman, Use CreateShotA with AddShot or use Object bullets and spawn the splitting bullets in there. What ever makes you happy.

@ Everybody else with Debug window. Call CreateDebugWindow; inside @initialize in your stage or first card inside plural and the window will pop up. The only sucky part is it's size not sticking.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 21, 2010, 02:08:02 PM
Its pretty much one fires, three more fire at the opposite angle, and then a mess come out, I decided to put the code back together and this is it, but for some reason Only 1 bullet comes from the first card but the mess of them come out the last!
Code: [Select]
CreateShotA(0,GetX,GetY,10);    SetShotDataA(0,0,3,angle,0,-0.05,0,WHITE56); ascent(l in 1..5){ AddShot(80,0,1+l,0); CreateShotA(1+l,0,0,0); SetShotDataA(1+l,0,3,rand(0,360)*l,0,-0.1,-2,WHITE56); ascent(o in 1..11){ AddShot(80,1+l,6+o,0); CreateShotA(6+o,0,0,0); SetShotDataA(6+o,0,5,angle-50+10*o,0,-0.25,-2,RED56);
Well, the code box is something... at least it didnt totally butcher the code...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 21, 2010, 03:59:33 PM
So I have this script file in which I handled the graphical effects for the boss fight I am working on. That way I can simply use #include_script and a single defined task in each seperate boss attack and make all scripts much more clear.

5 scripts are done and everything worked fine until now. So far, so good.

However, now I tried to make a script that spawns a child enemy to which the same graphical effects shall aplly. However, when I run the script, I get an error. The task defined in the included script is apparantly not defined. Neither are the variables.

The only possible explanations for me would be that
a) #include_script doesn't work in child enemies, or that
b) you cannot call #include_script in the same file more than once, even if it is in seperate script_enemy parts.

Does anybody know about this issue? I mean, I guess I could simply put the relevant stuff from the included script directly into the child enemy script, but I would like to have clarity on this issue...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 21, 2010, 04:01:38 PM
Its pretty much one fires, three more fire at the opposite angle, and then a mess come out, I decided to put the code back together and this is it, but for some reason Only 1 bullet comes from the first card but the mess of them come out the last!
Code: [Select]
CreateShotA(0,GetX,GetY,10);    SetShotDataA(0,0,3,angle,0,-0.05,0,WHITE56); ascent(l in 1..5){ AddShot(80,0,1+l,0); CreateShotA(1+l,0,0,0); SetShotDataA(1+l,0,3,rand(0,360)*l,0,-0.1,-2,WHITE56); ascent(o in 1..11){ AddShot(80,1+l,6+o,0); CreateShotA(6+o,0,0,0); SetShotDataA(6+o,0,5,angle-50+10*o,0,-0.25,-2,RED56);
Well, the code box is something... at least it didnt totally butcher the code...

I have no idea what the hell you are trying to do. Horizontal scrollbar = bad.

You do it like this >.<

CreateShotA(1,x,y,delay);
SetShotDataA(1,blablabla.....);
CreateShotA(2,x,y,d);
SetShotDataA(2,blablablabal....);
FireShot(1);
AddShot(time,1,2,0);

Afaik, it is like this =.=   fires bullet ID: 2  from  the first bullet ( aka splitting )
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 21, 2010, 04:03:06 PM
You have to add the child shot before you fire the main shot. This is important.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 21, 2010, 04:05:52 PM
The only possible explanations for me would be that
a) #include_script doesn't work in child enemies, or that
b) you cannot call #include_script in the same file more than once, even if it is in separate script_enemy parts.

Where are you calling this include_file? Inside the stage or the spellcard itself?

Because, I am calling included scripts from the same file ( spellcard with familiars ) and even some files twice. Script_Enemy  are considered separate from Script_Enemy_Main and there for should not collide with each other.

I don't know what exactly you are trying to do, but technically calling stuff should be possible. Please elaborate more

Example how I have a spellcard:
Code: [Select]
script_enemy_main {
    #include_function "script\DanceContest\functions\systemloader.txt"
}

script_enemy shaker{
    #include_function "script\DanceContest\functions\superfams.txt"
}
(systemloader is basically including 5 scripts at once, which superfams is one of those scripts. So technically I am calling the same file twice here and no errors. So there is something that Danmakufu does not like when you are calling it twice.)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 21, 2010, 04:15:47 PM
I am calling the #include_script at the beginning of the script_enemy{} portions outside the @ parts. Afaik, that's where one is supposed to define variables and tasks relevant for the entire script.
Code: [Select]
#TouhouDanmakufu
#Title[New Test L New 3]
#Text[Test]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {

#include_script ".\add\Filename.txt";

<snip>

}
//---------------
script_enemy CLONE{

#include_script ".\add\Filename.txt";
<snip>

}
The boss enemy then creates one child enemy in the @MainLoop when the ever-increasing timer variable frame reaches the value of -120.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 21, 2010, 04:54:09 PM
That is odd, outside the @ blocks is what I do as well. That should work. =|  Can you show the content perhaps of your  include_script?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 21, 2010, 05:13:07 PM
Nothing too troublesome, it worked perfectly fine in all previous scripts afterall. Just some variable and task definitions for animation, and a movement function definition. None of the variable or task names are used to name other things in my scripts.

Code: [Select]
let img_trail= GetCurrentScriptDirectory ~"add\Trail.png";
let img_sword= GetCurrentScriptDirectory ~"add\SwordTest.png";

let animate=0;
let animate_sword=0;
let animate_attack=0;


function rush(distance, time, bleft, btop, bright, bbottom){

let doit=0;
let angle=0;
while(doit==0){
angle=rand(0, 360);
if( GetX+distance*cos(angle)>bleft
&& GetY+distance*sin(angle)>btop
&& GetX+distance*cos(angle)<bright
&& GetY+distance*sin(angle)<bbottom ){ doit=1; }
}
SetMovePosition02(GetX+distance*cos(angle), GetY+distance*sin(angle), time);

}

task GhostWisp{

let visibility=128;
let size=0.5;

let obj=Obj_Create(OBJ_EFFECT);
Obj_SetAlpha(obj, visibility);
Obj_SetPosition(obj, GetX+rand(-10,10), GetY+rand(10,25));
ObjEffect_SetTexture(obj,img_trail);
ObjEffect_SetRenderState(obj, ADD);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLEFAN);
ObjEffect_SetLayer(obj, 1);

while(Obj_BeDeleted(obj)==false){

Obj_SetY(obj, Obj_GetY(obj)+1);
size=size*0.98;
visibility-=2;

if(visibility==0){ Obj_Delete(obj); }

ascent(i in 0..5){
ObjEffect_SetVertexColor(obj,i,visibility,255,255,255);
}

ObjEffect_SetVertexUV(obj,0,0,0);
ObjEffect_SetVertexUV(obj,1,21,0);
ObjEffect_SetVertexUV(obj,2,21,29);
ObjEffect_SetVertexUV(obj,3,0,29);

ObjEffect_SetVertexXY(obj,0,-11.5*size,-14.5*size);
ObjEffect_SetVertexXY(obj,1,11.5*size,-14.5*size);
ObjEffect_SetVertexXY(obj,2,11.5*size,14.5*size);
ObjEffect_SetVertexXY(obj,3,-11.5*size,14.5*size);

yield;
}
}

task GhostTrail{

LoadGraphic(img_trail);
LoadGraphic(img_sword);

loop{
yield;
GhostWisp;
}

}


task TSwAnim(t1, t2, t3){

loop(t1){ animate_sword+=164/t1; yield; }
loop(t2){ yield; }
loop(t3){ animate_sword-=164/t3; yield; }

}
GhostTrail is usually run in the @Intialize. In my child script I ran GhostWisp manually in the @MainLoop once the @Initialize has passed, so I neither load the graphics mulitple times, nor am I creating an EffectObject in @Initialize.

I don't think there is any content here that could cause these problems...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 21, 2010, 05:25:32 PM
I am confused =|  I don't see anything odd indeed. Assuming you are saying it worked all fine before in your scripts. I think you should apply trial and error here. Make backup, disable all functions/tasks you are trying to achieve and enable them step by step untill you hit the task/function/code that causes the error.

Aside from that I seriously don't see anything weird here except some doubting about GhostTrail but I don't know how it is all bound together with your main scripts.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 21, 2010, 05:53:55 PM
I copypasted the exact same line I used in the main script where it works just fine, and if the filename was invalid danmakufu would spit out an error about this, which it doesn't. The script's existence is acknowledged, yet the script is not included.

However, if I delete the #include_script and every reference to its data from the main enemy, the #include_script works just fine.

If I make a text file that has no other line but the #include_script, then include THAT script, it still tells me the stuff is not defined.

If I copy the script and call #include_script on the copy, which is identical except for the file name, everything works.


Conclusion:
Danmakufu doesn't recognize a repeated #include_script command, even if it is repeated in an entirely different section of the script.

*facepalm*

But hey, the script works now, so screw this nonsensical limitation. Now to tinker with that spell card...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 21, 2010, 05:56:53 PM
I copypasted the exact same line I used in the main script where it works just fine, and if the filename was invalid danmakufu would spit out an error about this, which it doesn't. The script's existence is acknowledged, yet the script is not included.

However, if I delete the #include_script and every reference to its data from the main enemy, the #include_script works just fine.

If I make a text file that has no other line but the #include_script, then include THAT script, it still tells me the stuff is not defined.

If I copy the script and call #include_script on the copy, which is identical except for the file name, everything works.


Conclusion:
Danmakufu doesn't recognize a repeated #include_script command, even if it is repeated in an entirely different section of the script.

*facepalm*

But hey, the script works now, so screw this nonsensical limitation. Now to tinker with that spell card...

=.= Oh god what? FFFFF. At this rate we need another thread called: "Weird fucked up things Danmakufu does not like".

Last time I was raging hard why my EnemyMarker would not show up on IRC. Then someone said to reverse the order of MagicCircle and SetEnemyMarker.

Example:
   MagicCircle(false);
   SetEnemyMarker(true);
Shows no magiccircle, but shows marker. But if you somehow write it like this:

   SetEnemyMarker(true);
   MagicCircle(false);
It will show no enemy marker at all.

Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Azure Lazuline on January 21, 2010, 07:03:42 PM
Setting MagicCircle(false) automatically turns off the enemy marker, so since you set the marker beforehand, it turned it off. Still stupid, I know, but at least there's a reason.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 21, 2010, 08:16:46 PM
There is no reason. They use different textures even. Danmakufu is just stupid as hell :V I was seriously raging hard until you told me to swap them.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 22, 2010, 04:52:30 AM
Ok, I am having issues with my stage code, in plain terms, the folder is set up like this"
Prisimriver\Lyrica\Lyrica.txt

But Lyrica.txt is a plural, which contains:
Lyrica 01.txt
Lyrica 02.txt
Lyrica S1.txt
Lyrica 03.txt

And each contain Data.txt which is called in each Script, via #include_function,Data.txt is located in the Prisimriver main folder, as is the Stage Script.

The Problem is that when I run the stage, it crashes saying that there is an error with Data.txt, but it works fine in the Single Files, and Crashes in the Plural file, its strange....
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on January 22, 2010, 05:19:40 AM
If it works in the Single files, there's nothing wrong with the single files, what does your Plural look like? Perhaps you're doing something strange there. Post up the plural and I'll take a look.

Also, about your code block problem how it mangles your code's spacing and line breaks, what operating system and what editor are you using? If you're on Windows and using NotePad++, you might be saving your files in the wrong format. Go to Format -> Convert to Windows Format and everything you copypaste from there should have line breaks in the correct place again outside of NotePad++.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 22, 2010, 05:24:31 AM
Posting Please Wait Warmly....
#TouhouDanmakufu[Plural]
#Title[Lyrica Boss]
#ScriptPathData
#ScriptPath[.\Lyrica\Lyrica 01.txt]
#ScriptPath[.\Lyrica\Lyrica 02.txt]
#ScriptNextStep
#ScriptPath[.\Lyrica\Lyrica S1.txt]
#ScriptPath[.\Lyrica\Lyrica 03.txt]
#EndScriptPathData
There is the Plural,
Uh....Windows, And I use just regular Notepad.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: KrackoCloud on January 22, 2010, 05:55:40 AM
Okay, so there's nothing too wrong with this spellcard, but something is a bit peculiar.
I suggest you take a simple test run first.
Scroll down to "task Flowercenter" and find "//spores"

Code: [Select]
#TouhouDanmakufu
#Title[Flower sp]
#Text[Description]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{

///

#include_function "lib\SHOT_REPLACE\shot_replace.dnh"

function wait(let frames){ loop(frames){yield;} }

///

let sprite = "script\img\ExRumia.png";
let Cutin = "";

let fr = 0;

//////////

@Initialize{
shotinit;

LoadGraphic(sprite);
SetLife(5000);
SetDamageRate(100, 100);
SetTimer(50);
SetInvincibility(30);

CutIn(YOUMU, "X Sign "\""X"\", Cutin, 0, 0, 0, 0);

SetScore(500000);
SetEnemyMarker(true);

Concentration01(60);
MagicCircle(true);

SetEffectForZeroLife(180, 100, 1);

SetMovePosition02(GetCenterX, GetCenterY - 100, 30);

SetShotAutoDeleteClip(100,100,100,100);

Flowers;
}

//////////

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

fr++;

yield;
}

//////////

@DrawLoop{
SetColor(255,255,255);
SetRenderState(ALPHA);
SetTexture(sprite);
SetGraphicRect(64,1,127,64);
DrawGraphic(GetX,GetY);
}

@Finalize{
DeleteGraphic(sprite);
}

//////////

task Flowers{
let tr_ang = GetAngleToPlayer+15;
let ang = 0;

wait(60);

loop{
tr_ang = GetAngleToPlayer-20;
loop(10){
loop(6){
Petal(tr_ang, ang, 20, 1, YELLOW02);
FlowerCenter(tr_ang, ang, 20, 1, GREEN05);
ang += 360/6;
}
tr_ang += 360/10;
}
wait(120);
tr_ang = GetAngleToPlayer+20;
loop(10){
loop(6){
Petal(tr_ang, ang, 20, -1, RED02);
FlowerCenter(tr_ang, ang, 20, -1, YELLOW05);
ang += 360/6;
}
tr_ang += 360/10;
}
wait(120);
}
yield;
}

//////////

task Petal (tr_ang, ang, radius, spin, graphic){
let obj = Obj_Create(OBJ_LASER);

let speed = 1;

Obj_SetPosition (obj, GetX+radius*cos(tr_ang), GetY+radius*sin(tr_ang) );
Obj_SetSpeed (obj, 0);
Obj_SetAngle (obj, ang);
ObjShot_SetGraphic (obj, graphic);
ObjShot_SetDelay (obj, 10);
ObjShot_SetBombResist (obj, true);

ObjLaser_SetLength (obj, 0);
ObjLaser_SetWidth (obj, 40);
ObjLaser_SetSource (obj, false);

while(!Obj_BeDeleted(obj) ){
if(ObjLaser_GetLength(obj) < 80){
ObjLaser_SetLength (obj, ObjLaser_GetLength(obj) +2);
}
if(speed<3){
speed += 0.01;
}

Obj_SetPosition (obj, GetX + radius*cos(tr_ang), GetY + radius*sin(tr_ang) ); //movement
radius += speed;
tr_ang += 0.2 * spin;

Obj_SetAngle (obj, Obj_GetAngle(obj) + (1*spin) ); //flower rotation
yield;
}
}

//////////

task FlowerCenter (tr_ang, add_ang, radius, spin, add_graphic){
let o2 = Obj_Create(OBJ_SHOT);

let speed = 1;
let count = 0;

Obj_SetPosition (o2, GetX+radius*cos(tr_ang), GetY+radius*sin(tr_ang) );
Obj_SetSpeed (o2, 0);
Obj_SetAngle (o2, 0);
ObjShot_SetGraphic (o2, YELLOW02);
ObjShot_SetDelay (o2, 10);
ObjShot_SetBombResist (o2, true);

while(!Obj_BeDeleted(o2) ){
count++;

if(count==50){ //spores.
CreateShot01(Obj_GetX(o2), Obj_GetY(o2), 0.5, rand_int(0,359), add_graphic, 2);
}

if(speed<3){ //acceleration
speed += 0.01;
}

Obj_SetPosition (o2, GetX + radius*cos(tr_ang), GetY + radius*sin(tr_ang) ); //movement
radius += speed;
tr_ang += 0.2 * spin;

if(Obj_GetX(o2) < GetClipMinX-20){ //out-of-screen deletion
Obj_Delete(o2);
}
if(Obj_GetX(o2) > GetClipMaxX+20){
Obj_Delete(o2);
}
if(Obj_GetY(o2) < GetClipMinY-20){
Obj_Delete(o2);
}
if(Obj_GetY(o2) > GetClipMaxY+20){
Obj_Delete(o2);
}

yield;
}
}

//////////

}


Note how the flower centers release around six "spores."
Strangely, I don't believe I have any loop that would make them release six. Rather, each flower should only shoot one.
Like I said before, the end result is pretty tolerable. I should be able to just loop my CreateShot01 twice to get 12 spores per flower, which would be more ideal in the spellcard, but... It just wouldn't be right. Could someone explain why this is happening?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on January 22, 2010, 06:00:34 AM
Code: [Select]
         loop(6){
            Petal(tr_ang, ang, 20, 1, YELLOW02);
            FlowerCenter(tr_ang, ang, 20, 1, GREEN05);
            ang += 360/6;
         }

Found in your Flowers task. Since it's looping 6 times, it's creating 6 flower centers, each one giving off one spore.

EDIT: Demonbman: I can't figure out the problem in your script from what you posted on IRC, sorry.  :-\
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Infy♫ on January 22, 2010, 12:27:17 PM
so how do i set the player's bombs, from a stage script?
i have only found a way to set lives, but nothing for bombs >:|
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on January 22, 2010, 12:49:53 PM
Write your own function that uses common data. Then update it in the player script. First thing that comes to mind for me if there's really no way to do it in the normal Danmakufu functions.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Infy♫ on January 22, 2010, 02:00:18 PM
When I use FadeOutMusic, the song wont start playing after I do PlayMusic again...
How do I solve this problem?!
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 22, 2010, 02:51:44 PM
EDIT: Demonbman: I can't figure out the problem in your script from what you posted on IRC, sorry.  :-\

Could you please, explain what Naut ment by "absolute file paths" ?

Edit: Oh, Hi Naut...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Iryan on January 22, 2010, 02:52:59 PM
@ Demonbman

Are your plural file, the seperate attacks and the Data.txt all in the same folder? It just might be that danmakufu doesn't read the path description properly if the single and plural files are in different directories, especially when using .\ instead of GetCurrentScriptDirectory~.

Edit:
The reason I don't want you to use absolute path names (relative to th_dnh) is because people will extract files differently, and thus have different path names than what is on your computer. The script will error if you have used them, and it pisses me the fuck off when I have to dick through your scripts to find every absolute path name you've declared and change it to something that works on my computer. If you use relative path names, then it will always work no matter how anybody extracts your files.
Also this. So much this.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on January 22, 2010, 03:03:26 PM
An absolute file path means that it is relative to your root directory (in this case, th_dnh).
script\bosses\holyshit.txt is an absolute file path, it is relative to th_dnh.exe.

A relative file path means that it gets the file path relative to the file you're calling it in. For example, if you have a text file in the folder script\bosses called dicks.txt, and you want to communicate to holyshit.txt for whatever reason, you can call it in an #include_function by saying:
.\holyshit.txt
The .\ gets the current directory of the file it's called in (just like GetCurrentScriptDirectory), and then follows the rest of the path name to the file you've specified. So in this case, it will find the directory that dicks.txt is in, and then find holyshit.txt in the same directory.

The reason I don't want you to use absolute path names (relative to th_dnh) is because people will extract files differently, and thus have different path names than what is on your computer. The script will error if you have used them, and it pisses me the fuck off when I have to dick through your scripts to find every absolute path name you've declared and change it to something that works on my computer. If you use relative path names, then it will always work no matter how anybody extracts your files.



so how do i set the player's bombs, from a stage script?
i have only found a way to set lives, but nothing for bombs >:|

while(GetPlayerBombCount>1){
    AddBomb(-1);
}

When I use FadeOutMusic, the song wont start playing after I do PlayMusic again...
How do I solve this problem?!

Delete the music file after it has successfully faded out, then reload it.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 22, 2010, 04:03:55 PM
An absolute file path means that it is relative to your root directory (in this case, th_dnh).
scriptossesholyshit.txt is an absolute file path, it is relative to th_dnh.exe.

A relative file path means that it gets the file path relative to the file you're calling it in. For example, if you have a text file in the folder scriptosses called dicks.txt, and you want to communicate to holyshit.txt for whatever reason, you can call it in an #include_function by saying:
.holyshit.txt
The . gets the current directory of the file it's called in (just like GetCurrentScriptDirectory), and then follows the rest of the path name to the file you've specified. So in this case, it will find the directory that dicks.txt is in, and then find holyshit.txt in the same directory.

The reason I don't want you to use absolute path names (relative to th_dnh) is because people will extract files differently, and thus have different path names than what is on your computer. The script will error if you have used them, and it pisses me the fuck off when I have to dick through your scripts to find every absolute path name you've declared and change it to something that works on my computer. If you use relative path names, then it will always work no matter how anybody extracts your files.


So I pretty much have to include a copy of Data.txt in each Folder?
Because I has three seperate folders and they all have the same problem
scipt\Prisimrivers\
Lyrica\L01, LO2 etc..
Lunasa\L01, LO2 etc..
Merlin\M01, MO2 etc..
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on January 22, 2010, 05:40:16 PM
Not necessarily. You can put the Data.txt file in the Prisimrivers folder outside of any of the specific sisters' folders. Then in any script you want to include the Data.txt into, you can put

#include_function ".\..\Data.txt"

The .\ as Naut already explained behaves like GetCurrentScriptDirectory. The ..\ on the other hand basically means "go back one folder". Now I haven't actually used this technique myself, but I've seen it used by other people before.

Also, do you realize that you're spelling their last name wrong? It's Prismriver last time I checked.  :V
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 23, 2010, 04:46:29 AM
Not necessarily. You can put the Data.txt file in the Prisimrivers folder outside of any of the specific sisters' folders. Then in any script you want to include the Data.txt into, you can put

#include_function "...Data.txt"

The . as Naut already explained behaves like GetCurrentScriptDirectory. The .. on the other hand basically means "go back one folder". Now I haven't actually used this technique myself, but I've seen it used by other people before.

Also, do you realize that you're spelling their last name wrong? It's Prismriver last time I checked.  :V

hmm...this ... thing might become in handy...cool
Prisimriver...Prismriver...........oh curses  :-X
EDIT: Oh, now it raises and error with cutin.txt.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Helepolis on January 23, 2010, 04:24:37 PM
The only time you are allowed to use absolute pathnames is when you release entire dnh folder in one go.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Demonbman on January 23, 2010, 05:04:26 PM
---------------------------ScriptError---------------------------「{」「}」の対応がとれていない部分があります。↓
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{


let angle = 90;
let angleacc = 0;
let bossimg = GetCurrentScriptDi
~~~---------------------------
OK 
 ---------------------------

I do not get what this error means, It appeared when I ran a Plural Script, but If I put the stuff like #Title and # Text in the Single Script, it still raises and error, but before I removed the #Title and Text, It worked perfectly...
Never Mind, I fixed It
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on January 24, 2010, 10:59:17 PM
I keep forgetting the dimensions of the field, which is important for the next spellcard I'm making.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Gc on January 24, 2010, 11:49:49 PM
I keep forgetting the dimensions of the field, which is important for the next spellcard I'm making.
384x448
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on January 25, 2010, 12:31:15 AM
384x448

That's the size of the area the player can move in; I need the dimensions of the enitre game screen (which includes some bits the player can't move around in. Don't include the frame).

Probably my fault, I needed to be moar specific.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Areylie on January 25, 2010, 12:35:08 AM
(GetCenterX*2,GetCenterY*2)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: AweStriker Nova on January 25, 2010, 12:49:21 AM
(GetCenterX*2,GetCenterY*2)

How did I not think of that?

Next question: Can I use Obj_IsIntersected to check for collisions with the player? I'll worry about that one later; more pressing matters are at hand.
Code: [Select]
task LayoutSet{
HoriWall(GetCenterX*2/5,GetCenterX*2/5,GetCenterX*2/5,WHITE47);
HoriWall(GetCenterX*6/5,GetCenterX*2/5,GetCenterX*2/5,WHITE47);
HoriWall(GetCenterX*2/5,GetCenterY*2-GetCenterX*2/5,GetCenterX*2/5,WHITE47);
HoriWall(GetCenterX*6/5,GetCenterY*2-GetCenterX*2/5,GetCenterX*2/5,WHITE47);
HoriWall(GetCenterX*4/5,GetCenterY+GetCenterX/5,GetCenterX*2/5,WHITE47);
HoriWall(GetCenterX*4/5,GetCenterY-GetCenterX/5,GetCenterX*2/5,WHITE47);
VertWall(GetCenterX*2/5,GetCenterX*2/5,GetCenterY*2-GetCenterX*4/5,WHITE47);
VertWall(GetCenterX*6/5,GetCenterX*2/5,GetCenterY*2-GetCenterX*4/5,WHITE47);
VertWall(GetCenterX*4/5,GetCenterY+GetCenterX/5,GetCenterX*2/5,WHITE47);
VertWall(GetCenterX*4/5,GetCenterY-GetCenterX/5,GetCenterX*2/5,WHITE47);
}

task HoriWall(x,y,length,graphic){
let hwall = Obj_Create(OBJ_LASER);
Obj_SetPosition(hwall,x,y);
Obj_SetAngle(hwall,0);
ObjShot_SetGraphic(hwall,graphic);
ObjLaser_SetLength(hwall,length);
ObjLaser_SetWidth(hwall,10);
ObjLaser_SetSource(hwall,false);
ObjShot_SetBombResist(hwall,true);
ObjShot_SetDelay(hwall,60);
}

task VertWall(x,y,length,graphic){
let vwall = Obj_Create(OBJ_LASER);
Obj_SetPosition(vwall,x,y);
Obj_SetAngle(vwall,90)
ObjShot_SetGraphic(vwall,graphic);
ObjLaser_SetLength(vwall,length);
ObjLaser_SetWidth(vwall,10);
ObjLaser_SetSource(vwall,false);
ObjShot_SetBombResist(vwall,true);
ObjShot_SetDelay(vwall,60);
}

task ReflectPod(angle){
let reflect = Obj_Create(OBJ_SHOT);
Obj_SetPosition(reflect,GetX,GetY);
Obj_SetAngle(reflect,angle);
ObjShot_SetGraphic(reflect,ORANGE02);
Obj_SetSpeed(reflect,1);
ObjShot_SetBombResist(reflect,true);
Obj_SetCollisionToPlayer(reflect,false);
while(!Obj_BeDeleted(reflect)){
if(Collision_Obj_Obj(reflect,hwall)==true{
Obj_SetAngle(reflect,-angle);
}
if(Collision_Obj_Obj(reflect,vwall)==true{
Obj_SetAngle(reflect,180-angle);
}
if(Obj_GetX(reflect)<=0||Obj_GetX(reflect)>=GetCenterX*2){
Obj_SetAngle(reflect,180-angle);
}
if(Obj_GetY(reflect)<=0||Obj_GetY(reflect)>=GetCenterY*2){
Obj_SetAngle(reflect,-angle);
}
if(reflecttime==2700){
explosion(Obj_GetX(reflect),Obj_GetY(reflect));
Obj_Delete(reflect);
}
reflecttime++;
wait(1);
}
}

On attempting to run a script with this section of code in it, I get the following:
---------------------------
ScriptError「C:\Users\ASN\Downloads\th_dnh\script\AweScript\ReflectionSniper.txt」
---------------------------
hwallは未定義の識別子です(392行目)

         if(Collision_Obj_Obj(reflect,hwall)==true{
            Obj_SetAngle(reflect,-angle);
         }
         if(Collision_Obj_Obj(reflect,vwall)
~~~
---------------------------
OK   
---------------------------
I know there are several hwalls in play by the time this will happen. What's wrong?

(LayoutSet is run once at the beginning of the card. ReflectPod is run at regular intervals.)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Drake on January 25, 2010, 06:16:12 AM
They have to be defined in the same task. hwall isn't a variable inside of ReflectPod, just in HoriWall.



I have effects such as the red magic circle that are with the boss at all times. However, every time an attack is finished and another starts, the circle resets to the default angle and does the startup animation. I want it to have fluid motion throughout the entire fight. In addition, at the end of the fight, many effects freeze (object effect freeze on finalize) or disappear (child enemies). This is also very bad and must be avoided.

A totally possible solution is adding CommonData and passing it between attacks. But this is a retarded cop-out solution to this and I don't want to have to deal with it.

The other solution would be to create an entirely separate enemy. Although obviously if it's set as a child enemy, it will disappear like the rest. I presume that it would be possible to have the effects controlled by the parent enemy and control the main boss as the child, but the problem is that plural files cannot be passed through the Create series and other miscellaneous problems arise.

How the hell would I do this?
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Stuffman on January 25, 2010, 06:44:48 AM
Pass boss position to commondata constantly, and make the circle into part of the stage @background?

Also I am pretty sure it is impossible to avoid the freeze on @finalize if it's part of the boss.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on January 25, 2010, 09:23:34 AM
Also I am pretty sure it is impossible to avoid the freeze on @finalize if it's part of the boss.

is it possible to just put
if(GetLife<1){Obj_Delete(whatever);}
???

it's extremely rare that you're able to get the enemy's life to 0.___ anyway... I'm just not that sure if that'll be able to delete it before the enemy dies...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on January 25, 2010, 01:43:27 PM
is it possible to just put
if(GetEnemyLife<1){Obj_Delete(whatever);}
???

it's extremely rare that you're able to get the enemy's life to 0.___ anyway... I'm just not that sure if that'll be able to delete it before the enemy dies...
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Kylesky on January 25, 2010, 02:49:53 PM
whoops... sorry ;D
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on January 26, 2010, 01:30:06 AM
is it possible to just put
if(GetLife<1){Obj_Delete(whatever);}
???

it's extremely rare that you're able to get the enemy's life to 0.___ anyway... I'm just not that sure if that'll be able to delete it before the enemy dies...

So rare that it's not possible. When the life of an enemy is less than 1, it proceeds to @Finalize and then deletes the enemy. I know people think "when the enemy has 0 or less than 0 life", but it's actually when the enemy has anything less than 1.



@Drake:
Make it an object effect if it isn't one already, spawn it through the stage (like the explosion effects and items), use GetEnemyX, GetEnemyY, while(IsBossExisting){}, etc. If the circle runs through the stage's yield tree it won't freeze on the boss' @Finalize.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Azure Lazuline on January 26, 2010, 01:35:47 AM
Also, before someone says it, checking if GetLife<2 won't work either. If the enemy has, say, 3 health and your shot does 2.1 or more damage, then that check won't be executed. There's really no way to achieve what you want without using common data.

(Also, a small note regarding something this reminded me of. The @Missed loop in player scripts runs once per frame while the player is dead, not just once. So if you have problems with the hitbox freezing, homing shots going straight, etc. during the death animation, just stick yield; in @Missed.)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on January 26, 2010, 01:42:21 AM
(Also, a small note regarding something this reminded me of. The @Missed loop in player scripts runs once per frame while the player is dead, not just once. So if you have problems with the hitbox freezing, homing shots going straight, etc. during the death animation, just stick yield; in @Missed.)

@Missed runs for 75 frames, which is the amount of time it takes for you to spawn. Eff why eye.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Blargel on January 26, 2010, 01:43:09 AM
So rare that it's not possible. When the life of an enemy is less than 1, it proceeds to @Finalize and then deletes the enemy. I know people think "when the enemy has 0 or less than 0 life", but it's actually when the enemy has anything less than 1.

That can't be right. If you put SetLife(1); in @Initialize, and press h (which takes off 10% life) during the script, the boss won't die. Although the health bar will drop to 0 (probably cause Danmakfu floored the float rather than rounded it), the boss won't die until you press h another 9 times.
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on January 26, 2010, 01:48:49 AM
1000th post... we need a new topic...
This happens on my survival cards (see my Ex Riolu boss)
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Naut on January 26, 2010, 01:51:14 AM
I have no idea where I read that, but I swear I read it in some documentation somewhere >: |
Title: Re: Danmakufu Q&A/Problem Thread II
Post by: Chronojet ⚙ Dragon on January 26, 2010, 01:55:01 AM
New thread. (http://www.shrinemaiden.org/forum/index.php?topic=4771.0)

Someone, please lock this thread.