А разве нету простой переменной типа $coordinate_X (event_ID)?
Вид для печати
А разве нету простой переменной типа $coordinate_X (event_ID)?
Ну это скорее вопрос к знатокам)). Но скорее всего то что ты спрашиваешь это @events[event_id].x
т.е. у нас в @events храниться массив обьектов(евентов).
UPD:$game_map.events[event_id].x
Вот про то где я капался по поводу чара:
Это про мерцающие видео :PHP код:
# ** Sprite_Character
#------------------------------------------------------------------------------
# This sprite is used to display the character.It observes the Game_Character
# class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Character < RPG::Sprite
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :character # character
#--------------------------------------------------------------------------
# * Object Initialization
# viewport : viewport
# character : character (Game_Character)
#--------------------------------------------------------------------------
def initialize(viewport, character = nil)
super(viewport)
@character = character
update
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# If tile ID, file name, or hue are different from current ones
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_hue != @character.character_hue
# Remember tile ID, file name, and hue
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
# If tile ID value is valid
if @tile_id >= 384
self.bitmap = RPG::Cache.tile($game_map.tileset_name,
@tile_id, @character.character_hue)
self.src_rect.set(0, 0, 32, 32)
self.ox = 16
self.oy = 32
# If tile ID value is invalid
else
self.bitmap = RPG::Cache.character(@character.character_name,
@character.character_hue)
@cw = bitmap.width / 8
@ch = bitmap.height / 8
self.ox = @cw / 2
self.oy = @ch
end
end
# Set visible situation
self.visible = (not @character.transparent)
# If graphic is character
if @tile_id == 0
# Set rectangular transfer
sx = @character.pattern * @cw
sy = (@character.direction - 2) / 2 * @ch
self.src_rect.set(sx, sy / 2, @cw, @ch)
end
# Set sprite coordinates
self.x = @character.screen_x
self.y = @character.screen_y
self.z = @character.screen_z(@ch)
# Set opacity level, blend method, and bush depth
self.opacity = @character.opacity
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
# Animation
if @character.animation_id != 0
animation = $data_animations[@character.animation_id]
animation(animation, true)
@character.animation_id = 0
end
end
end
Ивините за то что не убрал коментарии из кода для удобства обработки.PHP код:
# ** The AVI Player
#------------------------------------------------------------------------------
# by DerVVulfman
# version 1.3
# 02-28-2010
# Full SDK 2.2 Compatible (Does not need or require SDK 2.2)
#------------------------------------------------------------------------------
#
# INTRODUCTION:
#
# Let me for once be quick. ^_^
#
# This system can play .avi files with little to no flicker on playback for
# both RPGMaker XP and RPGMaker VX projects. And as far as playback in both
# fullscreen and window modes? No problem. This system works in both modes.
# The system will not, nor does not need, to change the window to fullscreen
# in order to play any .avi file.
#
# Oh, and since it's written as a lone 'module' and not as a class, it is
# VERY easy to use.
#
#
#-------------------------------------------------------------------------------
#
# EVENT & SCRIPT CALLS:
# A series of calls used (using the call script command) or in your scripts:
# Video.load * Video.play
# Video.start * Video.duration * Video.audio * Video.window
# Video.reset
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#
# * Video.load(filename)
# The Video.load command is non-optional. With it, you may load
# the file stored in your 'Video' folder. The .avi extension is
# optional for .avi files, so you may load "demo.avi" or "demo".
#
# * Video.play(reset)
# The Video.play command is non-optional. With it, you will run
# the video file established by the Video.load command. If the
# optional 'reset' value is set to true, the video playback will
# reset itself to a default 'fit in window' setting.
#
# * Video.start(time in frames)
# (OPTIONAL CALL)
# The Video.start command can control where you wish to begin
# playback of the video file established by the Video.load comm-
# and. By default, a video starts playback at the beginning of
# the file, but this can allow playback to start near the middle
# of a file if you wish. By caling Video.start without setting
# any start position, you can reset the start of the playback
# feature back to it's default 'at the beginning' setting.
#
# * Video.duration(time in frames)
# The Video.duration command can set for you where you wish the
# video file to stop playing. This is a useful feature for game
# designers if they want a video to end playback before the act-
# ual video itself ends. By calling Video.duration without set-
# ting any duration, you reset the system to play the full dura-
# tion of the video file.
#
# * Video.audio(volume)
# (OPTIONAL CALL)
# The Video.audio command can adjust the volume of the movie's
# playback. However, take care. Altering the volume here will
# also change the volume of other audio playback in the system.
# Valid values are from 0 to 1000, with 100 as the default. The
# volume value is optional and defaulted to 100.
#
# * Video.window(true)
# Video.window(left, top, width, height)
# (OPTIONAL CALL)
# The Video.window command determines if you choose to fill the
# entire gaming window with the video or choose to display the
# video within a defined window on the screen. Merely set the
# parameters to 'true' if you want the video stretched to fill
# the gaming window. Likewise, the default values mimic the di-
# mensions of the gaming window.
#
# * Video.reset
# (OPTIONAL CALL)
# The Video.reset command restores values back to their default
# states. Anything changed with the start, duration, audio and
# window commands will be returned to their original startup
# values. A useful call to be sure.
#
#
#-------------------------------------------------------------------------------
#
# VIDEO CONSIDERATIONS:
#
# First off, please create a new folder called Video in your project's root
# directory. It is here that your .avi files should be stored.
#
# To ensure good playback quality, it the following .avi encoding specifica-
# tions are recommended: Xvid + MP3 CBR (it is very important to keep a con-
# stant bit rate for the audio, else it won't play it)
#
# And finally, video resolution can be up to either 640x480 for RPGMaker XP
# or 544×416 for RPGMaker VX.
#
#
#-------------------------------------------------------------------------------
#
# AUDIO CONSIDERATIONS:
#
# As stated when discussing the Video.audio option, any and all changes to
# the volume of a movie will affect the playback of any other audio in the
# game. As such, setting a movie to play at 50 (or 50% volume) will also
# change the audio of all other effects in your game until you play another
# video with an increased audio setting.
#
#
#------------------------------------------------------------------------------
#
# RECOMMENDED/REQUIRED:
#
# If using this script on an RPGMaker XP project, the use of Zeriab's No Hang
# script is recommended, or like systems that prevents scripts from hanging.
#
#
#------------------------------------------------------------------------------
#
# CREDITS AND THANKS:
#
# Soundspawn for creating the first AVI Player of course. And for a little
# bit of sarcasm... Enterbrain for LEAVING THE SUCKER OUT. Aw, come on...
# The previous versions of the RPGMaker series had them!!!
#
#
#------------------------------------------------------------------------------
#
# TERMS AND CONDITIONS:
#
# Ya wanna use it? Go ahead. Just give both me and Soundspawn due credit.
# Use anyone else's script to prevent hanging... give 'em credit too, okay?
#
#
#===============================================================================
#==============================================================================
# ** Video
#------------------------------------------------------------------------------
# This module controls .avi video playback functions.
#==============================================================================
module Video
# = = = = = = = = C O N F I G U R A B L E S = = = = = = =
# Depending on XP or VX system (544x416 with RPGMaker VX)
V_MAXWIDTH = 640 # (or 544 if for RMVX)
V_MAXHEIGHT = 480 # (or 416 if for RMVX)
# The Video Escape Button
VIDEO_ESCAPE = Input::B
#=============================================================================
# * Set Video
# video : filename of video
#=============================================================================
def self.load(video)
# Reset invalid flag
@invalid = nil
# Determine that directory exists, set invalid flag to true
begin; Dir.open("./Video"); rescue Errno::ENOENT; @invalid = true; end
# Optional default extension of .avi
video = video + ".avi" if FileTest.exist?("./Video/#{video}.avi")
# Determine that video exists
@invalid = true unless FileTest.exist?("./Video/#{video}")
# Load only valid video
@movie = "./Video/#{video}" unless @invalid == true
end
#=============================================================================
# * Set Start
# start : start in frames to begin video playback (default = nil)
#=============================================================================
def self.start(start=nil)
@start = start
end
#=============================================================================
# * Set Duration
# duration : duration in frames to play the video (default = nil)
#=============================================================================
def self.duration(duration=nil)
@duration = duration
end
#=============================================================================
# * Set Audio
# volume : volume playback (1 to 1000, with 100 default)
#=============================================================================
def self.audio(volume=100)
@volume = volume
end
#=============================================================================
# * Set Window
# left : left position of video (or 'true' if fit in window)
# top : right position of video
# width : width of video window
# height : height of video window
#=============================================================================
def self.window(left=0, top=0, width=V_MAXWIDTH, height=V_MAXHEIGHT)
# If fit in game window
if left == true
@left = 0 ; @top = 0 ; @width = V_MAXWIDTH ; @height = V_MAXHEIGHT
# Or use user-defined settings
else
@left = left ; @top = top ; @width = width ; @height = height
end
end
#=============================================================================
# * Reset All
#=============================================================================
def self.reset
start
duration
audio
window
end
#=============================================================================
# * Play Video
#=============================================================================
def self.play(reset_after_play = false)
# Exit if no valid video
return if @invalid == true
# Windows API Handles
readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l'
wnd = Win32API.new('user32','FindWindowEx','%w(l,l,p,p)','L')
@mplayer = Win32API.new('winmm','mciSendString','%w(p,p,l,l)','V')
# Detect Parameters of Current Game Window
@detector = Win32API.new('user32','GetSystemMetrics','%w(l)','L')
# Load Video File & Attach to Game Window
@mplayer.call("open #{@movie} alias FILM style child parent " +
handle.to_s, 0, 0, 0)
# Prepare the Video
self.prepare(reset_after_play)
# Play Video
info = " " * 255
info2 = " " * 255
info3 = " " * 255
play_message = "play FILM window"
play_message += " from " + @start.to_s if @start != nil
@mplayer.call(play_message, 0, 0, 0)
loop do
sleep(1.0 / 24)
Input.update
@mplayer.call("status FILM mode", info, 255, 0)
@mplayer.call("status FILM position", info2, 255, 0)
state = info.unpack("a*")[0].gsub!("\000","").gsub!(" ","")
if @duration != nil
break if info2.to_i >= @duration
end
# Exit on end or Key control
unless VIDEO_ESCAPE == nil
break if Input.repeat?(VIDEO_ESCAPE) or state.to_s == "stopped"
else
break if state.to_s == "stopped"
end
end
# Reset Audio and Close Video
@mplayer.call("close FILM", 0, 0, 0)
Input.update
end
#--------------------------------------------------------------------------
# * Game Window Handle
#--------------------------------------------------------------------------
def self.handle
game_name = "\0" * 256
readini=Win32API.new('kernel32', 'GetPrivateProfileStringA', 'pppplp', 'l')
readini.call('Game', 'Title', '', game_name, 255, ".\\Game.ini")
return Win32API.new('user32', 'FindWindowEx', 'llpp', 'l').call(0, 0, nil,
game_name.delete!("\0"))
end
#=============================================================================
# * Video Prepare
#=============================================================================
def self.prepare(reset)
# Set defaults
l = 0 ; t = 0; w = V_MAXWIDTH ; h = V_MAXHEIGHT ; v = 100 ; s = nil ; d = nil
# Load options if available
l = @left if @left != nil ; t = @top if @top != nil
w = @width if @width != nil ; h = @height if @height != nil
v = @volume if @volume != nil ; d = @duration if @duration != nil
s = @start if @start != nil
# Prepare
@mplayer.call("put FILM window at #{l} #{t} #{w} #{h}", 0, 0, 0)
@mplayer.call("setaudio FILM volume to #{v}", @status, 0, 0)
# If the called values reset after the movie plays
@left, @top, @width, @height, @volume, @start, @duration = nil, nil, nil, nil, nil, nil, nil if reset
end
end
-----------------------------------------------------------------------------------
А это версия где автор уверяет, чтонет мерцания ток она на ВХ вроде и с ошибкой (смаил вместо куска кода).
------------------------------------------------------------------------------------------------------PHP код:
# By trebor777
# Date: 26/10/2008
# Version 1.5 - Updated 27/10/2008
#-------------------------------------------------------------------------------
# RMVX Avi Player
#
# Instructions:
# Video Specification ( to ensure good playability )
# Recommended encoding: Xvid + MP3 CBR (very important to keep a constant
# bit rate for the audio, else it won't play it)
# Video Resolution : Up to 640*480
# Save the videos into a new folder called Movies in your project root folder.
#
# Call in an event(using the call script command) or in your script:
#
# Movie.play("myvideo",width,height)
# Movie.play("myvideo")
#
# By providing the dimensions of your video, if smaller than 640*480, the script
# will stretch it in the window(or in the screen if in fullscreen), to fit a
# width of 640px, but keeping the original aspect ratio.
#
# Don't need to provide the dimensions if the video is 640*480.
#===============================================================================
module Movie
attr_accessor :fps
def self.play(movie, width=Graphics.width, height=Graphics.height)
movie= "./Movies/#{movie}.avi"
fps = 24
readini= Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l'
wnd= Win32API.new('user32','FindWindowEx','%w(l,l,p,p)','L')
@mplayer= Win32API.new('winmm','mciSendString','%w(p,p,l,l)','V')
@detector = Win32API.new('user32','GetSystemMetrics','%w(l)','L')
timer= 1.0/fps
info= " " * 255
game_name= "\0" * 256
readini.call('Game','Title','',game_name,255,".\\Game.ini")
game_name.delete!("\0")
hwnd= wnd.call(0,0,nil,game_name).to_s
@mplayer.call("open #{movie} alias FILM style child parent #{hwnd}",0,0,0)
@mplayer.call("status FILM length",info,255,0)
movie_lenght = info.unpack("a*")[0].gsub!("\000","").to_i
info= " " * 255
@ratio = height.to_f/width
@width = 0
self.update_stretch
@mplayer.call("play FILM window",0,0,0)
loop do
sleep(timer)
Input.update
update_stretch
@mplayer.call("status FILM mode",info,255,0)
s= info.unpack("a*")[0].gsub!("\000","")
break if Input.repeat?(Input::cool.gif or s.to_s == "stopped"
end
@mplayer.call("close FILM",0,0,0)
Input.update
end
def self.update_stretch
n_w = @detector.call(0)
if @width != n_w
@width = n_w
w = (n_w == 640)? 640 : Graphics.width
h = (n_w == 640)? 480 : Graphics.height
new_height = (w*@ratio).round
@mplayer.call("put FILM window at 0 #{(h-new_height)/2} #{w} #{new_height}",0,0,0)
end
end
end
Ну и в заключении боявая ситема: XAS 3.91
http://="http://rpgmaker.su/showthre...S-Hero-Edition
Это мои догадки, но вроде спрайты героя и врагов все в XAS работает отсюда.
PHP код:
# ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
#===============================================================================
# CT METER / SCENE TARGET / SPRITE SYSTEM / ANTI LAG
#===============================================================================
# ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
#==============================================================================
# ■ Action_Meter_Sprite (CT METER)
#==============================================================================
class Action_Meter_Sprite < Sprite
#--------------------------------------------------------------------------
# * initialize
#--------------------------------------------------------------------------
def initialize
super
@actor = $game_party.actors[0]
hud_size_x = XAS_HUD::CT_SIZE_X
hud_size_y = XAS_HUD::CT_SIZE_Y
@oc_range_x = hud_size_x + XAS_HUD::WINDOW_CT_X
@oc_range_y = hud_size_y + XAS_HUD::WINDOW_CT_Y
#Action Meter--------------------------------------
@meter_flow = 0
@meter_image = RPG::Cache.windowskin("CT_Meter")
@meter_bitmap = Bitmap.new(@meter_image.width,@meter_image.height)
@meter_range = @meter_image.width / 3
@meter_width = @meter_range * $game_system.action_meter / 100
@meter_height = @meter_image.height / 4
@meter_width_old = @meter_width
@meter_src_rect = Rect.new(@meter_range, 0, @meter_width, @meter_height)
@meter_bitmap.blt(0,0, @meter_image, @meter_src_rect)
@meter_sprite = Sprite.new
@meter_sprite.bitmap = @meter_bitmap
@meter_sprite.z = 5008
@meter_sprite.x = XAS_HUD::WINDOW_CT_X
@meter_sprite.y = XAS_HUD::WINDOW_CT_Y
meter_flow_update
#Number --------------------------------------
@number_image = RPG::Cache.windowskin("CT_Number")
@number_bitmap = Bitmap.new(@number_image.width, @number_image.height)
@number_sprite = Sprite.new
@number_sprite.bitmap = @number_bitmap
@number_sprite.z = 5009
@number_sprite.x = XAS_HUD::WINDOW_CT_X
@number_sprite.y = XAS_HUD::WINDOW_CT_Y
@number_cw = @number_image.width / 10
@number_ch = @number_image.height / 7
if $game_temp.cast_time > 0
number = $game_temp.cast_time / 10
number_y = @number_ch * 2
number_sup_y = @number_ch * 4
elsif $game_temp.xas_charge_time > 5
number = $game_temp.xas_charge_time.truncate
number_y = @number_ch * 2
number_sup_y = @number_ch * 3
else
number = $game_system.action_meter
if $game_system.action_meter <= XAS::DASH_ACTIVE_PERC
number_y = @number_ch * 1
else
number_y = @number_ch * 0
end
number_sup_y = @number_ch * 5
end
@number_text = number.abs.to_s.split(//)
for r in 0..@number_text.size - 1
@number_abs = @number_text[r].to_i
@number_src_rect = Rect.new(@number_cw * @number_abs, number_y, @number_cw, @number_ch)
@number_bitmap.blt(((@number_cw - 10) * r), 0, @number_image, @number_src_rect)
@number_src_rect = Rect.new(0, number_sup_y, @number_image.width, @number_ch)
@number_bitmap.blt(-55, -2, @number_image, @number_src_rect)
end
#HUD Visible----------------------------------------------------------------
visible_update
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
#@meter Dispose
@meter_image.dispose
@meter_sprite.bitmap.dispose
@meter_sprite.bitmap = nil
@meter_sprite.dispose
@meter_sprite = nil
@meter_bitmap.dispose
@meter_bitmap = nil
#Text Dispose
@number_image.dispose
@number_sprite.bitmap.dispose
@number_sprite.bitmap = nil
@number_sprite.dispose
@number_sprite = nil
@number_bitmap.dispose
@number_bitmap = nil
end
#--------------------------------------------------------------------------
# * update
#--------------------------------------------------------------------------
def update
meter_flow_update
number_update
visible_update
fade_update
end
#--------------------------------------------------------------------------
# * fade_update
#--------------------------------------------------------------------------
def fade_update
if XAS_HUD::FADE == true
x = ($game_player.real_x - $game_map.display_x) / 4
y = ($game_player.real_y - $game_map.display_y) / 4
if x < @oc_range_x and x > XAS_HUD::WINDOW_CT_X - 5 and
y > XAS_HUD::WINDOW_CT_Y - 10 and y < @oc_range_y and
@meter_sprite.opacity > 120
@meter_sprite.opacity -= 10
@number_sprite.opacity -= 10
elsif @meter_sprite.opacity < 255
@meter_sprite.opacity += 10
@number_sprite.opacity += 10
end
end
end
#--------------------------------------------------------------------------
# * visible_update
#--------------------------------------------------------------------------
def visible_update
if $game_switches[XAS_HUD::DISABLE_HUD_SWITCH] or
$game_switches[XAS::CT_DISABLE_SWITCH]
ct_visible = false
else
ct_visible = true
end
@meter_sprite.visible = ct_visible
@number_sprite.visible = ct_visible
end
#--------------------------------------------------------------------------
# * Number Update
#--------------------------------------------------------------------------
def number_update
@number_sprite.bitmap.clear
if $game_temp.cast_time > 0
number = $game_temp.cast_time / 10
number_y = @number_ch * 2
number_sup_y = @number_ch * 4
elsif $game_temp.xas_charge_time > 5
number = $game_temp.xas_charge_time.truncate
number_y = @number_ch * 2
number_sup_y = @number_ch * 3
elsif $game_temp.shield_active == true
number = $game_system.action_meter
number_y = @number_ch * 2
number_sup_y = @number_ch * 6
else
number = $game_system.action_meter
if $game_system.action_meter <= XAS::DASH_ACTIVE_PERC
number_y = @number_ch * 1
else
number_y = @number_ch * 0
end
number_sup_y = @number_ch * 5
end
@number_text = number.abs.to_s.split(//)
for r in 0..@number_text.size - 1
@number_abs = @number_text[r].to_i
@number_src_rect = Rect.new(@number_cw * @number_abs, number_y, @number_cw, @number_ch)
@number_bitmap.blt(((@number_cw - 10) * r), 0, @number_image, @number_src_rect)
@number_src_rect = Rect.new(0, number_sup_y, @number_image.width, @number_ch)
@number_bitmap.blt(-55, -2, @number_image, @number_src_rect)
end
end
#--------------------------------------------------------------------------
# * meter_flow_update
#--------------------------------------------------------------------------
def meter_flow_update
@meter_sprite.bitmap.clear
@meter_src_rect = Rect.new(0, @meter_height * 3, @meter_image.width / 3, @meter_height)
@meter_bitmap.blt(0,0, @meter_image, @meter_src_rect)
if $game_temp.cast_time > 0
meter_max = Database_Bullet::PLAYER_CAST_TIME[$game_temp.cast_skill_id] * 10
meter_now = $game_temp.cast_time
mc_y = @meter_height
elsif $game_temp.xas_charge_time > 5
meter_max = 100
meter_now = $game_temp.xas_charge_time
if $game_temp.xas_charge_time.truncate >= 100
mc_y = @meter_height
else
mc_y = @meter_height * 2
end
else
meter_max = 100
meter_now = $game_system.action_meter
if $game_system.action_meter <= XAS::DASH_ACTIVE_PERC
mc_y = @meter_height
else
mc_y = 0
end
end
@meter_width = @meter_range * meter_now / meter_max
@meter_src_rect = Rect.new(@meter_flow, mc_y, @meter_width, @meter_height)
@meter_bitmap.blt(0,0, @meter_image, @meter_src_rect)
@meter_flow += 5
if @meter_flow >= @meter_image.width - @meter_range
@meter_flow = 0
end
end
end
#-------------------------------------------------------------------------------
# ■ Scene_Map
#-------------------------------------------------------------------------------
class Scene_Map
alias ct_main main
def main
@ctmeter = Action_Meter_Sprite.new
ct_main
@ctmeter.dispose
end
alias ct_update update
def update
ct_update
@ctmeter.update
end
end
# ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
#===============================================================================
# SCENE TARGET
#===============================================================================
# ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
attr_accessor :xas_target_x
attr_accessor :xas_target_y
attr_accessor :xas_target_time
attr_accessor :xas_target_shoot_id
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias xas_target_initialize initialize
def initialize
xas_target_initialize
@xas_target_x = 0
@xas_target_y = 0
@xas_target_time = 0
@xas_target_shoot_id = 0
end
end
#==============================================================================
# ■ Game_Map
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# ● target_range
#--------------------------------------------------------------------------
def battler_in_range?(event)
event.target = false
sensor_range = -1
px = ($game_map.display_x / 128).truncate
py = ($game_map.display_y / 128).truncate
distance_x = (px - (event.x - 10)).abs
distance_y = (py - (event.y - 7)).abs
return true if distance_x >= sensor_range + 11
return true if distance_y >= sensor_range + 9
event.target = true
return false
end
#--------------------------------------------------------------------------
# ● check_battler_on_map
#--------------------------------------------------------------------------
def check_battler_on_map
for i in $game_map.events.values
battler_in_range?(i)
end
end
end
#==============================================================================
# ■ Scene Target Select
#==============================================================================
class Scene_Target_Select
#--------------------------------------------------------------------------
# ● Main
#--------------------------------------------------------------------------
def main
$game_temp.xas_target_x = 0
$game_temp.xas_target_y = 0
$game_temp.xas_target_time = 0
@new_x = $game_player.screen_x
@new_y = $game_player.screen_y
@index_max = -1
@target_index = 0
@spriteset = Spriteset_Map.new
@text_string = ""
@fy = 0
@fy_time = 0
for event in $game_map.events.values
if event.target and event.battler and not (event.dead? or event.erased or event.battler.e_object)
@index_max += 1
end
end
$game_system.se_play($data_system.equip_se)
if @index_max == -1
cancel_select
else
create_layout
create_layout_skill
create_cusrsor
create_text
create_skill_name
select_target(0)
end
Graphics.transition
loop do
Graphics.update
Input.update
update
break if $scene != self
end
dispose
end
#--------------------------------------------------------------------------
# ● Create Layout
#--------------------------------------------------------------------------
def create_layout
@layout_1 = Plane.new
@layout_1.bitmap = RPG::Cache.windowskin("XAS_Target_Layout1")
@layout_1.z = 9998
@layout_1.opacity = 255
end
#--------------------------------------------------------------------------
# ● Create Layout
#--------------------------------------------------------------------------
def create_layout_skill
@skill_layout = Sprite.new
@skill_layout.bitmap = RPG::Cache.windowskin("XAS_Active_Help")
@skill_layout.z = 10001
@skill_layout.x = -100
@skill_layout.y = 32
@skill_layout.opacity = 0
end
#--------------------------------------------------------------------------
# ● Create Cursor
#--------------------------------------------------------------------------
def create_cusrsor
@cursor = Sprite.new
@cursor.bitmap = RPG::Cache.windowskin("Cursor")
@cursor.z = 9999
@cursor.x = @new_x
@cursor.y = @new_y
@cursor.opacity = 255
@cursor.visible = true
end
#--------------------------------------------------------------------------
# ● Create Text
#--------------------------------------------------------------------------
def create_text
@text = Sprite.new
@text.bitmap = Bitmap.new(200,40)
@text.z = 10000
@text.bitmap.font.size = 20
@text.bitmap.font.bold = true
@text.bitmap.font.name = "Georgia"
@text.bitmap.draw_hemming_text(0, 0, 200, 40, @text.to_s,1)
@text.opacity = 255
@text.x = @new_x
@text.y = @new_y
end
#--------------------------------------------------------------------------
# ● Create Text
#--------------------------------------------------------------------------
def create_skill_name
@skill_name = Plane.new
@skill_name.bitmap = Bitmap.new(640,480)
@skill_name.z = 10002
@skill_name.bitmap.font.size = 20
@skill_name.bitmap.font.bold = true
@skill_name.bitmap.font.name = "Georgia"
@skill_name.oy = -40
skill = $data_skills[$game_temp.xas_target_shoot_id]
skill_text = skill.name.to_s + " - " + skill.description.to_s
@skill_name.bitmap.draw_hemming_text(0, 0, 640, 40, skill_text,1)
@skill_name.opacity = 0
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
Graphics.freeze
@spriteset.dispose
if @cursor != nil
@cursor.bitmap.dispose
@cursor.dispose
@text.bitmap.dispose
@text.dispose
@skill_layout.bitmap.dispose
@skill_layout.dispose
@skill_name.bitmap.dispose
@skill_name.dispose
@layout_1.bitmap.dispose
@layout_1.dispose
end
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
return if @index_max == -1
update_cursor_slide
update_layout_slide
update_targe_select
end
#--------------------------------------------------------------------------
# ● Update Layout Slide
#--------------------------------------------------------------------------
def update_layout_slide
@layout_1.ox += 3
if @skill_layout.x < 0
@skill_layout.x += 10
@skill_layout.opacity += 25
@skill_name.opacity += 25
else
@skill_layout.x = 0
@skill_layout.opacity = 255
@skill_name.opacity = 255
@skill_name.ox -= 3
end
end
#--------------------------------------------------------------------------
# ● Refresh Text
#--------------------------------------------------------------------------
def refresh_text
@text.bitmap.clear
@text.bitmap.draw_hemming_text(0, 0, 200, 40, @text_string.to_s,1)
end
#--------------------------------------------------------------------------
# ● Update Cursor Slide
#--------------------------------------------------------------------------
def update_cursor_slide
@speed_x = [[(@cursor.x - @new_x / 40), 1].max, 40].min
@speed_y = [[(@cursor.y - @new_y / 40), 1].max, 40].min
if @cursor.x > @new_x
@cursor.x -= @speed_x.abs
@cursor.x = @new_x if @cursor.x < @new_x
elsif @cursor.x < @new_x
@cursor.x += @speed_x.abs
@cursor.x = @new_x if @cursor.x > @new_x
end
if @cursor.y > @new_y
@cursor.y -= @speed_y.abs
@cursor.y = @new_y if @cursor.y < @new_y
elsif @cursor.y < @new_y
@cursor.y += @speed_y.abs
@cursor.y = @new_y if @cursor.y > @new_y
end
@text.x = - 85 + @cursor.x
@text.y = 20 + @cursor.y
if @fy_time > 25
@fy += 1
elsif @fy_time > 0
@fy -= 1
else
@fy = 0
@fy_time = 50
end
@fy_time -= 1
@cursor.oy = @fy
end
#--------------------------------------------------------------------------
# ● Select Target(type)
#--------------------------------------------------------------------------
def select_target(type)
return if @index_max < 0
check_index
valor = 0
for event in $game_map.events.values
if event.target and event.battler and not (event.dead? or event.erased or event.battler.e_object)
if valor == @target_index
@new_x = event.screen_x - 10
@new_y = event.screen_y
@text_string = event.battler.name
$game_temp.xas_target_x = event.x
$game_temp.xas_target_y = event.y
$game_temp.xas_target_time = 1
end
valor += 1
end
end
refresh_text
end
#--------------------------------------------------------------------------
# ● Cancel Select
#--------------------------------------------------------------------------
def cancel_select
$game_system.se_play($data_system.buzzer_se)
$game_temp.xas_target_x = 0
$game_temp.xas_target_y = 0
$game_temp.xas_target_time = 0
$game_temp.xas_target_shoot_id = 0
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# ● Update Target Select
#--------------------------------------------------------------------------
def update_targe_select
if Input.trigger?(Input::B)
cancel_select
elsif Input.trigger?(Input::DOWN) or Input.trigger?(Input::RIGHT)
@target_index += 1
select_target(0)
$game_system.se_play($data_system.cursor_se)
elsif Input.trigger?(Input::UP) or Input.trigger?(Input::LEFT)
@target_index -= 1
select_target(1)
$game_system.se_play($data_system.cursor_se)
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
$scene = Scene_Map.new
end
end
#--------------------------------------------------------------------------
# ● Check Index
#--------------------------------------------------------------------------
def check_index
if @target_index > @index_max
@target_index = 0
end
if @target_index < 0
@target_index = @index_max
end
end
end
# ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
#===============================================================================
# HOOKSHOT SPRITE
#===============================================================================
# ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
attr_accessor :hook_x
attr_accessor :hook_y
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias hookshot_initialize initialize
def initialize
@hook_x = 0
@hook_y = 0
hookshot_initialize
end
end
#==============================================================================
# ■ Hookshot
#==============================================================================
class Hookshot < Sprite
#--------------------------------------------------------------------------
# ● Intialize
#--------------------------------------------------------------------------
def initialize
super
create_hook
end
#--------------------------------------------------------------------------
# ● Create Hook
#--------------------------------------------------------------------------
def create_hook
@hook_image = RPG::Cache.windowskin("Hook_Shoot")
@hook_bitmap = Bitmap.new(640,480)
@hook_sprite = Sprite.new
@hook_sprite.bitmap = @hook_bitmap
@hook_cw = @hook_bitmap.width
@hook_ch = @hook_bitmap.height
@hook_src_rect = Rect.new(0, 0,@hook_cw , @hook_ch)
@hook_bitmap.blt(0,0, @hook_image, @hook_src_rect)
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
@hook_image.dispose
@hook_bitmap.dispose
@hook_bitmap = nil
@hook_sprite.bitmap.dispose
@hook_sprite.bitmap = nil
@hook_sprite.dispose
@hook_sprite = nil
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
update_visible
return if @hook_sprite.visible == false
update_draw_chain
end
#--------------------------------------------------------------------------
# ● Update Visible
#--------------------------------------------------------------------------
def update_visible
if $game_temp.hook_x == 0 and $game_temp.hook_y == 0
@hook_sprite.visible = false
else
@hook_sprite.visible = true
end
end
#--------------------------------------------------------------------------
# ● Update Draw Chain
#--------------------------------------------------------------------------
def update_draw_chain
@hook_sprite.bitmap.clear
d = $game_player.direction
case d
when 2
ex = 15
ey = 20
ex2 = 0
ey2 = 0
when 4
ex = 38
ey = 38
ex2 = 16
ey2 = 0
when 6
ex = -5
ey = 38
ex2 = -16
ey2 = 0
when 8
ex = 15
ey = 70
ex2 = 0
ey2 = 32
end
range_x = $game_temp.hook_x.truncate - $game_player.screen_x.truncate + ex2
range_y = $game_temp.hook_y.truncate - $game_player.screen_y.truncate + ey2
if $game_player.direction == 2 or $game_player.direction == 6
ry = 0
rx = 0
else
ry = 450
rx = 610
end
x_range = (range_x / 6).truncate
y_range = (range_y / 6).truncate
for i in 0...6
@hook_src_rect = Rect.new(0, 0,@hook_cw , @hook_ch)
@hook_bitmap.blt(rx + (x_range * i), ry + (y_range * i), @hook_image, @hook_src_rect)
end
@hook_sprite.x = $game_player.screen_x.truncate - rx - ex
@hook_sprite.y = $game_player.screen_y.truncate - ry - ey
@hook_sprite.z = $game_player.screen_z
if $game_temp.hook_x == 0 and
$game_temp.hook_y == 0
@hook_sprite.visible = false
else
@hook_sprite.visible = true
end
end
end
#-------------------------------------------------------------------------------
# ■ Scene_Map
#-------------------------------------------------------------------------------
class Scene_Map
#--------------------------------------------------------------------------
# ● Main
#--------------------------------------------------------------------------
alias hookshot_main main
def main
@hook = Hookshot.new
hookshot_main
@hook.dispose
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias hookshot_update update
def update
hookshot_update
@hook.update
end
end
# ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
#===============================================================================
# SPRITE SHADOW
#===============================================================================
# ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
#===============================================================================
# ■ Spriteset_Map
#===============================================================================
class Spriteset_Map
#--------------------------------------------------------------------------
# ● update
#--------------------------------------------------------------------------
alias background_effect_update update
def update
background_effect_update
if $game_temp.background_effect_time > 0
$game_temp.background_effect_time -= 1
@panorama.z = 1000
@fog.z = -1000
if $game_temp.background_effect_time == 0
@panorama.z = -1000
$game_map.panorama_name = $game_temp.pre_panorama_name
$game_map.panorama_hue = $game_temp.pre_panorama_hue
@fog.z = 3000
end
end
end
end
#===============================================================================
# ■ Sprite_Character
#===============================================================================
module Sprite_Shadow
#--------------------------------------------------------------------------
# ● Create Shadow
#--------------------------------------------------------------------------
def create_shadow
@shadow = Sprite.new(self.viewport)
@shadow.bitmap = RPG::Cache.windowskin("Shadow")
@cw2 = self.bitmap.width / 8
@ch2 = self.bitmap.height / 5
@shadow.ox = self.ox - @cw2 + 16
@shadow.oy = self.oy - @ch2 + 5
@shadow.x = self.character.screen_x
@shadow.y = self.character.screen_y
@shadow.z = self.character.screen_z - 1
@shadow.opacity = self.character.opacity - 30
@shadow.visible = self.character.visible
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
if @shadow != nil
@shadow.bitmap.dispose
@shadow.bitmap = nil
@shadow.dispose
@shadow = nil
end
super
end
#--------------------------------------------------------------------------
# ● update
#--------------------------------------------------------------------------
def update
super
if @shadow != nil
@shadow.x = self.character.screen_x
if self.character.direction == 2 or
self.character.direction == 8
@shadow.y = self.character.screen_y + $game_temp.jump_y
else
@shadow.y = self.character.screen_y + $game_temp.jump_y
end
@shadow.opacity = self.opacity - 30
if self.character.jumping?
@shadow.visible = true
else
@shadow.visible = false
end
@shadow.z = self.character.screen_z - 1
if self.character.erased
@shadow.bitmap.dispose
@shadow.bitmap = nil
@shadow.dispose
@shadow = nil
end
end
end
end
#===============================================================================
# ■ Sprite_Character
#===============================================================================
class Sprite_Character < RPG::Sprite
include Sprite_Shadow
#--------------------------------------------------------------------------
# ● Shadow
#--------------------------------------------------------------------------
alias shadow_initialize initialize
def initialize(viewport, character = nil)
shadow_initialize(viewport, character)
if self.character.is_a?(Game_Player)
create_shadow
end
end
end
# ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
#===============================================================================
# PLAYER SPRITE NAME SYSTEM
#===============================================================================
# ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
#===============================================================================
# ■ Game_Player
#===============================================================================
class Game_Player
#--------------------------------------------------------------------------
# ● Check Character Pose
#--------------------------------------------------------------------------
def update_character_pose
return unless can_refresh_pose?
check_character_pose
end
#--------------------------------------------------------------------------
# ● Can Refresh Pose?
#--------------------------------------------------------------------------
def can_refresh_pose?
return false if $game_system.map_interpreter.running?
return false if self.action != nil
return false if self.dead?
return false if self.battler.stop
return true
end
#--------------------------------------------------------------------------
# ● Check Character Pose
#--------------------------------------------------------------------------
def check_character_pose
if @fall
@pose_type = ""
elsif @pickup_lock_time > 0
@pose_type = "_Throw"
elsif @pickup_lock
@pose_type = "_Pickup"
elsif self.knockbacking? or (self.battler != nil and self.battler.state_sleep)
@pose_type = "_Hit"
elsif @collision_attack
@pose_type = "_Act"
elsif $game_temp.xas_charge_time > 10
@pose_type = "Charge"
elsif jumping? or $game_temp.dodge_time_real > 0
@pose_type = "_Jump"
elsif @dash
@pose_type = "_Dash"
elsif @quarter
@pose_type = "_Quarter"
else
@pose_type = "Normal"
end
change_character_graphic_pose
end
#--------------------------------------------------------------------------
# ● Update Character Graphic Pose
#--------------------------------------------------------------------------
def change_character_graphic_pose
return if @pose_type_old == @pose_type
@pose_type_old = @pose_type
name = @actor.character_name
file_name(name)
if RPG_FileTest.character_exist?(@character_file_name)
@character_name = @character_file_name
else
@character_name = name
end
end
#--------------------------------------------------------------------------
# ● File Name
#--------------------------------------------------------------------------
def file_name(name)
case @pose_type
when "Normal"
@character_file_name = name
when "Charge"
suffix = Database_Bullet::SELF_MOTIONS[@wp_tool_id]
@character_file_name = name + suffix.to_s + "_Charge"
when ""
@character_file_name = ""
when @pose_type
@character_file_name = name + @pose_type.to_s
else
@character_file_name = name
end
end
end
#===============================================================================
# ■ Sprite_Character
#===============================================================================
class Sprite_Character < RPG::Sprite
#--------------------------------------------------------------------------
# ● Update Opacity
#--------------------------------------------------------------------------
def update_char_effects
# Zoom
if @zoom_x != @character.zoom_x or
@zoom_y != @character.zoom_y
@zoom_x = @character.zoom_x
@zoom_y = @character.zoom_y
self.zoom_x = @character.zoom_x
self.zoom_y = @character.zoom_y
end
# Angle
if @character.angle != @character.angle_new
@character.angle = @character.angle_new
self.angle = @character.angle_new
end
# Fly
if $game_system.fly == true and @character.is_a?(Game_Player)
self.z = 999
self.bush_depth = 0
# Swimming
elsif @character.swimming
self.z = @character.screen_z(@ch)
self.bush_depth = 25
end
# Background Effect
if $game_temp.background_effect_time > 0
if @character.battler != nil or @character.tool_id > 0
self.z = @character.screen_z + 1500
end
end
if @character.icon_name != nil
create_treasure_icon
update_treasure_icon_frame
update_treasure_icon_float(self.bitmap.height)
#update_treasure_icon_blink
if @character.alwaly_on_target_id != 0
event = $game_map.events[@character.alwaly_on_target_id]
if event == nil
@character.move_toward_player
@character.alwaly_on_target_id = 0
@character.start
return
end
@character.x = event.x
@character.y = event.y
@character.move_speed = 6
self.x = event.screen_x
self.y = event.screen_y
end
self.z = 0
return
# Pickup
elsif @character.throw_active and $game_player.pickup_lock_time == 0
self.x = $game_player.screen_x
self.y = $game_player.screen_y - XAS::OBJECT_Y
self.z = $game_player.screen_z + 32
self.bush_depth = 0
@character.x = $game_player.x
@character.y = $game_player.y
return
#Alwaly on Target Position
elsif @character.alwaly_on_target_id != 0
if @character.alwaly_on_target_id < 0
@character.x = $game_player.x
@character.y = $game_player.y
@character.move_speed = 6
if @character_name[/\((\d+)\)/]
self.x = $game_player.screen_x
self.y = $game_player.screen_y + $1.to_i
else
self.x = $game_player.screen_x
self.y = $game_player.screen_y
end
return
else
event = $game_map.events[@character.alwaly_on_target_id]
return if event == nil
unless @character.hooked
@character.x = event.x
@character.y = event.y
end
@character.move_speed = event.move_speed
if @character_name[/\((\d+)\)/]
self.x = event.screen_x
self.y = event.screen_y + $1.to_i
else
self.x = event.screen_x
self.y = event.screen_y
end
end
# Height Correction
elsif @character_name[/\((\d+)\)/]
self.x = @character.screen_x
self.y = @character.screen_y + $1.to_i
end
@character.z = self.z
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias xas_charsprite_update update
def update
xas_charsprite_update
@battler = @character.battler if @battler == nil
update_char_effects
if @battler == nil or @_collapse_duration > 0 or
@character.collapse_done
return
end
if @battler.hiblink_duration.is_a?(Numeric)
if XAS_BA::BLINK_ON == true
@character.opacity = (@character.opacity + 70) % 190 + 40
end
if XAS_ABS_SETUP::BATTLER_SHAKE_EFFECT == true and @character.knockbacking?
self.x = @character.screen_x + rand(5)
end
@battler.hiblink_duration -= 1
if @battler.hiblink_duration <= 0
@battler.hiblink_duration = nil
@character.opacity = 255
end
end
end
end
# ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
#===============================================================================
# Anti Lag
#===============================================================================
# ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
#===============================================================================
# ■ Game_Character
#===============================================================================
class Game_Character
#--------------------------------------------------------------------------
# ● Can Update
#--------------------------------------------------------------------------
def can_update?
return false if self.is_a?(Game_Player)
return false if @trigger == 3 or @trigger == 4
return false if self.battler != nil and self.battler.sensor_range > 15
return false if self.tool_id != 0
@visible = false
sensor_range = $game_system.anti_lag_range
px = ($game_map.display_x / 128).truncate
py = ($game_map.display_y / 128).truncate
distance_x = (px - (self.x - 10)).abs
distance_y = (py - (self.y - 7)).abs
return true if distance_x >= sensor_range + 11
return true if distance_y >= sensor_range + 9
@visible = true
return false
end
end
#===============================================================================
# ■ Game_Event
#===============================================================================
class Game_Character
alias character_anti_lag_update update
def update
return if can_update?
character_anti_lag_update
end
end
#===============================================================================
# ■ Sprite_Character
#===============================================================================
class Sprite_Character < RPG::Sprite
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias xas_anti_update update
def update
return if @character.visible == false and self.visible == false
xas_anti_update
self.visible = @character.visible
end
end
Чёто у меня ошибку SyntaxError выдаёт... Вот такой скрипт:
Всё выполнялось на ура пока не поставил вместо числовых значений выделенные переменные.Цитата:
$BlizzABS.create_event ([$game_map.events [001].x], [$game_map.events[001].y], 'sheep', [[[], [0, '167-Small09', 0, 2, 0, 255, 0], 1, 4, 4, [], true, false, false,false, false, 0, []]])
В чём дело? Правильно ли я их подставил?
[$game_map.events [001].x] У тебя тут пробел(но тогда вроде должен быть NoMethodError). так же попробуй удалить квадратные скобки
Что-то ничего не помогает - ни убраный пробел, ни удалённые скобки... Попробую спросить на Каосе.
UPD: оказалось, что надо убрать нули из ID и очень важно сделать правильные переносы строк в скрипте - после запятых. Вобщем, скрипт наконец-то сработал и... появилась новая проблема - новый ивент возникает совсем не на месте только что убитого монстра, а, судя по всему, рандомно... Буду ждать ответа на Каосе.
Помогите решить проблему.Это скрипт освещения.Скрипт работает только на экране со стартовой точкой главного персонажа.
Код:#==============================================================================
# ■ Light Effects VX 1.1
# 5.21.2008
#------------------------------------------------------------------------------
# Script by: Kylock (originally for RMXP by Near Fantastica)
#==============================================================================
# To make an event glow, give it a Comment: with any of the supported light
# modes.
# The SWITCH setting below will disable light effects from updating with the
# switch is on.
#==============================================================================
# ● Change Log
#------------------------------------------------------------------------------
# 1.0 - Original Release
# 1.1 - New light modes added: LIGHT2, TORCH, TORCH2
# - Changed sprite blend mode to ADD (looks slightly better)
# - Fire-based lights are now red in color
#==============================================================================
# ● Light Modes
#------------------------------------------------------------------------------
# GROUND - Medium steady white light.
# FIRE - Large red light with a slight flicker.
# LIGHT - Small steady white light.
# LIGHT2 - X-Large steady white light.
# TORCH - X-Large red light with a heavy flicker.
# TORCH2 - X-Large red light with a sleight flicker.
#==============================================================================
class Spriteset_Map
alias les_spriteset_map_initalize initialize
alias les_spriteset_map_dispose dispose
alias les_spriteset_map_update update
def initialize
@light_effects = []
setup_lights
les_spriteset_map_initalize
update
end
def dispose
les_spriteset_map_dispose
for effect in @light_effects
effect.light.dispose
end
@light_effects = []
end
def update
les_spriteset_map_update
update_light_effects
end
def setup_lights
for event in $game_map.events.values
next if event.list == nil
for i in 0...event.list.size
if event.list[i].code == 108 and event.list[i].parameters == ["GROUND"]
type = "GROUND"
light_effects = Light_Effect.new(event,type)
light_effects.light.zoom_x = 2
light_effects.light.zoom_y = 2
light_effects.light.opacity = 100
@light_effects.push(light_effects)
end
if event.list[i].code == 108 and event.list[i].parameters == ["FIRE"]
type = "FIRE"
light_effects = Light_Effect.new(event,type)
light_effects.light.zoom_x = 300 / 100.0
light_effects.light.zoom_y = 300 / 100.0
light_effects.light.opacity = 100
@light_effects.push(light_effects)
end
if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT"]
type = "LIGHT"
light_effects = Light_Effect.new(event,type)
light_effects.light.zoom_x = 1
light_effects.light.zoom_y = 1
light_effects.light.opacity = 150
@light_effects.push(light_effects)
end
if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT2"]
type = "LIGHT2"
light_effects = Light_Effect.new(event,type)
light_effects.light.zoom_x = 6
light_effects.light.zoom_y = 6
light_effects.light.opacity = 150
@light_effects.push(light_effects)
end
if event.list[i].code == 108 and event.list[i].parameters == ["TORCH"]
type = "TORCH"
light_effects = Light_Effect.new(event,type)
light_effects.light.zoom_x = 6
light_effects.light.zoom_y = 6
light_effects.light.opacity = 150
@light_effects.push(light_effects)
end
if event.list[i].code == 108 and event.list[i].parameters == ["TORCH2"]
type = "TORCH2"
light_effects = Light_Effect.new(event,type)
light_effects.light.zoom_x = 6
light_effects.light.zoom_y = 6
light_effects.light.opacity = 150
@light_effects.push(light_effects)
end
end
end
for effect in @light_effects
case effect.type
when "GROUND"
effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
effect.light.blend_type = 1
when "FIRE"
effect.light.x = (effect.event.real_x - 600 - $game_map.display_x) / 8 + rand(6) - 3
effect.light.y = (effect.event.real_y - 600 - $game_map.display_y) / 8 + rand(6) - 3
effect.light.tone = Tone.new(255,-100,-255, 0)
effect.light.blend_type = 1
when "LIGHT"
effect.light.x = (-0.25 / 2 * $game_map.display_x) + (effect.event.x * 32) - 15
effect.light.y = (-0.25 / 2 * $game_map.display_y) + (effect.event.y * 32) - 15
effect.light.blend_type = 1
when "LIGHT2"
effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
effect.light.blend_type = 1
when "TORCH"
effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
effect.light.tone = Tone.new(255,-100,-255, 0)
effect.light.blend_type = 1
when "TORCH2"
effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
effect.light.tone = Tone.new(255,-100,-255, 0)
effect.light.blend_type = 1
end
end
end
def update_light_effects
if $game_switches[1]
for effect in @light_effects
next if effect.type == "FIRE" || effect.type == "TORCH"
effect.light.visible = false
end
else
for effect in @light_effects
next if effect.type == "FIRE" || effect.type == "TORCH"
effect.light.visible = true
end
end
for effect in @light_effects
case effect.type
when "GROUND"
effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
when "FIRE"
effect.light.x = (effect.event.real_x - 600 - $game_map.display_x) / 8 + rand(6) - 3
effect.light.y = (effect.event.real_y - 600 - $game_map.display_y) / 8 + rand(6) - 3
effect.light.opacity = rand(10) + 90
when "LIGHT"
effect.light.x = (-0.25 / 2 * $game_map.display_x) + (effect.event.x * 32) - 15
effect.light.y = (-0.25 / 2 * $game_map.display_y) + (effect.event.y * 32) - 15
when "LIGHT2"
effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
when "TORCH"
effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20 + rand(20) - 10
effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8 + rand(20) - 10
effect.light.opacity = rand(30) + 70
when "TORCH2"
effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
effect.light.opacity = rand(10) + 90
end
end
end
end
class Light_Effect
attr_accessor :light
attr_accessor :event
attr_accessor :type
def initialize(event, type)
@light = Sprite.new
@light.bitmap = Cache.picture("le.png")
@light.visible = true
@light.z = 1000
@event = event
@type = type
end
end
Японский бог воины! Ну я ж не просто так спрашиваю - почему ты не юзаешь трансформ! И не важно - нужен он тебе или нет. Важен или нет. Главное то, что он просто изменит графику и внутренности ивена, вместо того, чтобы заново создавать новый, который появится черт знает где и заново будет инициализироваться, отжирая драгоценные такты процессора.
Второе: естественно он появляется не там, где ты хочешь. Ты ведь вначале уничтожил событие (я прав?), а затем пытаешься по его координатам создать новое. Если нет - перебрось в личку с крипт, поправлю.
Вот это уже похоже на развернутый вопрос. :) Завтра гляну.
Вот переделанный под XP вариант скрипта VX:
Спойлер Movie:
Особенности: мерцание вызывает метод Graphics.update. Без его вызова ты через 10 секунд игры получишь ошибку: Script is hanging. В VX такое проблемы нет, насколько я помню, в нем достаточно вызова Input.update. Проблема обрисована. Теперь решения. Первое: лови за что поймаешь Рольфа - он уже правил, скорее всего этот же скрипт. Возможно, у него что-то вышло. Второе - эксперименты, мешающие мерцать видео, вроде отображения картинки в качестве фона для видео (вдруг поможет и мерцать не будет?). Увы - времени нет. И наконец реализованный мной костыль: sleep(9) Graphics.update - найди это место в скрипте. Как нетрудно догадаться, я запускаю ожидание на 9 секунд, после чего обновляю экран, что мешает игре выдать ошибку. Естетсвенно это мешает полноценной работе скрипта - ожидание после окончания видео, редкие, но все же мерцания картинки. В общем - некрасивое решение.