Witam.
Ten skrypt polega na pokazywanie avatara naszej postaci, lvl, Hp i Sp.
Screen
Spoiler:
Skrypt
Spoiler:
Kod:
#==============================================================================
# PaS HUD v.1.1 by DarkCloud
#
# ~~>Historia
# ~>Wersja 1.1
# -Zmienione grafiki barów
# -Dodany Exp bar
# -Informacja o obecnym lvl'u
# -Pozycjonowanie HUD'a
# *215:"@hudx = left/right" - Tu wybieramy pozycję poziomą HUD'a, lewy/prawy
# *219:"@hudy = up/down" - Tu wybieramy pozycję pionową HUD'a, góra/dół
#
#==============================================================================
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
#=====================================
# HUD Pic
#=====================================
def draw_hud(x, y)
bitmap = RPG::Cache.picture("Hud")
hw = bitmap.width
hh = bitmap.height
self.contents.blt(x , y , bitmap, Rect.new(0, 0, hw, hh))
end
#=====================================
# Actor Avatar
#=====================================
def draw_actor_avatar(actor, x, y)
bitmap = RPG::Cache.character("Avatars/" + actor.name, actor.character_hue)
aw = bitmap.width
ah = bitmap.height
self.contents.blt(x , y , bitmap, Rect.new(0, 0, aw, ah))
end
#=====================================
# Actor Name
#=====================================
def draw_actor_hud_name(actor, x, y)
self.contents.font.name = "Calligula"
self.contents.font.color = normal_color
self.contents.font.size = 14
self.contents.draw_text(x, y, 120, 32, actor.name)
end
#=====================================
# Actor level
#=====================================
def draw_actor_lv(actor, x, y)
self.contents.font.name = "Calligula"
self.contents.font.color = Color.new(0, 180, 0)
self.contents.font.size = 12
self.contents.draw_text(x, y, 32, 32, "Lv")
self.contents.font.name = "Arial"
self.contents.font.color = Color.new(200, 200, 0)
self.contents.font.size = 15
self.contents.draw_text(x + 10, y - 1, 24, 32, actor.level.to_s, 2)
end
#=====================================
# Actor HP bar
#=====================================
def draw_actor_hp_bar(actor, x, y)
@actor = $game_party.actors[0]
whp = 50 * @actor.hp / @actor.maxhp
self.contents.font.name = "Calligula"
self.contents.font.color = Color.new(0, 180, 0)
self.contents.font.size = 12
self.contents.draw_text(x - 20, y - 12, 32, 32, "HP")
self.contents.fill_rect(x, y, 50, 8, Color.new(230, 230, 230, 150))
self.contents.fill_rect(x, y + 1, whp, 1, Color.new(255, 0, 0))
self.contents.fill_rect(x, y + 2, whp, 1, Color.new(235, 0, 0))
self.contents.fill_rect(x, y + 3, whp, 1, Color.new(215, 0, 0))
self.contents.fill_rect(x, y + 4, whp, 1, Color.new(195, 0, 0))
self.contents.fill_rect(x, y + 5, whp, 1, Color.new(175, 0, 0))
self.contents.fill_rect(x, y + 6, whp, 1, Color.new(155, 0, 0))
bitmap = RPG::Cache.picture("HP_SP_bar")
hbw = bitmap.width
hbh = bitmap.height
self.contents.blt(x , y , bitmap, Rect.new(0, 0, hbw, hbh))
end
#=====================================
# Actor SP bar
#=====================================
def draw_actor_sp_bar(actor, x, y)
@actor = $game_party.actors[0]
wsp = 50 * @actor.sp / @actor.maxsp
self.contents.font.name = "Calligula"
self.contents.font.color = Color.new(0, 180, 0)
self.contents.font.size = 12
self.contents.draw_text(x - 18, y - 12, 32, 32, "SP")
self.contents.fill_rect(x, y, 50, 8, Color.new(230, 230, 230, 150))
self.contents.fill_rect(x, y + 1, wsp, 1, Color.new(0, 0, 255))
self.contents.fill_rect(x, y + 2, wsp, 1, Color.new(0, 0, 235))
self.contents.fill_rect(x, y + 3, wsp, 1, Color.new(0, 0, 215))
self.contents.fill_rect(x, y + 4, wsp, 1, Color.new(0, 0, 195))
self.contents.fill_rect(x, y + 5, wsp, 1, Color.new(0, 0, 175))
self.contents.fill_rect(x, y + 6, wsp, 1, Color.new(0, 0, 155))
bitmap = RPG::Cache.picture("HP_SP_bar")
sbw = bitmap.width
sbh = bitmap.height
self.contents.blt(x , y , bitmap, Rect.new(0, 0, sbw, sbh))
end
#=====================================
# Actor Exp bar
#=====================================
def draw_actor_exp_bar(actor, x, y)
@actor = $game_party.actors[0]
exp1 = actor.now_exp
exp2 = actor.next_exp
if actor.next_exp == 0
exp1 = 1
exp2 = 1
end
wexp = 150 * exp1 / exp2
self.contents.fill_rect(x, y, 150, 6, Color.new(230, 230, 230, 150))
self.contents.fill_rect(x, y + 1, wexp, 1, Color.new(255, 128, 0))
self.contents.fill_rect(x, y + 2, wexp, 1, Color.new(235, 118, 0))
self.contents.fill_rect(x, y + 3, wexp, 1, Color.new(215, 108, 0))
self.contents.fill_rect(x, y + 4, wexp, 1, Color.new(195, 98, 0))
bitmap = RPG::Cache.picture("Exp_bar")
ebw = bitmap.width
ebh = bitmap.height
self.contents.blt(x , y , bitmap, Rect.new(0, 0, ebw, ebh))
end
end
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Get the current EXP
#--------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end
#--------------------------------------------------------------------------
# * Get the next level's EXP
#--------------------------------------------------------------------------
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
alias hud_main main
def main
@Hud = Window_Hud.new
hud_main
@Hud.dispose if @Hud != nil
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias hud_update update
def update
@Hud.update
hud_update
end
end
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(-16, -16, 220, 150)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
if $game_switches[1] == false
self.x = -400
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
self.contents.clear
actor = $game_party.actors[0]
draw_hud(0, 0)
draw_actor_avatar(actor, 24, 24)
draw_actor_hud_name(actor, 88, 16)
draw_actor_lv(actor, 89, 31)
draw_actor_hp_bar(actor, 109, 58)
draw_actor_sp_bar(actor, 109, 73)
draw_actor_exp_bar(actor, 19, 88)
#------------------------------------------------------------------------
# * Hud position
#------------------------------------------------------------------------
left = - 16
right = 436
@hudx = left
up = - 16
down = 351
@hudy = up
if $game_switches[1] == true
self.x = @hudx
self.y = @hudy
end
if $game_switches[1] == false
self.x = -400
end
end
end
Instalacja
Spoiler:
1.Skrypt wstawiamy nad main.
2.Wchodzimy na dysk, na którym mamy projekt.
3.Graphics/Characters i tworzymy forder "Avatars".
4.Wklejamy tam avatar naszej postaci.
5.Importujemy grafikę. Hud i paski do pictures, avatar do characters.
6.Skrypt zamontowany.
Potrzeba Grafika
Spoiler:
Hud:
HP_SP_bar:
Exp_bar:
Jak nie odpowiada wan ta grafika to można dać swoją, ale trzeba ją nazwać jak są te.
________________________ ...Amelanduil & FireBlade words will be remembered... ...Amelanduil & FireBlade acts will be remembered... ...Amelanduil & FireBlade never gonna die...
Pomógł: 1 raz Dołączył: 21 Gru 2009 Posty: 85 Skąd: Nie pamiętam
Wysłany: Pią 22 Sty, 2010 17:51
Coś mi nie działa mógłbyś zamieścić demo?
________________________ _________________
_________________
Jak kraść to milinony...
Jak ruchać to księżniczki...
_________________
_________________
_________________
Zapomniałem dodać, że trzeba aktywować przełącznik nr.1.
[ Dodano: Sob 23 Sty, 2010 17:40 ]
Jeszcze jedno. Avatar musi się tak samo nazywać jak postać, więc jak ustawi się zdarzenie ze zmianą imienia wywali błąd.
________________________ ...Amelanduil & FireBlade words will be remembered... ...Amelanduil & FireBlade acts will be remembered... ...Amelanduil & FireBlade never gonna die...
Chodzi o to że żeby Hud się włączył/wyłączył trzeba włączyć przełącznik 0001 na ON
a z tym awatarem to musi się nazywać dokładnie tak samo jak char postaci
np 001fighter -01
PS: mam tego samego Huda w moim projekcie (coming soon)
Nie jestem pewien z tym co napisałeś pw115. W tym Hudzie avatar musi się nazywać jak postać. W bazie danych robimy nową postać, którą przechodzimy grę i nazywamy ją np. Mietek. Wchodzimy do folderu z grą, wchodzimy do Graphics/Characters i tworzymy tu nowy folder Avatars. W tym folderze ma znajdować się avatar naszej postaci o nazwie Mietek. Jak będzie inaczej wywali błąd.Vaizard, a czy ty nie pracujesz z Vx'em? Bo to jest do Xp'eka.
Pzdr
________________________ ...Amelanduil & FireBlade words will be remembered... ...Amelanduil & FireBlade acts will be remembered... ...Amelanduil & FireBlade never gonna die...
czeliosss, wiem, że pod XP :P nie mam już Vx i staram sie w XP coś zrobić bo tam ładniej wygląda ale dalej nie kumam z tym przełącznikiem dlatego ten hud sobie daruje ;p
Dobra jak nie wiesz to tobie wytłumaczę. Jak chcesz, żeby...
1. Hud był od początku to na początkowej mapie zrób zdarzenie na Auto start i włącz przełącznik nr. 1. Druga karta ma być aktywna, gdy jest włączony przełącznik.
2.było uruchamiane przyciskiem to zdarzenie na Auto start i włącz byle jaki przełącznik oprócz nr. 1. Druga strona jest znana. W typowych zdarzeniach robisz na równoległe i przełącznik, który wcześniej włączyłeś. Tam robisz warunek [Przełącznik nr. 1 jest ON]. Jak nie jest włączony to dajesz włącz przełącznik nr. 1. A jak jest włączony to wyłącz przełącznik. Mam nadzieję, że zrozumiałeś i zadziała.
________________________ ...Amelanduil & FireBlade words will be remembered... ...Amelanduil & FireBlade acts will be remembered... ...Amelanduil & FireBlade never gonna die...
Ściągnij go (TUTAJ )i powiedz czy Tobie działa...
A tu skrypt:
Spoiler:
Cytat:
#==============================================================================
# Pretty and Simple HUD v.1.2 by DarkCloud [02.06.08r]
#
# ~~>Historia
# ~>Wersja 1.2
# -Możliwość zmiany przezroczystości HUD'a
# -Animacja wejściowa HUD'a
# -Poprawiony kod skryptu, przepisany praktycznie na nowo
# -Bardziej intuicyjna konfiguracja skryptu
# ~>Wersja 1.1
# -Zmienione grafiki barów
# -Dodany Exp bar
# -Informacja o obecnym lvl'u
# -Pozycjonowanie HUD'a
# *215:"@hudx = left/right" - Tu wybieramy pozycję poziomą HUD'a, lewy/prawy
# *219:"@hudy = up/down" - Tu wybieramy pozycję pionową HUD'a, góra/dół
#
#==============================================================================
#==============================================================================
# * Config
#==============================================================================
# Tych rzeczy lepiej nie zmieniajcie =D
LEFT = 0
RIGHT = 452
UP = 0
DOWN = 367
# Pozycja HUD'a w osi X (LEFT - Lewy róg, RIGHT - Prawy róg)
HUDX_POSITION = LEFT
# Pozycja HUD'a w osi Y (UP - Górny róg, DOWN - Dolny róg)
HUDY_POSITION = UP
# Animacja wejściowa HUD'a (true - włączona, false - wyłączona)
ENTER_ANIMATION = true
# Przezroczystość HUD'a (Od 0 do 255)
OPACITY = 200
#==============================================================================
# END of Config
#==============================================================================
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
#=====================================
# Actor Name
#=====================================
def draw_actor_name2(actor, x, y)
self.contents.font.name = "Calligula"
self.contents.font.color = Color.new(255, 255, 255, OPACITY)
self.contents.font.size = 14
self.contents.draw_text(x, y, 120, 32, actor.name)
end
#=====================================
# Actor level
#=====================================
def draw_actor_lv(actor, x, y)
self.contents.font.name = "Calligula"
self.contents.font.color = Color.new(0, 180, 0, OPACITY)
self.contents.font.size = 12
self.contents.draw_text(x, y, 32, 32, "Lv")
self.contents.font.name = "Arial"
self.contents.font.color = Color.new(200, 200, 0, OPACITY)
self.contents.font.size = 15
self.contents.font.bold = true
self.contents.draw_text(x + 10, y - 1, 24, 32, actor.level.to_s, 2)
self.contents.font.bold = false
end
#=====================================
# Actor HP bar
#=====================================
def draw_actor_hp_bar(actor, x, y)
@actor = $game_party.actors[0]
whp = 50 * @actor.hp / @actor.maxhp
self.contents.font.name = "Calligula"
self.contents.font.color = Color.new(0, 180, 0, OPACITY)
self.contents.font.size = 12
self.contents.draw_text(x - 20, y - 12, 32, 32, $data_system.words.hp)
self.contents.fill_rect(x, y, 50, 8, Color.new(230, 230, 230, OPACITY - 50))
self.contents.fill_rect(x, y + 1, whp, 1, Color.new(255, 0, 0, OPACITY))
self.contents.fill_rect(x, y + 2, whp, 1, Color.new(235, 0, 0, OPACITY))
self.contents.fill_rect(x, y + 3, whp, 1, Color.new(215, 0, 0, OPACITY))
self.contents.fill_rect(x, y + 4, whp, 1, Color.new(195, 0, 0, OPACITY))
self.contents.fill_rect(x, y + 5, whp, 1, Color.new(175, 0, 0, OPACITY))
self.contents.fill_rect(x, y + 6, whp, 1, Color.new(155, 0, 0, OPACITY))
bitmap = RPG::Cache.picture("HP_SP_bar")
hbw = bitmap.width
hbh = bitmap.height
self.contents.blt(x, y, bitmap, Rect.new(0, 0, hbw, hbh), OPACITY)
end
#=====================================
# Actor SP bar
#=====================================
def draw_actor_sp_bar(actor, x, y)
@actor = $game_party.actors[0]
wsp = 50 * @actor.sp / @actor.maxsp
self.contents.font.name = "Calligula"
self.contents.font.color = Color.new(0, 180, 0, OPACITY)
self.contents.font.size = 12
self.contents.draw_text(x - 18, y - 12, 32, 32, $data_system.words.sp)
self.contents.fill_rect(x, y, 50, 8, Color.new(230, 230, 230, OPACITY - 50))
self.contents.fill_rect(x, y + 1, wsp, 1, Color.new(0, 0, 255, OPACITY))
self.contents.fill_rect(x, y + 2, wsp, 1, Color.new(0, 0, 235, OPACITY))
self.contents.fill_rect(x, y + 3, wsp, 1, Color.new(0, 0, 215, OPACITY))
self.contents.fill_rect(x, y + 4, wsp, 1, Color.new(0, 0, 195, OPACITY))
self.contents.fill_rect(x, y + 5, wsp, 1, Color.new(0, 0, 175, OPACITY))
self.contents.fill_rect(x, y + 6, wsp, 1, Color.new(0, 0, 155, OPACITY))
bitmap = RPG::Cache.picture("HP_SP_bar")
sbw = bitmap.width
sbh = bitmap.height
self.contents.blt(x, y, bitmap, Rect.new(0, 0, sbw, sbh), OPACITY)
end
#=====================================
# Actor Exp bar
#=====================================
def draw_actor_exp_bar(actor, x, y)
@actor = $game_party.actors[0]
exp1 = actor.now_exp
exp2 = actor.next_exp
if actor.next_exp == 0
exp1 = 1
exp2 = 1
end
wexp = 150 * exp1 / exp2
self.contents.fill_rect(x, y, 150, 6, Color.new(230, 230, 230, OPACITY - 50))
self.contents.fill_rect(x, y + 1, wexp, 1, Color.new(255, 128, 0, OPACITY))
self.contents.fill_rect(x, y + 2, wexp, 1, Color.new(235, 118, 0, OPACITY))
self.contents.fill_rect(x, y + 3, wexp, 1, Color.new(215, 108, 0, OPACITY))
self.contents.fill_rect(x, y + 4, wexp, 1, Color.new(195, 98, 0, OPACITY))
bitmap = RPG::Cache.picture("Exp_bar")
ebw = bitmap.width
ebh = bitmap.height
self.contents.blt(x, y, bitmap, Rect.new(0, 0, ebw, ebh), OPACITY)
end
end
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Get the current EXP
#--------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end
#--------------------------------------------------------------------------
# * Get the next level's EXP
#--------------------------------------------------------------------------
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make sprite set
@spriteset = Spriteset_Map.new
# Make message window
@message_window = Window_Message.new
# Make HUD window
@hud = Scene_HUD.new
# Transition run
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of sprite set
@spriteset.dispose
# Dispose of message window
@message_window.dispose
# Dispose of HUD window
@hud.dispose
# If switching to title screen
if $scene.is_a?(Scene_Title)
# Fade out screen
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Loop
loop do
# Update map, interpreter, and player order
# (this update order is important for when conditions are fulfilled
# to run any event, and the player isn't provided the opportunity to
# move in an instant)
$game_map.update
$game_system.map_interpreter.update
$game_player.update
# Update system (timer), screen
$game_system.update
$game_screen.update
# Abort loop if player isn't place moving
unless $game_temp.player_transferring
break
end
# Run place move
transfer_player
# Abort loop if transition processing
if $game_temp.transition_processing
break
end
end
# Update sprite set
@spriteset.update
# Update message window
@message_window.update
@hud.update
# If game over
if $game_temp.gameover
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If returning to title screen
if $game_temp.to_title
# Change to title screen
$scene = Scene_Title.new
return
end
# If transition processing
if $game_temp.transition_processing
# Clear transition processing flag
$game_temp.transition_processing = false
# Execute transition
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# If showing message window
if $game_temp.message_window_showing
return
end
# If encounter list isn't empty, and encounter count is 0
if $game_player.encounter_count == 0 and $game_map.encounter_list != []
# If event is running or encounter is not forbidden
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
# Confirm troop
n = rand($game_map.encounter_list.size)
troop_id = $game_map.encounter_list[n]
# If troop is valid
if $data_troops[troop_id] != nil
# Set battle calling flag
$game_temp.battle_calling = true
$game_temp.battle_troop_id = troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
end
end
end
# If B button was pressed
if Input.trigger?(Input::B)
# If event is running, or menu is not forbidden
unless $game_system.map_interpreter.running? or
$game_system.menu_disabled
# Set menu calling flag or beep flag
$game_temp.menu_calling = true
$game_temp.menu_beep = true
end
end
# If debug mode is ON and F9 key was pressed
if $DEBUG and Input.press?(Input::F9)
# Set debug calling flag
$game_temp.debug_calling = true
end
# If player is not moving
unless $game_player.moving?
# Run calling of each screen
if $game_temp.battle_calling
call_battle
elsif $game_temp.shop_calling
call_shop
elsif $game_temp.name_calling
call_name
elsif $game_temp.menu_calling
call_menu
elsif $game_temp.save_calling
call_save
elsif $game_temp.debug_calling
call_debug
end
end
end
#--------------------------------------------------------------------------
# * Player Place Move
#--------------------------------------------------------------------------
def transfer_player
# Clear player place move call flag
$game_temp.player_transferring = false
# If move destination is different than current map
if $game_map.map_id != $game_temp.player_new_map_id
# Set up a new map
$game_map.setup($game_temp.player_new_map_id)
end
# Set up player position
$game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
# Set player direction
case $game_temp.player_new_direction
when 2 # down
$game_player.turn_down
when 4 # left
$game_player.turn_left
when 6 # right
$game_player.turn_right
when 8 # up
$game_player.turn_up
end
# Straighten player position
$game_player.straighten
# Update map (run parallel process event)
$game_map.update
# Remake sprite set
@spriteset.dispose
@spriteset = Spriteset_Map.new
# Remake hud window
@hud.dispose
@hud = Scene_HUD.new
# If processing transition
if $game_temp.transition_processing
# Clear transition processing flag
$game_temp.transition_processing = false
# Execute transition
Graphics.transition(20)
end
# Run automatic change for BGM and BGS set on the map
$game_map.autoplay
# Frame reset
Graphics.frame_reset
# Update input information
Input.update
end
end
Dałoby się ten level(15) przesunąć tak na środek w prawo?
Żeby było tak idealnie nad HP/SP i EXP? x/ nie znam się na tych liczbach, dlatego pytam tutaj.
Ostatnio zmieniony przez Nhadala Sro 03 Mar, 2010 17:21, w całości zmieniany 1 raz
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach Nie możesz załączać plików na tym forum Możesz ściągać załączniki na tym forum