Hey all,
I was fooling around with the Ziifee Spin Command script today and I thought about changing the image up so that it acts as almost a frame. I resize the image to fit aesthetically and I boot up the game... and the image is off to the right and a little low.
I thought that it was no big deal and that it's a simple fix until I realized that the script is written a little... differently than most. I couldn't find a define "x/y" for the image and that I honestly didn't know what I was looking at.
Stumped, I told myself I may as well ask the people on the interwebs to help me out. I'm essentially looking for a way to manually move the location of the "spin40" graphic. Any help is appreciateed.
Script:
# ★ change BATORUREIAUTO
# SUTETOAIKON material, the use of animation, recommended
# Edited by: Aranarther (Credit Ziifee)
#================================================= =============================
# â– Ziifee
#================================================= =============================
module Zii
# ▼ icon (� 16 + vertical side - 1)
ATTACK = 1 # attack (basic)
GUARD = 52 # defense
SKILL = 133 # skills
ITEM = 144 # item
ESCAPE = 48 # escape
# â–¼ rotation (a "positive" or "reverse" Cart)
TURN = "reverse"
#------------------------------------------------- -------------------------
# â— normal rotation of judgement
#------------------------------------------------- -------------------------
def self.turn_normal?
return false if TURN == "reverse"
return true if TURN == "positive"
return true
end
end
#==============================================================================
# �� Window_SpinCommand
#------------------------------------------------------------------------------
# �@���]�p�R�}���h�I�����s���E�B���h
�E�����B
#==============================================================================
class Window_SpinCommand < Window_Base
attr_reader :index # �J�[�\�����u
attr_reader :help_window # �w���v�E�B���h�E
def initialize(cx, cy, commands, setting = {})
@radius = setting.has_key?("R") ? setting["R"] : 40 # �`�����a
@speed = setting.has_key?("S") ? setting["S"] : 36 # ���]����
@spin_back = setting.has_key?("G") ? setting["G"] : "" # �w�i����
@spin_line = setting.has_key?("L") ? setting["L"] : nil # �������u
x, y = cx - @radius - 28, cy - @radius - 28
width = height = @radius * 2 + 56
super(x, y, width, height)
self.opacity = 0
@index = 0
@commands = commands # �R�}���h
@spin_right = true
@spin_count = 0
update_cursor
end
def draw_spin_graphic(i, cx, cy)
case command_kind(i)
when "icon"
draw_icon(command_pull(i), cx - 12, cy - 12, command_enabled?(i))
end
end
#--------------------------------------------------------------------------
# �� ���t���b�V�� �o�O�����p
#--------------------------------------------------------------------------
def refresh
set_spin
end
#--------------------------------------------------------------------------
# �� �������`�� �o�O�����p
#--------------------------------------------------------------------------
def draw_item(index, enabled = true)
@commands[index][3] = enabled
set_spin
end
#--------------------------------------------------------------------------
# �� �������R�}���h������������
#--------------------------------------------------------------------------
def command_name(index = @index)
return "" if index < 0
name = @commands[index][0]
return name != nil ? name : ""
end
#--------------------------------------------------------------------------
# �� �R�}���h������������
#--------------------------------------------------------------------------
def command_kind(index)
result = @commands[index][1]
return result != nil ? result : ""
end
#--------------------------------------------------------------------------
# �� �R�}���h������ ������
#--------------------------------------------------------------------------
def command_pull(index)
result = @commands[index][2]
return result != nil ? result : ""
end
#--------------------------------------------------------------------------
# �� �R�}���h���L���t���O������
#--------------------------------------------------------------------------
def command_enabled?(index)
result = @commands[index][3]
return result != nil ? result : true
end
#--------------------------------------------------------------------------
# �� ���O�����u�� index ����������
#--------------------------------------------------------------------------
def set_index(name)
n = -1
for i in 0...@commands.size
n = i if @commands[i][0] == name
end
@index = n if n >= 0
update_cursor
call_update_help
set_spin
end
#--------------------------------------------------------------------------
# �� �J�[�\�����u������
# index : �V�����J�[�\�����u
#--------------------------------------------------------------------------
def index=(index)
@index = index
update_cursor
call_update_help
set_spin
end
#--------------------------------------------------------------------------
# �� ���S��X���W������
#--------------------------------------------------------------------------
def center_x
return contents.width / 2
end
#--------------------------------------------------------------------------
# �� ���S��Y���W������
#--------------------------------------------------------------------------
def center_y
return contents.height / 2
end
#--------------------------------------------------------------------------
# �� ������������
#--------------------------------------------------------------------------
def item_max
return @commands.size
end
#--------------------------------------------------------------------------
# �� �w�i������ (�����` ����)
#--------------------------------------------------------------------------
def set_background
return if @spin_back == ""
bitmap = Cache.system(@spin_back)
rect = Rect.new(0, 0, bitmap.width, bitmap.height)
self.contents.blt(12, 12, bitmap, rect)
end
#--------------------------------------------------------------------------
# �� ���������� (�����` ����)
#--------------------------------------------------------------------------
def set_text
return if @spin_line == nil
y = center_y - WLH / 2 + @spin_line
self.contents.draw_text(center_x - 48, y, 96, WLH, command_name, 1)
end
#--------------------------------------------------------------------------
# �� �X�s���A�C�R�����p�x�����������ï
¿½ï¿½ï¿½
#--------------------------------------------------------------------------
def angle_size
return (Math::PI * 2 / item_max)
end
#--------------------------------------------------------------------------
# �� �X�s���A�C�R�����]�����J�E���g ����������
#--------------------------------------------------------------------------
def set_spin_count
@spin_count = angle_size * 360 / @speed
set_spin(true)
end
#--------------------------------------------------------------------------
# �� �X�s������ �����s
# spin : ���]�t���O (true �������]��)
#--------------------------------------------------------------------------
def set_spin(spin = false)
self.contents.clear
set_background
angle = spin ? @speed * @spin_count / 360 : 0
angle = @spin_right ? angle : -angle
for i in 0...item_max
n = (i - @index) * angle_size + angle
cx = @radius * Math.sin(n) + center_x
cy = - @radius * Math.cos(n) + center_y
draw_spin_graphic(i, cx, cy)
end
set_text
end
#--------------------------------------------------------------------------
# �� �t���[���X�V
#--------------------------------------------------------------------------
def update
super
update_cursor
if @spin_count > 0
@spin_count -= 1
set_spin(@spin_count >= 1)
return
end
update_command
end
#--------------------------------------------------------------------------
# �� �R�}���h���������\����
#--------------------------------------------------------------------------
def command_movable?
return false if @spin_count > 0
return false if (not visible or not active)
return false if (index < 0 or index > item_max or item_max == 0)
return false if (@opening or @closing)
return true
end
#--------------------------------------------------------------------------
# �� �R�}���h���E������
#--------------------------------------------------------------------------
def command_right
@index = (@index + 1) % item_max
@spin_right = true
set_spin_count
end
#--------------------------------------------------------------------------
# �� �R�}���h����������
#--------------------------------------------------------------------------
def command_left
@index = (@index - 1 + item_max) % item_max
@spin_right = false
set_spin_count
end
#--------------------------------------------------------------------------
# �� �R�}���h�I�����X�V
#--------------------------------------------------------------------------
def update_command
if command_movable?
if Input.press?(Input::LEFT)
Sound.play_cursor
Zii.turn_normal? ? command_right : command_left
end
if Input.press?(Input::RIGHT)
Sound.play_cursor
Zii.turn_normal? ? command_left : command_right
end
end
call_update_help
end
#--------------------------------------------------------------------------
# �� �J�[�\�����X�V
#--------------------------------------------------------------------------
def update_cursor
if @index < 0
self.cursor_rect.empty
else
rect = Rect.new(0, 0, 24, 24)
rect.x = center_x - rect.width / 2
rect.y = center_y - rect.height / 2 - @radius
self.cursor_rect = rect
end
end
#--------------------------------------------------------------------------
# �� �w���v�E�B���h�E������
# help_window : �V�����w���v�E�B���h�E
#--------------------------------------------------------------------------
def help_window=(help_window)
@help_window = help_window
call_update_help
end
#--------------------------------------------------------------------------
# �� �w���v�E�B���h�E�X�V���\�b�h�������o��
#--------------------------------------------------------------------------
def call_update_help
if self.active and @help_window != nil
update_help
end
end
#--------------------------------------------------------------------------
# �� �w���v�E�B���h�E���X�V (���e���p���������`����)
#--------------------------------------------------------------------------
def update_help
end
end
#==============================================================================
# �� Window_ActorCommand
#==============================================================================
class Window_ActorCommand < Window_SpinCommand
#--------------------------------------------------------------------------
# �� �I�u�W�F�N�g������
#--------------------------------------------------------------------------
def initialize
set = []
set.push([Vocab::attack, "icon", Zii::ATTACK, true])
set.push([Vocab::skill, "icon", Zii::SKILL, true])
set.push([Vocab::guard, "icon", Zii::GUARD, true])
set.push([Vocab::item, "icon", Zii::ITEM, true])
if $game_troop.can_escape
set.push([Vocab::escape, "icon", Zii::ESCAPE, true])
end
super(72, 356, set, {"R"=>40, "S"=>52, "G"=>"Spin40", "L"=>-12})
self.active = false
set_spin
end
#--------------------------------------------------------------------------
# �� �Z�b�g�A�b�v
# actor : �A�N�^�[
#--------------------------------------------------------------------------
def setup(actor)
@commands[0][2] = Zii::ATTACK
@commands[1][0] = Vocab::skill
if actor.weapons[0] != nil
n = actor.weapons[0].icon_index
@commands[0][2] = n if n > 0
end
@commands[1][0] = actor.class.skill_name if actor.class.skill_name_valid
self.index = 0
set_spin
end
end
#==============================================================================
# �� Scene_Battle
#------------------------------------------------------------------------------
# �@�o�g���������������s���N���Xï¿
½ï¿½ï¿½ï¿½ï¿½B
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# �� �����\���r���[�|�[�g������
#--------------------------------------------------------------------------
alias :neomemo13_create_info_viewport :create_info_viewport
def create_info_viewport
neomemo13_create_info_viewport
@info_viewport.rect.set(0, 0, 544, 416)
@status_window.x = 128
@status_window.y = 288
#@actor_command_window.x = 530
end
#--------------------------------------------------------------------------
# �� �����\���r���[�|�[�g���X�V
#--------------------------------------------------------------------------
alias :neomemo13_update_info_viewport :update_info_viewport
def update_info_viewport
ox = @info_viewport.ox
neomemo13_update_info_viewport
@info_viewport.ox = ox
end
#--------------------------------------------------------------------------
# �� �A�N�^�[�R�}���h�I�����J�n
#--------------------------------------------------------------------------
alias :neomemo13_start_actor_command_selection :start_actor_command_selection
def start_actor_command_selection
neomemo13_start_actor_command_selection
@actor_command_window.active = true
@actor_command_window.visible = true
end
end