Converting the state when MP zero script

Oddball

Veteran
Veteran
Joined
Sep 4, 2014
Messages
1,923
Reaction score
534
First Language
English
Primarily Uses
N/A
How would I change this script

#         Script Mp_zero_state, version 1.02

#         Author: bgillisp

#         Released: 10/23/2014

 

#         This script causes a state to be added when a battler's mp drops

#         below a specified value. The default is zero, but that can

#         be edited if desired.

 

# To use: Place in the materials section, but above main

 

#         When setting up your state, it is important to set 

#         ***in the state*** when the state is to be removed

#         If this is not done, the state may remain even after the

#         battle has ended.

 

#Terms of Use:

#         Free for use in commercial and non-commercial projects, with

#         credit given.

 

 

# Warning: For the script to function properly *all* enemy battlers must have 

#          MP at the start of a battle. Failure to make sure all your enemy

#          battlers have mp at the start of a battle could cause your

#          game to crash.

 

# Warning: Do *not* use remove by restriction and also set restriction to 

#          anything other than none. If you did that with without this script,

#          the state would apply then remove on the same turn. With this 

#          script, it will continually apply then remove the state, which 

#          will cause a stack overflow.

 

# Revisio History

#          8.18.14  :Initial Release of Version 1.0

#          10.23.14 :Fixed crash bug if someone's MP was below the cutoff 

#                    when battle started

#                   :Added feature to turn on or off the script for actors

#                   :and enemies individually

#          10.24.14 :Fixed bug where once the state was applied, if you 

#                    regained MP, the state stayed applied.

 

#----------------------------------------------------------------------------

# Editable region

 

module BG_mp_zero_state

  

  #Set to true to enable this feature. Set to false to disable the script

  MP_zero_state_switch = true

  

  #Set the state you wish to use here. By default, it is set to 

  #the state mp_regen

  Mp_zero_state = 15

  

  #Set the MP value at which the state is applied at. Default is 0.

  Mp_zero_value = 10

  

  #Set if you wish to have enemies affected as well as players

  MP_zero_enemy_affected = false

  

  #Set if you wish to have players affected as well as enemies

  MP_zero_actor_affected = true

  

end

 

#End of Editable Region

#--------------------------------------------------------------------------

 

 

#Do not edit anything below here unless you know what you are doing.

#Failure to ahead to this warning may result in unpredictable behavior in

#your game. Consider yourself warned

#__________________________________________________________________________

 

 

class Game_Battler < Game_BattlerBase

 

  alias bgmp_zero_state_refresh refresh

  def refresh

    

    #Call aliased method

    bgmp_zero_state_refresh

    if(BG_mp_zero_state::MP_zero_state_switch)

      if(self.mp <= BG_mp_zero_state::Mp_zero_value)

        #Add the desired state.

        if(enemy? and BG_mp_zero_state::MP_zero_enemy_affected)

          add_state(BG_mp_zero_state::Mp_zero_state)

          return

        end

        if(actor? and BG_mp_zero_state:: MP_zero_actor_affected)

          add_state(BG_mp_zero_state::Mp_zero_state)

          return

        end

      end

      

      remove_state(BG_mp_zero_state::Mp_zero_state)

      

    end #End if for switch

  end

  

end #End of Game_Battler class

 

module BattleManager

  

  class << self

  

    alias bgmp_zero_state_battle_start battle_start

  

    def battle_start

    

      #Check to see if we need to add the state to any actors before battle

      #start

      $game_party.battle_members.each do |actor|

        if(BG_mp_zero_state:: MP_zero_actor_affected and BG_mp_zero_state::MP_zero_state_switch)

          actor.refresh if actor.mp <= BG_mp_zero_state::Mp_zero_value

        end

      end

    

      #Call aliased method

      bgmp_zero_state_battle_start

    end #End battle_state

 

  end # End class

 

end #End Module
 

so that it adds a state when TP is above a certain point? Or is there a script out theere that already does that?

 

Edit: nevermind. found a solution

 

http://www.rpgmakervxace.net/topic/1713-request-auto-states-solved/
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
again, please just link to the original script. Don't copy/paste it into your post.
 

Oddball

Veteran
Veteran
Joined
Sep 4, 2014
Messages
1,923
Reaction score
534
First Language
English
Primarily Uses
N/A
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,047
Members
137,569
Latest member
Shtelsky
Top