07-24-2006, 01:00 PM
Level Up system
by Jimmie
Jul 24 2006
Well, here y'all go. It's a system sortof based on Final Fantasy 2, but without the skill training.
In fact, if you've played Naufrager, you're probably familiar with it. It's the exact same thing really, with the raising strength when you attack and stuff.
In fact, it's the same as Final Fantasy: <sumthin'> Nova as well.
Anyways. Setting up us the script.
The constants at the start are all you need to worry about. The comments explain them pretty well, unless their obvious.
The <stat>_P things are how many "points" you gain with each use.
The <stat>_UP things are how much that stat is increased when you reach 200 points.
The <stat>_ANI things are what animation is used on the character when a stat increases. You'll have to make the animation thing yourself. I'm not sharing :eusa_shhh:
Plug it in main and set it up like you want it.
That's it.
Try a few battles, defend a bit (preferably with Hilda or another weak character) and see your Dexterity increase.
Attack and watch your strength shoot to the sky.
//Jimmie
by Jimmie
Jul 24 2006
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.
Well, here y'all go. It's a system sortof based on Final Fantasy 2, but without the skill training.
In fact, if you've played Naufrager, you're probably familiar with it. It's the exact same thing really, with the raising strength when you attack and stuff.
In fact, it's the same as Final Fantasy: <sumthin'> Nova as well.
Anyways. Setting up us the script.
The constants at the start are all you need to worry about. The comments explain them pretty well, unless their obvious.
The <stat>_P things are how many "points" you gain with each use.
The <stat>_UP things are how much that stat is increased when you reach 200 points.
The <stat>_ANI things are what animation is used on the character when a stat increases. You'll have to make the animation thing yourself. I'm not sharing :eusa_shhh:
Plug it in main and set it up like you want it.
That's it.
Try a few battles, defend a bit (preferably with Hilda or another weak character) and see your Dexterity increase.
Attack and watch your strength shoot to the sky.
Code:
#================================
#** Level Up system based on actions
#----------------------------------------------------------------
#** Created by Jimme Reashu A.K.A. Jimmie
#----------------------------------------------------------------
#** Version 1.0
#** Created 24 of July, 2006
#----------------------------------------------------------------
#** Possible updates:
#** Adding report window at end of battle to show summary of stat increases.
#----------------------------------------------------------------
#** All comments below these may be removed.
#** Have fun!
#** //Jimmie
#================================
class Scene_Battle
STR_P = 10
DEX_P = 10
INT_P = 10
AGI_P = 10
HP_P = 5
SP_P = 4
#** How many points you get if the stat is at 0. Stat increases every time the points hit 200
#** HP and SP get 5 and 4 lvl points resp. for EVERY POINT of these LOST.
P_MODIFY = 1.1
#** For every 5 points over 0 the stat is, the _P increase is divided by this number.
STR_UP = 1
DEX_UP = 1
INT_UP = 1
AGI_UP = 1
HP_UP = 1
SP_UP = 1
STR_ANI = 101
DEX_ANI = 102
INT_ANI = 103
AGI_ANI = 104
HP_ANI = 105
SP_ANI = 106
alias jimmr_lvl_attack make_basic_action_result
alias jimmr_lvl_skill make_skill_action_result
def make_basic_action_result
jimmr_lvl_attack
if @active_battler.is_a?(Game_Actor)
actor = $game_actors[@active_battler.id]
if @active_battler.current_action.basic == 0
#ATTACKING
actor.str += (STR_P / (P_MODIFY**(actor.str/5)))
while actor.q_str >= 200
actor.q_str -= 200
@str_plus += STR_UP
@animation1_id = STR_ANI
end
elsif @active_battler.current_action.basic == 1
actor.q_dex += (DEX_P / (P_MODIFY**(actor.dex/5)))
while actor.q_dex >= 200
actor.q_dex -= 200
@dex_plus += DEX_UP
@animation1_id = DEX_ANI
end
end
end
end
def make_skill_action_result
jimmr_lvl_skill
actor.q_int += (INT_P / (P_MODIFY**(actor.int/5)))
actor.q_sp += ((SP_P * skill.sp_cost) / (P_MODIFY**(actor.sp/5)))
while actor.q_int >= 200
actor.q_int -= 200
@int_plus += INT_UP
@animation1_id = INT_ANI
end
while actor.q_sp >= 200
actor.q_sp -= 200
@maxsp_plus += SP_UP
@animation1_id = SP_ANI
end
end
end
class Game_Actor < Game_Battler
attr_accessor :q_str, :q_dex, :q_int, :q_agi, :q_hp, :q_sp
alias jimmr_lvl_actor setup
def setup(actor_id)
@q_str = 0
@q_dex = 0
@q_int = 0
@q_agi = 0
@q_hp = 0
@q_sp = 0
jimmr_lvl_actor(actor_id)
end
end
class Game_Battler
def attack_effect(attacker)
self.critical = false
hit_result = (rand(100) < attacker.hit)
if hit_result == true
atk = [attacker.atk - self.pdef / 2, 0].max
self.damage = atk * (20 + attacker.str) / 20
self.damage *= elements_correct(attacker.element_set)
self.damage /= 100
if self.damage > 0
if rand(100) < 4 * attacker.dex / self.agi
self.damage *= 2
self.critical = true
end
if self.guarding?
self.damage /= 2
end
end
if self.damage.abs > 0
amp = [self.damage.abs * 15 / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
eva = 8 * self.agi / attacker.dex + self.eva
hit = self.damage < 0 ? 100 : 100 - eva
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)
end
if hit_result == true
remove_states_shock
self.hp -= self.damage
@state_changed = false
states_plus(attacker.plus_state_set)
states_minus(attacker.minus_state_set)
if self.is_a?(Game_Actor) and self.damage.abs > 0
self.q_hp += ((HP_P * self.damage) / (P_MODIFY**(actor.hp/5)))
while self.q_hp >= 200
self.q_hp -= 200
@maxhp_plus += HP_UP
@animation1_id = HP_ANI
end
end
else
self.damage = "Miss"
self.critical = false
if self.is_a?(Game_Actor)
self.q_agi += (AGI_P / (P_MODIFY**(actor.agi/5)))
while self.q_agi >= 200
self.q_agi -= 200
@agi_plus += AGI_UP
@animation1_id = AGI_ANI
end
end
end
return true
end
#--------------------------------------------------------------------------
def skill_effect(user, skill)
self.critical = false
if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
return false
end
effective = false
effective |= skill.common_event_id > 0
hit = skill.hit
if skill.atk_f > 0
hit *= user.hit / 100
end
hit_result = (rand(100) < hit)
effective |= hit < 100
if hit_result == true
power = skill.power + user.atk * skill.atk_f / 100
if power > 0
power -= self.pdef * skill.pdef_f / 200
power -= self.mdef * skill.mdef_f / 200
power = [power, 0].max
end
rate = 20
rate += (user.str * skill.str_f / 100)
rate += (user.dex * skill.dex_f / 100)
rate += (user.agi * skill.agi_f / 100)
rate += (user.int * skill.int_f / 100)
self.damage = power * rate / 20
self.damage *= elements_correct(skill.element_set)
self.damage /= 100
if self.damage > 0
if self.guarding?
self.damage /= 2
end
end
if skill.variance > 0 and self.damage.abs > 0
amp = [self.damage.abs * skill.variance / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
eva = 8 * self.agi / user.dex + self.eva
hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)
effective |= hit < 100
end
if hit_result == true
if skill.power != 0 and skill.atk_f > 0
remove_states_shock
effective = true
end
last_hp = self.hp
self.hp -= self.damage
effective |= self.hp != last_hp
@state_changed = false
effective |= states_plus(skill.plus_state_set)
effective |= states_minus(skill.minus_state_set)
if self.is_a?(Game_Actor) and self.damage > 0
self.q_hp += ((HP_P * self.damage) / (P_MODIFY**(actor.hp/5)))
while self.q_hp >= 200
self.q_hp -= 200
@maxhp_plus += HP_UP
@animation1_id = HP_ANI
end
end
if skill.power == 0
self.damage = ""
unless @state_changed
self.damage = "Miss"
end
end
else
self.damage = "Miss"
if self.is_a?(Game_Actor)
self.q_agi += (AGI_P / (P_MODIFY**(actor.agi/5)))
while self.q_agi >= 200
self.q_agi -= 200
@agi_plus += AGI_UP
@animation1_id = AGI_ANI
end
end
end
unless $game_temp.in_battle
self.damage = nil
end
return effective
end
#--------------------------------------------------------------------------
def item_effect(item)
self.critical = false
if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or
((item.scope == 5 or item.scope == 6) and self.hp >= 1)
return false
end
effective = false
effective |= item.common_event_id > 0
hit_result = (rand(100) < item.hit)
effective |= item.hit < 100
if hit_result == true
recover_hp = maxhp * item.recover_hp_rate / 100 + item.recover_hp
recover_sp = maxsp * item.recover_sp_rate / 100 + item.recover_sp
if recover_hp < 0
recover_hp += self.pdef * item.pdef_f / 20
recover_hp += self.mdef * item.mdef_f / 20
recover_hp = [recover_hp, 0].min
end
recover_hp *= elements_correct(item.element_set)
recover_hp /= 100
recover_sp *= elements_correct(item.element_set)
recover_sp /= 100
if item.variance > 0 and recover_hp.abs > 0
amp = [recover_hp.abs * item.variance / 100, 1].max
recover_hp += rand(amp+1) + rand(amp+1) - amp
end
if item.variance > 0 and recover_sp.abs > 0
amp = [recover_sp.abs * item.variance / 100, 1].max
recover_sp += rand(amp+1) + rand(amp+1) - amp
end
if recover_hp < 0
if self.guarding?
recover_hp /= 2
end
end
self.damage = -recover_hp
last_hp = self.hp
last_sp = self.sp
self.hp += recover_hp
self.sp += recover_sp
if self.is_a?(Game_Actor) and self.damage > 0
self.q_hp += ((HP_P * self.damage) / (P_MODIFY**(actor.hp/5)))
while self.q_hp >= 200
self.q_hp -= 200
@maxhp_plus += HP_UP
@animation1_id = HP_ANI
end
end
effective |= self.hp != last_hp
effective |= self.sp != last_sp
@state_changed = false
effective |= states_plus(item.plus_state_set)
effective |= states_minus(item.minus_state_set)
if item.parameter_type > 0 and item.parameter_points != 0
case item.parameter_type
when 1
@maxhp_plus += item.parameter_points
when 2
@maxsp_plus += item.parameter_points
when 3
@str_plus += item.parameter_points
when 4
@dex_plus += item.parameter_points
when 5
@agi_plus += item.parameter_points
when 6
@int_plus += item.parameter_points
end
effective = true
end
if item.recover_hp_rate == 0 and item.recover_hp == 0
self.damage = ""
if item.recover_sp_rate == 0 and item.recover_sp == 0 and
(item.parameter_type == 0 or item.parameter_points == 0)
unless @state_changed
self.damage = "Miss"
end
end
end
else
self.damage = "Miss"
end
unless $game_temp.in_battle
self.damage = nil
end
return effective
end
#--------------------------------------------------------------------------
def slip_damage_effect
self.damage = self.maxhp / 10
if self.damage.abs > 0
amp = [self.damage.abs * 15 / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
self.hp -= self.damage
if self.is_a?(Game_Actor) and self.damage > 0
self.q_hp += ((HP_P * self.damage) / (P_MODIFY**(actor.hp/5)))
while self.q_hp >= 200
self.q_hp -= 200
@maxhp_plus += HP_UP
@animation1_id = HP_ANI
end
end
return true
end
end
#:alright:
//Jimmie