Isolating digits is very useful if you have a custom battle system and want to have graphics represent your current HP or other stats. Of course if you wanted to, you could just make tons of graphics and forks but this way is more efficient.

1) you will need 10 variables:

1 for the number to isolate

1 for the thousands place

1 for the thousands place * 1000

1 for the hundreds place

1 for the hundreds place * 100

1 for the tens place

1 for the tens place * 10

1 for the ones place

1 for the thousands + hundreds place

1 for the thousands + hundreds + tens place

We will call the number to isolate "number", the thousands place

"thousands", the housands place * 1000 thousands2 the hundreds place

"hudreds", the hundreds place * 100 hundreds2, the tens place "tens",
the

tens place * 10 tens2, the ones place "ones", the thousands + hundreds

"ThousHun", the thousands + hundreds + tens "ThousHunTens"

2)ISOLATING THE THOUSANDS PLACE

set the variable thousands to the number variable

set the variable thousands to divide by 1000

set the variable thousands2 to 1000

set the variable thousands2 to multiply by the variable thousands

***This sets the thousands variable to whatever number you want to isolate.

It then divides by 1000 giving you the thousands place since RPG2K cuts off

the decimal. Then it multiplies that by 1000 and puts it in the variable

thousands2 setting that up for use in Isolating the other digits.

EX: 3249 is the number you want to isolate. 3249 is stored in thousands.

3249 is divided by 1000 and it cuts off the remainder leaving you with 3

which is the thousands place. It multiplies that by 1000 giving you 3000 and

puts that in the thousands2 variable for use in isolating other digits.

3)ISOLATING THE HUNDREDS PLACE

set the variable hundreds to the number variable

set the variable hundreds to subtract the variable thousands2

set the variable hundreds to divide by 100

set the variable hundreds2 to 100

set the variable hundreds2 to multiply by the variable hundreds

set the variable ThousHun to thousands2

set the variable ThousHun to add the variable hundreds2

***This sets the hundreds variable to whatever number you want to isolate.

It then subtracts the variable in thousands2 to get rid of the thousands

place. It then divides by 100 giving you the hundreds place. It then

multiplies that by 100 setting it up for use in isolating the other digits.

It then sets the variable ThousHun to the variable thousands2. It then sets

the variable ThousHun to add the variable hundreds2. This is also used in

isolating the other digits.

EX: 3249 is stored in the variable hundreds. 3000 is subtracted from 3249 to

give you 249 which eliminates the thousands place. It then divides 249 by

100 and cuts off the decimal giving you the hundreds place which is 2. It

then sets the hundreds2 variable to 100. It then multiplies that by the

variable hundreds (the hundreds place) to give you 200 which is used in

isolating other digits. It then adds the variables thousands2 and hundreds2

together to produce 3200 which is used in isolating other digits.

4)ISOLATING TENS

set the variable tens to the variable number

set the variable tens to subtract the variable ThousHun

set the variable tens to divide by 10

set the variable tens2 to 10

set the variable tens2 to multiply by the variable tens

set the variable ThousHunTen to the variable ThousHun

set the variable ThousHunTen to add the variable tens2

***This sets the tens variable to whatever number you want to isolate. It

then subtracts the variable in ThousHun to get rid of the hundreds and

thousands place. It then divides by 10 giving you the tens place. It then

multiplies that by 10 setting it up for use in isolating the other digits.

It then sets the variable ThousHunTen to the variable ThousHun. It then sets

the variable ThousHun to add the variable tens2. This is also used in

isolating the other digits.

EX: 3249 is stored in the variable tens. The variable tens (3249) subtracts

the variable ThousHun (3200) to get rid of the thousands and hundreds places

and gives you 49. It then divides that by 10 and drops the remainder to give

you 4 which is the tens place. It then sets the hundreds2 variable to 10. It

then multiplies that by the variable tens (the tens place) to give you 40

which is used in isolating other digits. It then adds the variables ThousHun

and tens2 together to produce 3240 which is used in isolating other digits.

5) ISOLATING ONES

set the variable ones to the variable number

set the variable ones to subtract the variable ThousHunTen

***This sets the ones variable to whatever number you want to isolate. It

then subtracts the variable ThousHunTen to give you the ones place

EX: 3249 is stored in the variable ones. The variable ones (3249) subtracts

the variable ThousHunTen (3240) to get rid of the thousands, hundreds, and

tens place and gives you 9 which is the ones place.

There you go. This isn't just limited to displaying HP. You could also use it
for special attacks when your character reaches a certain HP or other attribute
like the FF 7777 HP trick as well as many other things. Use your imagination!

NOTE - this tutorial was written very fast and is probably very sloppy.....I
will try to make an update soon.

All questions can go to hatestruct@hotmail.com

2001 fotik

Сайт управляется системой uCoz