Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- - Mime Effect Addon v1.1
- - Made by: Sixth
- - Requires: Tsukihime's Mime Effect
- - Description:
- This short script will let you make skills that can't be mimed.
- From v1.1, it will also add a success rate feature for your mime skills.
- - Note-tags:
- Use this note-tag on the skills you do NOT want to allow to be mimed:
- <no_mime>
- That's it!
- Use this note-tag to setup the chance for the mime to succeed:
- <mime_chance: value>
- The value must be replaced by the percentage of success.
- It must be an integer number from 0 to 100.
- 0 = 0%, 15 = 15%, 100 = 100%, and so on.
- Examples:
- <mime_chance: 30>
- <mime_chance: 50>
- <mime_chance: 85>
- If a mime skill got no success chance note-tag, it will be set to 100%
- automatically.
- Ohh, and the battle log for a failed mime skill expects a skill that doesn't
- have any effects or damage setup.
- If it has some effects or damage, the battle log will not display the text
- for the failed mime.
- - Installation:
- Place this script below Tsukihime's Mime Effect script!
- =end
- class RPG::UsableItem
- attr_accessor :mime_chance
- def can_mime?
- @can_mime = !(@note =~ /<no_mime>/i) if @can_mime.nil?
- return @can_mime
- end
- def mime_chance
- init_mime_chance if @mime_chance.nil?
- return @mime_chance
- end
- def init_mime_chance
- @mime_chance = @note =~ /<mime_chance:(?:\s*)(\d+)>/ ? $1.to_i : 100
- end
- end
- class Game_Action
- def can_mime?
- return false unless self.item
- return self.item.can_mime?
- end
- def name
- return self.item ? self.item.name : "nothing"
- end
- end
- class Scene_Battle < Scene_Base
- def check_mime_action # Overwrite!
- item = @subject.current_action.item
- if item.mime_effect?
- l_act = @subject.current_action.friends_unit.last_action
- if l_act && l_act.can_mime?
- if item.mime_chance > rand(100)
- replace_action
- @subject.use_item(item) # mime item usage
- else
- @log_window.mime_fail = ['fail', l_act.name ]
- end
- else
- @log_window.mime_fail = l_act ? l_act.name : "nothing"
- end
- end
- end
- end
- class Window_BattleLog < Window_Selectable
- attr_accessor :mime_fail
- alias disp_mime_fail7151 display_failure
- def display_failure(target, item)
- if @mime_fail.is_a?(Array)
- add_text(sprintf("Failed to mime %s!", @mime_fail[1]))
- wait
- @mime_fail = false
- elsif @mime_fail == 'nothing'
- add_text("But there is nothing to be mimed!")
- wait
- @mime_fail = false
- elsif @mime_fail.is_a?(String)
- add_text(sprintf("But %s can't be mimed!", @mime_fail))
- wait
- @mime_fail = false
- else
- disp_mime_fail7151(target, item)
- end
- end
- end
- # End of script!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement