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

Re: Danmakufu Q&A/Problem Thread v3
« Reply #240 on: February 21, 2010, 02:36:30 AM »
New question! =D

I have a boss that spews out my custom made power and point items, like a fountain, but when the boss dies so do the items, because their effect objects that the boss created. This is a problem becaus this means an enemy's items wont show up at all. ^^;;

Is there a way to make an effect object independent? or transfer it to the stage's effects?

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread v3
« Reply #241 on: February 21, 2010, 02:39:38 AM »
AddShot(30*a,1,2,GetCenterX*b/10);

You're telling it to shoot at GetCenterX*b/10 from the base of the laser. GetCenterX just means 244 so you're telling it to shoot at 244*b/10 from the laser's base along the laser.

(Does that even make sense?)

It does when the laser has length 244. Still, when I run the code, I get no uncharacteristically straight LaserCs.

Re: Danmakufu Q&A/Problem Thread v3
« Reply #242 on: February 21, 2010, 02:43:07 AM »
Is there a way to make an effect object independent? or transfer it to the stage's effects?

Yes. Create the effect object... In the stage.

Re: Danmakufu Q&A/Problem Thread v3
« Reply #243 on: February 21, 2010, 02:44:07 AM »
Yes. Create the effect object... In the stage.

Eeee...that comes with a little problem, how does the stage know when or where to spawn the items? ^^;

Re: Danmakufu Q&A/Problem Thread v3
« Reply #244 on: February 21, 2010, 02:48:28 AM »
Well you can get whether or not the boss just died using IsBossExisting and a little bit of logic. To drop items on the boss' location after it just died, just pass CommonData in the boss' @Finalize of it's coordinates, then spawn all your items on that location the next frame.

Re: Danmakufu Q&A/Problem Thread v3
« Reply #245 on: February 21, 2010, 02:50:30 AM »
Well you can get whether or not the boss just died using IsBossExisting and a little bit of logic. To drop items on the boss' location after it just died, just pass CommonData in the boss' @Finalize of it's coordinates, then spawn all your items on that location the next frame.

would IsBossExisting work with multiple enemies onscreen during stages?

Re: Danmakufu Q&A/Problem Thread v3
« Reply #246 on: February 21, 2010, 02:51:21 AM »
You cannot have more then one boss on the screen at any time, all other enemies will not trigger the function. You can use GetEnemyNum to see how many enemies in total are currently alive.

Re: Danmakufu Q&A/Problem Thread v3
« Reply #247 on: February 21, 2010, 03:00:01 AM »
You cannot have more then one boss on the screen at any time, all other enemies will not trigger the function. You can use GetEnemyNum to see how many enemies in total are currently alive.

okay so I can get the enemy number, maybe if it sees the number go down I can make the dropping event trigger...worth a try ^^

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #248 on: February 21, 2010, 03:05:14 AM »
okay so I can get the enemy number, maybe if it sees the number go down I can make the dropping event trigger...worth a try ^^

The problem is if an enemy dies on the same frame that an enemy spawns. The best solution for this would be to use common data in every enemy's @Finalize containing an array describing the location and type of item to drop. Then you read the data in the stage script to create the items and delete the array in the common data.
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread v3
« Reply #249 on: February 21, 2010, 03:10:18 AM »
AddShot(30*a,1,2,GetCenterX*b/10);

You're telling it to shoot at GetCenterX*b/10 from the base of the laser. GetCenterX just means 244 so you're telling it to shoot at 244*b/10 from the laser's base along the laser.

(Does that even make sense?)

Wait, along the laser? Am I accidentally firing the LaserCs in the direction of the LaserA or is something else the matter?

Re: Danmakufu Q&A/Problem Thread v3
« Reply #250 on: February 21, 2010, 03:14:42 AM »
Wait, along the laser? Am I accidentally firing the LaserCs in the direction of the LaserA or is something else the matter?
Your firing LaserCs from the direction of LaserA, put 0,1*b/10 for it to fire from the LaserA

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #251 on: February 21, 2010, 03:15:29 AM »
Wait, along the laser? Am I accidentally firing the LaserCs in the direction of the LaserA or is something else the matter?

That is indeed what you're doing. If the laser being added to is facing 90 degrees and the 4th parameter in AddShot is 200, then the added shot will be added at 90 degrees 200 pixels away from the base of the parent laser.
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread v3
« Reply #252 on: February 21, 2010, 03:19:48 AM »
Actually, with no change to the parameters, I'm seeing a stream of the lasers at x=0 but none farther to the right (assuming the wall spawns on the left).

Re: Danmakufu Q&A/Problem Thread v3
« Reply #253 on: February 21, 2010, 03:23:58 AM »
The problem is if an enemy dies on the same frame that an enemy spawns. The best solution for this would be to use common data in every enemy's @Finalize containing an array describing the location and type of item to drop. Then you read the data in the stage script to create the items and delete the array in the common data.

Im so confused, I almost get what your trying to tell me to do but I dont think I get it, do you mean create a new common data every time an enemy spawns? how do I make an array out of the strings used for common data? how do I call the function in stage trough the enemy's @Finalize? my main issue right now is knowing when an enemy dies X3

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #254 on: February 21, 2010, 03:40:38 AM »
Enemy's @Finalize:
Code: [Select]
@Finalize {
    // Assuming we want the enemy to drop 10 power items and 12 point items.
    // Reason for the 2D array is so if multiple enemies die in one frame, they don't override
    // each other so both enemies will drop items instead of just one.
    SetCommonData("powerItems", GetCommonDataDefault("powerItems", []) ~ [[10, GetX, GetY]]);
    SetCommonData("pointItems", GetCommonDataDefault("pointItems", []) ~ [[12, GetX, GetY]]);
}

In the stage's @MainLoop:
Code: [Select]
@MainLoop{
    let powerItemsArray = GetCommonDataDefault("powerItems", []);
    ascent(i in 0..length(powerItemsArray)){
        loop(powerItemsArray[i][0]){
            // Assuming the function that creates power items is called CreatePowerItem
            // Also assuming you want to randomize the locations slightly.
            CreatePowerItem(powerItemsArray[i][1] + rand(-32, 32), powerItemsArray[i][2] + rand(-32, 32));
        }
    }

    // And do the same thing with pointItemsArray. Too lazy to write more code.

    SetCommonData("powerItems", []);
    SetCommonData("pointItems", []);
    yield;
}

Lines of code with comments show a lot more than just explanation. I hope this helps.
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread v3
« Reply #255 on: February 21, 2010, 03:52:09 AM »
Your firing LaserCs from the direction of LaserA, put 0,1*b/10 for it to fire from the LaserA

I cannot make sense of that 0,1*b/10. Could you post the complete line of code?

Re: Danmakufu Q&A/Problem Thread v3
« Reply #256 on: February 21, 2010, 04:06:26 AM »
Yes! works perfectly, thanks dancing Flandre! ^^

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #257 on: February 21, 2010, 04:19:00 AM »
I cannot make sense of that 0,1*b/10. Could you post the complete line of code?
Perhaps it would be best to describe what you are trying to accomplish. If we know that, then we can show you a piece of code that will do what you want and you can look through it and compare it to your own code to see what went wrong.

Yes! works perfectly, thanks dancing Flandre! ^^
No problem. *dances some more*
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread v3
« Reply #258 on: February 21, 2010, 04:34:36 AM »
What I'm trying to do:

Every 30 frames, fire 10 evenly spaced LaserC(2)s straight downward from the LaserA.
Every 30 frames, starting from Frame 45, fire 9 evenly spaced LaserC(2)s straight downward from the LaserA.

Keep doing this until the LaserA is deleted 600 frames after its creation.
« Last Edit: February 21, 2010, 04:40:18 AM by AweStriker Nova »

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #259 on: February 21, 2010, 03:29:23 PM »
Umm, do you really want to use LaserCs for that? It seems LaserAs would work just fine, and Cs are much harder for danmakufu to process.

Anyways...


Code: [Select]
task TAttack(x, y, ang, length){


let obj= Obj_Create(OBJ_LASER);

Obj_SetPosition(obj,x, y);
ObjLaser_SetLength(obj, length);
ObjLaser_SetWidth(obj, 20);
ObjShot_SetDelay(obj, 0);
Obj_SetAngle(obj, ang);
ObjLaser_SetSource(obj, true);
ObjShot_SetGraphic(obj, WHITE11);

let timer=0;

while(Obj_BeDeleted(obj)==false){

timer++;

if(timer>0&&timer%30==0&&timer<530){
ascent(i in 0..10){
CreateLaserC(1, x+cos(ang)*(i/9)*length, y+sin(ang)*(i/9)*length, 10, 25, RED11, 5);
SetLaserDataC(1, 0, 2, ang+90, 0, 0, 0);
FireShot(1);
}
}

if(timer>30&&(timer-15)%30==0&&timer<530){
ascent(i in 0..9){
CreateLaserC(1, x+cos(ang)*((i+0.5)/9)*length, y+sin(ang)*((i+0.5)/9)*length, 10, 25, RED11, 5);
SetLaserDataC(1, 0, 2, ang+90, 0, 0, 0);
FireShot(1);
}
}

if(timer==600){ ObjShot_FadeDelete(obj); }

yield;
}
}
I programmed not exactly what you said, but what I assume you meant. If I got it wrong, then please tell me.  :D

If you meant for the lasers to go straight down instead of rectangular to the laser, just replace ang+90 in the SetLaserDataC functions with 90.

« Last Edit: February 21, 2010, 03:34:48 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."

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread v3
« Reply #260 on: February 21, 2010, 03:46:37 PM »
That worked mostly as expected. I just forgot to mention the "wall" had a downward velocity of 0.25 (which was easy enough to add in, and fix so the sub-lasers spawned from the laser's current position instead of its initial position).

Why LaserC? Don't LaserA's always have a bright light at their base? This field of lasers is fairly thick, and the player has to see through it (the task is run in conjunction with one commented "Orbital Strike Cannon" - guess what that does).

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #261 on: February 21, 2010, 03:53:08 PM »
*facepalm*

I meant CreateLaser01.
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."

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread v3
« Reply #262 on: February 21, 2010, 07:59:10 PM »
I went and changed all of that too, and the dimensions and graphics. The RED11 lasers looked white. Now they look like aqua needles. I also threw in a differential so the player still has to stay on his or her toes.

Now, about SetDurableSpellCard. I think it doesn't require any parameters; is this true? Yes.

Also, if I call PlayMusic in the first card of a Plural Script, will it keep playing? Yes.

Oh, and how do I change the frame, Reimu's graphics, and Marisa's graphics?
« Last Edit: February 21, 2010, 08:25:19 PM by AweStriker Nova »

Shockman

  • Some idiot
  • I can't believe I got this account back .|.|.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #263 on: February 22, 2010, 05:53:31 AM »
how do you change the framework?
it's not really explained anywhere.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #264 on: February 22, 2010, 06:02:11 AM »
By changing the framework, do you mean changing the ugly default purple cloud frame image, or the way system information is displayed?

The former is accomplished by putting a 640x480 image called stg_frame.png in the img folder in your Danmakufu root directory. If there is no img folder, you can go ahead and create one.

The latter is accomplished by first disabling the default system view with SetDefaultStatusVisible(false); and then making a bunch of effect objects on layer 8 to draw your own custom graphics instead. You can get the information to display in the script with GetScore, GetGraze, GetPoint, GetPlayerLife, and GetPlayerBomb.
<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.

Shockman

  • Some idiot
  • I can't believe I got this account back .|.|.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #265 on: February 22, 2010, 06:07:20 AM »
By changing the framework, do you mean changing the ugly default purple cloud frame image, or the way system information is displayed?

The former is accomplished by putting a 640x480 image called stg_frame.png in the img folder in your Danmakufu root directory. If there is no img folder, you can go ahead and create one.

The latter is accomplished by first disabling the default system view with SetDefaultStatusVisible(false); and then making a bunch of effect objects on layer 8 to draw your own custom graphics instead. You can get the information to display in the script with GetScore, GetGraze, GetPoint, GetPlayerLife, and GetPlayerBomb.
thanks! I was talking about the cloud frame.

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread v3
« Reply #266 on: February 22, 2010, 11:53:23 PM »
I'm having problems with these CreateShots.

Code: [Select]
CreateShot01(Obj_GetX(redbeam)*cos(Obj_GetAngle(redbeam))*l*ObjLaser_GetLength(redbeam)/7,Obj_GetY(redbeam)*sin(Obj_GetAngle(redbeam))*l*ObjLaser_GetLength(redbeam)/7,0.6,Obj_GetAngle(redbeam)+90,RED05,10);
CreateShot01(Obj_GetX(redbeam)*cos(Obj_GetAngle(redbeam))*l*ObjLaser_GetLength(redbeam)/7,Obj_GetY(redbeam)*sin(Obj_GetAngle(redbeam))*l*ObjLaser_GetLength(redbeam)/7,0.6,Obj_GetAngle(redbeam)-90,RED05,10);
CreateShot01(Obj_GetX(bluebeam)*cos(Obj_GetAngle(bluebeam))*l*ObjLaser_GetLength(bluebeam)/7,Obj_GetY(bluebeam)*sin(Obj_GetAngle(bluebeam))*l*ObjLaser_GetLength(bluebeam)/7,0.6,Obj_GetAngle(bluebeam)+90,BLUE05,10);
CreateShot01(Obj_GetX(bluebeam)*cos(Obj_GetAngle(bluebeam))*l*ObjLaser_GetLength(bluebeam)/7,Obj_GetY(bluebeam)*sin(Obj_GetAngle(bluebeam))*l*ObjLaser_GetLength(bluebeam)/7,0.6,Obj_GetAngle(bluebeam)-90,BLUE05,10);
CreateShot01(Obj_GetX(greenbeam)*cos(Obj_GetAngle(greenbeam))*l*ObjLaser_GetLength(greenbeam)/7,Obj_GetY(greenbeam)*sin(Obj_GetAngle(greenbeam))*l*ObjLaser_GetLength(greenbeam)/7,0.6,Obj_GetAngle(greenbeam)+90,GREEN05,10);
CreateShot01(Obj_GetX(greenbeam)*cos(Obj_GetAngle(greenbeam))*l*ObjLaser_GetLength(greenbeam)/7,Obj_GetY(greenbeam)*sin(Obj_GetAngle(greenbeam))*l*ObjLaser_GetLength(greenbeam)/7,0.6,Obj_GetAngle(greenbeam)-90,GREEN05,10);

Right now they spawn ludicrously far away from the actual lasers, which have carefully manipulated dynamic angles, lengths, and base positions.

They're in an Ascent loop of l in 2..5 (will be changed to 1..5 and all instances of 7 changed to 6), and here's how the lasers operate:

(image to come)
The lasers are color coded. redbeam is aimed at the source of greenbeam. bluebeam is aimed at the source of redbeam. greenbeam is aimed at the source of bluebeam.
« Last Edit: February 23, 2010, 12:01:06 AM by AweStriker Nova »

Re: Danmakufu Q&A/Problem Thread v3
« Reply #267 on: February 22, 2010, 11:58:39 PM »
Should be Xcoordinate + distance*cos(angle), not *. Also, the variable l may be large, but fix the first area before you check that.

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread v3
« Reply #268 on: February 23, 2010, 12:26:13 AM »
Presumably that error also exists in Y. After all, you saw how freakin' long the x term was.

I must have accidentally lumped Obj_GetX into the "stuff to multiply together" category.

ChaoStar

  • Dark History Boy
Re: Danmakufu Q&A/Problem Thread v3
« Reply #269 on: February 24, 2010, 08:37:00 PM »
Code: [Select]
script_spell BloodRage{
let img_spell = GetCurrentScriptDirectory~"CrimsonAura.png";

function wait(w){
loop(w){yield;}
}
SetPlayerInvincibility(20);
CrimsonGlow;
wait(60);


task CrimsonGlow{
let obj = Obj_Create(OBJ_EFFECT);
ObjEffect_SetRenderState(obj,ALPHA);
ObjEffect_SetTexture(obj,img_spell);

Obj_SetPosition(obj,GetPlayerX,GetPlayerY);
ObjEffect_SetScale(obj,1,1);
ObjEffect_SetLayer(obj,5);
ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLESTRIP);

ObjEffect_SetVertexXY(obj,0,-21.5,-20.5);
ObjEffect_SetVertexXY(obj,0,21.5,-20.5);
ObjEffect_SetVertexXY(obj,0,-21.5,20.5);
ObjEffect_SetVertexXY(obj,0,21.5,20.5);

ObjEffect_SetVertexUV(obj,0,0,0);
ObjEffect_SetVertexUV(obj,1,43,0);
ObjEffect_SetVertexUV(obj,2,0,41);
ObjEffect_SetVertexUV(obj,3,43,41);



}

@Initialize{
LoadGraphic(img_spell);

}

@MainLoop{
CollectItems();
yield;
}

@Finalize{
}



End();
}

The object effect won't appear... is it the code, or the image?