Demo – Version 1.0 >
#------------------------------------------------------------------------------#
# Galv's Nickname Functionality
#------------------------------------------------------------------------------#
# For: RPGMAKER VX ACE
# Version 1.0
#------------------------------------------------------------------------------#
# 2012-11-04 - Version 1.0 - release
#------------------------------------------------------------------------------#
# This script was made to give more usability/functionality to nicknames.
#
# Allows you to set bonus stats depending on the actor's nickname.
# This could be used for simple job, perk or race bonuses.
# Also adds escape codes to use actor nicknames in message boxes and script
# calls to more easily use nicknames within your eventing.
#------------------------------------------------------------------------------#
# INSTRUCTIONS:
# Read the setup options below and set it nickname bonuses in the boxes.
#------------------------------------------------------------------------------#
# ESCAPE CODES:
# Added some escape codes to call nicknames within message box:
#
# /Na[x] # will display the nickname of actor x
# /Np[x] # will display the nickname of party member in that position
# # (0 being the leader, 1 being second party member, etc.)
#------------------------------------------------------------------------------#
# CONDITIONAL BRANCH/VARIABLES:
# Basic functions to use in 'script' area of conditional branch and variables.
#
#
# actor_nick?(x, "Nickname") # returns true or false if actor with id of x
# # has that nickname
#
# member_nick?(x, "Nickname") # returns true or false if member x (leader = 0)
# # has that nickname
#
# party_has?("Nickname") # returns true or false if a member has that nick
#
#
# count_nick("Nickname") # returns number of party who have that nick
# # (use in control variable 'script')
#
#
# OTHER SCRIPT CALLS:
#
# mem_nick(x, "Nickname") # changes nick of actor in party position x
# # (leader = 0)
#
#------------------------------------------------------------------------------#
# You can change nicknames using event commands as normal and stats will apply.
#------------------------------------------------------------------------------#
$imported = {} if $imported.nil?
$imported["Nickname_Functions"] = true
module Nick
#------------------------------------------------------------------------------#
# SCRIPT SETTINGS
#------------------------------------------------------------------------------#
PER_LEVEL = false # Multiply the bonuses by actor's level? true or false
# Keep in mind negatives to stats are multiplied, too...
#------------------------------------------------------------------------------#
# NICKNAME BONUS SETUP:
#------------------------------------------------------------------------------#
NICKS = { # Don't touch
#------------------------------------------------------------------------------#
"Heroic" => [
1000, # Max HP
200, # Max MP
100, # ATK
80, # DEF
40, # MAT
80, # MDF
20, # AGI
20 # LUK
],
#------------------------------------------------------------------------------#
"Cleaner" => [
-50, # Max HP
50, # Max MP
0, # ATK
-3, # DEF
-5, # MAT
-2, # MDF
5, # AGI
22 # LUK
],
#------------------------------------------------------------------------------#
"Dwarf" => [
80, # Max HP
0, # Max MP
5, # ATK
15, # DEF
-5, # MAT
15, # MDF
-5, # AGI
10 # LUK
],
#------------------------------------------------------------------------------#
# You can copy/paste the code segmented by the lines to add more.
#------------------------------------------------------------------------------#
# END SCRIPT SETTINGS
#------------------------------------------------------------------------------#
} # Don't touch
end
class Game_BattlerBase
alias galv_nick_param param
def param(param_id)
value = galv_nick_param(param_id)
[[value += other_plus(param_id), param_max(param_id)].min, param_min(param_id)].max.to_i
end
def other_plus(param_id)
@other_plus_bonus = 0
if Nick::NICKS.keys.include?(@nickname)
@other_plus_bonus += Nick::NICKS[@nickname][param_id]
@other_plus_bonus *= @level if Nick::PER_LEVEL
@other_plus_bonus.to_i
else
0
end
end
end # Game_BattlerBase
class Game_Interpreter
#------------------------------------------------------------------------------#
# OVERWRITE
#------------------------------------------------------------------------------#
def command_324
actor = $game_actors[@params[0]]
actor.nickname = @params[1] if actor
actor.hp = actor.mhp if actor.hp > actor.mhp && actor
actor.mp = actor.mmp if actor.mp > actor.mmp && actor
end
#------------------------------------------------------------------------------#
def count_nick(nickname)
@count = 0
$game_party.members.count.times { |i|
if $game_party.members[i].nickname == nickname
@count += 1
end
}
return @count
end
def party_has?(nickname)
@result = false
$game_party.members.count.times { |i|
if $game_party.members[i].nickname == nickname
@result = true
end
}
return @result
end
def member_nick?(id, nick)
$game_party.members[id].nickname == nick
end
def actor_nick?(id, nick)
$game_actors[id].nickname == nick
end
def mem_nick(id, nick)
return if $game_party.members[id].nil?
$game_party.members[id].nickname = nick
end
end # Game_Interpreter
class Window_Base < Window
alias galv_nick_convert_escape_characters convert_escape_characters
def convert_escape_characters(text)
result = galv_nick_convert_escape_characters(text)
result = galv_nick_escape_characters(result)
result
end
def galv_nick_escape_characters(result)
result.gsub!(/\eNa\[(\d+)\]/i) { actor_nickname($1.to_i) }
result.gsub!(/\eNp\[(\d+)\]/i) { member_nickname($1.to_i) }
result
end
def actor_nickname(n)
actor = n >= 1 ? $game_actors[n] : nil
actor ? actor.nickname : ""
end
def member_nickname(n)
actor = n >= 0 ? $game_party.members[n] : nil
actor ? actor.nickname : ""
end
end # Window_Base < Window