Charas-Project

  • Home
  • Help
  • Search
  • Calendar
  • Login
  • Register
*
Please login or register.

Login with username, password and session length
 

News:

Click here to join us on IRC (#charas on irc.freenode.net)!



  • Charas-Project »
  • Game Creation »
  • Requests »
  • RPG Maker Programming »
  • Variable Troubles...
« previous next »
  • Print
Pages: [1]

Author Topic: Variable Troubles...  (Read 3507 times)

Offline Blackmoon69

  • Initiate
  • *
  • Posts: 13
Variable Troubles...
« 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.)
Logged

Offline Prpl_Mage

  • Administrator
  • Sage
  • *
  • Posts: 7,645
  • The Administrator Mage
    • Check out our itch website
Re: Variable Troubles...
« Reply #1 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.
Logged
Cool RPGM Project!
Sprite till you die

Oh my god, this was ...10 years ago...

Offline Blackmoon69

  • Initiate
  • *
  • Posts: 13
Re: Variable Troubles...
« Reply #2 on: July 16, 2010, 02:28:03 AM »
Thanks a lot!
Logged

Offline zuhane

  • Freakalicious
  • Leader
  • *
  • Posts: 2,192
  • Kill me
Re: Variable Troubles...
« Reply #3 on: July 16, 2010, 06:44:31 PM »
Purple Mage: the knight in shining armour. Always there.
Logged
Geese ruined my life.

https://soundcloud.com/tom-kingston-3/geese

  • Print
Pages: [1]
« previous next »
  • Charas-Project »
  • Game Creation »
  • Requests »
  • RPG Maker Programming »
  • Variable Troubles...
 

  • SMF 2.0.10 | SMF © 2015, Simple Machines
  • XHTML
  • 2O11
  • RSS
  • WAP2
  • Simple Machines Forum