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

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #360 on: July 03, 2011, 02:00:32 PM »
I'm not sure what you wish the script to do. I tested it's in fact animated. Now I'm wondering why you have these GetSpeedX since it's always equal to 0 in your script.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #361 on: July 03, 2011, 02:22:32 PM »
Effect objects are seeming like the best idea, but I'm not really sure how to find the proper vertices to use...Can someone give me a hand? Here's the sprite sheet for the eye if that helps... http://imageshack.us/photo/my-images/6/eyen.png/

Darkness1

  • Nothing to see here.
  • Enigmatic, isn't it?
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #362 on: July 03, 2011, 03:13:46 PM »
The only way for me to understand it was with Helepolis video tutorial: http://www.youtube.com/watch?v=EMw7DOWYMkw&feature=channel_video_title

Probably, you're going to use four vertices, and give them XY positions. They are counted from the center of the game point. One eye seems to be about 56 x 72 pixels large. Then the XY vertices should be
0 : -28 and -36.
1 : 28 and -36.
2 : -28 and 36.
3 : 28 and 36.

Then you set the point in the graphic for the vertices using UV. It should be like this:
0 : 14, 5.
1 : 70, 5.
2 : 14, 77.
3 : 70, 77.

These coordinates are only for the closed eye, and i might have made some mistakes. This uses the same primitive type as in helepolis video, the triangelstrip. Using effect objects is hard work, but the results may be really good.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #363 on: July 04, 2011, 02:18:54 AM »
Ok, the effect object worked brilliantly for making the closed eye, but now I can't get the eye to "open" by going to the next sprite...Here's what I've got: http://pastebin.com/DejPxDZV

I'm not sure what I'm doing wrong, but at least it's not crashing my game...the eye just vanishes after 120 frames instead of opening, even though the while loop is right there. Can anyone figure this out? >.<

EDIT: Thanks for the link, Darkness1!!! That tutorial made it so much simpler to understand the purpose and use of effect objects ^_^

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #364 on: July 04, 2011, 03:18:48 AM »
For sure it vanishes, since you delete the object when the counter equals 120. Your while(!Obj_BeDeleted(obj)) loop is not needed at all :ohdear:

Darkness1

  • Nothing to see here.
  • Enigmatic, isn't it?
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #365 on: July 04, 2011, 07:52:43 AM »
What Ginko said, it deletes when the counter reaches 120, and the animation starts after the counter reaches 120. Also, unlike drawloop, you don't have to loop what's being shown, because you're using SET functions. So you don't need to use while for the vertices. And because the XY vertices are the same for both of the eyes, you don't have to use that command again. I would do it like this :     
Code: [Select]
    task EYE(deletetime){
 
   //coding for the effect object, including the starting vertices. 
 
    while(!Obj_BeDeleted(obj)){

    counter++;

    yield;

    if(counter==120){
ObjEffect_SetVertexUV(obj, 0, 13, 85);
ObjEffect_SetVertexUV(obj, 1, 69, 85);
ObjEffect_SetVertexUV(obj, 2, 13, 159);
ObjEffect_SetVertexUV(obj, 3, 69, 159);
    }

    if(counter==deletetime){
    Obj_Delete(obj);
    }}}

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #366 on: July 04, 2011, 10:42:34 AM »
You could also just create an enemy and just skip the code that defines the hitbox.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #367 on: July 04, 2011, 01:11:51 PM »
Cool! Getting rid of that loop took care of it perfectly...now to add a background :D Thanks guys!

EDIT: I can't quite remember what you use to say "while the enemy has this much health, do this..." <-- for use in a task loop

Just a quick question if someone wouldn't mind answering...
« Last Edit: July 04, 2011, 01:17:23 PM by ByakuganAce »

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #368 on: July 04, 2011, 01:42:04 PM »
if(GetLife == X){
      do something;
}

or

if(GetLife <= X){
      do something;
}

or

if(GetLife >= X){
      do something;
}
« Last Edit: July 04, 2011, 01:43:55 PM by JmLyan »

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #369 on: July 04, 2011, 01:43:33 PM »
Danmakufu Functions Page.

So in your case, the right condition is "GetLife > N" in the main boss' script, or "GetEnemyLife > N" in another enemy script.
« Last Edit: July 04, 2011, 01:45:18 PM by Ginko »

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #370 on: July 04, 2011, 04:19:17 PM »
Excellent! Thanks again ^_^

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #371 on: July 06, 2011, 12:15:53 AM »
*sigh* Sorry to keep bothering you guys :/ I have yet another STUPID question...

I want the loop in the fire loop in this script http://pastebin.com/CgXbCTQm to loop every 60 frames...I've tried using a counter variable and counter++; along with the while loop, and I've also tried placing this loop inside another loop that waits for 60 frames, but neither of them has worked...If I'm on to anything with these, or if there's another way, could someone please help me make it work? I'm really sorry to be such a constant bother >.<


Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #372 on: July 06, 2011, 01:09:54 AM »
Let's take a look at what your fire task is doing.
task fire{
   
   loop(5){ // In a loop for 5 loops...
   
   PlaySE(CSD~"sound\Shot1.wav"); // you are playing a sound...
   bullet(GetEnemyX,GetEnemyY,5,45,237,0);
   bullet(GetEnemyX,GetEnemyY,5,135,237,0);
   bullet(GetEnemyX,GetEnemyY,5,225,237,0);
   bullet(GetEnemyX,GetEnemyY,5,315,237,0); // firing 4 bullets...
   
   
   wait(6); // and waiting 6 frames in between each loop.
   
   } // After this loop is finished...
   loop{yield;} // you are yielding in an infinite loop forever for no apparent reason.
   }


There is absolutely no point to the second loop. If you want to repeat the first loop indefinitely, stick it inside another loop that goes on indefinitely like so:

loop {
    loop(5){
        // stuff
        wait(6); // 6 * 5 = 30.
    }
    wait(30); // 30 + 30 = 60 so it'll start the bullet firing loop after 60 frames.
}
<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: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #373 on: July 06, 2011, 01:44:04 AM »
Worked like a charm! Thank you for tolerating my stupidity! This is the epitome of my stupid, but...what is the purpose of having a yield; ? I just can't figure out the significance :/

Fetch()tirade

  • serial time-waster
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #374 on: July 06, 2011, 01:57:57 AM »
You should probably get a better explanation from someone who knows more about programming than me, but yeah.

DMF reads and interprets code frame by frame.

Let's say you've got a block of code. For the first frame (or zeroth, whichever one), DMF will perform actions based upon the code. If a yield is inserted anywhere into the code, then DMF will assume that's the end of the code you want performed during the initial (ha!) frame and will move onto the next frame. Then for the second frame (or first dammit), DMF will perform any actions coded to perform on that frame, and so on and so forth. The entire script is read like: what happens on frame #1, what happens on frame #2, what happens on frame #3, etc.

If you have something like:
Code: [Select]
doawesomeshit; // task
domoreawesomeshit; // task
wait(30); // or loop(30){yield;}
BURNINATE; // task

then DMF will initiate the first and second tasks, perform no actions in that particular section of code for 30 frames (half a second), then initiate the third task. Consecutive actions will run on the same frame unless there is a yield; or wait(); in place.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #375 on: July 06, 2011, 02:17:50 AM »
Worked like a charm! Thank you for tolerating my stupidity! This is the epitome of my stupid, but...what is the purpose of having a yield; ? I just can't figure out the significance :/

http://www.shrinemaiden.org/forum/index.php/topic,9281.msg635706.html#msg635706
I should save a list of links to posts that explain things that are commonly asked from now on.  :3
<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: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #376 on: July 06, 2011, 02:26:19 AM »
You're simply asking Danmakufu to do several things simultaneously. Yet :
- you can't necessarily make several things at a time
- you want them to be connected timewise, which won't be natural; some things need a lot of time to be done, and you don't want it to be slower than the rest.
- you don't want a value to me modified while it's being read by something else.

The multiple blocks of code that are simultaneously supposed to happen here are the main loop and the tasks. Those threads are competing for being processed, but you want them to apply in a certain order in order to avoid all the mess above. So you give each of them a token. Whenever you want to give some processing  to another thread, you have this thread yield, and take back its token, then give your process time to a thread that still has his token. When noone has any token, you give each thread one.
« Last Edit: July 06, 2011, 02:28:23 AM by Ginko »

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #377 on: July 06, 2011, 04:51:01 PM »
Ok, makes sense now...thanks guys :) I'll undoubtedly be back, but for now... thanks!

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #378 on: July 06, 2011, 07:24:42 PM »
Ya, so I wanted to test out my script but....I got an error. Before the stage even started, like when I select a character the error comes up. I had my older brother translate it, it says that it can't find my script...and it's in the script folder, so, I don't really know why. >.<

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #379 on: July 06, 2011, 08:43:06 PM »
Please take a screenshot of the error. Your telling us it can't find the script is pretty much wrong, since if it couldn't find your script it simply wouldn't be in DNH's list. It erroring before running happens in 90% of errors, it means you have a syntax error or some such thing.

Also, please post in the Danmakufu Q&A thread next time. You didn't even hit the right forum.

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 #380 on: July 06, 2011, 09:59:26 PM »
And I was right...here I am again >.<

Where does one go about finding Reimu without a hitbox?

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #381 on: July 07, 2011, 01:32:44 AM »
Where does one go about finding Reimu without a hitbox?

You would like to create your own System.png and edit it to remove the hitbox graphic.
Lemme give you a dat extraction.
« Last Edit: July 07, 2011, 01:34:32 AM by Mewkkyuuri »

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #382 on: July 07, 2011, 06:41:22 PM »
Sorry, back again :( How do you make object bullets accelerate? I can't think of anything that works...I want to make two circles of ten object bullets on either side of the boss that accelerate so that they are spinning faster, and then to launch the circles of bullets at the player. I tried to do it with CreateShotA instead, but when I call a second SetShot to launch the bullets, they all leave from the same point in a line instead of remaining as a circle. Any takers?

I know, I have a ton of questions :/

Fetch()tirade

  • serial time-waster
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #383 on: July 07, 2011, 07:51:15 PM »
Sorry, back again :( How do you make object bullets accelerate? I can't think of anything that works...I want to make two circles of ten object bullets on either side of the boss that accelerate so that they are spinning faster, and then to launch the circles of bullets at the player. I tried to do it with CreateShotA instead, but when I call a second SetShot to launch the bullets, they all leave from the same point in a line instead of remaining as a circle. Any takers?

I know, I have a ton of questions :/

Acceleration with object bullets can be achieved, but it is not easy. It has to do with changing the rate of movement over pixels in relation to time.

For example: A standard CreateShot01 aimed at 0 degrees (straight right) at a speed of 2 will adjust its position 2 pixels to the right of its current position every frame. The same CreateShot01, different in that it is now aimed at 45 degrees (right-down), will adjust its position by  2 * cos(45) pixels [x-position] and 2 * sin(45) pixels [y-position] every frame.

In order to make an object bullet accelerate or decelerate, it needs to have variables and control statements for monitoring its current position, its current movement speed per frame, the final movement speed per frame, and the rate at which to adjust the current movement speed until it reaches its final movement speed. There also needs to be a checking system in order to ensure that the values given to the object bullet are logical (you can't assign a bullet -0.15 deceleration and expect it to go faster).

Here is a little script demonstrating this. I know there are some problems with it, but I think it demonstrates the concept of what I'm trying to explain.

---

And if you're having problems with CreateShotA, then you should post your script. It'll make debugging it much easier than having us guess at what the problem is.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #384 on: July 07, 2011, 09:03:00 PM »
Sorry, back again :( How do you make object bullets accelerate? I can't think of anything that works...I want to make two circles of ten object bullets on either side of the boss that accelerate so that they are spinning faster, and then to launch the circles of bullets at the player. I tried to do it with CreateShotA instead, but when I call a second SetShot to launch the bullets, they all leave from the same point in a line instead of remaining as a circle. Any takers?

I know, I have a ton of questions :/

Acceleration with object bullets can be achieved, and it is easy. Seriously ...

If you just want to make bullet spin, usually, you can have a time counter "t" and do the following each frame, with a 0 speed bullet :
Code: [Select]
t++;
Obj_SetX(obj, x + R*cos(offset + angularspeed*t));
Obj_SetY(obj, y + R*sin(offset + angularspeed*t));
Obj_SetAngle(obj,offset+t+90); //optional
yield;

Now you want the bullet to accelerate ? Just accelerate the time ! For example if you use (a*t)*t instead of t and your bullet spins for 300 frames, the bullet will accelerate from 0 to a*300 times the speed it had above. A value of "a" around 1/100 seems reasonable, then.

Code: [Select]
t++;
Obj_SetX(obj, x + R*cos(offset + angularspeed*a*t*t));
Obj_SetY(obj, y + R*sin(offset + angularspeed*a*t*t));
Obj_SetAngle(obj,offset+t+90); //optional
yield;

« Last Edit: July 07, 2011, 09:05:14 PM by Ginko »

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #385 on: July 07, 2011, 11:01:04 PM »
Worked wonderfully! Sorry I'm so bothersome :/

TheTeff007

  • Best Touhou 2015!
  • So much cuteness...!
    • Youtube Channel
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #386 on: July 08, 2011, 06:21:04 AM »
3.) Your handling of the timer sound is really inefficient. If you decide to change the timer of the spell, you'd have to redefine all the conditionals. Why aren't you using GetTimer?
[/quote]

Well, GetTimer doesn't work with my script for some reason, it doesn't crash or anything, but the sound doesn't play.

So, I came up with another way to manage the timer:

Code: [Select]
let Timeout = 3000; //This value will change depending on the time the spell lasts. This spell lasts 60 seconds.
let Rep = 0;

//at the main loop

loop(6){if(fcount == Timeout + (60 * Rep)){PlaySE(Time1); Rep+=1;}}

loop(4){if(fcount == Timeout + (60 * Rep)){PlaySE(Time2); Rep+=1;}}

It uses less code, and if the timer changes, I only need to modify one value.

EDIT: BTW, I just put "10" as the value of the SetScore and the result was 29 in-game. I then put 1 and the result was "2" in game.
I don't know how this works, but the formula of this can be discovered. I hope...
« Last Edit: July 08, 2011, 06:57:40 AM by Teff007 »
Small Teaser of my upcoming project~

No need to call me Teff007. Teff will do just as well~

Darkness1

  • Nothing to see here.
  • Enigmatic, isn't it?
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #387 on: July 08, 2011, 07:12:16 AM »
Asking questions about 3D drawing cause it goes horrible for me:
  • Is there anyway to calculate 3D positions? It's so hard to get the pieces to fit together as well as looking good. (And if i were to rotate my 3D object, I'm sure of that they actually aren't fitting together.)
  • Okay, i got no clue here. I'm drawing the floor at the start of BackGround and then the bookshelves, but the floor is drawn on top of the bookshelves. I am using Zbuffer and i don't know how to make the floor be drawn behind the bookshelves entirely.

Pastebin: http://pastebin.com/9vx1cm9j

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #388 on: July 08, 2011, 07:45:15 AM »
Asking questions about 3D drawing cause it goes horrible for me:
  • Is there anyway to calculate 3D positions? It's so hard to get the pieces to fit together as well as looking good. (And if i were to rotate my 3D object, I'm sure of that they actually aren't fitting together.)
  • Okay, i got no clue here. I'm drawing the floor at the start of BackGround and then the bookshelves, but the floor is drawn on top of the bookshelves. I am using Zbuffer and i don't know how to make the floor be drawn behind the bookshelves entirely.

Pastebin: http://pastebin.com/9vx1cm9j

Oh my, your code is quite messy. First of all: SetViewTo and SetViewFrom are camera functions. You only call them once in the beginning of your stage and modify them only if you wish to change the view. Right now it looks like you are swaying the camera to everywhere and nowhere.

Second: please show a screenshot how it currently looks for you. I cannot really make up from your code what is wrong.

Third (advised): Script your 3D objects as functions, so you can call them back with one line, instead of copy-pasting the entire block. For example:

Code: [Select]
 
SetTexture(bg2);
SetGraphicRect(0,0,512,512);
SetGraphicScale(1.2,1.2);
SetGraphicAngle(-90, 0, 180);
DrawGraphic3D(0,0,0);
change this to
Code: [Select]
 
function createFloor(px,py,pz) {
SetTexture(bg2);
SetColor(215,215,215);
SetGraphicRect(0,0,512,512);
SetGraphicScale(1.2,1.2);
SetGraphicAngle(-90, 0, 180);
DrawGraphic3D(px,pz,py);      // <--- parameters px y and z
}

So next time you call your floor for redrawing you just use     createFloor(0,0,0);  and it will be drawn at your given locations.


EDIT

About calculating your 3D positions. Welcome to Danmakufu, the wonderful engine that does not make your life easy. Basically you need to Trial & Error a lot with fitting the objects. Work with powers of 2 for all your objects (2 4 8 16 etc..).  Remember that each object is calculated from the center of the object. You know, just like effect objects drawn at 0,0. So you need to visualize strongly on how you want to place the objects and then test endlessly how they appear. Some tips to keep in mind:

- Don't use dodgy scales (like 1.2,1.35). Stick to integers like 1,1  2,2 etc.
- Use powers of 2 for the GraphicRects etc
- Don't exceed GraphicRects beyond 1024 else it will show bad clipping when you are using fog.
« Last Edit: July 08, 2011, 07:57:08 AM by Helepolis »

Darkness1

  • Nothing to see here.
  • Enigmatic, isn't it?
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #389 on: July 08, 2011, 08:18:23 AM »
It's still messy, but i changed them into functions and limited the use of camera functions: http://pastebin.com/sSbeH3W8

And here's a screenshot of how it looks: http://img189.imageshack.us/img189/3695/screenshotbg.png

The floor looks like water, it's on top of the other objects, especially on the left shelf's side for some reason.

EDIT:

I have a lot of problem with scaling the sides of the bookshelves as well as setting the right angle for it. Both are the same size of 512x512, which means that i have to scale them down incredibly much. Especially the sides, which are the smallest parts of the object. The front and top parts were much easier to do. But well, i could lower the SetGraphicRect...
« Last Edit: July 08, 2011, 08:25:45 AM by Darkness1 »