Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===== Rpg Makver VX ACE Script =============================
- #= NPC HUD
- #===== By: ==================================================
- #= Jaxx L.Timing ---------------------- VERSION: 7/14/2013 =#
- #===== Credit to: ===========================================
- #= lilcooldude69
- #= For his 'Very Simple Hud' which I used as a referece.
- #= http://forums.rpgmakerweb.com/index.php?/topic/1057-very-simple-hud/
- #===== Compatible With: =====================================
- #= Rpg Maker VX ACE
- #===== Description: =========================================
- #= Shows the stats of any character you want.
- #===== Instructions: ========================================
- #= Step One: == Create an actor to represent your NPC and write
- #= down their position in the list for later reference.
- #= Step Two: == Create an event using the NPC's sprite.
- #= Step Three: == Create an empty event next to the event you just made.
- #= Step Four: == Set the event to switch ON a Switch of your choosing,
- #= write down the Switch number. Set the event to trigger on player contact.
- #= Step Five: == Set the event to substitute a variable's value of your choosing
- #= with the position number from Step One as a CONSTANT, write down
- #= the Variable number you choose. Set the event to trigger on player contact.
- #= Step Six: Copy and paste this empty event on each side of your NPC.
- #= Step Seven: == Set up a different empty event surrounding your empty events
- #= that will turn OFF the Switch from Step Four and surround the events you made.
- #= Final Step: == Plug the Switch and Variable numbers you wrote down into
- #= the 'Customization Settings' below.
- #============================================================
- module NPC_HUD_Settings
- #----------------------------------------------------
- # * Customization Settings
- #----------------------------------------------------
- SWITCH = 1 # Switch to activate NPC_HUD
- VARIABLE = 1 # Variable set to actor values
- TRANSPARENT = false # Make 'true' if you want the portrait to appear semi-transparent.
- SEPARATOR = " / " # Set the separator between Name and Title
- VERTICAL = 280 # Pixels between the top of the screen and the HUD
- HORIZONTAL = 62 # Pixels between the LEFT side of the screen and the HUD
- # *HORIZONTAL = 62 centers the HUD*
- end
- include NPC_HUD_Settings
- class NPC_HUD < Window_Base
- #----------------------------------------------------
- # * Object Initialization
- #----------------------------------------------------
- def initialize
- super(HORIZONTAL,VERTICAL,420,125)
- self.visible = $game_switches[SWITCH]
- $game_variables[VARIABLE] = 1
- @actor = $game_actors[$game_variables[VARIABLE]]
- refresh
- end
- #----------------------------------------------------
- # * Refresh
- #----------------------------------------------------
- def refresh
- self.contents.clear
- contents.clear
- draw_window_content
- end
- #----------------------------------------------------
- # * Draw Window Contents
- #----------------------------------------------------
- def draw_window_content
- @actor = $game_actors[$game_variables[VARIABLE]]
- @level = @actor.level
- @hp = @actor.hp
- @mp = @actor.mp
- contents.font.size = 20
- draw_face(@actor.face_name, @actor.face_index, 0, 0, enabled = TRANSPARENT)
- draw_actor_name(@actor, 110, 0)
- draw_actor_nickname(@actor, 126+$game_actors[$game_variables[VARIABLE]].name.size*9, 0)
- draw_text(107+$game_actors[$game_variables[VARIABLE]].name.size*9, 0, 13, 24, SEPARATOR, 2)
- draw_actor_level(@actor, 334, 0)
- draw_actor_hp(@actor, 110, 20, 280)
- draw_actor_mp(@actor, 110, 40, 280)
- draw_actor_params(@actor, 110, 65, 2)
- draw_actor_params(@actor, 150, 65, 3)
- draw_actor_params(@actor, 190, 65, 4)
- draw_actor_params(@actor, 230, 65, 5)
- draw_actor_params(@actor, 270, 65, 6)
- draw_actor_params(@actor, 310, 65, 7)
- end
- #--------------------------------------------------------------------------
- # * Draw Parameters
- #--------------------------------------------------------------------------
- def draw_actor_params(actor, x, y, param_id)
- change_color(normal_color)
- draw_text(x, y + 15, 36, line_height, actor.param(param_id), 2)
- change_color(system_color)
- draw_text(x, y, 120, line_height, Vocab::param(param_id))
- end
- #-----------------------------------------------------
- # * Update
- #-----------------------------------------------------
- def update
- super
- self.visible = $game_switches[SWITCH]
- return if !self.visible
- if @actor != $game_actors[$game_variables[VARIABLE]]
- refresh
- end
- end
- end
- class Scene_Map < Scene_Base
- #------------------------------------------------------
- # * Scene_Map Class
- #------------------------------------------------------
- alias jlt_start_scenemap_eh849h start
- alias jlt_terminate_scenemap_eh849h terminate
- alias jlt_update_scenemap_eh849h update
- def start
- jlt_start_scenemap_eh849h()
- @winhud = NPC_HUD.new
- update
- end
- def terminate
- @winhud.dispose
- jlt_terminate_scenemap_eh849h()
- end
- def update
- jlt_update_scenemap_eh849h()
- @winhud.update
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment