Charas-Project
Game Creation => Requests => RPG Maker Programming => Topic started 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.)
-
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.
-
Thanks a lot!
-
Purple Mage: the knight in shining armour. Always there.