08-12-2005, 01:00 PM
Mastery Script
neoanimus
Aug 12 2005
What does it do?
This script is basically a AP script based on a variable. Like experience Ap is accumulated in battle. However, once accumulated the AP increases the Mastery Level or M.Lv. Each level adds a certain percentage to the stats you apply this script to. For example.
Normally at level 99, you may have up to 9999 HP.
Using this script, at level 99 and M.lv. 1
you will have 12498 as seen below.
It can also be used to increase any parameter just by applying the equestion included in the script.
MASTERY SYSTEM SCRIPT
MASTERY SYSTEM SCRIPT
Insert this script after Game_Actor.
To edit this script for your game, change the [3] inside $game_variables[3] to the number of the variables you want to use. Be sure to change this to a variable that is not used for anything else or the script will not work correctly. Inside variables call the variable you used AP so you dont use it for anything else.
Add the following script after Game_Enemy:
To use the Mastery System do the following within Game_Actor:
add this equation to the parameters you want to change without the parentheses. "+ (("within these parentheses copy the equation for the parameter you want to change"* mastery_level)/ 4)"
Ex.
To display your Mastery Level and Ap add the following to Window_Base:
To show your gained AP in the results window replace the Window_BattleResult with this:
Last, within Scene_Battle 2 add the following:
Under def start_phase5
add the following after exp = 0
add the following after gold+= enemy.gold
after this
add this
Replace this:
with this:
That's about it, everything else in explained within the script.
neoanimus
Aug 12 2005
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
What does it do?
This script is basically a AP script based on a variable. Like experience Ap is accumulated in battle. However, once accumulated the AP increases the Mastery Level or M.Lv. Each level adds a certain percentage to the stats you apply this script to. For example.
Normally at level 99, you may have up to 9999 HP.
Using this script, at level 99 and M.lv. 1
you will have 12498 as seen below.
It can also be used to increase any parameter just by applying the equestion included in the script.
Mastery Script
MASTERY SYSTEM SCRIPT
MASTERY SYSTEM SCRIPT
Insert this script after Game_Actor.
Code:
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
attr_reader :ap
attr_reader :mastery_level
#--------------------------------------------------------------------------
# define AP
#--------------------------------------------------------------------------
def ap
@ap = [[$game_variables[3], 9999].min, 0].max
return @ap
end
#--------------------------------------------------------------------------
# define mastery level
#--------------------------------------------------------------------------
def mastery_level
if @ap < 32 or nil
return 1
elsif @ap >= 32 and @ap < 74
return 2
elsif @ap >= 74 and @ap < 186
return 3
elsif @ap >= 186 and @ap < 324
return 4
elsif @ap >= 324 and @ap < 512
return 5
elsif @ap >= 512 and @ap < 747
return 6
elsif @ap >= 747 and @ap < 938
return 7
elsif @ap >= 938 and @ap < 1320
return 8
elsif @ap >= 1320 and @ap < 1860
return 9
elsif @ap >= 1860 and @ap < 2174
return 10
elsif @ap >= 2174 and @ap < 2512
return 11
elsif @ap >= 2512 and @ap < 3238
return 12
elsif @ap >= 3238 and @ap < 4174
return 13
elsif @ap >= 4174 and @ap < 5747
return 14
elsif @ap >= 5747 and @ap < 6938
return 15
elsif @ap >= 6938 and @ap < 7643
return 16
elsif @ap >= 7643 and @ap < 8128
return 17
elsif @ap >= 8128 and @ap < 8702
return 18
elsif @ap >= 9002 and @ap < 9999
return 19
elsif @ap == 9999
return 20
end
end
#----------------------------------------------------------------------------
# Ap to Mastery Level Up
#-----------------------------------------------------------------------------
def next_ap_s
if @ap >= 0 and @ap < 35
return @mastery_level > 0 ?@next_ap.to_s : "35"
elsif @ap >= 35 and @ap < 74
return @mastery_level > 0 ?@next_ap.to_s : "74"
elsif @ap >= 74 and @ap < 186
return @mastery_level > 0 ?@next_ap.to_s : "186"
elsif @ap >= 186 and @ap < 324
return @mastery_level > 0 ?@next_ap.to_s : "324"
elsif @ap >= 324 and @ap < 512
return @mastery_level > 0 ?@next_ap.to_s : "512"
elsif @ap >= 512 and @ap < 747
return @mastery_level > 0 ?@next_ap.to_s : "747"
elsif @ap >= 747 and @ap < 938
return @mastery_level > 0 ?@next_ap.to_s : "938"
elsif @ap > 938 and @ap < 1320
return @mastery_level > 0 ?@next_ap.to_s : "1320"
elsif @ap >= 1320 and @ap < 1860
return @mastery_level > 0 ?@next_ap.to_s : "1860"
elsif @ap >= 1860 and @ap < 2174
return @mastery_level > 0 ?@next_ap.to_s : "2174"
elsif @ap >= 2174 and @ap < 2512
return @mastery_level > 0 ?@next_ap.to_s : "2512"
elsif @ap >= 2512 and @ap < 3238
return @mastery_level > 0 ?@next_ap.to_s : "3238"
elsif @ap >= 3238 and @ap < 4174
return @mastery_level > 0 ?@next_ap.to_s : "4174"
elsif @ap >= 4174 and @ap < 5747
return @mastery_level > 0 ?@next_ap.to_s : "5747"
elsif @ap >= 5747 and @ap < 6938
return @mastery_level > 0 ?@next_ap.to_s : "6938"
elsif @ap >= 6938 and @ap < 7643
return @mastery_level > 0 ?@next_ap.to_s : "7643"
elsif @ap >= 7643 and @ap < 8128
return @mastery_level > 0 ?@next_ap.to_s : "8128"
elsif @ap >= 8128 and @ap < 8702
return @mastery_level > 0 ?@next_ap.to_s : "8702"
elsif @ap >= 9002 and @ap < 9999
return @mastery_level > 0 ?@next_ap.to_s : "9999"
elsif @ap == 9999
return @mastery_level > 0 ?@next_ap.to_s : "9999"
end
end
end
Add the following script after Game_Enemy:
Code:
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ? ????AP ???
#--------------------------------------------------------------------------
def plus_ap
str = $data_enemies[@enemy_id].str
mag = $data_enemies[@enemy_id].int
plus_ap = 0
if str >= mag
if str > 1 and str < 20
plus_ap = 1
elsif str >= 20 and str < 40
plus_ap = 2
elsif str >= 40 and str < 60
plus_ap = 3
elsif str >= 60 and str < 80
plus_ap = 4
elsif str >= 80 and str < 100
plus_ap = 5
elsif str >= 100 and str < 120
plus_ap = 6
elsif str >= 120 and str < 140
plus_ap = 7
elsif str >= 140 and str < 160
plus_ap = 8
elsif str >= 160 and str < 180
plus_ap = 10
elsif str >= 180 and str < 200
plus_ap = 12
elsif str >= 200 and str < 300
plus_ap = 15
elsif str >= 300
plus_ap = 20
end
elsif mag > str
if mag > 1 and mag < 20
plus_ap = 1
elsif mag >= 20 and mag < 40
plus_ap = 2
elsif mag >= 40 and mag < 60
plus_ap = 3
elsif mag >= 60 and mag < 80
plus_ap = 4
elsif mag >= 80 and mag < 100
plus_ap = 5
elsif mag >= 100 and mag < 120
plus_ap = 6
elsif mag >= 120 and mag < 140
plus_ap = 7
elsif mag >= 140 and mag < 160
plus_ap = 8
elsif mag >= 160 and mag < 180
plus_ap = 10
elsif mag >= 180 and mag < 200
plus_ap = 12
elsif mag >= 200 and mag < 300
plus_ap = 15
elsif mag >= 300
plus_ap = 20
end
end
return plus_ap
end
end
add this equation to the parameters you want to change without the parentheses. "+ (("within these parentheses copy the equation for the parameter you want to change"* mastery_level)/ 4)"
Ex.
Code:
def base_maxhp
return $data_actors[@actor_id].parameters[0, @level] + (($data_actors[@actor_id].parameters[0, @level] * mastery_level)/ 4)
end
Code:
def draw_actor_mastery_level(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "M.Lv")
self.contents.font.color = normal_color
self.contents.draw_text(x + 20, y, 24, 32, actor.mastery_level.to_s, 2)
end
def draw_actor_ap(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 24, 32, "Ap")
self.contents.font.color = normal_color
self.contents.draw_text(x + 24, y, 84, 32, actor.ap.to_s, 2)
self.contents.draw_text(x + 108, y, 12, 32, "/", 1)
self.contents.draw_text(x + 120, y, 84, 32, actor.next_ap_s)
end
Code:
#==============================================================================
# ¦ Window_BattleResult
#------------------------------------------------------------------------------
# ???????????? EXP ????????????????????
#==============================================================================
class Window_BattleResult < Window_Base
#--------------------------------------------------------------------------
# ? ?????????
# exp : EXP
# gold : ????
# treasures : ?????
#--------------------------------------------------------------------------
def initialize(exp, ap, gold, treasures)
@exp = exp
@ap = ap
@gold = gold
@treasures = treasures
super(160, 0, 320, @treasures.size * 32 + 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype # "Battle Result" window font
self.contents.font.size = $defaultfontsize
self.y = 160 - height / 2
self.back_opacity = 160
self.visible = false
refresh
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
self.contents.clear
x = 4
self.contents.font.color = normal_color
cx = contents.text_size(@exp.to_s).width
self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
x += cx + 4
self.contents.font.color = system_color
cx = contents.text_size("Exp").width
self.contents.draw_text(x, 0, 64, 32, "Exp")
x += cx + 16
self.contents.font.color = normal_color
cx = contents.text_size(@ap.to_s).width
self.contents.draw_text(x, 0, cx, 32, @ap.to_s)
x += cx + 4
self.contents.font.color = system_color
cx = contents.text_size("Ap").width
self.contents.draw_text(x, 0, 64, 32, "Ap")
x += cx + 16
self.contents.font.color = normal_color
cx = contents.text_size(@gold.to_s).width
self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
x += cx + 4
self.contents.font.color = system_color
self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
y = 32
for item in @treasures
draw_item_name(item, 4, y)
y += 32
end
end
end
Under def start_phase5
add the following after exp = 0
Code:
ap = 0
plus_ap = 0
add the following after gold+= enemy.gold
Code:
plus_ap += enemy.plus_ap
after this
Code:
for enemy in $game_troop.enemies
# ??????????????
unless enemy.hidden
# ?? EXP????????
exp += enemy.exp
gold += enemy.gold
plus_ap += enemy.plus_ap
# ?????????
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
Code:
if exp > 0
ap = (exp / (20 + exp/85) + 1 + plus_ap)
end
$game_variables[3] = $game_variables[3] + ap
Code:
@result_window = Window_BattleResult.new(exp, gold, treasures)
Code:
@result_window = Window_BattleResult.new(exp, ap, gold, treasures)
That's about it, everything else in explained within the script.