Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- - Individual Skill Cost Features v1.0
- - Made by: Sixth
- - Description:
- This script will let you make new features that can change the MP/TP cost of
- only the specified skills instead of changing the cost globally.
- - Note-tags:
- Use these note-tags to add these new features to your actors, classes, enemies,
- equipment and states:
- <mp cost ex: skill_id, value>
- <tp cost ex: skill_id, value>
- Replace skill_id with the database ID of the skill.
- Replace the value with the percentage you want to multiply the cost.
- It must be a float value from 0.0 to ... infinity.
- 0.0 means 0%, which also means no cost at all for the specified skill.
- 0.5 means 50%, so the cost is halved.
- 1.5 means 150%, so the cost is doubled.
- And so on...
- Note that this bonus is multiplicative, so if a battler got two features for
- the same skill, like:
- <mp cost ex: 15, 0.5>
- <mp cost ex: 15, 0.75>
- It would multiply the cost of Skill 15 by 0.5 * 0.75, which is 0.375, and that
- means 37.5% of the original cost at the end.
- This is how the default MCR feature works too, in case you wonder...
- You can use multiple of these note-tags on the same database object to setup a
- cost modifier for multiple skills if needed.
- - Installation:
- Place this script below Materials but above Main!
- If you use other scripts altering the skill cost calculation, your best bet is
- to put this above them, because this script overwrites the methods for these
- calculation for more precise results (integer conversion in the middle would
- ruin it otherwise).
- =end
- class RPG::BaseItem
- attr_accessor :mp_cost_ex, :tp_cost_ex
- def mp_cost_ex
- init_mp_cost_ex if @mp_cost_ex.nil?
- return @mp_cost_ex
- end
- def init_mp_cost_ex
- @mp_cost_ex = {}
- cnote = @note.clone
- while cnote =~ /<mp cost ex: (\d+), (.*)>/i
- @mp_cost_ex[$1.to_i] = $2.to_f
- cnote.sub!(/<mp cost ex: (\d+), (.*)>/i,"")
- end
- end
- def tp_cost_ex
- init_tp_cost_ex if @tp_cost_ex.nil?
- return @tp_cost_ex
- end
- def init_tp_cost_ex
- @tp_cost_ex = {}
- cnote = @note.clone
- while cnote =~ /<tp cost ex: (\d+), (.*)>/i
- @tp_cost_ex[$1.to_i] = $2.to_f
- cnote.sub!(/<tp cost ex: (\d+), (.*)>/i,"")
- end
- end
- end
- class Game_BattlerBase
- def mp_cost_ex(sid)
- return feature_objects.inject(1.0) {|r,obj| r *= (obj.mp_cost_ex[sid] || 1) }
- end
- def tp_cost_ex(sid)
- return feature_objects.inject(1.0) {|r,obj| r *= (obj.tp_cost_ex[sid] || 1) }
- end
- def skill_mp_cost(sk)
- return (sk.mp_cost * mcr * mp_cost_ex(sk.id)).to_i
- end
- def skill_tp_cost(sk)
- return (sk.tp_cost * tp_cost_ex(sk.id)).to_i
- end
- end
- # End of script!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement