Advertisement
Skyloftian_Link

Example for GKing

May 23rd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.94 KB | None | 0 0
  1. class Scene_Map < Scene_Base
  2.  
  3.   alias :ex_start :start
  4.   def start
  5.     ex_start
  6.     @infos = My_Window.new(0, 0, 200, 100)
  7.   end
  8.  
  9.   alias new_update update
  10.   def update
  11.     new_update
  12.     change_character if Input.trigger?(:C)
  13.   end
  14.  
  15.   def change_character
  16.     Sound.play_ok
  17.     $game_party.swap_order($game_party.leader.index, $game_party.members[1].index)
  18.     @infos.refresh
  19.   end
  20.  
  21. end
  22.  
  23. class My_Window < Window_Base
  24.  
  25.   def initialize(x, y, width, height)
  26.     super(x, y, width, height)
  27.     self.opacity = 50
  28.   end
  29.  
  30.   def update
  31.     super
  32.     @actor1 = $game_party.leader
  33.     if @actor1.hp != @hp || @actor1.mp != @mp
  34.       refresh
  35.     end
  36.   end
  37.  
  38.   def refresh
  39.     self.contents.clear
  40.     self.draw_character(@actor1.character_name, @actor1.character_index, 16, 32)
  41.     self.draw_actor_hp(@actor1, 42, 16)
  42.     self.draw_actor_mp(@actor1, 42, 42)
  43.     @hp = @actor1.hp
  44.     @mp = @actor1.mp
  45.   end
  46.  
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement