AP Skill System
Intro
It's been probably over a year since I posted a script on here. But when I got that email for VX Ace a week or so ago I was like; "Ooo Neat!"And decided to take a look at the trial. The new features options for items looked rather interesting and I immediately saw how easy it would be to make this script, and so I typed this up for fun. Let me know what you think or if you have any problems with it, again, this is the first script I've written in about a year...
What it Does
If you've played Final fantasy 9 then you probably know what I'm getting at with this.
But for those of you who haven't here is a simple explanation for what this does:
This takes the skills that equippable items give your actors and gives them a sort of exp bar (called AP).
Whenever a battle is won, the party will gain AP for these skills.
Once the skills gain enough AP, the actor will permanently learn the skill and will be able to use it without the required equipped item.
As you can see, this can give the player the incentive to use crappy weapons to learn a good skill.
How to use it:
- Choose an equippable item
- Add a feature
- Choose the Skills tab then Add skill
- Choose any skill
- Click OK, then OK again
- And Done! easy right?
Script:
Ap_Skill_System.txt ( 5.57K )
Number of downloads: 22CODE
=begin
#======================#
#AP System for Skills #
#by: CR4200 #
#======================#
Basically what this does is give the skills you get from equipment features an exp
bar (called AP). Once that AP bar is filled by winning battles, the actor will
learn that skill and can use it without needing to have the item equipped.(ie. FFIX)
How to use it:
1. Choose an equippable item
2. Add a feature
3. Choose the Skills tab then Add skill
4. Choose any skill
5. Click OK, then OK again
6. And Done! easy right?
Technical/formula info:
Default formula for AP needed for a skill: (mp_cost + tp_cost) * 2
-> can be changed in customization below
Default formula for AP gained from battle: [(total exp/100),1].max
-> if total_exp/100 < 1 then the vaule will be one.
-> this can be changed on line 151
I'm aware the position of the AP in the menu is it bit... off, so theres an
option below to turn it off if you just want to put it in the skill description
AP will stay for a skill, even if you unequip the item and equip a different item
with the same skill.(skill ap based on skill_id)
Skill AP is unique to individual actors.
If a skill doesn't appear, make sure the actor can use the skills type (Magic, Special, etc.)
to give ap to an actor outside of battle:
Choose "Script" in event command window (very last one)
Enter:
$game_party.battle_members[i].gain_ap(amount)
where i = the index of the desired actor in the party
and amount = the amount of ap given
=end
#==================================Begin Customizing=======================================#
module CR4200_Module
#Victory message for gaining AP
ObtainAp = "The party gained %s AP!"
#Message for when a person leans a skill from gaining AP. (1st)%s=actors name, (2nd)%s= skill name(line
PersonLearns = "%s learned %s!"
#Show AP in skill menu next to Mp/Tp (true/false)
ShowInMenu = true
#Color of AP in skills menu (Red by default)
Color = Color.new(255, 128, 128, 128)
#Skills that you do NOT want to have AP when added to equippables
#ie.[1,2,3] will not gain ap or display in menu by default
Exceptions = []
end
class Game_Actor < Game_Battler
def get_max_ap(skill_id)
#Formula for AP points needed to learn skill Default: (mp_cost + tp_cost) * 2#
return ($data_skills[skill_id].tp_cost + $data_skills[skill_id].mp_cost) * 2
end
end
#===================================End Customizing=======================================#
class Game_Actor < Game_Battler
alias apsystemcr4200 setup
alias apsystem_refresh_cr4200 refresh
def setup(actor_id)
apsystemcr4200(actor_id)
@skills_ap_list = {}
@all_weapon_skills = []
init_all_weapon_skills
init_ap_list
end
def refresh
init_ap_list
apsystem_refresh_cr4200
end
def all_weapon_skills
init_all_weapon_skills
return @all_weapon_skills
end
def get_wpn_skills
return added_skills
end
def init_all_weapon_skills
for i in added_skills
@all_weapon_skills.push(i)
end
end
def has_ap?(skill)
return false if skill.mp_cost <= 0 and skill.tp_cost <= 0
return false if CR4200_Module::Exceptions.include?(skill.id)
return true
end
def get_ap_list
return @skills_ap_list
end
def init_ap_list
for i in added_skills
next if @skills.include?(i) or !has_ap?($data_skills[i])
if @skills_ap_list[i] == get_max_ap(i)
learn_skill(i)
#VVVV===Message that shows when someone learns a skill===#
$game_message.add(sprintf(CR4200_Module::PersonLearns, actor.name, $data_skills[i].name))
end
@skills_ap_list[i] = 0 if !@skills_ap_list.include?(i)
end
end
def gain_ap(ap)
init_all_weapon_skills
temp_list = @skills_ap_list.clone
@skills_ap_list.clear
for i in @all_weapon_skills
@skills_ap_list[i] = temp_list[i].to_i
end
for i in added_skills
total_ap = (temp_list[i].to_i + ap)
unless total_ap >= get_max_ap(i)
@skills_ap_list[i] = total_ap
else
@skills_ap_list[i] = get_max_ap(i)
end
end
init_ap_list
end
end
class Window_SkillList < Window_Selectable
alias draw_apvalue draw_skill_cost
def pass_cr4200_aptest?(skill)
return false if CR4200_Module::ShowInMenu == false
return false if skill.mp_cost <= 0 and skill.tp_cost <= 0
return false if CR4200_Module::Exceptions.include?(skill.id)
return true
end
def draw_skill_cost(rect, skill)
draw_apvalue(rect, skill)
if @actor.get_ap_list.include?(skill.id) and pass_cr4200_aptest?(skill)
color = (CR4200_Module::Color)
change_color(color, true)
draw_text(rect, " " + (@actor.get_ap_list[skill.id]).to_s + "/" + (@actor.get_max_ap(skill.id)).to_s, 0)
end
end
end
module BattleManager
def self.gain_ap
#vvvvvv=====Formula for AP gained in battle, modify as you please=====#
ap = ([($game_troop.exp_total).round, 1].max)
text = sprintf(CR4200_Module::ObtainAp, ap)
$game_message.add('\.' + text)
$game_party.all_members.each do |actor|
actor.gain_ap(ap)
end
wait_for_message
end
def self.process_victory
play_battle_end_me
replay_bgm_and_bgs
$game_message.add(sprintf(Vocab::Victory, $game_party.name))
display_exp
gain_gold
gain_drop_items
gain_exp
gain_ap
SceneManager.return
battle_end(0)
return true
end
end
Possible features:-Leveling skills? (Thunder I => Thunder II)
-Other Features as Equippable Passive Skills(again like FFIX; such as increased TP charge)