Author Topic: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)  (Read 153801 times)

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #990 on: March 29, 2012, 12:51:42 AM »
The problem is that if you're getting the first object's position when firing the child bullets, and you delete the first object, it's going to default to 0,0.
Instead,
task Bullet(x,y,v,angle,graphic,delay){
    let obj=Obj_Create(OBJ_SHOT);
    Obj_SetPosition(obj, x, y);
    Obj_SetAngle(obj, angle);
    Obj_SetSpeed(obj, v);
    ObjShot_SetGraphic(obj, graphic);
    ObjShot_SetDelay  (obj, 0);
    ObjShot_SetBombResist (obj, true);

    let ox = Obj_GetX(obj);
    let oy = Obj_GetY(obj);
    let dir = #;
    wait(60);
    loop(8){
        CreateShot01(ox, oy, # , dir , # , # );
        dir+=360/8;
    }
}

As you can see, even if the first bullet is deleted for some reason, ox and oy still exist to reference. I'm still only guessing what you were doing before though, and this doesn't seem like it would cause the problem by itself unless you were deleting the first bullet before firing the rest for whatever reason. I can only really assume this is right until you run into the problem again.

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

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #991 on: March 29, 2012, 01:07:05 AM »
Thanks! ill try this and hope it works!

puremrz

  • Can't stop playing Minecraft!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #992 on: March 31, 2012, 01:53:24 PM »
There's something wrong with a task I made, and I know what it is, but I don't know how to solve it.

Here's a simplified version that emulates the problem:

Code: [Select]
task Boolat(xpos,ypos,speed,angle){
let frame=0;
let red=Obj_Create(OBJ_SHOT);
Obj_SetPosition(red,xpos,ypos);
Obj_SetAngle(red,angle);
Obj_SetSpeed(red,speed);
ObjShot_SetGraphic(red,RED02);
 
while(!Obj_BeDeleted(red)){

if(frame==60){

let blue=Obj_Create(OBJ_SHOT);
Obj_SetPosition(blue,Obj_GetX(red),Obj_GetY(red));
Obj_SetAngle(blue,angle+40);
Obj_SetSpeed(blue,1);
ObjShot_SetGraphic(blue,BLUE01);

while(!Obj_BeDeleted(blue)){
if(Obj_GetX(blue)<=minx){
Obj_SetAngle(blue,180-Obj_GetAngle(blue));
Obj_SetX(blue,minx);
}
if(Obj_GetX(blue)>=maxx){
Obj_SetAngle(blue,180-Obj_GetAngle(blue));
Obj_SetX(blue,maxx);
}
wait(1);
}

}

Obj_SetAngle(red,angle+(frame*3));

frame++;
wait(1);
}
}

The RED02 bullet has to spin around, and the BLUE01 bullet has to bounce off the screen.
60 frames after the RED02 bullet is made, a BLUE01 bullet is created on RED02's current location.
When that happens, I don't want it to, but RED02 stop spinning, and the script only pays attention to BLUE01, which will bounce off the edges of the screen.
I know that's because there are two "while" statements inside each other, but how do I make them independent from each other, so the RED02 bullet will keep on spinning, and the BLUE01 bullet appears on RED02's location and will still bounce?

This is just an example, in reality I want to make the player's familiars shoot bouncing bullets, but the same thing goes wrong (the familiars that shoot bouncing bullets get stuck in place until said bullets are deleted)


Also, Danmakufu crashes if you forget to write ObjShot_SetGraphic *near-ragequit*
Full Danmakufu game "Juuni Jumon - Summer Interlude" is done!
By the same person who made Koishi Hell 1,2 (except this game is serious)
Topic: http://www.shrinemaiden.org/forum/index.php/topic,9647.0.html

MMX

  • In Soviet Gensokyo...
  • ...bullets dodge you.
    • LiveJournal blog
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #993 on: March 31, 2012, 03:49:24 PM »
I know that's because there are two "while" statements inside each other, but how do I make them independent from each other, so the RED02 bullet will keep on spinning, and the BLUE01 bullet appears on RED02's location and will still bounce?

This is just an example, in reality I want to make the player's familiars shoot bouncing bullets, but the same thing goes wrong (the familiars that shoot bouncing bullets get stuck in place until said bullets are deleted)


Also, Danmakufu crashes if you forget to write ObjShot_SetGraphic *near-ragequit*
Better create a common tasks for all bullet types you have so you can call one from another to run them simultaneously. You can adjust the inner while if you want too, but that's the wrong way ;)
« Last Edit: March 31, 2012, 03:52:38 PM by MMX »
My danmakufu thread Most recent - "Kappa Mechanics" (Nitori fight)   My youtube channel Latest update - EoSD extra no bombs clear


puremrz

  • Can't stop playing Minecraft!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #994 on: March 31, 2012, 04:47:50 PM »
Better create a common tasks for all bullet types you have so you can call one from another to run them simultaneously. You can adjust the inner while if you want too, but that's the wrong way ;)

But if I make them into two tasks, I can't write Obj_SetPosition(blue,Obj_GetX(red),Obj_GetY(red));
That will just give me an error telling me red doesn't exist in this task.
So how can I make blue spawn on red's position?
Full Danmakufu game "Juuni Jumon - Summer Interlude" is done!
By the same person who made Koishi Hell 1,2 (except this game is serious)
Topic: http://www.shrinemaiden.org/forum/index.php/topic,9647.0.html

MMX

  • In Soviet Gensokyo...
  • ...bullets dodge you.
    • LiveJournal blog
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #995 on: March 31, 2012, 05:27:08 PM »
But if I make them into two tasks, I can't write Obj_SetPosition(blue,Obj_GetX(red),Obj_GetY(red));
That will just give me an error telling me red doesn't exist in this task.
So how can I make blue spawn on red's position?
As i see from your script you only need to pass red's coordinates to blue once on it creation, so just make two tasks like this:
Code: [Select]
task RedBullet(x,y,spd,ang){
let red=Obj_Create(OBJ_SHOT);
let frame=0;

//bullet setup goes here

while(!Obj_BeDeleted(red)){
//do stuff
if(frame==60){BlueBullet(Obj_GetX(red),Obj_GetY(red),1,ang+40);}
frame++;
yield;
}
}

task BlueBullet(x,y,spd,ang){
}
« Last Edit: March 31, 2012, 05:31:28 PM by MMX »
My danmakufu thread Most recent - "Kappa Mechanics" (Nitori fight)   My youtube channel Latest update - EoSD extra no bombs clear


puremrz

  • Can't stop playing Minecraft!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #996 on: March 31, 2012, 05:38:49 PM »
As i see from your script you only need to pass red's coordinates to blue once on it creation, so just make two tasks like this:
Code: [Select]
task RedBullet(x,y,spd,ang){
let red=Obj_Create(OBJ_SHOT);
let frame=0;

//bullet setup goes here

while(!Obj_BeDeleted(red)){
//do stuff
if(frame==60){BlueBullet(Obj_GetX(red),Obj_GetY(red),1,ang+40);}
frame++;
yield;
}
}

task BlueBullet(x,y,spd,ang){
}

I see now, the blue bullet's task is still called from within the red one (At least I got that right).
But was trying to call red's x and y from inside the blue bullet's task, and that didn't work as expected.
Thanks, that solved my problems. :D I can probably also use this for some other things I had trouble with before.
Full Danmakufu game "Juuni Jumon - Summer Interlude" is done!
By the same person who made Koishi Hell 1,2 (except this game is serious)
Topic: http://www.shrinemaiden.org/forum/index.php/topic,9647.0.html

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #997 on: March 31, 2012, 11:04:17 PM »
For future reference: you could also have passed red as a parameter into blue's task, so Obj_GetX(red) would still work in the blue task. That's not needed in this case, though.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #998 on: April 04, 2012, 11:03:23 PM »
Ok. So I've been having this problem... I made this stage boss, and everytime I make a replay of him, it has some kind of bug like the one from SA (when you reach utsuho and she kills you even through you beat her). I don't know why this happens :S. I wonder if someone here knows why this happens. Ty

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #999 on: April 04, 2012, 11:34:51 PM »
Danmakufu sucks at recording replays? I dunno, I can't give a much better explanation than that.
<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.

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #1000 on: April 04, 2012, 11:39:09 PM »
A few things can cause that. Replays only save your input and the random number seed, so if there's anything that's not determined by that, it will mess up. For example, using GetTime.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #1001 on: April 05, 2012, 12:51:21 AM »
On some of my more complicated scripts, I've seen replays desync as well and I don't really have any good explanation for that. Saving just the inputs and random seed should work for all my scripts, but it doesn't a lot of the time.
<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.