Académique Documents
Professionnel Documents
Culture Documents
code
#--------------------------------------------------------------------------
# define faces
#--------------------------------------------------------------------------
def draw_actor_face(actor, x, y)
face = rpg::cache.character("faces/" + actor.character_name,
actor.character_hue)
fw = face.width
fh = face.height
src_rect = rect.new(3, -1, fw, fh)
self.contents.blt(x - fw / 23, y - fh, face, src_rect)
end
this is part of the summon system, it is just the equipment section of the
summon system. i will post the rest of it later.
make a new script after the window skill script. and add this one. this
window skills script is for the summon equip. don't replace it with the
window skill or it will mess up and done overwrite your window skill
script
code#=======================================================================
=======
# ■ window_skill
#---------------------------------------------------------------------------
---
# スキル画面、バトル画面で、使用できるスキルの一覧を衼 br />?示するウィンドウです。
#===========================================================================
===
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor : アクター
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 75, 290, 405)
@actor = actor
@column_max = 1
refresh
self.index = 0
# 戦闘中の場合はウィンドウを画面中央へ移動し、半透明にぼ br />?る
if $game_temp.in_battle
self.x = 200
self.y = 225
self.height = 256
self.width = 440
self.back_opacity = 160
end
end
#--------------------------------------------------------------------------
# ● スキルの取得
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills[i]]
if skill != nil
@data.push(skill)
end
end
# 項目数が 0 でなければビットマップを作成し、全項目を描画
@item_max = @data.size
if @item_max > 0
self.contents = bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 1 * (288 + 32)
y = index / 1 * 32
rect = rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, color.new(0, 0, 0, 0))
bitmap = rpg::cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
end
now make a new script below scene skill script and add this one
code#---------------------------------------------------------------------
#equipment for summon-------------------------------------------------
#by olamide bakre
#scene_equipsummon
#help window
class window_descri < window_base
#--------------------------------------------------------------------------
# ● initialize
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 64)
self.contents = bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
end
def set_text(text, align = 1)
if text != @text or align != @align
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
@text = text
@align = align
@actor = nil
end
self.visible = true
end
end
#end of text box
#text box
class window_textsummon < window_selectable
def initialize
super(0, 0, 290, 76)
self.contents = bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
end
#--------------------------------------------------------------------------
# ● refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.draw_text(4, 0, 120,32, "summons list")
testing = time.now.strftime("%a %b %e %h:%m:%s %y\n")
end
end
#equipment list
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
#loop
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills[i]]
if skill != nil and skill.element_set.include?(@element_id)
@data.push(skill)
end
end
#item max is set to a value and called as a function
@item_max = @data.size
if @item_max > 0
self.contents = bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
for i in 0...@item_max
draw_item(i)
end
end
end
#end of function
#beginning of object
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = normal_color
end
x = 4 + index % 1 * (288 + 32)
y = index / 1 * 32
rect = rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, color.new(0, 0, 0, 0))
bitmap = rpg::cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
#self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
end
#--------------------------------------------------------------------------
# ● update help text
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
end
def initialize(actor)
super(290, 0, 350, 210)
self.contents = bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
@actor = actor
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● return item index
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@data = []
@data.push($data_weapons[@actor.weapon_id])
@data.push($data_armors[@actor.armor1_id])
@data.push($data_armors[@actor.armor2_id])
@data.push($data_armors[@actor.armor3_id])
@data.push($data_armors[@actor.armor4_id])
@item_max = @data.size
self.contents.font.color = system_color
self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4)
draw_item_name(@data[0], 92, 32 * 0)
draw_item_name(@data[1], 92, 32 * 1)
draw_item_name(@data[2], 92, 32 * 2)
draw_item_name(@data[3], 92, 32 * 3)
draw_item_name(@data[4], 92, 32 * 4)
end
#--------------------------------------------------------------------------
# ● update help
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#--------------------------------------------------------------------------
# ● refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
actor = $game_party.actors[0]
draw_actor_face(actor, 189, 250 )
draw_actor_name(actor, 4, 120)
draw_actor_level(actor, 4, 140)
self.contents.draw_text(4, 170, 150, 32, "class:")
draw_actor_class(actor, 65, 170)
self.contents.draw_text(4, 200, 150, 32, "element:")
if $element_var == 0
$element_var = "none"
end
self.contents.draw_text(85, 200, 150, 32, $element_var.to_s)
#define empty
#$equip_slot1 = 0
if $equip_slot1 == 0
$equip_slot1 =
"-----------------------------empty-------------------------"
$equip_slot2 =
"-----------------------------empty-------------------------"
$equip_slot3 =
"-----------------------------empty-------------------------"
$equip_slot4 =
"-----------------------------empty-------------------------"
end
self.contents.font.color = system_color
self.contents.draw_text(4, 2, 600, 32, $equip_slot1.to_s )
self.contents.draw_text(4, 35, 600, 32, $equip_slot2.to_s)
self.contents.draw_text(4, 65, 600, 32, $equip_slot3.to_s)
self.contents.draw_text(4, 95, 600, 32, $equip_slot4.to_s)
#end
end
end
#end
class scene_equipsummon < scene_skill
$equip_slot1 = 0
#initialize object
def initialize(menu_index = 0, char_index = 0)
@menu_index = menu_index
@char_index = char_index
end
def main
#selection window
s1 = "equip"
s2 = "class change"
s3 = "return"
@option = window_command.new(150, [s1, s2, s3])
@option.index = @menu_index
$icon
#class selection window
@select = window_command.new(150, ["equip", "remove"])
@select.index = @menu_index
@select.z = 0
@select.x = 150
@select.y = 190
@select.visible = false
@select.active = false
#class selection window ends
#confirm
@confirm_window = window_base.new(135, 188, 400, 64)
@confirm_window.contents = bitmap.new(368, 32)
@confirm_window.contents.font.name = $fontface
@confirm_window.contents.font.size = $fontsize
@confirm_window.contents.draw_text(4, 0, 500, 32,"what do you want to
do?")
#confirm
@item_max = $game_party.actors.size
@actor = $game_party.actors[0]
@info = window_textsummon.new
@list = window_listsummon.new(@actor, @element_id = 18)
@help_window = window_descri.new
@help_window.visible = false
@wepon = window_weaponsummon.new(@actor)
@wepon.active = false
@char = window_charsummon.new
@confirm_window.visible = false
@confirm_window.z = 1500
@option.visible = false
@option.active = false
@option.x = 270
@option.y = 252
@option.z = 1500
#end of window
graphics.transition
loop do
graphics.update
input.update
update
if $scene != self
break
end
end
graphics.freeze
@option.dispose
@confirm_window.dispose
@info.dispose
@list.dispose
@wepon.dispose
@char.dispose
@select.dispose
@help_window.dispose
end
#begin
def update
@select.update
@option.update
@info.update
@list.update
@wepon.update
@char.update
@help_window.update
if @option.active
option_update
return
end
if @list.active
list_update
return
end
if @wepon.active
wepon_update
return
end
if @char.active
char_update
return
end
if @select.active
select_update
return
end
end
#end of update
def draw_icon(x, y)
skills = @data[@list.index]
$icon = sprite.new
$icon.bitmap = rpg::cache.icon(skills)
$icon.z = 255
$icon.y = y
$icon.x = x
end
#define end selection
def select_update
@select.active
if input.trigger?(input::b)
@select.z = 0
@select.x = 145
@select.y = 150
@select.visible = false
@select.active = false
@char.active = true
end
actor = $game_party.actors[0]
if input.trigger?(input::c)
case @select.index
when 0
$game_system.se_play($data_system.decision_se)
if @char.index == 0
if $data_classes[1].name == "slayer"
testing = actor.class_id = 2
end
id = $data_skills[@list.index + 1].element_set[0]
$element_var = $data_system.elements[id]
@char.refresh
$equip_slot1 = @data[@list.index] + " \t \t equipped"
$skill_equip.push(@data[@list.index])
@data[@list.index].replace(" equipped ")
@list.refresh
@list.active = true
@char.active = false
@char.index = -1
elsif @char.index == 1
if $data_classes[1].name == "slayer"
testing = actor.class_id = 2
end
id = $data_skills[@list.index + 1].element_set[0]
$element_var = $data_system.elements[id]
$equip_slot2 = @data[@list.index] + " \t \t equipped"
$skill_equip.push(@data[@list.index])
@data[@list.index].replace(" equipped ")
@list.refresh
@list.active = true
@char.active = false
@char.index = -1
elsif @char.index == 2
if $data_classes[1].name == "slayer"
testing = actor.class_id = 2
end
@element_id = @list.index
id = $data_skills[@list.index + 1].element_set[0]
$element_var = $data_system.elements[id]
$equip_slot3 = @data[@list.index] + " \t \t equipped"
$skill_equip.push(@data[@list.index])
@data[@list.index].replace(" equipped ")
@list.refresh
@list.active = true
@char.active = false
@char.index = -1
elsif @char.index == 3
if $data_classes[1].name == "slayer"
testing = actor.class_id = 2
end
id = $data_skills[@list.index + 1].element_set[0]
$element_var = $data_system.elements[id]
$equip_slot4 = @data[@list.index] + " \t \t equipped"
$skill_equip.push(@data[@list.index])
@data[@list.index].replace(" equipped ")
@list.refresh
@list.active = true
@char.active = false
@char.index = -1
end
@char.refresh
@select.z = 0
@select.x = 145
@select.y = 150
@select.visible = false
@select.active = false
@char.active = true
when 1
$game_system.se_play($data_system.buzzer_se)
if @char.index == 0
$element_var = 0
if $equip_slot1 ==
"-----------------------------empty-------------------------"
$game_system.se_play($data_system.buzzer_se)
else
if $data_classes[2].name == "swordman"
testing = actor.class_id = 1
@char.refresh
end
$equip_slot1 =
"-----------------------------empty-------------------------"
@actor.learn_skill(0)
@list.refresh
end
elsif @char.index == 1
$element_var = 0
$equip_slot2 =
"-----------------------------empty-------------------------"
@char.refresh
elsif @char.index == 2
$element_var = 0
$equip_slot3 =
"-----------------------------empty-------------------------"
@char.refresh
elsif @char.index == 3
$element_var = 0
$equip_slot4 =
"-----------------------------empty-------------------------"
@char.refresh
end
@char.refresh
@select.z = 200
@select.x = 145
@select.y = 150
@select.visible = true
@select.active = true
@char.active = false
return
end
end
end
#end of selection
#update class change
def char_update
if input.trigger?(input::c)
$game_system.se_play($data_system.decision_se)
#graphics.update
@select.z = 200
@select.x = 145
@select.y = 150
@select.visible = true
@select.active = true
@char.active = false
end
if input.trigger?(input::b)
$game_system.se_play($data_system.cancel_se)
@char.index = -1
@char.active = false
@list.active = true
end
end
def option_update
#input
if input.trigger?(input::b)
then
$game_system.se_play($data_system.cancel_se)
@confirm_window.visible = false
@confirm_window.z = 1500
@option.visible = false
@option.active = false
@option.x = 270
@option.y = 252
@option.z = 1500
@list.active = true
return
end
if input.trigger?(input::c)
#begin
$game_system.se_play($data_system.decision_se)
case @option.index
when 0#equip
$game_system.se_play($data_system.decision_se)
@wepon.active = true
@wepon.index = 0
@confirm_window.visible = false
@confirm_window.z = 0
@option.visible = false
@option.active = false
@option.z = 0
@option.update
when 1#class change
@confirm_window.visible = false
@confirm_window.z = 0
@option.visible = false
@option.active = false
@option.z = 0
@option.update
@char.active = true
@char.index = @char_index
when 2#return
$game_system.se_play($data_system.decision_se)
@confirm_window.visible = false
@confirm_window.z = 0
@option.visible = false
@option.active = false
@option.z = 0
@option.update
@list.active = true
return
end
#end
end
end
end
#end of code
def skill
return @data[@list.index]
end
#equipped skills
$skill_equip = []
#aliasing begin reference to class method ^-^
alias new_list_update list_update
#skill list
def list_update
new_list_update
@list.refresh
@data = []
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills[i]].name
if skill != nil
@data.push(skill)
end
end
end
end
#update function, alias
and to call the script. just use call script and put this
code$scene = scene_equipsummon.new