License Table
Dark32
Описание:
Добавляет возможность изучать магию и повышать характеристики, а так же в дальнейшем возможность носить оружие, броню и аксессуары (далее способности) подобно тому, как это реализовано в FFXII, т.е. по средствам их покупки на доске лицензий. Купив одну способность вы открываете соседние с ней (те что непосредственно соприкасаются с клеткой). Каждая способность имеет свою цену, выраженную в абстрактных очках (AP), но ничто не мешает вам изменить название, я только за.Спойлер Скрин:
Использование:
Поместить все скрипты до Main
Открыть Module D32 и произвести настройки
Спойлер Скрин настроек:Спойлер Пояснения к настройкам:
Stat - Названия характеристик именно в этом порядке (Пусто не удалять)
Description - Описание характеристик именно в этом порядке (Пусто не удалять)
AP - имя абстрактных очков
DIX , DIY - размер таблицы
MODE=32 - размер сетки (в комплекте есть 64)
PHP код:
if MODE == 32 # режим размера
Bit=Bitmap.new(".//Graphics//32Rect") #- Имя картинки для сетки
SPD = 8 #- скорость перемещения курсора
LAG = 2 #- частота обновления перемещения курсора
DX = 20 #- число клеток по горизонтали
DY = 12 #- число клеток по вертикали
X = 5 #- начальная точка Х
Y = 4 #- начальная точка У
end
PHP код:
#задаём клетки
Select = Rect.new(0 * MODE , 0 * MODE , MODE , MODE) #выбранная клетка, рамка
Black = Rect.new(1 * MODE , 0 * MODE , MODE , MODE)#чёрная клетка
White = Rect.new(2 * MODE , 0 * MODE , MODE , MODE)#белая клетка
Gray = Rect.new(3 * MODE , 0 * MODE , MODE , MODE)#неактивная клетка
Spec = Bitmap.new(".//Graphics//IcoSet")#иконки характеристик именно в этом порядке
Демка:
Версия 0.1.1 #выход в свет
LicenseTable.zip
Скрипт:
графика отдельно http://dl.dropbox.com/u/31129431/LicenseTable/GR.zip в папку Graphics
образец таблицы http://dl.dropbox.com/u/31129431/Lic...e/Spell.rxdata в папку Data
Попробую выложить, главное чтобы форум не съел половину кода.
Спойлер Module D32:
Game_ActorPHP код:
module D32
Stat=["Пусто","SP","HP","INT","AGI","DEX","STR"]
Description=[]
Description<<""
Description<<"+100 SP"
Description<<"+100 HP"
Description<<"+1 INT"
Description<<"+1 AGI"
Description<<"+1 DEX"
Description<<"+1 STR"
AP = "AP"
DIX = 15
DIY = 15
Dark=Color.new(125,125,125,125)
MODE=32
Select = Rect.new(0 * MODE , 0 * MODE , MODE , MODE)
Black = Rect.new(1 * MODE , 0 * MODE , MODE , MODE)#Color.new(113,47,38)
White = Rect.new(2 * MODE , 0 * MODE , MODE , MODE)#Color.new(240,220,130)
Gray = Rect.new(3 * MODE , 0 * MODE , MODE , MODE)
Spec = Bitmap.new(".//Graphics//IcoSet")
if MODE == 64
Bit=Bitmap.new(".//Graphics//Rect")
SPD = 32
LAG = 4
DX = 10
DY = 6
X = 5
Y = 2
end
if MODE == 32
Bit=Bitmap.new(".//Graphics//32Rect")
SPD = 8
LAG = 2
DX = 20
DY = 12
X = 5
Y = 4
end
end
PHP код:
class Game_Actor < Game_Battler
attr_accessor :magicl
attr_accessor :ap
alias old_initialize initialize
def initialize(actor_id)
@magicl=[]
@ap=200
old_initialize(actor_id)
end
end
Спойлер Scene_Table:PHP код:
#==============================================================================
# ** Scene_Status
#------------------------------------------------------------------------------
# This class performs status screen processing.
#==============================================================================
class Scene_Table
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
#--------------------------------------------------------------------------
def initialize(actor_index = 0,x=D32::DIX/2,y=D32::DIY/2)
@actor_index = actor_index
@x=x
@y=y
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
@deb=false
@plane = Plane.new
@plane.bitmap= Bitmap.new(".//Graphics//Fone")
@actor = $game_party.actors[@actor_index]
#p @actor.magicl
@bitmam_table = Sprite.new#(480,480)
@bitmam_table.bitmap = Bitmap.new((D32::DX)*D32::MODE, (D32::DY)*D32::MODE)
@bitmam_table.y = 480-D32::DY*D32::MODE
@bitmam_table.bitmap.fill_rect(0,0,D32::DX*D32::MODE,D32::DY*D32::MODE,D32::Dark)
# Make status window
#@table_window = Window_Status.new(@actor)
# Execute transition
@dx,@dy=0,0
load_data_spell
magicl
draw_spell(0,0)
@win_info = Window_Table_Info.new(@spell_array[@y][@x],@cost_array[@y][@x],@actor)
@coun = 0
Graphics.transition
loop {
Graphics.update
Input.update
update
break if $scene != self
}
Graphics.freeze
@bitmam_table.dispose
@plane.dispose
@win_info.dispose
end
def save_data_spell(filename=".//Data//Spell.rxdata.new")
File.open(filename,'wb+')do|f|
@spell_array.each_index{|y|
@spell_array[y].each_index{|x|
f.write("[#{@spell_array[y][x]}:#{@cost_array[y][x]}]")
}
f.write("\n")
}
end
end
def load_data_spell
@spell_array = []
@cost_array = []
magicl = @actor.magicl.empty?
i , y = 0 , 0
File.open(".//Data//Spell.rxdata")do|f|
f.read.gsub(/\[([-\d]+):(\d+)\]/){
@spell_array [y] = [] if !@spell_array[y]
@cost_array [y] = [] if !@cost_array[y]
@actor.magicl[y] = [] if !@actor.magicl[y] and magicl
@spell_array [y] << $1.to_i
@cost_array [y] << $2.to_i
@actor.magicl[y].push(@actor.skills.include?($1.to_i)? 2 : 0) if magicl
i += 1
y += 1 if i % D32::DIX == 0
}
#p @spell_array
end
end
def magicl
@actor.magicl.each_index{|y|
@actor.magicl[y].each_index{|x|
if @actor.magicl[y][x] == 2
@actor.magicl[y+1][x] = 1 if @actor.magicl[y+1] and @actor.magicl[y+1][x] == 0
@actor.magicl[y-1][x] = 1 if @actor.magicl[y-1] and @actor.magicl[y-1][x] == 0 and y-1>=0
@actor.magicl[y][x+1] = 1 if @actor.magicl[y][x+1] and @actor.magicl[y][x+1] == 0
@actor.magicl[y][x-1] = 1 if @actor.magicl[y][x-1] and @actor.magicl[y][x-1] == 0 and x-1>=0
end
}
}
end
def draw_spell(dx=@dx,dy=@dy,x=@x,y=@y)
@bitmam_table.bitmap.clear
(D32::DX+2).times{|ix|
(D32::DY+2).times{|iy|
b1 = @spell_array[y+iy-D32::Y-1] if y+iy-D32::Y-1>=0 # проверка строк
b2 = @spell_array[y+iy-D32::Y-1][x+ix-D32::X-1] if b1 and x+ix-D32::X-1>=0 # столбцов
#b3 = @spell_array[y+iy-D32::Y-1][x+ix-D32::X-1]!=0 if b2 # не пустоты
#b4 = @spell_array[y+iy-D32::Y-1][x+ix-D32::X-1]> 0 if b2 # магия?
b5 = @actor.magicl[y+iy-D32::Y-1][x+ix-D32::X-1] if b2 # доступность
#@bitmam_table.bitmap.fill_rect((ix-1)*64+dx,(iy-1)*64+dy,64,64,
#(ix+iy+x+y)%2 == 0 ? D32::Black : D32::White) if b3
# клетки
@bitmam_table.bitmap.blt((ix-1)*D32::MODE+dx,(iy-1)*D32::MODE+dy,D32::Bit,
(ix+iy+x+y)%2 == 0 ? D32::Black : D32::White) if b2 and b2 != 0
# иконки скилов
@bitmam_table.bitmap.blt((ix-1)*D32::MODE+dx+(D32::MODE/2-12),(iy-1)*D32::MODE+dy+(D32::MODE/2-12),
RPG::Cache.icon($data_skills[b2].icon_name) , Rect.new( 0 , 0 , 24, 24),
b5 != 1 ? 255 : 50) if b2 and b2 > 0
# иконки стат
@bitmam_table.bitmap.blt((ix-1)*D32::MODE+dx+(D32::MODE/2-12),(iy-1)*D32::MODE+dy+(D32::MODE/2-12),
D32::Spec , Rect.new( (-b2-1)*24 , 0 , 24, 24),
b5 != 1 ? 255 : 50) if b2 and @spell_array[y+iy-D32::Y-1][x+ix-D32::X-1]< 0
# сервя сетка
@bitmam_table.bitmap.blt((ix-1)*D32::MODE+dx,(iy-1)*D32::MODE+dy,D32::Bit,
D32::Gray) if b5 == 0 and b2 and b2 != 0
# отладка
@bitmam_table.bitmap.draw_text((ix-1)*D32::MODE+dx,(iy-1)*D32::MODE+dy,200,32,
"#{b2}") if b2 and $DEBUG and @deb
}
}
@bitmam_table.bitmap.blt(D32::X*D32::MODE,D32::Y*D32::MODE,D32::Bit,D32::Select)
#@bitmam_table.bitmap.draw_text(0,0,200,32,"#{x}x#{y}[#{dx}x#{dy}]")
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@coun+=1
if @dx != 0 and @coun % D32::LAG == 0
@dx = @dx>0 ? @dx-D32::SPD : @dx+D32::SPD
draw_spell
end
if @dy != 0 and @coun % D32::LAG == 0
@dy = @dy>0 ? @dy-D32::SPD : @dy+D32::SPD
draw_spell
end
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(6)
return
end
if Input.press?(Input::LEFT ) and @dx == 0 and @x>0
$game_system.se_play($data_system.cursor_se)
@x-=1
@dx=-D32::MODE
@win_info.refresh(@spell_array[@y][@x],@cost_array[@y][@x])
return
end
if Input.press?(Input::RIGHT ) and @dx == 0 and @x<D32::DIX-1
$game_system.se_play($data_system.cursor_se)
@x+=1
@dx=+D32::MODE
@win_info.refresh(@spell_array[@y][@x],@cost_array[@y][@x])
return
end
if Input.press?(Input::UP ) and @dy == 0 and @y>0
$game_system.se_play($data_system.cursor_se)
@y-=1
@dy=-D32::MODE
@win_info.refresh(@spell_array[@y][@x],@cost_array[@y][@x])
return
end
if Input.press?(Input::DOWN ) and @dy == 0 and @y<D32::DIY-1
$game_system.se_play($data_system.cursor_se)
@y+=1
@dy=+D32::MODE
@win_info.refresh(@spell_array[@y][@x],@cost_array[@y][@x])
return
end
if Input.trigger?(Input::C)
#p @x,@y
#p @spell_array[@y][@x],@cost_array[@y][@x]
if @actor.magicl[@y][@x] == 1 and @spell_array[@y][@x] !=0 and @actor.ap >= @cost_array[@y][@x]
@actor.ap -= @cost_array[@y][@x]
$game_system.se_play($data_system.decision_se)
if @spell_array[@y][@x] >0
@actor.learn_skill(@spell_array[@y][@x])
else
#p @spell_array[@y][@x]
case @spell_array[@y][@x]
#when -9 : @actor.mdef += 10
#when -8 : @actor.pdef += 10
#when -7 : @actor.atk += 1
when -6 : @actor.maxsp += 100
when -5 : @actor.maxhp += 100
when -4 : @actor.int += 1
when -3 : @actor.agi += 1
when -2 : @actor.dex += 1
when -1 : @actor.str += 1
end
end
@actor.magicl[@y][@x] = 2
magicl
draw_spell
@win_info.refresh(@spell_array[@y][@x],@cost_array[@y][@x])
else
$game_system.se_play($data_system.buzzer_se)
end
return
end
#--------------------------------------
# Отладка
#--------------------------------------
if Input.trigger?(Input::A) and $DEBUG
save_data_spell
end
if Input.trigger?(Input::SHIFT ) and $DEBUG
save_data_spell(".//Data//Spell.rxdata")
end
if Input.trigger?(Input::F6 ) and $DEBUG
@actor.ap+=100
@win_info.refresh(@spell_array[@y][@x],@cost_array[@y][@x])
end
if Input.trigger?(Input::F7 ) and $DEBUG
if @spell_array[@y][@x] >0
@actor.learn_skill(@spell_array[@y][@x])
else
#p @spell_array[@y][@x]
case @spell_array[@y][@x]
when -6 : @actor.maxsp += 100
when -5 : @actor.maxhp += 100
when -4 : @actor.int += 1
when -3 : @actor.agi += 1
when -2 : @actor.dex += 1
when -1 : @actor.str += 1
end
end
@actor.magicl[@y][@x] = 2
magicl
draw_spell
@win_info.refresh(@spell_array[@y][@x],@cost_array[@y][@x])
end
if Input.trigger?(Input::F5 ) and $DEBUG
s ="A - Сохранить дуликат базы в .//Data//Spell.rxdata.new \n"+
"Shift - Перезаписать базу \n"+
"X - Сменить заклинание на +1 \n"+
"Y - Сменить заклинание на -1 \n"+
"Z - Номера заклинаний \n"+
"Ctrl - +1 цены \n"+
"Alt - -1 цены\n"+
"F5 - Эта справка\n"+
"F6 - +100 AP"+
"F7 - Изучить строго!"+
"Внимание! Проверка на дубликаты\nв данном режиме не производится!"
print s
end
if Input.trigger?(Input::X) and $DEBUG and @spell_array[@y][@x]<$data_skills.size-1
@spell_array[@y][@x]+=1
draw_spell
@win_info.refresh(@spell_array[@y][@x],@cost_array[@y][@x])
end
if Input.trigger?(Input::Y) and $DEBUG and @spell_array[@y][@x]>-6
@spell_array[@y][@x]-=1
draw_spell
@win_info.refresh(@spell_array[@y][@x],@cost_array[@y][@x])
end
if Input.trigger?(Input::Z) and $DEBUG
@deb = !@deb
draw_spell
end
if Input.press?(Input::CTRL ) and $DEBUG
@cost_array[@y][@x]+=1
@win_info.refresh(@spell_array[@y][@x],@cost_array[@y][@x])
end
if Input.press?(Input::ALT ) and $DEBUG
@cost_array[@y][@x]-=1 if @cost_array[@y][@x]>0
@win_info.refresh(@spell_array[@y][@x],@cost_array[@y][@x])
end
#--------------------------------------
# Конец отладки
#--------------------------------------
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Table.new(@actor_index,@x,@y)
return
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Table.new(@actor_index,@x,@y)
return
end
end
end
Спойлер Window_Table_Info:PHP код:
#==============================================================================
# ** Window_Status
#------------------------------------------------------------------------------
# This window displays full status specs on the status screen.
#==============================================================================
class Window_Table_Info < Window_Base
attr_accessor :idi,:cost
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(idi,cost,actor)
super(0, 0, 640, 480-D32::DY*D32::MODE)
self.contents = Bitmap.new(width - 32, height - 32)
@idi = idi
@cost = cost
@actor=actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(idi=@idi,cost=@cost)
self.contents.clear
skill = $data_skills[idi]
self.contents.font.size = 19
self.contents.draw_text(0,0,500,32,idi>0 ? "#{skill.name}" : D32::Stat[idi])
self.contents.draw_text(0,24,500,32,idi>0 ? "#{skill.description }" : D32::Description[idi])
str = idi!=0 ? "#{cost}" : ""
self.contents.draw_text(500 ,0,200,16,"#{D32::AP}")
self.contents.draw_text(500 ,16,200,16,"Цена: #{str}")
self.contents.draw_text(500 ,32,200,16,"Есть: #{@actor.ap}")
self.contents.font.size = 22
end
end
Не обязательные скрипты
Спойлер Модификация меню(Scene_Menu MF):PHP код:
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs menu screen processing.
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make command window
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Status"
s5 = "Save"
s6 = "End Game"
s7 = "Лицензии"
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6,s7])
@command_window.index = @menu_index
@command_window.height =220
# If number of party members is 0
if $game_party.actors.size == 0
# Disable items, skills, equipment, and status
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
# If save is forbidden
if $game_system.save_disabled
# Disable save
@command_window.disable_item(4)
end
# Make play time window
@playtime_window = Window_PlayTime.new
@playtime_window.x = 0
@playtime_window.y = 224
# Make steps window
@steps_window = Window_Steps.new
@steps_window.x = 0
@steps_window.y = 320
# Make gold window
@gold_window = Window_Gold.new
@gold_window.x = 0
@gold_window.y = 416
# Make status window
@status_window = Window_MenuStatus.new
@status_window.x = 160
@status_window.y = 0
# Execute transition
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 windows
@command_window.dispose
@playtime_window.dispose
@steps_window.dispose
@gold_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@command_window.update
@playtime_window.update
@steps_window.update
@gold_window.update
@status_window.update
# If command window is active: call update_command
if @command_window.active
update_command
return
end
# If status window is active: call update_status
if @status_window.active
update_status
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If command other than save or end game, and party members = 0
if $game_party.actors.size == 0 and @command_window.index < 4
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Branch by command window cursor position
case @command_window.index
when 0 # item
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to item screen
$scene = Scene_Item.new
when 1 # skill
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2 # equipment
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3 # status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4 # save
# If saving is forbidden
if $game_system.save_disabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to save screen
$scene = Scene_Save.new
when 5 # end game
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to end game screen
$scene = Scene_End.new
#-------------------
when 6 # license
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
#-------------------
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when status window is active)
#--------------------------------------------------------------------------
def update_status
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Make command window active
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 1 # skill
# If this actor's action limit is 2 or more
if $game_party.actors[@status_window.index].restriction >= 2
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to skill screen
$scene = Scene_Skill.new(@status_window.index)
when 2 # equipment
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to equipment screen
$scene = Scene_Equip.new(@status_window.index)
when 3 # status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to status screen
$scene = Scene_Status.new(@status_window.index)
#-------------------
when 6 # license
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to status screen
#p @status_window.index
$scene = Scene_Table.new(@status_window.index)
#--------------------
end
return
end
end
end
Спойлер Модификация Статуса (Status MF):PHP код:
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw AP
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_actor_ap(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "AP")
self.contents.font.color = normal_color
self.contents.draw_text(x + 40, y, 120, 32, "#{actor.ap}",2)
end
end
class Window_MenuStatus < Window_Selectable
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 64
y = i * 116
actor = $game_party.actors[i]
draw_actor_graphic(actor, x - 40, y + 80)
draw_actor_name(actor, x, y)
draw_actor_class(actor, x + 144, y)
draw_actor_level(actor, x, y + 32)
draw_actor_state(actor, x + 90, y + 32)
draw_actor_exp(actor, x, y + 64)
draw_actor_hp(actor, x + 236, y + 32)
draw_actor_sp(actor, x + 236, y + 64)
draw_actor_ap(actor, x, y + 48)
end
end
end
class Window_Status < Window_Base
alias old_refres refresh
def refresh
old_refres
draw_actor_ap(@actor,320,96)
end
end
Ошибки:
- Не открываются клетки, если изучен скил с уровнем
- Не открываются клетки, если изучен скил через событие
- Не открываются клетки, если изучен скил через сторонний скрипт
- Не закрываются клетки, если забыт скил через событие
- Не закрываются клетки, если забыт скил через сторонний скрипт
Планы:
- Добавить изучение возможности носить оружие
- Добавить изучение возможности носить броню
- Каждому герою своя таблица
- Каждому класу своя таблица (если герою не установлена)
- Общая таблица, если не выбрана выше
- Скачать FFXII
- Пройти FFXII
- Совместимость c
Режим отладки, отладчики найдут сами.
Социальные закладки