All pastes #25094 Raw Edit

Miscellany

public text v1 · immutable
#25094 ·published 2005-10-10 06:36 UTC
rendered paste body
(In a script by itself)

class Window_BattleScan < Window_Base
 def initialize
   super(0, 0, 640, 320)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = $fontface
   self.contents.font.size = $fontsize
   self.z = 8998
   self.back_opacity = 180
   self.visible = false
   enemy
refresh
 end
 #-------------------------------------------------------------------------
 # Refresh

def enemy
    enemy = $game_variables[70]
  end
   

 def refresh
   
   # Clear Contents
   self.contents.clear
   







  name = "Name: " + enemy.name
   hp = "HP: " + enemy.hp.to_s + "/" + enemy.base_maxhp.to_s
   sp = "SP: " + enemy.sp.to_s + "/" + enemy.base_maxsp.to_s
   atk = "Attack: " + enemy.base_atk.to_s
   pdef = "Physical Defense: " + enemy.base_pdef.to_s
   mdef = "Magic Defense: " + enemy.base_mdef.to_s
   eva = "Evasion: " + enemy.base_eva.to_s
   
   # Draw Enemy Stats
   draw_stat(name,0)
   draw_stat(hp,1)
   draw_stat(sp,2)
   draw_stat(atk,3)
   draw_stat(pdef,4)
   draw_stat(mdef,5)
   draw_stat(eva,6)
   case enemy.name
   when "(monster name here)"
     #-----------------------------------------------------------------------------------------------------------
     draw_stat("Description: (insert description)",7)
     draw_stat("Weakness: (insert weakness)",8)
     draw_stat("Resistance: (insert resistance)",9)

end
 def draw_stat(text,line)
   
   # Draw Individual Stat
   width = self.contents.text_size(text).width
   height = self.contents.text_size(text).height
   self.contents.draw_text(0, height * line, width, height, text)

end
end

(In def skill_effect)
if (user.is_a?(Game_Actor))
if skill.id == (the id of your scan skill)
       $game_system.se_play($data_system.decision_se)
       start_scan_window
     end
end

(Anywhere in the CBS, in scene 4 with the DBS)

#--------------------------------------------------------------------------
 def start_scan_window
   @scan_window = Window_BattleScan.new
   @scan_window.visible = true
   @do_loop = true
   loop do
     Graphics.update
     Input.update
     update_scanwindow_input
     if @do_loop == false
       break
     end
   end
   @scan_window.dispose
   Graphics.update
 end
 #--------------------------------------------------------------------------
 def update_scanwindow_input
   if Input.trigger?(Input::B) or Input.trigger?(Input::C)
     $game_system.se_play($data_system.cancel_se)
     @do_loop = false
     return
   end
 end
 #--------------------------------------------------------------------------