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

Re: Danmakufu Q&A/Problem Thread II
« Reply #930 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.

Re: Danmakufu Q&A/Problem Thread II
« Reply #931 on: January 20, 2010, 04:23:50 AM »
Try using GetCurrentScriptDirectory instead of .

Re: Danmakufu Q&A/Problem Thread II
« Reply #932 on: January 20, 2010, 04:29:42 AM »
That fixed it. Thanks.

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread II
« Reply #933 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!
« Last Edit: January 20, 2010, 09:00:59 PM by Koa⑨ma »

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #934 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.
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

Re: Danmakufu Q&A/Problem Thread II
« Reply #935 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.

DgBarca

  • Umineko fuck yeah
  • Spoilers ?
Re: Danmakufu Q&A/Problem Thread II
« Reply #936 on: January 20, 2010, 03:19:41 PM »
Actually, I have already did it.
Put the power of the player is a bit...not balanced...ze.
[21:16] <redacted> dgbarca makes great work
[21:16] <redacted> i hope he'll make a full game once

Re: Danmakufu Q&A/Problem Thread II
« Reply #937 on: January 20, 2010, 05:34:33 PM »
Actually, I have already did it.
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....

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: Danmakufu Q&A/Problem Thread II
« Reply #938 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.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #939 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.
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #940 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.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #941 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]);
    }
}
« Last Edit: January 20, 2010, 09:06:40 PM by Blargel »
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: Danmakufu Q&A/Problem Thread II
« Reply #942 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

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #943 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  :'()
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: Danmakufu Q&A/Problem Thread II
« Reply #944 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?
« Last Edit: January 20, 2010, 09:16:51 PM by Fujiwara no Mokou »

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #945 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
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #946 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 =|

Re: Danmakufu Q&A/Problem Thread II
« Reply #947 on: January 20, 2010, 10:24:18 PM »
I have never used the debug window before. Am I a disappointment?

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: Danmakufu Q&A/Problem Thread II
« Reply #948 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.

Re: Danmakufu Q&A/Problem Thread II
« Reply #949 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?

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread II
« Reply #950 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

Re: Danmakufu Q&A/Problem Thread II
« Reply #951 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


I would post the script to this but unfortunalty I got mad at it and Deleted it off the face of the Universe...

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #952 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[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.
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

Drake

  • *
Re: Danmakufu Q&A/Problem Thread II
« Reply #953 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
« Last Edit: January 21, 2010, 06:30:40 AM by DRE∀K DOWN! »

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

Re: Danmakufu Q&A/Problem Thread II
« Reply #954 on: January 21, 2010, 06:47:52 AM »
Yay Drake!


>task


>not sub




 >:(

Drake

  • *
Re: Danmakufu Q&A/Problem Thread II
« Reply #955 on: January 21, 2010, 06:54:52 AM »
I'm expanding it for my own purposes, you silly

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

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #956 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.
« Last Edit: January 21, 2010, 08:43:10 AM by Helepolis »

Re: Danmakufu Q&A/Problem Thread II
« Reply #957 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...

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #958 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...
« Last Edit: January 21, 2010, 04:03:35 PM by Iryan »
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #959 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 )