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

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem Thread II
« Reply #420 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...  :-\
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #421 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.
« Last Edit: November 23, 2009, 12:15:55 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.

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem Thread II
« Reply #422 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...
« Last Edit: November 23, 2009, 02:21:59 PM by kyle_090594 »
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread II
« Reply #423 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?

Helepolis

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

Re: Danmakufu Q&A/Problem Thread II
« Reply #425 on: November 23, 2009, 11:58:57 PM »
Is there a command for random that sticks to whole integers?
Just wanted to shout out and say thanks for all the time and effort your putin in to make sure smogon has then best VGC'ers around.

Drake

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

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

ChaoStar

  • Dark History Boy
Re: Danmakufu Q&A/Problem Thread II
« Reply #427 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.

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread II
« Reply #428 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 }.

Drake

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

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

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #430 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.
<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 #431 on: November 25, 2009, 09:59:08 AM »
what is the function for finding the x y position of a BULLET?
Just wanted to shout out and say thanks for all the time and effort your putin in to make sure smogon has then best VGC'ers around.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #432 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.
<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.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #433 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?)
<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 #434 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.

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

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

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #436 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.
<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: Danmakufu Q&A/Problem Thread II
« Reply #437 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.

ChaoStar

  • Dark History Boy
Re: Danmakufu Q&A/Problem Thread II
« Reply #438 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
« Last Edit: November 26, 2009, 01:18:05 AM by ChaoStar »

Re: Danmakufu Q&A/Problem Thread II
« Reply #439 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
Just wanted to shout out and say thanks for all the time and effort your putin in to make sure smogon has then best VGC'ers around.

Drake

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

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

Re: Danmakufu Q&A/Problem Thread II
« Reply #441 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. :-\
« Last Edit: November 26, 2009, 07:33:17 AM by rdj522 »

Drake

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

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

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

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #444 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.
<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 #445 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.

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 #446 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.

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



That works excellently. Thanks, guys!

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem Thread II
« Reply #448 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?
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #449 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?
<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.