Author Topic: Danmakufu Q&A/Problem thread number 4  (Read 141630 times)

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem thread number 4
« Reply #60 on: June 27, 2010, 01:39:35 AM »
After the definition of your "fire" task, you have a superfluous closing } bracket, making danmakufu dismiss the code after that from the script. The dismissed code includes the definition of the wait function.

Just remove the superfluous } bracket.
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."

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem thread number 4
« Reply #61 on: June 27, 2010, 01:45:57 AM »
Code: [Select]
        task fire{
                        superbullet(GetEnemyX,GetEnemyY,3,GetAngleToPlayer,Aqua01,30);
                        superbullet(GetEnemyX,GetEnemyY,3,GetAngleToPlayer-20,Aqua01,30);
                        superbullet(GetEnemyX,GetEnemyY,3,GetAngleToPlayer+20,Aqua01,30);
               
                }
        }

You have an extra closing bracket there (or more likely, you're forgetting an opening one). That closes the entire script before wait; is declared, hence the error. You probably meant to do this:

Code: [Select]
        task fire{
               loop{
                        superbullet(GetEnemyX,GetEnemyY,3,GetAngleToPlayer,Aqua01,30);
                        superbullet(GetEnemyX,GetEnemyY,3,GetAngleToPlayer-20,Aqua01,30);
                        superbullet(GetEnemyX,GetEnemyY,3,GetAngleToPlayer+20,Aqua01,30);
                        wait(20);
                }
        }

Mr. Sacchi

  • All shall be well and all manner of thing shall be well.
  • Not postponed. Not in the end. Not for long.
Re: Danmakufu Q&A/Problem thread number 4
« Reply #62 on: June 27, 2010, 02:16:16 AM »
Did that, didn't work, it looks like the problem is at the "wait(120)" on the MainTask.
yay, danmakufu is screwing with me, >_>''

Edit:
Nevermind, I removed the Wait function and checked the "extra }" looks like I was missing "loop{"

Bah, lack of attention sucks...
« Last Edit: June 27, 2010, 02:42:28 AM by Sacchi »

Formless God

Re: Danmakufu Q&A/Problem thread number 4
« Reply #63 on: June 27, 2010, 05:30:40 AM »
Thanks a lot Hele. That worked like a charm :)

Oh, another thing. Why is the score displayed in-game always approx. three times the number I used in SetScore() ? For example, SetScore(2000000) gave a random number between 6000000 and 6027997. And shooting the enemy increases the number unless SetTimer() is also included :/
I thought I messed up my code somewhere, but it happened to this piece as well.

Furienify

  • Yeehaw!
  • Equestrian Fansubber
    • Youtube Channel
Re: Danmakufu Q&A/Problem thread number 4
« Reply #64 on: June 27, 2010, 05:35:19 AM »
Thanks a lot Hele. That worked like a charm :)

Oh, another thing. Why is the score displayed in-game always approx. three times the number I used in SetScore() ? For example, SetScore(2000000) gave a random number between 6000000 and 6027997. And shooting the enemy increases the number unless SetTimer() is also included :/
I thought I messed up my code somewhere, but it happened to this piece as well.

Danmakufu errors like that with numbers over a certain value, if I remember correctly. Kinda sad, but it's an engine thing.

TheMasterSpark

  • Lunatic lemurialist
Re: Danmakufu Q&A/Problem thread number 4
« Reply #65 on: June 27, 2010, 05:21:03 PM »
I think I need some of your help with getting my thinking straight here. I'm trying to make it so that a bunch of script enemies move to a predefined coordination and then start moving in a perfect circle around the player character. Let's say that an enemy is positioned at coordinates GetPlayerX+150 and GetPlayerY-100, how does the logic look to make it move in a circle around the player? I really can't seem to wrap my head around it at the moment..

Edit: I'll add that my ideal goal is to make it so that the script enemies maintain their distance from the player as they move in circles, regardless of what the player himself is doing. I would need a nudge in the right direction to get anywhere at this stage though.  :blush:
« Last Edit: June 27, 2010, 05:23:57 PM by MasterSpark »

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem thread number 4
« Reply #66 on: June 27, 2010, 05:49:16 PM »
Hm, first of you should make shure the enemies don't do collision damage to the player, otherwise they would probably ram him when entering the circle formation.

Second, give every enemy a different value for a new variable "delta" so that so that they spread even on 360 degrees around the player. For example, if there are 4 enemies, give them delta values of 0, 90, 180 and 270. Also give the a variable "speedtime" with an integer value of 60 or so.

Third, insert this code in the enemies' MainLoop{}

Code: [Select]
delta+=angv;
if(speedtime>5){ speedtime--; }

SetMovePosition02(GetPlayerX+rad*cos(delta), GetPlayerY+rad*sin(delta), speedtime);

"rad" is here the radius around the player and "angv" the angular velocity at which the enemies circle you.


Note that I didn't test this code, so there may be typoes, but in theory it should work nicely.
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."

TheMasterSpark

  • Lunatic lemurialist
Re: Danmakufu Q&A/Problem thread number 4
« Reply #67 on: June 27, 2010, 06:06:23 PM »
That worked brilliantly. To think that it would look so easy now that it's all there on paper...

Thanks a bunch. :)

AzraelYvstyr

Re: Danmakufu Q&A/Problem thread number 4
« Reply #68 on: June 27, 2010, 07:15:51 PM »
Mmmm, where to start from?

I've various problems with danmakufu and I'd like you to help me if you can, please.

1) BGM -> I've found me totally unable to put a damn bgm into the game. I've tried LoadMusic & PlayMusic, the #BGM at the start of the script, and even attempted to play it like a SE in the mainTask (when I went mad about it). Please help me stop my headache.

2) Delete Bullets after a time -> I've attempted to make a "spellcard" (not sure if "that" deserves to be called spellcard) that make the enemy to follow the player, while shooting "bombs" of bullets that explode and then form swirls of bullets, but these swirls don't disappear so after escaping the enemy for a while the screen is filled with bullets and it's impossible to dodge. I don't know if it's possible to make bullets disappear after a time.

3) Make the familiars shoot -> Well, this is what's making me rage the most. I can't make the familiar shoot. I've tried GetEnemyX-Y, Obj_GetX-Y(starFam) (being starFam the name of the familiar script) but I keep receiving error messages THAT TELL ME THE MISTAKE IS IN THE WAIT FUNCTION, WTF. Here is the script if it can help...

Code: [Select]
script_enemy starFam{

let CSD = GetCurrentScriptDirectory;
let imgFam = CSD ~ "system\familiar.png";

let dir = 0;
let r = 100;

let famAngle = GetArgument;

let spin = 0;

@Initialize{
SetLife(2000);
SetDamageRateEx(1,1,30,20);
LoadGraphic(imgFam);
mainTask;

}

@MainLoop{
SetCollisionA(GetX,GetY,16);
SetCollisionB(GetX,GetY,16);
yield;
}

@DrawLoop{
SetTexture(imgFam);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(0.3,0.3);
SetGraphicAngle(spin,0,0);
SetGraphicRect(0,0,128,128);
DrawGraphic(GetX,GetY);

SetTexture(imgFam);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(0.3,0.3);
SetGraphicAngle(0,spin,0);
SetGraphicRect(0,0,128,128);
DrawGraphic(GetX,GetY);

spin-=3;
}

@Finalize{
DeleteGraphic(imgFam);
}

task mainTask{
yield;
movement;
wait(60);
fire;
}

task movement{
loop{
SetMovePosition03(GetEnemyX+r*cos(dir+famAngle),GetEnemyY+r*sin(dir+famAngle),20,10);
dir++;
yield;
}
}

task fire{
loop{
CreateShot01(Obj_GetX(starFam),Obj_GetY(starFam),3,0,PURPLE23,10);
CreateShot01(Obj_GetX(starFam),Obj_GetY(starFam),3,72,PURPLE23,10);
CreateShot01(Obj_GetX(starFam),Obj_GetY(starFam),3,144,PURPLE23,10);
CreateShot01(Obj_GetX(starFam),Obj_GetY(starFam),3,216,PURPLE23,10);
CreateShot01(Obj_GetX(starFam),Obj_GetY(starFam),3,288,PURPLE23,10);

wait(10);
yield;
}
}

task lazor(x,y,v,dir,length,width,graphic,delay){
let lobj = Obj_Create(OBJ_LASER);

Obj_SetPosition(lobj,x,y);
Obj_SetSpeed(lobj,v);
Obj_SetAngle(lobj,dir);
ObjLaser_SetLength(lobj,length);
ObjLaser_SetWidth(lobj,width);
ObjShot_SetGraphic(lobj,graphic);
ObjShot_SetDelay(lobj,delay);
ObjLaser_SetSource(lobj,true);
}

}

Ignore the lazor task because I'm not using it in the fire task.

4) Shot replacement -> I've tried to do it and miserably failed. U_U


Please forgive my ignorance, and my poor english.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem thread number 4
« Reply #69 on: June 27, 2010, 07:45:21 PM »
Mmmm, where to start from?

I've various problems with danmakufu and I'd like you to help me if you can, please.

1) BGM -> I've found me totally unable to put a damn bgm into the game. I've tried LoadMusic & PlayMusic, the #BGM at the start of the script, and even attempted to play it like a SE in the mainTask (when I went mad about it). Please help me stop my headache.

2) Delete Bullets after a time -> I've attempted to make a "spellcard" (not sure if "that" deserves to be called spellcard) that make the enemy to follow the player, while shooting "bombs" of bullets that explode and then form swirls of bullets, but these swirls don't disappear so after escaping the enemy for a while the screen is filled with bullets and it's impossible to dodge. I don't know if it's possible to make bullets disappear after a time.

3) Make the familiars shoot -> Well, this is what's making me rage the most. I can't make the familiar shoot. I've tried GetEnemyX-Y, Obj_GetX-Y(starFam) (being starFam the name of the familiar script) but I keep receiving error messages THAT TELL ME THE MISTAKE IS IN THE WAIT FUNCTION, WTF. Here is the script if it can help...

Code: [Select]
bunch of code
Ignore the lazor task because I'm not using it in the fire task.

4) Shot replacement -> I've tried to do it and miserably failed. U_U


Please forgive my ignorance, and my poor english.

1) Your BGM probably has the wrong codec format. Open an original touhou song or a song that works in danmakufu and check the properties such as the Hz, channels, bitrate etc. Use Audacity (or some other program) to save it in correct codec.

2) Yes it is possible. Depends on if you are using regular bullets (createshot01 etc) or object bullets. In case of regular bullets, you need to use DeleteEnemyShot and the similar ones (see the wiki). Incase of Object bullets > obj_delete(obj);  when ever you want to delete it

3) Shooting the familiar is the same as bosses. You need to use  GetX and GetY for the familiar location. Obj_GetX or Y is NOT for familiars, it is for objects.

If this is your entire code, then where the hell is your wait function? If it gives you error on the wait function, it means it is not there (or you didnt post your entire code using Pastebin.org). Either way, the  wait function is not shared with the familiar as obviously it must be in your enemy_script_main section. You need to define it for the familiar as well (unless you know how to create included scripts).

4) Shot replacement >>
- Declare at the top let ShotData = "pathname to the shotdata.txt";
- Inside @Initialize >> LoadUserShotData(ShotData);
- Then use the ID codes inside the data to spawn the bullet: example >> CreateShot01(x,y,v,dir,ID,delay);
« Last Edit: June 27, 2010, 07:48:52 PM by Helepolis »

AzraelYvstyr

Re: Danmakufu Q&A/Problem thread number 4
« Reply #70 on: June 27, 2010, 08:04:42 PM »
I've solved the familiars' problem, thank you very much.

My failure with the shot replacement was not declaring the ShotData variable ^^U. By the way, can I use the standard bullets while having the shot replacement? (I mean mix both bullets in a same spellcard). Ah, I guess I've to declare again the ShotData and LoadUserShotData in the familiar script, right?

And with DeleteEnemyShot (It's CreateShotA so I suppose it has to be with that one), I've no idea of how it works.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem thread number 4
« Reply #71 on: June 27, 2010, 08:09:54 PM »
I've solved the familiars' problem, thank you very much.
(  '.')b

My failure with the shot replacement was not declaring the ShotData variable ^^U. By the way, can I use the standard bullets while having the shot replacement? (I mean mix both bullets in a same spellcard). Ah, I guess I've to declare again the ShotData and LoadUserShotData in the familiar script, right?
Afaik, shot data is somehow shared between both the familiar and the boss. You just need to load it in the main section.

There is a huge difference between shotreplacement and  shotsheet. Read it here in the FAQ (click to read)

And with DeleteEnemyShot (It's CreateShotA so I suppose it has to be with that one), I've no idea of how it works.

Read the wiki

AzraelYvstyr

Re: Danmakufu Q&A/Problem thread number 4
« Reply #72 on: June 27, 2010, 09:14:00 PM »
There is a huge difference between shotreplacement and  shotsheet. Read it here in the FAQ (click to read)

Well, I didn't remember that ^^U

And with the DeleteEnemyShot, I've already read the wiki when I asked, but the wiki says 1 parameter and is the type of bullet. What I want is erasing the bullets after a while, what I don't know how to do with a function that doesn't have a time parameter.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem thread number 4
« Reply #73 on: June 27, 2010, 09:19:09 PM »
Well, I didn't remember that ^^U

And with the DeleteEnemyShot, I've already read the wiki when I asked, but the wiki says 1 parameter and is the type of bullet. What I want is erasing the bullets after a while, what I don't know how to do with a function that doesn't have a time parameter.

I advise you to read the danmakufu tutorials, especially this part of the basics tutorial. It will teach you what you need to know.

Edit: what the hell is wrong with my typing?
« Last Edit: June 27, 2010, 09:25:18 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."

Re: Danmakufu Q&A/Problem thread number 4
« Reply #74 on: June 30, 2010, 09:34:29 AM »
Trying my best learning how to use task, but this is so confusing  :ohdear:

So I'm trying to learn how to use functions with task thingy but couldn't get the script to work. Also in the task part, no matter what I try I cannot get the bullets to bounce off the top part of the screen x_x. confusing confusing (head explodes)

What I have in mind (ze)
bullets spawn with those "tail" bullets after then and they bounce off the top and the sides

My script so far :(

Code: [Select]
#TouhouDanmakufu
#Title[1]
#Text[1]
#Player[FREE]
#ScriptVersion[2]
#BGM[]
#PlayLevel[Normal]

script_enemy_main{

let SupaShot = GetCurrentScriptDirectory~"\c6shots.txt";
let BossImage = GetCurrentScriptDirectory~"\enem1.png";
let frame = 0;
let angle = 0;
let move = 0;
let s = 0;
   
   
   @Initialize{
LoadGraphic(BossImage);
LoadUserShotData(SupaShot);
SetLife(2500);
SetTimer(60);
SetInvincibility(30);
Concentration01(100);
MagicCircle(true);
SetMovePosition02(GetCenterX, GetCenterY - 100, 120); //Move the boss to the top center of the screen.
   }
   
   @MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
frame++;
omg++;
move++;
   
   if(frame==100){
function wow;
frame = 0;
}



if(move== 500){
SetMovePosition03(rand(100,400), 200, 5, 5);
move = 0;
}
   

yield;

 }

    @DrawLoop {
SetTexture(BossImage);
SetGraphicRect(0,0,100,100);
DrawGraphic(GetX, GetY);
DrawText("I'm a boss", 50, 50, 12, 255);


    }

    @Finalize {
    }

task Bullet(x, y, v, angle) {
      let obj=Obj_Create(OBJ_SHOT);

      Obj_SetPosition(obj, x, y);
      Obj_SetAngle(obj, angle);
      Obj_SetSpeed(obj, v);
      ObjShot_SetGraphic(obj, RED01);
      ObjShot_SetDelay  (obj, 0);
      ObjShot_SetBombResist (obj, true);

      while(Obj_BeDeleted(obj)==false) {

              if(Obj_GetX(obj)<GetClipMinX) {
                     Obj_SetAngle(obj, 180 - Obj_GetAngle(obj) );
                     Obj_SetX(obj,  Obj_GetX(obj) + 0.1);
              }

              if(Obj_GetX(obj)>GetClipMaxX) {
                     Obj_SetAngle(obj, 180 - Obj_GetAngle(obj) );
                     Obj_SetX(obj,  Obj_GetX(obj) - 0.1);
              }

              yield;
       }
}

function wow(x, y){
ascent(i in 0..10){
ascent(k in 0..6){
Bullet(x, y, 0.5*(1+k), i*40);
 }   
 }
}



}

Hey There !

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 number 4
« Reply #75 on: June 30, 2010, 09:42:08 AM »
First of all... you're calling wow like this
Code: [Select]
function wow;
when it's supposed to be like this
Code: [Select]
wow;

also, if you want it to bounce on top of the screen, you need this:
Code: [Select]
  if(Obj_GetY(obj)<GetClipMinY) {
                     Obj_SetAngle(obj, 0 - Obj_GetAngle(obj) );
                     Obj_SetY(obj,  Obj_GetY(obj) + 0.1);
              }

other than that... I'm too lazy to look at your code right now :V
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Fetch()tirade

  • serial time-waster
Re: Danmakufu Q&A/Problem thread number 4
« Reply #76 on: June 30, 2010, 09:56:49 AM »
In addition you have two more problems:

1.
Code: [Select]
omg++
You have not defined this variable in any way at the top, so you can't do anything with it.

2.
Code: [Select]
function wow(x, y){
ascent(i in 0..10){
ascent(k in 0..6){
Bullet(x, y, 0.5*(1+k), i*40);
 }   
 }
}

   if(frame==100){
function wow;
frame = 0;
}

Not only did you needlessly add "function" when calling the wow function, you also called it without specifying the (x,y) values that you made for it.

Re: Danmakufu Q&A/Problem thread number 4
« Reply #77 on: June 30, 2010, 10:16:30 AM »
Quote
other than that... I'm too lazy to look at your code right now
Thankyou for you time  :)

Code: [Select]
omg++*facepalm

Code: [Select]
function wow(x, y){ Ohhhh
*double facepalm
Hey There !

Elementoid

  • Having a heated affair with feux-familiars
Re: Danmakufu Q&A/Problem thread number 4
« Reply #78 on: July 01, 2010, 01:47:44 AM »
I believe I remember someone a while back mentioning that you didn't need applocale to run danmakufu if you went to certain files and changed Japanese text into something else? Does anyone know what to change or if it works?

I'm trying to use danmakufu on this new computer and I don't want to have to go through the hassle of getting all that stuff to work again.

Fetch()tirade

  • serial time-waster
Re: Danmakufu Q&A/Problem thread number 4
« Reply #79 on: July 01, 2010, 02:05:56 AM »
Sorry, I dunno. I've actually come here with a question of my own.

When you kill a boss familiar or just any enemy that isn't the boss, Danmakufu automatically makes that "shhk" (you know what I mean)  sound. Is there any possible way I can get rid of it and replace it with another sound?

EDIT: Another question. How would one go about stopping background music set using PlayMusic?

EDIT AGAIN: Forget the second. I just inserted a blank .wav file right after the song ended. I had trimmed it down to exactly 2:23, so it was relatively easy.
« Last Edit: July 01, 2010, 02:48:08 AM by Flashtirade »

Dr. Katz

Re: Danmakufu Q&A/Problem thread number 4
« Reply #80 on: July 01, 2010, 02:57:19 AM »
I believe I remember someone a while back mentioning that you didn't need applocale to run danmakufu if you went to certain files and changed Japanese text into something else? Does anyone know what to change or if it works?

I'm trying to use danmakufu on this new computer and I don't want to have to go through the hassle of getting all that stuff to work again.

I don't need applocale to run danmakufu, but it crashes in scripts with things
like this s???u??, so i just erase that and danmakufu works perfectly.

Sorry, I dunno. I've actually come here with a question of my own.

When you kill a boss familiar or just any enemy that isn't the boss, Danmakufu automatically makes that "shhk" (you know what I mean)  sound. Is there any possible way I can get rid of it and replace it with another sound?

EDIT: Another question. How would one go about stopping background music set using PlayMusic?

EDIT AGAIN: Forget the second. I just inserted a blank .wav file right after the song ended. I had trimmed it down to exactly 2:23, so it was relatively easy.

I'm not entirely sure but have you tried using StopSE in that moment?, i hope it helps...

Now my question: is there a way to reduce the lag from CreateLaserC?.

Elementoid

  • Having a heated affair with feux-familiars
Re: Danmakufu Q&A/Problem thread number 4
« Reply #81 on: July 01, 2010, 03:06:38 AM »
Nevermind, I figured it out. Deleting the Rumia Player and ExRumia Scripts solved the issue for me.

Edit: Except now all the rumia images are gone. Oooooooooops.

And for the CLC problem, might you be able to just make a train of regular bullets? If you used the right graphics, you could probably make something nearly the same with less power needed to make it work.
« Last Edit: July 01, 2010, 03:14:59 AM by Elementoid »

Fetch()tirade

  • serial time-waster
Re: Danmakufu Q&A/Problem thread number 4
« Reply #82 on: July 01, 2010, 03:11:39 AM »
EDIT 3: Welp. Second problem still not solved.

It would work for the first one, on the condition that I knew the specific name of the audio file to stop playing, but it wouldn't work for the second one.

Danmakufu differentiates between SE (sound effects) and Music. SE clips have a maximum size limit (which was discovered in one of the previous threads), but Music clips do not. Because of this, they are handled differently by Danmakufu, and each type has its own defined functions. The problem is that Danmakufu doesn't have a StopSE equivalent for music. It does have FadeOutMusic, but that doesn't seem to be working out for me. I'm running more tests as I type, and it appears that the problem lies how long I wait to insert the blank .wav file.

As for your question, the only way to reduce that is to get a better computer. No seriously. CreateLaserC's just take a lot of processing power.



FUCKING EDIT NUMBER 4: There's no problem at all with just shoving another blank .wav right into the point where you want the looping to stop. The problem was with my tests.

When Danmakufu plays a sound, it plays it at the same speed as the original file, regardless of type, size, or the state of time (sped up, slowed) when it is inserted into the script. Like the 10-second countdown at the end of Hourai Elixir, it is not affected at all by the slowing of time.
However, the timer itself IS affected by the slowdown, and thus any programming based on that timer will be affected by the state of time.
The code I was using, if left unchecked, could cause significant slowdown that was programmed into it using the Slow function. Even worse is the fact that the slow effect was dispersed randomly depending on what time it activated.
I'm such an idiot.
« Last Edit: July 01, 2010, 03:37:56 AM by Flashtirade »

Elementoid

  • Having a heated affair with feux-familiars
Re: Danmakufu Q&A/Problem thread number 4
« Reply #83 on: July 01, 2010, 05:16:07 AM »
Does Obj_BeDeleted test for whether an object currently exists or not,  or whether there was ever an object that was later deleted?

Basically, would
Code: [Select]
if (Obj_BeDeleted(CertainObject)==true){
wait(90);
CreateCertainObject();
}
work if I'd never created a CertainObject before?

Fetch()tirade

  • serial time-waster
Re: Danmakufu Q&A/Problem thread number 4
« Reply #84 on: July 01, 2010, 06:07:06 AM »
Yes and no. In a sense it checks the existence of an object, but it does so by checking whether or not the specified object has been deleted. It cannot check for objects that do not exist. It is usually used to script while the value returns false, otherwise functions like Obj_GetX(thing) and Obj_SetAngle(thing) will not work [because there is no object anymore].

Code: [Select]
let timer = 0;
while( Obj_BeDeleted(CertainObject) == false && timer >= 0){
   if(timer == 90){
      CreateCertainObject();
   }
   timer++;
}
This is how I usually do it in object bullets. This way, the timer will stop counting (and running the function inside the task) when the object is deleted, saving processing power and reducing lag.
« Last Edit: July 01, 2010, 06:09:35 AM by Flashtirade »

Re: Danmakufu Q&A/Problem thread number 4
« Reply #85 on: July 02, 2010, 10:32:36 PM »
Hey, I have a problem with transparency. I tried to set up a custom shot, and it's mostly working, but there are a few white pixels around the shot that should be transparent. I tried opening the image up with GIMP, and quite frankly I can't see why they're there, since it looks to me like I set the entire background as transparent.  Here's the image:

http://i74.photobucket.com/albums/i255/Sapphire_flame2/Coinstrans.png

And here's the code, just in case that's the problem. I doubt it is, but whatever:

Code: [Select]
#UserShotData

ShotImage = ".\img\Coinstrans.png"

ShotData {
    id               = 1     
    rect             = (0, 0, 20, 20)   
    render           = ALPHA       
    delay_color      = (255, 128, 255)
    angular_velocity = rand(-5, 5) 
}

}


Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #86 on: July 02, 2010, 11:26:05 PM »
If you're setting the bullet as alpha-blend, you don't want any extra black anywhere. {0,0,0} will be rendered as transparent, but everything else will not and it'll look weird. Instead, set the original coins on a transparent background. How did you set this up to begin with? It should just be take image -> move to new image.

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

Re: Danmakufu Q&A/Problem thread number 4
« Reply #87 on: July 03, 2010, 05:19:23 AM »
I have some more question, why doesn't this work ? I did this for my music and it worked ???

let Crystal1 = GetCurrentScriptDirectory~"\Crystal1.txt";
let Crystal2 = GetCurrentScriptDirectory~"\Crystal2.txt";

   if(spawn==1){
CreateEnemyFromFile(Crystal1);
CreateEnemyFromFile(Crystal2);
}

 :/
Hey There !

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem thread number 4
« Reply #88 on: July 03, 2010, 06:24:16 AM »
   if(spawn==1){
CreateEnemyFromFile(Crystal1);
CreateEnemyFromFile(Crystal2);
}

That is like logical =| CreateEnemeyFromFile  has more than just the name of the file you know.

Quote from: Touhou wiki
CreateEnemyFromFile, Create a child enemy which behavior is defined in the file. Plural-script files can not be passed.
6 Parameters
    1) path of the enemy script (string)
    2) x-coordinate
    3) y-coordinate
    4) velocity
    5) direction
    6) user-defined argument

Wiki people, the wiki. These are all standard explained.

Wotan Manasal

Re: Danmakufu Q&A/Problem thread number 4
« Reply #89 on: July 05, 2010, 06:27:05 AM »
Hello. I have a problem when loading shots from shotsheets.

Can anybody point out what's wrong in the following code? In the task fire, 134 is supposed to be the id of the custom shot I want to use. At least, that's the id that the shotsheet I used points out. But the shot aren't fired at all. Is there anything wrong in the CreateShot01 functions, or in the LoadUserShotData function, or am I missing something else?

(The path to the shotsheet is correct, by the way; maybe its syntax isn't.)

Code: [Select]
#TouhouDanmakufu
#Title[Spellcard 1]
#Text[A spellcard I made just for fun.]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{

let CSD = GetCurrentScriptDirectory;

let imgBoss = CSD ~ "images\img1.png";
let cut = CSD ~ "images\img2.png";
let bg = CSD ~ "images\bg1.png";
let bgm = CSD ~ "sound\track.mp3";

@Initialize{

LoadUserShotData(CSD ~ "\shots\supershot.png");

SetLife(10000);
SetTimer(99);

SetScore(200000);

SetMovePosition01(GetCenterX,GetCenterY,5);
LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);
LoadMusic(bgm);
PlayMusic(bgm);
CutIn(YOUMU,"XXXXXXXXXX - XXXXX",cut,0,0,300,384);

mainTask;
}

@MainLoop{
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,16);
yield;
}

@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,300,300);

SetGraphicScale(0.25,0.25);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);
}

@BackGround{
SetTexture(bg);
SetRenderState(ALPHA);
SetAlpha(100);
SetGraphicRect(0,0,512,512);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX,GetCenterY);
}

@Finalize{
DeleteGraphic(imgBoss);
DeleteGraphic(cut);
DeleteGraphic(bg);
DeleteMusic(bgm);
}

task mainTask{
yield;
fire;
fire_laser;
fire_laser_2;
movement;
}

task movement{
loop{
SetMovePosition01(rand_int(GetCenterX-100,GetCenterX+100),rand_int(90,140),5);
wait(60);
SetMovePosition01(rand_int(GetCenterX-100,GetCenterX+100),rand_int(90,140),5);
wait(60);
yield;
}
}

task fire_laser{
loop{
CreateLaser01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer,100,10,BLUE02,0);
wait(60);
yield;
}
}

task fire_laser_2{
loop{
CreateLaser01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-10,50,8,BLUE02,0);
CreateLaser01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+10,50,8,BLUE02,0);
CreateLaser01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-15,50,8,BLUE02,0);
CreateLaser01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+15,50,8,BLUE02,0);
wait(10);
yield;
}
}

task fire{
loop{
CreateShot01(GetEnemyX,GetEnemyY,3,0,134,10);
CreateShot01(GetEnemyX,GetEnemyY,3,45,134,10);
CreateShot01(GetEnemyX,GetEnemyY,3,90,134,10);
CreateShot01(GetEnemyX,GetEnemyY,3,135,134,10);
CreateShot01(GetEnemyX,GetEnemyY,3,180,134,10);
CreateShot01(GetEnemyX,GetEnemyY,3,225,134,10);
CreateShot01(GetEnemyX,GetEnemyY,3,270,134,10);
CreateShot01(GetEnemyX,GetEnemyY,3,315,134,10);


CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer,AQUA01,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-10,AQUA01,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+10,AQUA01,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-20,AQUA01,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+20,AQUA01,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-30,AQUA01,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+30,AQUA01,10);

CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-5,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+5,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-15,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+15,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-25,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+25,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-35,AQUA01,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+35,AQUA01,10);


wait(30);
yield;
}
}

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