Advertisement
TheSixth

Actor Based Action Icons for YEA FTB

Apr 30th, 2018
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.09 KB | None | 0 0
  1. =begin
  2.  
  3. Actor Based Action Icons for YEA FTB
  4. Made by: Sixth
  5. Requires: Yanfly's Free Turn Battle script
  6.  
  7. This little snippet will let you change the action amount display in Yanfly's
  8. Free Turn Battle script.
  9. By default, all of the actions use the same icon, but with this script, the
  10. action icons can indicate which actors have some actions left and which of them
  11. used up their action points already.
  12.  
  13. You can setup a custom action icon set for your actors by using this note-tag
  14. on them:
  15.  
  16.   <ftb icon: normal_icon, used_icon>
  17.  
  18. Replace the normal_icon part with the index of the icon for unused action
  19. points.
  20. Replace the used_icon part with the index of the icon for used action points.
  21.  
  22. If an actor got no such note-tag, it will use the default icons setup in
  23. Yanfly's FTB script.
  24.  
  25. Place this script below Yanfly's Free Turn Battle script!
  26.  
  27. =end
  28.  
  29. class RPG::Actor < RPG::BaseItem
  30.  
  31.   attr_accessor :ftb_icon
  32.  
  33.   def ftb_icon
  34.     init_ftb_icon if @ftb_icon.nil?
  35.     return @ftb_icon
  36.   end
  37.  
  38.   def init_ftb_icon
  39.     if @note =~ /<ftb icon:(?:\s*)(\d+),(?:\s*)(\d+)>/i
  40.       @ftb_icon = [$1.to_i,$2.to_i]
  41.     else
  42.       @ftb_icon = [YEA::FTB::ICON_ACTION,YEA::FTB::ICON_EMPTY]
  43.     end
  44.   end
  45.  
  46. end
  47.  
  48. class Game_Actor < Game_Battler
  49.  
  50.   def ftb_icon
  51.     return actor.ftb_icon
  52.   end
  53.  
  54. end
  55.  
  56. class Window_FTB_Gauge < Window_Base
  57.  
  58.   def refresh
  59.     contents.clear
  60.     collect_icons
  61.     draw_icons
  62.   end
  63.  
  64.   def collect_icons
  65.     @icons = {:used => [], :rem => []}
  66.     $game_party.members.reverse.each do |mem|
  67.       next unless mem.game_battlerbase_inputable_ftb
  68.       rem = mem.max_ftb_actions - mem.ftb_actions
  69.       @icons[:rem] << [mem.ftb_icon[0],rem]
  70.       @icons[:used] << [mem.ftb_icon[1],mem.ftb_actions]
  71.     end
  72.   end
  73.  
  74.   def draw_icons
  75.     dx = contents.width
  76.     @icons[:rem].values.each do |dt|
  77.       dt[1].times do
  78.         dx -= 24
  79.         draw_icon(dt[0], dx, 0)
  80.       end
  81.     end
  82.     @icons[:used].each do |dt|
  83.       dt[1].times do
  84.         dx -= 24
  85.         draw_icon(dt[0], dx, 0)
  86.       end
  87.     end
  88.   end
  89.    
  90. end
  91. # End of script! O_O
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement