- SpytjeAdministrateur
- Nombre de messages : 5935
Localisation : La terre
Distinction : Spiraliste [Korn']
Forestia : Projet du mois juillet 2014
Papy Pulkigrat [Yama']
Date d'inscription : 16/03/2008
Modification de script [résolu]
Mer 6 Juin 2012 - 22:53
Bonsoir,
Quelqu'un pourait il me modifier un script qui permet d'afficher une icone au dessus de la tête d'un event.
J'aimerais enlever la fonction de durée, donc que l'icone reste continuelement au dessus de l'event.
J'ai déjà tenté de le modifier mais impossible de supprimer "duration"...
Voici le script :
Merci d'avance.
EDIT:
J'ai trouvé un autre script qui fonctionne comme il faut je le partage ci-dessous.
Quelqu'un pourait il me modifier un script qui permet d'afficher une icone au dessus de la tête d'un event.
J'aimerais enlever la fonction de durée, donc que l'icone reste continuelement au dessus de l'event.
J'ai déjà tenté de le modifier mais impossible de supprimer "duration"...
Voici le script :
Merci d'avance.
- Code:
#==============================================================================
# ★ RGSS3_アイコンポップ Ver1.2
#==============================================================================
=begin
作者:tomoaky
webサイト:ひきも記 (http://hikimoki.sakura.ne.jp/)
イベントの頭上に任意のアイコンを表示することができます。
イベントコマンド『スクリプト』で以下を実行してください
pop_icon(event_id, icon_id, duration)
event_id 番のイベントの頭上に icon_id 番のアイコンが表示されます。
event_id に 0 を指定すると実行中のイベント自身が対象となり、
-1 を指定すればプレイヤーが対象となります。
duration は省略することが可能です、その場合は 120 となります。
例)pop_icon(-1, 17, 300)
プレイヤーに戦闘不能アイコンを5秒間(300フレーム)表示します
アイコン表示中に pop_icon コマンドを実行しても効果はありません。
すぐに次のアイコンを表示したい場合は、delete_icon コマンドで
アイコンを削除してから pop_icon コマンドを実行してください。
例)delete_icon(-1)
プレイヤーに表示中のアイコンを削除する
おまけとしてイベントコマンド『アイテムの増減』『武器の増減』『防具の増減』が
実行されたとき、自動でアイコンを表示する機能が付いています。
アイコンを表示する対象はゲーム変数(初期設定では6番)で変更が可能です、
値は pop_icon コマンドにおける event_id と同様ですが、-2 以下を指定することで
機能をオフにすることができます。
使用するゲーム変数(初期設定)
0006
2012.01.19 Ver1.2
・表示中のアイコンポップを削除する delete_icon コマンドを追加
・自律移動【カスタム】のスクリプトコマンドで
アイコンポップ機能が動作しない不具合を修正
2011.12.21 Ver1.11
・並列処理で event_id に 0 を指定するとアイコンが表示されない不具合を修正
2011.12.17 Ver1.1
・コマンドに表示時間を指定する機能を追加しました
2011.12.15 Ver1.0
公開
=end
#==============================================================================
# □ 設定項目
#==============================================================================
module TMICPOP
GRAVITY = 24 # アイコンにかかる重力
SPEED = -320 # アイコンの初速(Y方向)
VN_TARGET = 6 # 自動ポップ対象設定として扱うゲーム変数番号
end
#==============================================================================
# □ コマンド
#==============================================================================
module TMICPOP
module Commands
#--------------------------------------------------------------------------
# ○ アイコンポップの開始
#--------------------------------------------------------------------------
def pop_icon(event_id, icon_id, duration = 120)
target = get_character(event_id)
return unless target
target.icpop_id = icon_id
target.icpop_duration = duration
end
#--------------------------------------------------------------------------
# ○ アイコンポップの削除
#--------------------------------------------------------------------------
def delete_icon(event_id)
target = get_character(event_id)
return unless target
target.icpop_delete_flag = true
end
end
end # module TMICPOP
#==============================================================================
# ■ Game_CharacterBase
#==============================================================================
class Game_CharacterBase
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :icpop_id # アイコンポップ ID
attr_accessor :icpop_duration # アイコンポップ 表示時間
attr_accessor :icpop_delete_flag # アイコンポップ 削除フラグ
#--------------------------------------------------------------------------
# ● 公開メンバ変数の初期化
#--------------------------------------------------------------------------
alias tmicpop_game_characterbase_init_public_members init_public_members
def init_public_members
tmicpop_game_characterbase_init_public_members
@icpop_id = 0
@icpop_duration = 0
@icpop_delete_flag = false
end
end
#==============================================================================
# ■ Sprite_Character
#==============================================================================
class Sprite_Character
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# character : Game_Character
#--------------------------------------------------------------------------
alias tmicpop_sprite_character_initialize initialize
def initialize(viewport, character = nil)
@icpop_duration = 0
tmicpop_sprite_character_initialize(viewport, character)
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
alias tmicpop_sprite_character_dispose dispose
def dispose
dispose_icpop
tmicpop_sprite_character_dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias tmicpop_sprite_character_update update
def update
update_icpop
tmicpop_sprite_character_update
end
#--------------------------------------------------------------------------
# ● 新しいエフェクトの設定
#--------------------------------------------------------------------------
alias tmicpop_sprite_character_setup_new_effect setup_new_effect
def setup_new_effect
tmicpop_sprite_character_setup_new_effect
if !@icpop_sprite && @character.icpop_id > 0
@icpop_id = @character.icpop_id
@character.icpop_id = 0
start_icpop
end
end
#--------------------------------------------------------------------------
# ○ アイコンポップ表示の開始
#--------------------------------------------------------------------------
def start_icpop
dispose_icpop
@icpop_duration = @icpop_duration_max = @character.icpop_duration
@icpop_sprite = ::Sprite.new(viewport)
@icpop_sprite.bitmap = Cache.system("IconSet")
@icpop_sprite.src_rect.set(@icpop_id % 16 * 24, @icpop_id / 16 * 24, 24, 24)
@icpop_sprite.ox = 12
@icpop_sprite.oy = 24
@icpop_y_plus = 0
@icpop_y_speed = TMICPOP::SPEED
update_icpop
end
#--------------------------------------------------------------------------
# ○ アイコンポップの解放
#--------------------------------------------------------------------------
def dispose_icpop
@character.icpop_delete_flag = false
if @icpop_sprite
@icpop_sprite.dispose
@icpop_sprite = nil
end
end
#--------------------------------------------------------------------------
# ○ アイコンポップの更新
#--------------------------------------------------------------------------
def update_icpop
if @icpop_duration > 0
@icpop_duration -= 1
if @character.icpop_delete_flag
@icpop_duration = 0
dispose_icpop
elsif @icpop_duration > 0
@icpop_sprite.x = x
@icpop_y_plus += @icpop_y_speed
@icpop_y_speed += TMICPOP::GRAVITY
if @icpop_y_plus > 0
@icpop_y_plus = 0 - @icpop_y_plus
@icpop_y_speed = 0 - @icpop_y_speed / 2
end
@icpop_sprite.y = y - height + (@icpop_y_plus / 256)
@icpop_sprite.z = z + 200
@icpop_sprite.opacity = (@icpop_duration < 16 ? @icpop_duration * 16 :
(@icpop_duration_max - @icpop_duration) * 32)
else
dispose_icpop
@character.icpop_id = 0
end
end
end
end
#==============================================================================
# ■ Game_Event
#==============================================================================
class Game_Event
include TMICPOP::Commands
#--------------------------------------------------------------------------
# ○ キャラクターの取得
# param : -1 ならプレイヤー、0 ならこのイベント、それ以外はイベント ID
#--------------------------------------------------------------------------
def get_character(param)
if param < 0
$game_player
else
$game_map.events[param > 0 ? param : @id]
end
end
end
#==============================================================================
# ■ Game_Interpreter
#==============================================================================
class Game_Interpreter
include TMICPOP::Commands
#--------------------------------------------------------------------------
# ● アイテムの増減
#--------------------------------------------------------------------------
alias tmicpop_game_interpreter_command_126 command_126
def command_126
tmicpop_game_interpreter_command_126
value = operate_value(@params[1], @params[2], @params[3])
if value > 0
if $game_variables[TMICPOP::VN_TARGET] >= -1 && !$game_party.in_battle
item = $data_items[@params[0]]
pop_icon($game_variables[TMICPOP::VN_TARGET], item.icon_index)
end
end
end
#--------------------------------------------------------------------------
# ● 武器の増減
#--------------------------------------------------------------------------
alias tmicpop_game_interpreter_command_127 command_127
def command_127
tmicpop_game_interpreter_command_127
value = operate_value(@params[1], @params[2], @params[3])
if value > 0
if $game_variables[TMICPOP::VN_TARGET] >= -1 && !$game_party.in_battle
item = $data_weapons[@params[0]]
pop_icon($game_variables[TMICPOP::VN_TARGET], item.icon_index)
end
end
end
#--------------------------------------------------------------------------
# ● 防具の増減
#--------------------------------------------------------------------------
alias tmicpop_game_interpreter_command_128 command_128
def command_128
tmicpop_game_interpreter_command_128
value = operate_value(@params[1], @params[2], @params[3])
if value > 0
if $game_variables[TMICPOP::VN_TARGET] >= -1 && !$game_party.in_battle
item = $data_armors[@params[0]]
pop_icon($game_variables[TMICPOP::VN_TARGET], item.icon_index)
end
end
end
end
EDIT:
J'ai trouvé un autre script qui fonctionne comme il faut je le partage ci-dessous.
- Code:
#==============================================================================
# ** Event Icon Display
#------------------------------------------------------------------------------
# MephistoX
# Based on the Work of SephirothSpawn
#==============================================================================
#To use it:
#If you want an icon show on an event: $game_map.events[event_id].event_icon = id of the icon in the sheet
#If you want an icon show on a player : $game_player.event_icon = id of the icon.
#Really simple, to delete just use nil instead of icon id.
#==============================================================================
# ** Game_CharacterBase
#==============================================================================
class Game_CharacterBase
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :event_icon
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias_method :meph_eid_gchbase_inpbmems, :init_public_members
#--------------------------------------------------------------------------
# * Public Objects Initialization
#--------------------------------------------------------------------------
def init_public_members
# Original Method
meph_eid_gchbase_inpbmems
# Set Event Icon
@event_icon = nil
end
end
#==============================================================================
# ** Sprite_Character
#==============================================================================
class Sprite_Character < Sprite_Base
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias_method :meph_eid_sprchar_update, :update
alias_method :meph_eid_sprchar_dispose, :dispose
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Original Method
meph_eid_sprchar_update
# Update Event Icon
update_event_icon
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
# Dispose Event Icon
dispose_event_icon
# Original Method
meph_eid_sprchar_dispose
end
#--------------------------------------------------------------------------
# * Dispose Event Icon
#--------------------------------------------------------------------------
def dispose_event_icon
# Unless sprite is nil?
unless @event_icon_sprite.nil?
# Dispose Event Icon Sprite
@event_icon_sprite.dispose
# Set to nil
@event_icon_sprite = nil
end
end
#--------------------------------------------------------------------------
# * Update Event Icon
#--------------------------------------------------------------------------
def update_event_icon
# Dispose Icon if Character icon (var) is nil
return dispose_event_icon if @character.event_icon.nil?
# Create Event icon if Sprite is nil
return create_event_icon if @event_icon_sprite.nil?
# If Settings changed
if @event_icon != @character.event_icon
# Dispose and create the sprite
dispose_event_icon
create_event_icon
end
# Set x & y coordinates
@event_icon_sprite.x = x + 4
@event_icon_sprite.y = y - oy / 2 - 12
end
#--------------------------------------------------------------------------
# * Create Event Icon
#--------------------------------------------------------------------------
def create_event_icon
# Create a new Sprite
@event_icon_sprite = ::Sprite.new(viewport)
# Set Bitmap as icon set
@event_icon_sprite.bitmap = Cache.system('IconSet')
# Determine x rect for bitmap
box = (@character.event_icon % 16 * 24)
# Determine y rect for bitmap
boy = (@character.event_icon / 16 * 24)
# Set rect for sprite
@event_icon_sprite.src_rect.set(box, boy, 24, 24)
# Set origin for the sprite
@event_icon_sprite.ox, @event_icon_sprite.oy = 16, 42
# Determine coordinates
@event_icon_sprite.x = x + 4
@event_icon_sprite.y = y - oy / 12 - 12
# Determine Z coordinate (deepness)
@event_icon_sprite.z = z
# Change Setting
@event_icon = @character.event_icon
end
end
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum
|
|