The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: Revolverwinds on September 09, 2012, 07:01:09 PM

Title: [XP] Clarification desired on battle script
Post by: Revolverwinds on September 09, 2012, 07:01:09 PM
 :tpg: :tpg:


I've located this script that does the job, but I'm not totally sure which values to change and how to phrase the changes. The instructions are vague for my skill level...but I'll I really need to know is what to change and where. Concisely put, this is what I'm confused about.

1. Where do I tag the enemies and how do I phrase the tag(is it by their name or ID number?)

2. Where do I change actor's name to my character's name and do I phrase this change by use of their ID number or actual name.

Please help, and all the thanks in the world to the person who does!


#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Actor-dependent Enemy Stats
# Author: Kread-EX, by request of Demonfire94
# Date: 28/02/2010
# Version 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

#  TERMS OF USAGE
# #------------------------------------------------------------------------------------------------------------------
# #  You are free to adapt this work to suit your needs.
# #  You can use this work both for commercial and non-commercial work.
# #  Credit is appreciated.
# #------------------------------------------------------------------------------------------------------------------

=begin

HOW TO SETUP PROPORTIONAL STATS:

Enter the following in the note section for each enemy you want to have stats
proportional to actor states.

HP=50
MP=50
ATK=50
DEF=50
SPI=50
AGI=50
Actor=1

In this example, the monster will have all stats 50% higher than those of the
first actor.
For any tag you DON'T enter, the default editor value will be applied.
Always perform a carriage return when changing tags.
Note that the percentage applies to BASE stats, and thus, don't take the
equipment into account.
You can only enter 1 actor, though.

=end

#==============================================================================
# ** Game_Enemy
#==============================================================================

class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # * Determine tags
  #--------------------------------------------------------------------------
  def tags
    return enemy.note.split("\r\n")
  end
  #--------------------------------------------------------------------------
  # * Get Basic Maximum HP
  #--------------------------------------------------------------------------
  def base_maxhp
    percent = actor_id = final_value = nil
    dynamic = false
    tags.each {|str|
      if str.include?('HP')
        dynamic = true
        percent = (str.gsub(/\D/,'').to_i / (str.include?('-') ? -100.0 : 100.0))
      elsif str.include?('Actor')
        actor_id = (str.gsub(/\D/,'')).to_i
      end
    }
    if dynamic
      final_value = $game_actors[actor_id].base_maxhp
      final_value += ($game_actors[actor_id].base_maxhp * percent).round
      return final_value
    end
    return enemy.maxhp
  end
  #--------------------------------------------------------------------------
  # * Get Basic Maximum MP
  #--------------------------------------------------------------------------
  def base_maxmp
    percent = actor_id = final_value = nil
    dynamic = false
    tags.each {|str|
      if str.include?('MP')
        dynamic = true
        percent = (str.gsub(/\D/,'').to_i / (str.include?('-') ? -100.0 : 100.0))
      elsif str.include?('Actor')
        actor_id = (str.gsub(/\D/,'')).to_i
      end
    }
    if dynamic
      final_value = $game_actors[actor_id].base_maxmp
      final_value += ($game_actors[actor_id].base_maxmp * percent).round
      return final_value
    end
    return enemy.maxmp
  end
  #--------------------------------------------------------------------------
  # * Get Basic Maximum attack
  #--------------------------------------------------------------------------
  def base_atk
    percent = actor_id = final_value = nil
    dynamic = false
    tags.each {|str|
      if str.include?('ATK')
        dynamic = true
        percent = (str.gsub(/\D/,'').to_i / (str.include?('-') ? -100.0 : 100.0))
      elsif str.include?('Actor')
        actor_id = (str.gsub(/\D/,'')).to_i
      end
    }
    if dynamic
      final_value = $game_actors[actor_id].base_atk
      final_value += ($game_actors[actor_id].base_atk * percent).round
      return final_value
    end
    return enemy.atk
  end
  #--------------------------------------------------------------------------
  # * Get Basic defense
  #--------------------------------------------------------------------------
  def base_def
    percent = actor_id = final_value = nil
    dynamic = false
    tags.each {|str|
      if str.include?('DEF')
        dynamic = true
        percent = (str.gsub(/\D/,'').to_i / (str.include?('-') ? -100.0 : 100.0))
      elsif str.include?('Actor')
        actor_id = (str.gsub(/\D/,'')).to_i
      end
    }
    if dynamic
      final_value = $game_actors[actor_id].base_def
      final_value += ($game_actors[actor_id].base_def * percent).round
      return final_value
    end
    return enemy.def
  end
  #--------------------------------------------------------------------------
  # * Get Basic spirit
  #--------------------------------------------------------------------------
  def base_spi
    percent = actor_id = final_value = nil
    dynamic = false
    tags.each {|str|
      if str.include?('SPI')
        dynamic = true
        percent = (str.gsub(/\D/,'').to_i / (str.include?('-') ? -100.0 : 100.0))
      elsif str.include?('Actor')
        actor_id = (str.gsub(/\D/,'')).to_i
      end
    }
    if dynamic
      final_value = $game_actors[actor_id].base_spi
      final_value += ($game_actors[actor_id].base_spi * percent).round
      return final_value
    end
    return enemy.spi
  end
  #--------------------------------------------------------------------------
  # * Get Basic agility
  #--------------------------------------------------------------------------
  def base_agi
    percent = actor_id = final_value = nil
    dynamic = false
    tags.each {|str|
      if str.include?('AGI')
        dynamic = true
        percent = (str.gsub(/\D/,'').to_i / (str.include?('-') ? -100.0 : 100.0))
      elsif str.include?('Actor')
        actor_id = (str.gsub(/\D/,'')).to_i
      end
    }
    if dynamic
      final_value = $game_actors[actor_id].base_agi
      final_value += ($game_actors[actor_id].base_agi * percent).round
      return final_value
    end
    return enemy.agi
  end
  #--------------------------------------------------------------------------
end
Title: Re: Clarification desired on battle script
Post by: D&P3 on September 09, 2012, 07:17:29 PM
You input the data into the enemy noteboxes

[spoiler](https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg4host.net%2Fupload%2F09211536504cead8a6814.png&hash=380bbac67fbec0a191b2ba3605ec46693d81f171)[/spoiler]

And the changes you want to make are not made with actors names, but instead with their id.
So Ralph would be 1, next actor would be 2...and so on.
Title: Re: Clarification desired on battle script
Post by: Revolverwinds on September 09, 2012, 07:31:46 PM
A field of thanks for your reply. Only... I'm using XP. Is there anyway that this script can be utilized without the 'note' box?
Title: Re: [XP] Clarification desired on battle script
Post by: modern algebra on September 09, 2012, 08:54:32 PM
No. That's a VX script. It only works in VX.

Unfortunately, I am not familiar enough with the available XP scripts to know if there is a similar one written for RMXP. A quick search got me this: http://z11.invisionfree.com/RMXP_Ultimate/index.php?showtopic=752

But it doesn't seem as customizable as this script.