Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- - Simple Face HUD
- Made by: Sixth
- A simple script to show the face of the party leader on the map scene.
- Check out the setting area if you want, but other than that, it's pretty much
- a plug-and-play script.
- Put this script between Materials and Main.
- Terms of use:
- * Free to use for whatever purposes you want.
- * Credit me (Sixth) in your game, pretty please! :P
- * Posting modified versions of this script is allowed as long as you notice me
- about it with a link to it!
- =end
- module FacePic
- # Some self-explanatory settings below...
- Settings = {
- :pos => [8,8], # X and Y position
- :opa => 255, # Opacity level
- :z => 200, # Z level
- :zoom => [0.8,0.8], # Zoom level (1.0 = original size)
- :switch => 0, # 0 = Always show, >0 = Shown when switch is ON
- }
- end
- # End of setting area! Don't change anything below unless you know... and so on.
- class FaceHUD
- def initialize(data,view=nil)
- @data = data
- @view = view
- @id = $game_party.leader.id
- init_pic
- update_vis if @data[:switch] > 0
- end
- def init_pic
- @pic = Sprite.new(@view)
- @pic.x = @data[:pos][0]
- @pic.y = @data[:pos][1]
- @pic.z = @data[:z]
- @pic.opacity = @data[:opa]
- @pic.zoom_x = @data[:zoom][0]
- @pic.zoom_y = @data[:zoom][1]
- refresh
- end
- def refresh
- @pic.bitmap.dispose if @pic.bitmap
- @pic.bitmap = Cache.face($game_actors[@id].face_name).clone
- @pic.src_rect.width = @pic.src_rect.height = 96
- index = $game_actors[@id].face_index
- @pic.src_rect.x = index % 4 * 96
- @pic.src_rect.y = index / 4 * 96
- end
- def update
- update_vis if @data[:switch] > 0 && @vis != $game_switches[@data[:switch]]
- update_face if @id != $game_party.leader.id
- end
- def update_vis
- @vis = $game_switches[@data[:switch]]
- @pic.visible = @vis
- end
- def update_face
- @id = $game_party.leader.id
- refresh
- end
- def disposed?
- return @disposed
- end
- def dispose
- @pic.bitmap.dispose
- @pic.dispose
- @disposed = true
- end
- end
- class Spriteset_Map
- alias add_face_hud0273 create_timer
- def create_timer
- add_face_hud0273
- init_face_hud
- end
- def init_face_hud
- @face_hud = FaceHUD.new(FacePic::Settings,@viewport2)
- end
- alias upd_face_hud0071 update_timer
- def update_timer
- upd_face_hud0071
- @face_hud.update
- end
- alias disp_face_hud9665 dispose_timer
- def dispose_timer
- disp_face_hud9665
- @face_hud.dispose
- end
- end
- # End of script! Yay!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement