Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #
- # Shanghai Simple Script - Teach Skill Items
- # Last Date Updated: 2010.05.03
- # Level: Normal
- #
- # This script allows the target character to learn a skill (outside of battle)
- # when an item containing those skill teaching properties is applied to that
- # character.
- #===============================================================================
- # Instructions
- # -----------------------------------------------------------------------------
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
- #
- # <teach skill: x>
- # <teach skill: x, x, x>
- # Place this in the item's notebox. Replace x with the ID of the skills you want
- # to teach the character. Use the comma version for multiple skills.
- #===============================================================================
- $imported = {} if $imported == nil
- $imported["TeachSkillItems"] = true
- #==============================================================================
- # RPG::BaseItem
- #==============================================================================
- class RPG::BaseItem
- #--------------------------------------------------------------------------
- # teach_skills
- #--------------------------------------------------------------------------
- def teach_skills
- return @teach_skills if @teach_skills != nil
- @teach_skills = []
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:TEACH SKILL|LEARN SKILL):[ ](\d+(?:\s*,\s*\d+)*)>/i
- $1.scan(/\d+/).each { |num|
- @teach_skills.push(num.to_i) if num.to_i > 0 }
- end
- }
- return @teach_skills
- end
- end
- #==============================================================================
- # ** Game_Battler
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- # * Item Application Test
- #--------------------------------------------------------------------------
- alias item_test_sss_teachskillitems item_test unless $@
- def item_test(user, item)
- return true if item.teach_skills != []
- return item_test_sss_teachskillitems(user, item)
- end
- #--------------------------------------------------------------------------
- # * Apply Item Effects
- #--------------------------------------------------------------------------
- alias item_effect_sss_teachskillitems item_effect unless $@
- def item_effect(user, item)
- item_effect_sss_teachskillitems(user, item)
- return if @skipped or @missed or @evaded
- teach_item_skills(item) if actor?
- end
- #--------------------------------------------------------------------------
- # * teach_item_skills
- #--------------------------------------------------------------------------
- def teach_item_skills(item)
- for skill_id in item.teach_skills do learn_skill(skill_id) end
- end
- end
- #===============================================================================
- #
- # END OF FILE
- #
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement