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

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread v3
« Reply #360 on: March 04, 2010, 02:42:38 AM »
What.

That's odd, mine was packaged in for no apparent reason...  :/
Although I do know 4.1 doesn't have one.
I guess I'll just stick to using the numbers then.

Although there is another thing I wanted to do...

Parsee's Grandfather Cherry Blossom cards produce that 5-petaled flower thing, and I want one with 6. How would I do that?
« Last Edit: March 04, 2010, 02:46:16 AM by AweStriker Nova »

Re: Danmakufu Q&A/Problem Thread v3
« Reply #361 on: March 04, 2010, 02:58:39 AM »
let x = GetX;
let y = GetY;

ascent(i in 0..6){
   CreateShotA(0, x + 15*cos(i*60), y + 15*sin(i*60), 20);
   SetShotDataA(0, 0, 0, i*60, 0, 0, 0, YELLOW12);
   SetShotKillTime(0, 240);
   FireShot(0);
}

It's just a circle of bullets.

ChaoStar

  • Dark History Boy
Re: Danmakufu Q&A/Problem Thread v3
« Reply #362 on: March 04, 2010, 03:54:35 AM »
I wanted to make something like Sakuya's last word, in IN. buuut...

How do you make object bullets curve?

How do you make them curve, and when a variable equals one, shoot bullets in the direction the bullet is pointing?

Re: Danmakufu Q&A/Problem Thread v3
« Reply #363 on: March 04, 2010, 03:59:26 AM »
How do you make object bullets curve?

How do you make them curve, and when a variable equals one, shoot bullets in the direction the bullet is pointing?

while(!Obj_BeDeleted(obj)){
  angle++;
  Obj_SetAngle(obj, angle);
  if(variable==1){
    CreateShot01(Obj_GetX(obj), Obj_GetY(obj), 3, Obj_GetAngle(obj), RED01, 0);
  }
  yield;
}


Insert whatever logic you may need.

Totally going to consistantly highlight danmakufu code from now on, so much easier to read.

8lue Wizard

  • Cobalt Magician
  • (Apparently)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #364 on: March 05, 2010, 02:44:07 AM »
nm, answered on IRC.
« Last Edit: March 05, 2010, 03:04:51 AM by Blue Mage »

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread v3
« Reply #365 on: March 05, 2010, 04:26:37 AM »
Huh. Don't CreateA bullets fade delete? Mine just seem to cease to exist instantaneously.

Still, I got the radius right on that snowflake thing first try (6). It looks good next to accompanying "sonic wave" and stream of fireballs. Can't wait until I add the dark purple fog, lightning, and bright white laser trail.

EDIT: Lightning is proving a bad idea to implement
EDIT2: never mind, lightning is too awesome to not implement

What, you thought all those were going to be spawned from the same projectile?
« Last Edit: March 05, 2010, 06:24:18 PM by AweStriker Nova »

Re: Danmakufu Q&A/Problem Thread v3
« Reply #366 on: March 05, 2010, 04:31:51 AM »
Use SetShotKillTime to delete LaserA

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread v3
« Reply #367 on: March 05, 2010, 05:12:02 AM »
I wasn't asking about that.

I have this code:
Code: [Select]
task icecrystal(x,y){
let seeddir = rand_int(0,360);
ascent(i in 1..7){
CreateShotA(1,x+6*cos(seeddir),y+6*sin(seeddir),4);
SetShotDataA(1,0,0,seeddir,0,0,0,86);
SetShotKillTime(1,180);
FireShot(1);
seeddir+=360/6;
}
}

and instead of fading out, the crystals vanish abruptly.

Hat

  • Just an unassuming chapeau.
  • I will never be ready.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #368 on: March 05, 2010, 05:20:24 AM »
IT'S TIME... for another classic episode of my crippling, brain-raping stupidity.

So. Ya know how in MoF and all the games ever the options kind of... drift a little as you move? They'll lag behind your movement a bit. Could someone please provide a bit of guidance? I needn't have a whole working script, just a quick conceptual response should be sufficient (it's for LERNIN :V)

if there were ever any doubt that I am a retard...

Re: Danmakufu Q&A/Problem Thread v3
« Reply #369 on: March 05, 2010, 05:25:42 AM »
In stead of having the options move when the player does, set it only to update the position using the % way.

8lue Wizard

  • Cobalt Magician
  • (Apparently)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #370 on: March 05, 2010, 07:05:34 AM »
IT'S TIME... for another classic episode of my crippling, brain-raping stupidity.

So. Ya know how in MoF and all the games ever the options kind of... drift a little as you move? They'll lag behind your movement a bit. Could someone please provide a bit of guidance? I needn't have a whole working script, just a quick conceptual response should be sufficient (it's for LERNIN :V)

if there were ever any doubt that I am a retard...

How I did it in my Nazrin player just recently:

Code: [Select]
    let PickX = []; // option positions             
    let PickY = []; // (lol parallel arrays)
    @MainLoop{
        if((GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD)){
            PickX = [-30,-18,18,30];
            PickY = [-4,4,4,-4];
        } else {
            PickX = [-120,-60,60,120];
            PickY = [12,-8,-8,12];
        }
        ascent(i in 0..4){
...
            let optx = (PickX[i] - Obj_GetX(opt))/4 + Obj_GetX(opt);
            let opty = (PickY[i] - Obj_GetY(opt))/4 + Obj_GetY(opt);
            Obj_SetX(opt,optx);
            Obj_SetY(opt,opty);
        }
    }

Seems to work well enough. You can also play with optx and opty a bit before calling SetX and SetY. (I put some sinusoidal action in)

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #371 on: March 05, 2010, 10:28:42 AM »
Code: [Select]
script_spell Ultimate_Shield{
let shield = GetCurrentScriptDirectory~"img\字る.png";
let sparkle = GetCurrentScriptDirectory~"img\effect.png";
let spin = 4;

@Initialize{yield; LoadGraphic(shield); LoadGraphic(sparkle); run();}
@MainLoop{spin++; yield;}
@Finalize{DeleteGraphic(shield); DeleteGraphic(sparkle);}

task run(){SetPlayerInvincibility(220); loop(10){yield;} Sparlke; loop(220){yield;} End;}

task Sparlke{
loop{
loop(1){yield;}
Sparkle(GetPlayerX+rand(-120,120),GetPlayerY+rand(-120,120));
}}

task Sparkle(xx,yy){

let spark=Obj_Create(OBJ_EFFECT);
let atta = 0;
let attb = 0;
let attfra = 0;

ObjEffect_SetTexture(spark,sparkle);
ObjEffect_SetScale(spark,1,1);
ObjEffect_SetRenderState(spark,255);
ObjEffect_CreateVertex(spark,8);
ObjEffect_SetLayer(spark,8);
ObjEffect_SetPrimitiveType(spark,PRIMITIVE_TRIANGLEFAN);

while(Obj_BeDeleted(spark)==false){attfra++;

   ObjEffect_SetVertexXY(spark, 0, xx-20,yy-20);
   ObjEffect_SetVertexXY(spark, 1, xx,yy-20);
   ObjEffect_SetVertexXY(spark, 2, xx+20,yy-20);
   ObjEffect_SetVertexXY(spark, 3, xx+20,yy);
   ObjEffect_SetVertexXY(spark, 4, xx+20,yy+20);
   ObjEffect_SetVertexXY(spark, 5, xx,yy+20);
   ObjEffect_SetVertexXY(spark, 6, xx-20,yy+20);
   ObjEffect_SetVertexXY(spark, 7, xx-20,yy);

ObjEffect_SetVertexUV(spark,0,0,0);
ObjEffect_SetVertexUV(spark,1,0,10);
ObjEffect_SetVertexUV(spark,2,0,20);
ObjEffect_SetVertexUV(spark,3,10,0);
ObjEffect_SetVertexUV(spark,4,20,20);
ObjEffect_SetVertexUV(spark,5,20,10);
ObjEffect_SetVertexUV(spark,6,20,0);
ObjEffect_SetVertexUV(spark,7,10,0);

if(attfra>80){atta++;
ObjEffect_SetVertexXY(spark, 1, xx,yy-20+atta);
ObjEffect_SetVertexXY(spark, 3, xx+20-atta,yy);
ObjEffect_SetVertexXY(spark, 5, xx,yy+20-atta);
ObjEffect_SetVertexXY(spark, 7, xx-20+atta,yy);}

if(atta==20){Obj_Delete(spark);}
}}

What I want to happen is a object that appears, then the corners fold in, but I cant even get the image to appear at all >_<;
ObjEffect_SetRenderState(spark,255);
 ...?! I think you meant to type:
ObjEffect_SetRenderState(spark,ADD); ObjEffect_SetRenderAlpha(spark,255);
Other than that, when in doubt check the file paths of the images again. And I am so totally not going to look wether or not you placed you vertices correctly.



I wasn't asking about that.

I have this code:
Code: [Select]
task icecrystal(x,y){
let seeddir = rand_int(0,360);
ascent(i in 1..7){
CreateShotA(1,x+6*cos(seeddir),y+6*sin(seeddir),4);
SetShotDataA(1,0,0,seeddir,0,0,0,86);
SetShotKillTime(1,180);
FireShot(1);
seeddir+=360/6;
}
}

and instead of fading out, the crystals vanish abruptly.
SetShotKillTime makes the bullets vanish instantaneously. They only fade (like every regular bullet) when they are removed through bombs or player death. For forced fade deletiong you will have to use ObjShot_FadeDelete(obj);
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."

Re: Danmakufu Q&A/Problem Thread v3
« Reply #372 on: March 05, 2010, 12:41:40 PM »
So. Ya know how in MoF and all the games ever the options kind of... drift a little as you move? They'll lag behind your movement a bit. Could someone please provide a bit of guidance? I needn't have a whole working script, just a quick conceptual response should be sufficient (it's for LERNIN :V)

I don't want to emphasize any misplaced self-doubt you may have, but you probably should've looked at other player scripts that use the same effect before asking that question.

Unless you don't download player scripts >: |

Hat

  • Just an unassuming chapeau.
  • I will never be ready.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #373 on: March 05, 2010, 02:01:25 PM »
I do, but none of the player scripts I have use that effect; that is, unless your Remilia does, but I can't tell. \=| I suppose I'll look at the scripts that have already been posted before I come bothering you guys here...?
« Last Edit: March 05, 2010, 02:05:21 PM by Karfloozly »

Re: Danmakufu Q&A/Problem Thread v3
« Reply #374 on: March 05, 2010, 03:16:03 PM »
Usually the idea is to at least attempt to find an answer on your own before asking a question about it. I don't mind helping people with their Danmakufu problems, but I do mind if they don't put any effort at all in to solving them.

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread v3
« Reply #375 on: March 05, 2010, 06:23:44 PM »
So I've been trying to get an Object Sinuate to move in something akin to a sine wave.
Code: [Select]
task lightningbolt(x,y,speed,direction){
let laserbolt = ObjSinuateLaser_Create(x,y,speed,direction,50,8,67,0);
while(!Obj_BeDeleted(laserbolt)){
Obj_SetPosition(laserbolt,Obj_GetX(laserbolt)+25*cos(direction+90),Obj_GetY(laserbolt)+25*sin(direction+90));
yield;
}
}
This is the way I am currently trying to do it. The initial angle points it right at the player, obviously, but with any luck it will curve off to either side. In short, this is the part of the card that is likely to cause the most trouble due to its erratic movement.

But right now, it just seems to be shooting a laser at some odd angle.

Drake

  • *
Re: Danmakufu Q&A/Problem Thread v3
« Reply #376 on: March 05, 2010, 06:35:38 PM »
Add a let dir = direction and dir++ in there, bud. Just having one direction isn't going to do you much good.

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

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #377 on: March 05, 2010, 06:39:22 PM »
So I've been trying to get an Object Sinuate to move in something akin to a sine wave.
Code: [Select]
task lightningbolt(x,y,speed,direction){
let laserbolt = ObjSinuateLaser_Create(x,y,speed,direction,50,8,67,0);
while(!Obj_BeDeleted(laserbolt)){
Obj_SetPosition(laserbolt,Obj_GetX(laserbolt)+25*cos(direction+90),Obj_GetY(laserbolt)+25*sin(direction+90));
yield;
}
}
This is the way I am currently trying to do it. The initial angle points it right at the player, obviously, but with any luck it will curve off to either side. In short, this is the part of the card that is likely to cause the most trouble due to its erratic movement.

But right now, it just seems to be shooting a laser at some odd angle.
Huh? Why would it do anything else?

Obj_SetPosition(laserbolt,Obj_GetX(laserbolt)+25*cos(direction+90),Obj_GetY(laserbolt)+25*sin(direction+90));

This code makes your laser move with a speed of 25 pixels per frame (which is ludicrously high if you ask me) in the direction of (direction+90).
Where is the code that is supposed to cause random movement? I don't see any.

If you want to have the bullet curve in a random direction, then include another parameter in your function, lets call it phi, and then put direction+=phi in your while{} loop. Then randomize the number you put into phi somehow.

Edit: Dang it, lunar dial'd!
« Last Edit: March 05, 2010, 06:42:17 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 #378 on: March 05, 2010, 08:09:48 PM »
I just realized the source of my problem is entirely different.

Here's what I missed:
   task lightningbolt(x,y,speed,direction){
      let offset = rand_int(0,360);
      let laserbolt = ObjSinuateLaser_Create(x,y,speed,direction,50,8,67,0);
      while(!Obj_BeDeleted(laserbolt)){
         Obj_SetPosition(laserbolt,Obj_GetX(laserbolt)+25*rand(0,1)*cos(offset)*cos(direction+90),Obj_GetY(laserbolt)+25*rand(0,1)*sin(offset)*sin(direction+90));
         yield;
      }
   }


This will move the sinuate laser (because it is one) to a point somewhere within 25 pixels of its last position every frame, but with a general velocity of (speed) in (direction). I think.

AFTER TESTING: Meh, it's close enough.
« Last Edit: March 05, 2010, 08:17:32 PM by AweStriker Nova »

Re: Danmakufu Q&A/Problem Thread v3
« Reply #379 on: March 07, 2010, 03:12:33 AM »
Hey, quick Stage/Enemy scripting question!

I want enemies on a stage that follow another enemy around like slaves. If this were a boss, I'd just have them reference GetEnemyX/Y, but it's just another, larger normal enemy. Any tips on how to accomplish this?

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #380 on: March 07, 2010, 04:16:39 AM »
Hey, quick Stage/Enemy scripting question!

I want enemies on a stage that follow another enemy around like slaves. If this were a boss, I'd just have them reference GetEnemyX/Y, but it's just another, larger normal enemy. Any tips on how to accomplish this?

In the master enemy's @MainLoop:
SetCommonData("ThisEnemysX", GetX);
SetCommonData("ThisEnemysY", GetY);

Then in the slave enemy's, F.O.E.!:
..... GetCommonData("ThisEnemysX", GetX); .....
..... GetCommonData("ThisEnemysY", GetY); .....
.....or just make the slave enemies move in the same pattern as the master enemy.

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread v3
« Reply #381 on: March 07, 2010, 05:36:29 AM »
Odd...
I'm having trouble with this code. It's giving me a mismatch error for some reason... a reason that I can't see.
Code: [Select]
script_enemy_main{

let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "Materials\Graphics\PlaceholderBoss.png";
#include_function ".\ExpandedShotDatav4\shot_replace.dnh";

@Initialize{
SetLife(1000);
SetDamageRate(25,15);
SetTimer(40);
SetScore(1000);
SetMovePosition01(GetCenterX,GetCenterY-150,5);
LoadGraphic(imgBoss);
ShotInit;
CutIn(KOUMA,"Collapse Sign "\""Burial in the Collapsing Cavern"\","",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{
collapseroutine;
move;
}

task collapseroutine{
let shotchoice = [52, 155, 164, 207]
loop{
CreateShotA(1,rand_int(GetClipMinX,GetClipMaxX),GetClipMinY,10);
SetShotDataA_XY(1,0,rand(-1,1),0,0,0.07,0,3,shotchoice[rand_int(0,3)]);
FireShot(1);
wait(30);
}
}

task move{
loop{
SetMovePositionRandom01(200,50,4,GetClipMinX,GetClipMinY,GetClipMaxX,GetCenterY-75);
earthfans;
wait(120);
}
}

task earthfans{
let angle = GetAngleToPlayer;
ascent[a in 3..8]{
ascent in [b in -5..6]{
CreateShotA(1,GetX,GetY,5);
SetShotDataA(1,0,1,angle+90+10*b,0,0,0,37);
SetShotDataA(1,10*a,0,angle+rand_int(-5,5),0,0,0,37);
SetShotDataA(1,90-10*a,NULL,0,0,0,37);
FireShot(1);
CreateShotA(1,GetX,GetY,5);
SetShotDataA(1,0,1,angle-90+10*b,0,0,0,37);
SetShotDataA(1,10*a,0,angle+rand_int(-5,5),0,0,0,37);
SetShotDataA(1,90-10*a,NULL,0,0,0,37);
FireShot(1);
}
}
}

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

}

8lue Wizard

  • Cobalt Magician
  • (Apparently)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #382 on: March 07, 2010, 05:54:22 AM »
Quote
         ascent in [b in -5..6]{

dunno if it'd cause a mismatch error, but that certainly doesn't look right.

...moreover, are square brackets kosher for ascents? I've only ever seen parentheses.

Re: Danmakufu Q&A/Problem Thread v3
« Reply #383 on: March 07, 2010, 05:58:12 AM »
Ascents are written in Paranthesis, not brackets, so Blue Showdown is right

ascent(b in -5..6){

should fix your problem

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread v3
« Reply #384 on: March 07, 2010, 06:26:55 AM »
*slaps self upside the head*

It won't fix my latency problems (for some reason DMF's average speed has dropped to about 50 after I fixed teh jerkiness), but it will fix my script...

So if anyone knows what to do about those...

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #385 on: March 07, 2010, 06:32:49 AM »
Maybe you have too many programs running, or maybe you have too many bullets on the playing field at once? I'm not sure what you mean by "latency problems".

Re: Danmakufu Q&A/Problem Thread v3
« Reply #386 on: March 07, 2010, 06:39:43 AM »
ObjEffect_SetRenderState(spark,255);
 ...?! I think you meant to type:
ObjEffect_SetRenderState(spark,ADD); ObjEffect_SetRenderAlpha(spark,255);
Other than that, when in doubt check the file paths of the images again. And I am so totally not going to look wether or not you placed you vertices correctly.   
for some reason I get an error with ObjEffect_SetRenderAlpha(spark,255);   like its saying that thats isnt a command or something

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread v3
« Reply #387 on: March 07, 2010, 06:42:36 AM »
Because it isn't a command. The only way to change the alpha of an object effect is with ObjEffect_SetVertexColor(obj,vertex,alpha,r,g,b);
Obj is the object (of course), vertex is the number of the vertex to change (you have to loop through all of them - remember the numbering starts at 0), alpha is obvious (0 to 255 as usual), and r/g/b is the color.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #388 on: March 07, 2010, 10:31:57 AM »
for some reason I get an error with ObjEffect_SetRenderAlpha(spark,255);   like its saying that thats isnt a command or something
Auuuugh.

Well, yeah. I did a typo in my advice. It would have had to be ObjEffect_SetAlpha(spark,255);, without the "Render". And even then, even though it would have been an actual command, it probably wouldn't have worked properly. Use Azure's code.

...I seriously need to reread the advice I give.  :X
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 #389 on: March 07, 2010, 03:34:37 PM »
Maybe you have too many programs running, or maybe you have too many bullets on the playing field at once? I'm not sure what you mean by "latency problems".

I only ever have Danmakufu running at one time (other than Notepad and Windows Explorer), but somehow it still won't go above 50 FPS except for bursts of super-fast-ness after a script is done running.