Hero Stuff - G@MeF@Ce - 03-10-2021
Hero Stuff
Version 1.o
Introduction
When you're in the game to save the world...
save time by not having to switch to other menus,
save buttons by assigning two buttons to make things work,
heck save the leader with low health by trading places and give the heroes in your party a chance to prove their worth!
How can one do this? (you faintly hear inside your mind) Well if you got RMXP ... then you can do it with HERO STUFF!
These are just a few of my old scripts that got a make over (and boy did I find many lines of useless code)
May the RMXP torch stay brightly lit! ~ enjoy ^,^
Features
1 demo, 3 scripts.
all scripts can be disabled by game switch
Swap Leader - once made for XAS now just for RMXP
Double Tap to Dash and Blur... - it will live up to it's name
Hero Mini Hud - it's a hud, that's mini, and appears right above the hero
Demo
Hero Mini Hud v3
Code: ################################################################################
# [RMXP] Hero Mini HUD v3.0 by gameface101 3/26/2011 - 3/8/21
#
# www.gameface101.com remembering and giving thanks to:
# Hackel, mr_wiggles, albertfish and LiTTleDRAgo for RGSS support in the past
# and inspiration for script into the future
#===============================================================================
# RMXP Instructions:
# Open Script Database (F11) Copy and Paste this Script above Main
#
# setup options in the module
################################################################################
module G101_hmh
#[control options]==============================================================
HMH_OFF = 101 #disabled when this switch is true/on
PRESS_HOLD = Input::L #hold to enable
TRIGGER_HUD = Input::R #press to activate
HMH_VISI = false #set true to begin visible
#[display options]==============================================================
HMH_O = 255 #content opacity
HMH_SKIN_O = 0 #skin opacity
HMH_X = 0 #horizontal position
HMH_Y = 110 #vertical position
HMH_W = 80
HMH_H = 80
#[name settings]================================================================
HERO_NAME = true
NAME_SIZE = 18
N_X = 0
N_Y = 0
N_Z = 3000
#[hp bar settings]==============================================================
HP_ON = true
HP_X = 20
HP_Y = 16
HP_WID = 36
HP_HET = 4
#[special bar settings]=========================================================
SP_ON = true
SP_X = 2
SP_Y = 22
SP_WID = 36
SP_HET = 4
#[experience bar settings]======================================================
EXP_ON = true
EXP_X = 2
EXP_Y = 28
EXP_WID = 36
EXP_HET = 4
end
################################################################################
#===============================================================================
# ■ Window_Base
#===============================================================================
class HMini_Hud < Window_Base
include G101_hmh
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize
super($game_player.screen_x,$game_player.screen_y,160,80)
self.visible = (HMH_VISI)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Impact"
self.contents.font.size = 32
self.z = 3000
self.opacity = HMH_SKIN_O
self.contents_opacity = HMH_O
@old_name = ''
@old_hp = @old_sp = @old_exp = @hr = 0
@name_sprite = Sprite.new
@name_sprite.bitmap = Bitmap.new(132, 132)
@name_sprite.z = 5000
@name_sprite.bitmap.font.name = self.contents.font.name
@name_sprite.bitmap.font.size = self.contents.font.size
@name_sprite.visible = self.visible
refresh
end
#--------------------------------------------------------------------------
# ● Refresh
#--------------------------------------------------------------------------
def refresh
actor = $game_party.actors[0]
return if @old_hp == actor.hp
self.contents.clear
if HERO_NAME && @old_name != actor.name
@old_name = actor.name
@name_sprite.bitmap.clear
@name_sprite.bitmap.font.size = NAME_SIZE
@name_sprite.bitmap.font.color.set(0, 0, 0)#hemming
@name_sprite.bitmap.draw_text(N_X - 1, N_Y - 1, 160, 32, actor.name, 0)
@name_sprite.bitmap.draw_text(N_X - 1, N_Y + 1, 160, 32, actor.name, 0)
@name_sprite.bitmap.draw_text(N_X + 1, N_Y - 1, 160, 32, actor.name, 0)
@name_sprite.bitmap.draw_text(N_X + 1, N_Y + 1, 160, 32, actor.name, 0)
@name_sprite.bitmap.font.color = normal_color #white
@name_sprite.bitmap.draw_text(N_X, N_Y, 160, 32, actor.name, 0)
end
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
super
@name_sprite.x = $game_player.screen_x - self.width / 8 + 2
@name_sprite.y = $game_player.screen_y - self.width / 2 - 26
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
super
@name_sprite.dispose
end
#--------------------------------------------------------------------------
# ● Toggle visibility
#--------------------------------------------------------------------------
def vis=(val)
self.visible = val
@name_sprite.visible = self.visible
end
end #end Window_Base class
#===============================================================================
# ■ Scene_Map
#===============================================================================
class Scene_Map
include G101_hmh
alias hmini_hud_main main
alias hmini_hud_update update
#--------------------------------------------------------------------------
# ● Main
#--------------------------------------------------------------------------
def main
layout
hmini_hud_main
[@HMini_hud,@HPMini_hud,@SMini_Hud,@XPMini_Hud,@STMini_Hud,
@CHMini_Hud].each {|i| i.dispose if i != nil && !i.disposed?}
end
#--------------------------------------------------------------------------
# ● Layout
#--------------------------------------------------------------------------
def layout
@HMini_hud = HMini_Hud.new
@HPMini_hud = HPMini_Hud.new
@SMini_Hud = SMini_Hud.new
@XPMini_Hud = XPMini_Hud.new
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
@HMini_hud.update
unless $game_switches[HMH_OFF] == true
if @HMini_hud.visible and
Input.press?(PRESS_HOLD) and Input.trigger?(TRIGGER_HUD)
@HMini_hud.vis = @HMini_hud.visible = false
$game_system.se_play(RPG::AudioFile.new("", 100, 100))
elsif !@HMini_hud.visible and
Input.press?(PRESS_HOLD) and Input.trigger?(TRIGGER_HUD)
@HMini_hud.vis = @HMini_hud.visible = true
$game_system.se_play(RPG::AudioFile.new("", 100, 100))
end
end
[@HMini_hud,@HPMini_hud,@SMini_Hud,@XPMini_Hud].each {|i| i.visible = @HMini_hud.visible}
hmini_hud_update
#center window according to hero position
@HMini_hud.x = $game_player.screen_x - @HMini_hud.width / 2
#place window above actor
@HMini_hud.y = $game_player.screen_y - HMH_Y
[@HMini_hud,@HPMini_hud,@SMini_Hud,@XPMini_Hud].each {|i| i.x = @HMini_hud.x}
[@HPMini_hud,@SMini_Hud,@XPMini_Hud].each {|i| i.y = @HMini_hud.y}
if @HMini_hud.visible == true
[@HMini_hud,@HPMini_hud,@SMini_Hud,@XPMini_Hud].each {|i| i.update}
[@HMini_hud,@HPMini_hud,@SMini_Hud,@XPMini_Hud].each {|i| i.refresh}
end
end
end #end Scene_Map class
#===============================================================================
# ■ Window_Base
#===============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● Draw bars
#--------------------------------------------------------------------------
def draw_hmini_hud_bar(x, y, min, max, width = 152, height = 6,
bar_color = Color.new(150, 0, 0, 255),
end_color = Color.new(255, 255, 60, 255))
#-------------------------------------------------------------------------------
for i in 0..height
self.contents.fill_rect(x, y + height - i, width +1, 1,
Color.new(50, 50, 50, 255))
end
#-------------------------------------------------------------------------------
for i in 1..(height - 1)
r = 100 * (height - i) / height + 0 * i / height
g = 100 * (height - i) / height + 0 * i / height
b = 100 * (height - i) / height + 0 * i / height
a = 255 * (height - i) / height + 255 * i / height
self.contents.fill_rect(x, y + height, width, 1, Color.new(r, b, g, a))
end
#-------------------------------------------------------------------------------
for i in 1..( (min / max.to_f) * width - 1)
for j in 1..(height -1)
r = bar_color.red * (width - i) / width + end_color.red * i / width
g = bar_color.green * (width - i) / width + end_color.green * i / width
b = bar_color.blue * (width - i) / width + end_color.blue * i / width
a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
self.contents.fill_rect(x + i, y + height - j, 1, 1, Color.new(r, g, b, a))
end
end
end
end
#===============================================================================
# ■ HP window/bar
#===============================================================================
class HPMini_Hud < Window_Base
include G101_hmh
#--------------------------------------------------------------------------
# ● HP initialize
#--------------------------------------------------------------------------
def initialize
super($game_player.screen_x-38,$game_player.screen_y-48,160,80)
self.visible = (HMH_VISI)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Impact"
self.contents.font.size = 24
self.z = 3000
self.opacity = HMH_SKIN_O
self.contents_opacity = HMH_O
refresh
end
#--------------------------------------------------------------------------
# ● HP refresh
#--------------------------------------------------------------------------
def refresh
actor = $game_party.actors[0]
return if @old_hp == actor.hp
self.contents.clear
self.opacity = HMH_SKIN_O
self.contents_opacity = HMH_O
if HP_ON == true
@old_hp = actor.hp
hpx = self.width / 4 + 5
draw_hmini_hud_bar(hpx,HP_Y,actor.hp,
actor.maxhp,HP_WID,HP_HET,Color.new(250,50,0,255),
Color.new(255,100,50,255))
end
end
end
#===============================================================================
# ■ SP window/bar
#===============================================================================
class SMini_Hud < Window_Base
include G101_hmh
#--------------------------------------------------------------------------
# ● SP initialize
#--------------------------------------------------------------------------
def initialize
super($game_player.screen_x-38,$game_player.screen_y-48,160,80)
self.visible = (HMH_VISI)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Impact"
self.contents.font.size = 24
self.z = 3000
self.opacity = HMH_SKIN_O
self.contents_opacity = HMH_O
refresh
end
#--------------------------------------------------------------------------
# ● SP refresh
#--------------------------------------------------------------------------
def refresh
actor = $game_party.actors[0]
return if @old_sp == actor.sp
self.contents.clear
self.opacity = HMH_SKIN_O
self.contents_opacity = HMH_O
if SP_ON == true
@old_sp = actor.sp
spx = self.width / 4 + 5
draw_hmini_hud_bar(spx,SP_Y,actor.sp,
actor.maxsp,SP_WID,SP_HET,Color.new(0,50,250,255),
Color.new(50,100,255,255))
end
end
end
#===============================================================================
# ■ XP window/bar
#===============================================================================
class XPMini_Hud < Window_Base
include G101_hmh
#--------------------------------------------------------------------------
# ● XP initialize
#--------------------------------------------------------------------------
def initialize
super($game_player.screen_x-38,$game_player.screen_y-48,160,80)
self.visible = (HMH_VISI)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Impact"
self.contents.font.size = 24
self.z = 3000
self.opacity = HMH_SKIN_O
self.contents_opacity = HMH_O
@old_hp = @old_sp = @old_exp = @hr = 1234567890000
refresh
end
#--------------------------------------------------------------------------
# ● XP refresh
#--------------------------------------------------------------------------
def refresh
if EXP_ON == true
actor = $game_party.actors[0]
return if @old_exp == actor.now_exp
self.contents.clear
self.opacity = HMH_SKIN_O
self.contents_opacity = HMH_O
@old_exp = actor.now_exp
xpx = self.width / 4 + 5
draw_hmini_hud_bar(xpx,EXP_Y,actor.now_exp,
actor.next_exp,EXP_WID,EXP_HET,Color.new(0,255,0,255),
Color.new(100,255,100,255))
end
end
end
#===============================================================================
# ■ SP window/bar
#===============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● now xp
#--------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end
#--------------------------------------------------------------------------
# ● next xp
#--------------------------------------------------------------------------
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
#end of script ^,^
Swap Leader
Code: ################################################################################
# [RMXP] Swap Leader v3.0 by G@MeF@Ce 2/5/11 - 3/8/21
#
# www.gameface101.com remembering and giving thanks to:
# mr_wiggles, hackel, kain nobel, modern algebra, dark_seed, and albertfish
# for all the support in the past and inspiration to make scripts in the future
#===============================================================================
# RMXP Instructions:
# Open Script Database (F11) Copy and Paste this Script above Main
#
# setup options in the module
################################################################################
module G101_SL
#[CONTROL OPTIONS]==============================================================
NO_SWAP = 2
SL_PRESS_HOLD = Input::L
TRIGGER_SWITCH = Input::X
#[GRAPHIC OPTIONS]==============================================================
ANIMATED_SWITCH = true
ANIMATION_ID = 66
#[SOUND OPTIONS]================================================================
SWITCH_SOUND = true
SOUND_SWITCH = RPG::AudioFile.new("", 100, 100)
end
#===============================================================================
# ■ Game_Temp
#===============================================================================
class Game_Temp
attr_accessor :remember_skill
attr_accessor :remember_item
attr_accessor :collapse_done
alias swap_initialize initialize
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize
@remember_skill = []
@remember_item = []
swap_initialize
end
end
#===============================================================================
# ■ Scene_Map
#===============================================================================
class Scene_Map
alias swap_leader_update update
include G101_SL
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
swap_leader_update
actor = $game_party.actors[0]
unless $game_party.actors.empty?
if actor.hp == 0
unless $game_party.all_dead?
$game_party.actors.shift
$game_player.refresh
$game_map.refresh
end
end
end
return false if $game_system.map_interpreter.running?
if $game_switches[NO_SWAP] == false
if $game_party.actors.size > 1
if Input.press?(SL_PRESS_HOLD) and Input.trigger?(TRIGGER_SWITCH)
if ANIMATED_SWITCH == true
$game_player.animation_id = ANIMATION_ID
end
if SWITCH_SOUND == true
$game_system.se_play(SOUND_SWITCH)
end
g101_swap_leader
end
end
end
end
#--------------------------------------------------------------------------
# ● swap method
#--------------------------------------------------------------------------
def g101_swap_leader
old_lead = $game_party.actors.shift
$game_party.add_actor (old_lead.id)
$game_player.refresh
end
end
#end of script ^,^
Double Tap to Dash and Blur...
Code: ################################################################################
# [RMXP] Double Tap Dash Blur by G@MeF@Ce v3.0 1/28/10 - 3/9/21
#
# www.gameface101.com remembering and giving thanks to:
# Gamba for the directional dash in the ABS and Zues81 for the trails script
#===============================================================================
# RMXP Instructions:
# Open Script Database (F11) Copy and Paste this Script above Main
#
# setup options in the module
#
# to blur event:
#
# X = Event ID number
# $game_map.events[X].blur = true
#
# to stop event blur:
# $game_map.events[X].blur = false
#
################################################################################
module DTDB
#[CONTROL OPTIONS]==============================================================
DISABLE_SWITCH = 1 #game switch on to disable
DISABLE_TILE = 7 #terrain ID for dash off
#[DASH OPTIONS]=================================================================
NORMAL_SPEED = 4 #set normal speed
DASH_SPEED = 5.0 #set dash speed
TIME = 4 #time between double tap
STOP_DASH = 0#0 = default, 1 = stop dash on turn, 2 or highter dash always on
DASH_TIME = 100 #time to check dash
#[GRAPHIC OPTION]===============================================================
CHARACTER_DASH_GRAPHIC = "_dash" #"NAME_dash" graphic
#[SOUND OPTIONS]================================================================
DASH_SOUND = "" #play sound when dashing
DASH_SOUND_VOL = 100
#[BLUR OPTIONS]=================================================================
BLUR_LENGTH = 10 #set number of repeated images to create a blurrr
BLUR_TYPE = 0#0=Normal 1=Light 2=Dark
end
################################################################################
#===============================================================================
# ■ Game_Character
#===============================================================================
class Game_Character
attr_accessor :move_speed
attr_accessor :time_dash
attr_accessor :character_name
attr_accessor :blur
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias tap_dash_initialize initialize
def initialize
@time_dash = 0
tap_dash_initialize
@blur = false
end
end
#===============================================================================
# ■ RPG_FileTest
#===============================================================================
module RPG_FileTest
def RPG_FileTest.character_exist?(filename)
return RPG::Cache.character(filename, 0) rescue return false
end
end
#===============================================================================
# ■ Game_Map
#===============================================================================
class Game_Map
include DTDB
attr_accessor :time_dash
attr_accessor :dashing
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias tap_dash_setup setup
def setup(map_id)
@dash = []
for i in 2..8
@dash[i] = 0
end
@time_c = 0
@dashing = false
@direction = 0
@direction_old = $game_player.direction
@time_rec = 0
$game_player.time_dash = DASH_TIME if @time_dash == nil
tap_dash_setup(map_id)
end
#--------------------------------------------------------------------------
# ● Can Tap Dash?
#--------------------------------------------------------------------------
def can_tap_dash?
return false if $game_system.map_interpreter.running?
return true
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias tap_dash_update update
def update
tap_dash_update
return unless can_tap_dash?
#disable tile
if $game_map.terrain_tag($game_player.x , $game_player.y) == DISABLE_TILE
$game_player.character_name = $game_party.actors[0].character_name if $game_player.character_name == $game_party.actors[0].character_name + CHARACTER_DASH_GRAPHIC
end
#dash graphic
if $game_switches[DISABLE_SWITCH] == false and $game_map.terrain_tag($game_player.x , $game_player.y) != DISABLE_TILE
if @dashing == true
newname = $game_party.actors[0].character_name + CHARACTER_DASH_GRAPHIC if $game_party.actors[0].hp > 0
$game_player.character_name = newname if $game_player.character_name != newname and
RPG_FileTest.character_exist?(newname)
$game_player.move_speed = DASH_SPEED
if STOP_DASH == 0
unless Input.press?(Input::DOWN) or Input.press?(Input::LEFT) or
Input.press?(Input::RIGHT) or Input.press?(Input::UP)
@dashing = false
$game_player.blur = false#
end
elsif STOP_DASH == 1
unless Input.press?(@keyboard) and @direction == $game_player.direction
@dashing = false
$game_player.blur = false#
end
end
else
$game_player.character_name = $game_party.actors[0].character_name if $game_player.character_name == $game_party.actors[0].character_name + CHARACTER_DASH_GRAPHIC
#input and speed check
$game_player.move_speed = NORMAL_SPEED if $game_player.move_speed == DASH_SPEED
dir = $game_player.direction
case dir
when 2
@keyboard = Input::DOWN
when 4
@keyboard = Input::LEFT
when 6
@keyboard = Input::RIGHT
when 8
@keyboard = Input::UP
end
if @dash[dir] == 1
if Input.press?(@keyboard)
for i in 2..8
if i != dir
@dash[i] = 0
$game_player.blur = false
end
end
else
@dash[dir] = 2
for i in 2..8
if i != dir
@dash[i] = 0
$game_player.blur = false
end
end
end
elsif @dash[dir] == 2
if @time_c < (TIME)
if Input.press?(@keyboard)
@time_c = 0
@dash[dir] = 0
@dashing = true
$game_system.se_play(RPG::AudioFile.new(DASH_SOUND, DASH_SOUND_VOL, 100))
$game_player.blur = true
@direction = $game_player.direction
end
end
if @time_c > (TIME)
@time_c = 0
@dash[dir] = 0
$game_player.blur = false
end
else
@time_c = 0
if Input.trigger?(@keyboard)
@dash[dir] = 1
for i in 2..8
if i != dir
@dash[i] = 0
$game_player.blur = false
end
end
end
end
end
end
end
end #end character class
#===============================================================================
# ■ Spriteset_Map
#===============================================================================
class Spriteset_Map
include DTDB
$blurr_images = DTDB::BLUR_LENGTH
$transparence = DTDB::BLUR_TYPE
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias spriteset_map_update update
def update
if $blurr_images != @last_blurr_images
@last_blurr_images = $blurr_images
if @blur_sprites != nil
for blur_sprite in @blur_sprites.values
blur_sprite.dispose
end
@blur_sprites = nil
end
end
if @blur_sprites == nil
@blur_sprites = {}
for i in 0...$blurr_images
@blur_sprites[i] = Sprite_Blur.new(@viewport1, $game_player)
@blur_sprites[i].opacity = 156 / $blurr_images * i
end
end
for id in $game_map.events.keys.sort
event = $game_map.events[id]
if event.blur == true and @blur_sprites[id * $blurr_images] == nil
for i in 0...$blurr_images
@blur_sprites[id * $blurr_images + i] = Sprite_Blur.new(@viewport1, event)
@blur_sprites[id * $blurr_images + i].opacity = 156 / $blurr_images * i
end
end
end
for blur_sprite in @blur_sprites.values
blur_sprite.update
end
spriteset_map_update
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
alias spriteset_map_dispose dispose
def dispose
spriteset_map_dispose
for blur_sprite in @blur_sprites.values
blur_sprite.dispose
end
end
end
#===============================================================================
# ■ Sprite_Blur
#===============================================================================
class Sprite_Blur < Sprite
include DTDB
attr_accessor :real_x
attr_accessor :real_y
attr_accessor :character
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(viewport, character)
super(viewport)
self.opacity = 0
@character = character
update
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
if self.opacity == 0
super
if @character_name != @character.character_name or @character_hue != @character.character_hue
@character_name = @character.character_name
@character_hue = @character.character_hue
self.bitmap = RPG::Cache.character(@character_name,@character_hue)
self.blend_type = $transparence
@cw = bitmap.width / 4
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch
end
self.visible = (not @character.transparent and @character.blur)
sx = @character.pattern * @cw
sy = (@character.direction - 2) / 2 * @ch
self.src_rect.set(sx, sy, @cw, @ch)
self.opacity = 156
self.z = @character.screen_z(@ch) - 1
@real_x = @character.real_x
@real_y = @character.real_y
update
else
self.opacity -= 156 / ($blurr_images - 1)
self.x = (@real_x - $game_map.display_x + 3)/4 + 16
self.y = (@real_y - $game_map.display_y + 3)/4 + 32
end
end
end
#end of script ^,^
Instructions
There's a demo, there's instructions in the header of each script as well and a user-friendly modules to tweak it your way.
If you still need further assistance, write my number down... just kidding, post here or catch me on the Save-Point discord.
Compatibility
Classes are aliased, Game_Map, Game_Player and Scene_Map gets refreshed. Other than that, all should be compatible.
Credit and Thanks
shout outs in the script headers to those who have supported me in the past and inspired me to make scripts in the future.
Terms and Conditions
Simply free to use, must give credit to the names in each script. You must also finish what you start so complete your project!
Ok gang, be kind to others and look both ways before crossing the street, you may have to put the cell phone down.
|