Charas-Project

Game Creation => Requests => RPG Maker Programming => Topic started by: Blackmoon69 on July 15, 2010, 09:27:53 PM

Title: Variable Troubles...
Post by: Blackmoon69 on July 15, 2010, 09:27:53 PM
I have a pretty simple question.(Kind of.) How do you make the value of variable a subtract from the value of variable b. So I guess this is the equation. A-B=C? I don't know if that's correct. But the idea is, to set a variable for attack, then subtract it from a variable that is an enemies life. (This is for an RPG/Action game.)
Title: Re: Variable Troubles...
Post by: Prpl_Mage on July 16, 2010, 12:26:16 AM
It's pretty much as you said

But RPGM can't handle more than 1 variable or switch as a precondition.

We create 2 variables.
One is hero attack, the other is enemy hp.

Now, if the hero have 3 attack, the value of the variable [HERO ATTACK] will be 3.
Let's say your enemy got 9hp. We set the value of the variable [ENEMY HP] to 9.

It's all about the variable operation.
If there is no defense involved you pick the enemy hp varaible[ENEMY HP].
You check the box for "Subtract"
Then we check "value of variable" and pick the [HERO ATTACK] var.

And it's done.

If the enemy have 9hp and you attack. it will have 6hp left.
in neat c++ code it would look like this pretty much.
enmyhp = enmhp - hroattk
(enemy health = old health - hero attack)

I hope it makes some sense.
Title: Re: Variable Troubles...
Post by: Blackmoon69 on July 16, 2010, 02:28:03 AM
Thanks a lot!
Title: Re: Variable Troubles...
Post by: zuhane on July 16, 2010, 06:44:31 PM
Purple Mage: the knight in shining armour. Always there.