Charas-Project

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

Login with username, password and session length
 

News:

New forum theme up and running!



  • Charas-Project »
  • Game Creation »
  • Requests »
  • RPG Maker Programming »
  • Restoring % of MP after battle ...
« previous next »
  • Print
Pages: [1]

Author Topic: Restoring % of MP after battle ...  (Read 1814 times)

Offline TheBlobbyKnight

  • Member
  • Initiate
  • *
  • Posts: 2
Restoring % of MP after battle ...
« on: June 11, 2007, 08:56:51 AM »
Restoring a percentage of MP when a battle is won; Is it possible, and if so, how? I figure there has to be some way of triggering a common event when a battle is won, but the only thing that comes to mind is a bunch of nested IF conditions with enemy hp for each monster group, which would be amazingly inefficient and take forever to do ... Is there any other way of doing this?
Logged

Offline Phayre

  • Exemplar
  • *
  • Posts: 1,089
(No subject)
« Reply #1 on: June 11, 2007, 02:55:21 PM »
I'm not sure if this is possible, or exactly how to do it, but you could seta switch to turn on on a battle end, then on each screen have a common event where it auto starts, restores the MP, then turns the switch off.
Logged

Offline TheBlobbyKnight

  • Member
  • Initiate
  • *
  • Posts: 2
(No subject)
« Reply #2 on: June 13, 2007, 05:32:49 AM »
In case anyone's interested, I did manage to solve this ... Without even touching battle events, in just one common event. It's pretty simple, but I hadn't noticed the game kept track of the # of battles and victories ...

It needs five variables: Temp, Battles A, Battles B, Wins A, Wins B. The part in italics should be repeated for each party member. The whole thing goes under a parallel process common event (with no trigger switch).

- Set Battle B to number of battles (it's under Other)
- Set Wins B to number of victories (also under Other)
- Branch: If Battle B > Battle A
    - Branch: If Wins B > Wins A
        - Branch: if [char] is in party
            - Branch: if [char] HP >= 1
                - Set Temp to [char]'s max MP
                - Set Temp divide by ten
                - Change [char]'s MP + Temp
            :End
        :End

     :End
     - Set Battle A to number of battles
     - Set Wins A to number of victories
:End

The characters will recover 10% of MP after each battle won (but not when they're dead). You could use another variable and the modulus function to change the rounding too, if that mattered.
Logged

  • Print
Pages: [1]
« previous next »
  • Charas-Project »
  • Game Creation »
  • Requests »
  • RPG Maker Programming »
  • Restoring % of MP after battle ...
 

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