Charas-Project

Game Creation => Requests => RPG Maker Programming => Topic started by: Dragoon de Sol on November 01, 2007, 05:31:58 AM

Title: Request: ATB And Percentage bar assistance for Custom Battle System
Post by: Dragoon de Sol on November 01, 2007, 05:31:58 AM
Okay, I can't get to the RPG Maker Programming area, so this'll have to do.

I need help with two things.

1. I need help on how to code an ATB bar that determines when a character/enemy can act.

2. I need help on how to code bars that measure percentages of amounts, such as HP/MP.
Title:
Post by: Ben on November 01, 2007, 05:38:25 AM
2k3 or xp?
Title:
Post by: Dragoon de Sol on November 01, 2007, 03:07:22 PM
Heh..oops.

2K3.
Title:
Post by: Ben on November 01, 2007, 04:10:20 PM
i am of no help to you then... Gemini is XP compatible onry.
Title:
Post by: Dragoon de Sol on November 01, 2007, 04:17:13 PM
Dammit.
Title:
Post by: Dominicy on November 01, 2007, 06:36:37 PM
It all depends on how specific you want the ATB bar.  such as add one to a variable called "Character 1 ATB" and have a conditional branch that asks if the variable is atleast one.  if it is, display picture "Character 1 ATB bar 1" or something, and keep doing that up until you reach how ever much you want, such as up to 10 or 20.  That's the best I can do for now..
Title:
Post by: Moosetroop11 on November 01, 2007, 08:10:17 PM
MOVED.

You got the main page problem too huh? Sucks. I hear firefox can load it fine.
Title:
Post by: RPG noob on November 01, 2007, 09:04:20 PM
This should help for the percentages

 
Quote
If you thought of cross multiplying, you were right. For those of you who don't know, cross multiplying is the term for the metheod we'll use to solve this. Lets say the hero has 2 life left our of 10. And we're trying to find the percentage of that. Heres what the coding would look like.  [percentage] = hero current life (2)  [percentage] times 100 (percentage)  [percentage] / hero complete life (10)    we have 2, times 100 = 200, divided by 10 = 20.  Thus, we'll get 20% as the amount of life left.    Whenever you want to find a value that you can't get by using the variable options command (percentage for example) you need an algorithm to find the value. You need to think of what it needs to accomplish, and what you have to work with.


Then you would have a conditional branch that checks what the percent is and show the picture accordingly.

On a side note I can't get on the main page either using opera
Title:
Post by: Dragoon de Sol on November 01, 2007, 09:27:49 PM
Thanks RN. Now all I need is the ATB. I know how to work the bar, just not how to determine how it fills. Do I measure seconds or what?
Title:
Post by: RPG noob on November 01, 2007, 11:00:56 PM
You want an event that loops with a condition switch           (switch 1 on) which counts a seconds variable up to how ever many seconds you want until the players turn e.g 10.  When it reaches 10 seconds make the event stop (switch 1 off) and show the commands.  When the character has used a command flick the switch on and set the timer variable back to 0 and hopefully the process will start again.

Sorry if thats a bit hard to understand
Title:
Post by: Dragoon de Sol on November 01, 2007, 11:52:09 PM
Hmm...I see what you mean now.

We need to get your name changed from Noob to something else ^_^
Title:
Post by: DragonBlaze on November 02, 2007, 01:39:38 AM
Quote
Originally posted by RPG noob
You want an event that loops with a condition switch           (switch 1 on) which counts a seconds variable up to how ever many seconds you want until the players turn e.g 10.  When it reaches 10 seconds make the event stop (switch 1 off) and show the commands.  When the character has used a command flick the switch on and set the timer variable back to 0 and hopefully the process will start again.

Sorry if thats a bit hard to understand


I would advise against this method because usually you want the atb gauge to fill up according to the characters speed/agility. So if you want to have it fill up according to their agility, do something like this.

Find out the maximum agility a character can have, by defualt its 999; however, your game may only go up to 100 or 500. Once you find this number, set a variable [hero1ATB] equal to it, then make it a little bigger. So if your highest is 999, set [hero1ATB] equal to 1010 (or something like that). After you have it set to the correct value, subtract the heros agility from [hero1ATB]. If the agility of the hero was maxed out at 999, the number will be very small (11), but if the agility was low such as 10, the number will be really high at 1000.

After you get this new number for [hero1ATB] make a parallel process event for the ATB. Every .1 seconds, add a number to a new variable called [hero1ATBadd]. Lets say this number is 10. Every time you add 10 to [hero1ATBadd], check with a conditional branch for if [hero1ATBadd] is greater than or equal to [hero1ATB]. If it is, then turn a switch [hero1turn] ON (or do whatver you want to do in order for the hero to take its turn. So if [hero1ATB] is 11, it'll be the heros turn every .2 seconds. if [hero1ATB] is 1000, it'll take 10 seconds for the hero to take its turn. By balancing the number you add (10) and the max agility (1010), you can control how fast you want the heros bar to fill on the various levels.

You can do this for multiple characters, just make sure that the max number is the same for all of them.

In the end, the code will look something like this.

[hero1ATB] = 1010
subract hero1 agility from [hero1ATB]
Label 1
wait .1 seconds
[hero1ATBadd] + 10
if [hero1ATBadd] is greater than or equal to [hero1ATB]
--(take a turn)
else
--jump to label 1

you'll want to turn that code off while its the heros turn, i learned that the hard way...
Title:
Post by: Dragoon de Sol on November 02, 2007, 01:49:53 AM
Thanks for the tip, man.
Title:
Post by: RPG noob on November 02, 2007, 03:06:53 PM
nice one db I didn't think about agility lvl lol... serves me right for trying to figure it out really late  :D
Title:
Post by: DragonBlaze on November 03, 2007, 03:23:29 AM
Lol, on my first cbs agility didn't play a role in it either. Then when I first started adding agility, it was a mess...
Title:
Post by: Dragoon de Sol on November 03, 2007, 03:31:03 AM
lol. I'm still working on how to get the bars themselves working. The percentages work, but the bars don't.

If I set them to equal to an amount, then unless it IS that amount, it wont show.

If I set it to greater than/less than or equal to, then the bars seems to fill up to the point where the percentage is.
Title:
Post by: RPG noob on November 03, 2007, 11:09:02 AM
I admit I've never made a cbs so I don't know if this works.  This is for if you had 10 pictures of bars.

Branch if variable is greater than 0
Branch if variable is less than 11
show picture hp bar1
else
Branch if var is less than 21
show picture hp bar2
else
Branch if var is less than 31
show picture hp bar3
and so on until less than 101

Try something like that depending on how many pictures you have
Title:
Post by: DragonBlaze on November 03, 2007, 09:23:08 PM
Lol, I got an easier way... well its the way I do it at least.

Cross multiplying gives you the percent out of 100 right? Well to be honest, you're not really looking for the percent, your looking for the number for the bar you want to display the percent..

What I mean to say is this, lets say you have 20 pictures for the bar. (0 being emtpy and 20 being full). Instead of multiplying the current hp by 100 then dividing by the total hp, you want to multiply the current hp by 19 (one less than the number of pictures) then divide by the total hp.

OR...

[current HP] equal to heros current hp
[current HP] multiply by 19 (one less than the number of pics you use)
Divide [current HP] by total hp

Now what you can do is this.

if [current hp] is 0 (or less) show the empty bar.
if it's 1, show the next bar up (almost emtpy).
If its 2, show the next bar up
keep  going.
then if [current hp] is 19 show the full bar.

This will make it a bit easier to work with.

The reason we're only using 19 while we have 20 pictures is because we're counting '0' in the cases for testing (if the hp is 0). And testing 0-19 is 20 cases, so it works well with 20 pictures. If you were using 10 pictures, you'd want to multiply it by 9, and if you were using 100 pictures, you'd want multiply it by 99.

This method doesn't give you a variable representation of the percent, but it makes displaying it to the user a lot easier.
Title:
Post by: Dragoon de Sol on November 03, 2007, 10:51:13 PM
lol, I just added every single percentage and made a bar show for it. like for 1 and 2 percents, the 2percent bar shows
Title:
Post by: Dragoon de Sol on November 10, 2007, 03:29:36 AM
Sorry to kick my own topic ^_^

DragonBlaze, how would I go about displaying that ATB you were talking about if the bar was 100 pixels long.