Partagez
Aller en bas
claire
claire
Membre

Nombre de messages : 459
Age : 24
Localisation : Pardies
Distinction : aucune
Date d'inscription : 28/02/2008
http://wyzigoth.site.voila.fr/

[résolu]Script classement de compétence Empty [résolu]Script classement de compétence

le Dim 18 Mai 2008 - 15:17
Alors voilà, j'ai script XP qui permet de classer les compétence en 3 catégories, je souhaiterai que quelqu'un puisse le convertir en VX
Le voilà :
Code:

#==============================================================================
# ¦ Scene_Skill
#----------a--------------------------------------------------------------------
#==============================================================================

class Scene_Skill
#--------------------------------------------------------------------------
# ? ?????????
# actor_index : ??????????
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
$option_magie=" "
end
#--------------------------------------------------------------------------
# ? ?????
#--------------------------------------------------------------------------
def main
@actor = $game_party.actors[@actor_index]
@help_window = Window_Help.new
@status_window = Window_SkillStatus.new(@actor)
@skill_window = Window_Skill.new(@actor)

#==========================================================================
# ¦ Le tableau de choix
#-------------------------------------------------------------------------------------------------------------------------------------
# ?*Pour ajouter: ajouter une virgule et marque ente " " ce que vous voulez afficher pour les
# 3 ligne suivant les explication et ajouter à la ligne 33 après n[x], une nouvelle virgule et un nouveau n[x+1]
# ?**Pour enlever: vous n'avez qu'à enlever les dernière valeur de chaque ligne (invocation, n[2]...)
#==========================================================================
n=["Magie Noir","Magie Blanche","Invocation"]# Les options
@mot_clef=["noir","blanche","Invocation"] # les mot clef
@aide=["Affiche la magie noir","Affiche la magie blanche","Affiche les Invocation possible"] # l'aide

@command_window = Window_Command.new(160, [ n[0],n[1], n[2] ]) #affiche commande
@command_window.x=480 # position horizontal (max 640)
@command_window.y=0 # position vertical (max 480)
@command_window.z=1000
@command_window.opacity=255 # régle l'opacité (max 255)
#===========================================================================

@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
@skill_window.active=false
@command_window.active=true
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
@status_window.dispose
@skill_window.dispose
@target_window.dispose

end
#--------------------------------------------------------------------------
# ?
#--------------------------------------------------------------------------
def update
if @command_window.active
@command_window.update
if Input.trigger?(Input::B) and @command_window.active
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(1)
@skill_window.active = true
@target_window.visible = false
@target_window.active = false
@command_window.active=false
@command_window.visible=false
end
#-------------------------Retour au menu-------------------
#------------------------------------------------------------
#------------------------curseur survol-------------------
$option_magie=@mot_clef[@command_window.index]
@help_window.set_text(@aide[@command_window.index])
@skill_window.refresh

#-------------------------apuis sur la touche-------------------
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@skill_window.active=true
@command_window.active=false
@skill_window.help_window = @help_window
end
else
update_back
end
end
#==============ancien update==============
def update_back
#-------------------------------------------------------
# ????????
@help_window.update
@status_window.update
@skill_window.update
@target_window.update
# ?????????????????: update_skill ???
if @skill_window.active
# print("2")
update_skill
return
end
# ???????????????????: update_target ???
if @target_window.active
update_target
return
end
end
#--------------------------------------------------------------------------
# ? ?????? (?????????????????)
#--------------------------------------------------------------------------
def update_skill
# B ??????????
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active=true
@command_window.visible=true
@skill_window.active=false
end
# C ??????????
if Input.trigger?(Input::C)
# ????????????????????????
@skill = @skill_window.skill
# ????????
if @skill == nil or not @actor.skill_can_use?(@skill.id)
# ??? SE ???
$game_system.se_play($data_system.buzzer_se)
return
end
# ?? SE ???
$game_system.se_play($data_system.decision_se)
# ??????????
if @skill.scope >= 3
# ?????????????????
@skill_window.active = false
@target_window.x = (@skill_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
# ???? (??/??) ?????????????
if @skill.scope == 4 || @skill.scope == 6
@target_window.index = -1
elsif @skill.scope == 7
@target_window.index = @actor_index - 10
else
@target_window.index = 0
end
# ????????????
else
# ??????? ID ??????
if @skill.common_event_id > 0
# ?????????????
$game_temp.common_event_id = @skill.common_event_id
# ??????? SE ???
$game_system.se_play(@skill.menu_se)
# SP ??
@actor.sp -= @skill.sp_cost
# ?????????????
@status_window.refresh
@skill_window.refresh
@target_window.refresh
# ??????????
$scene = Scene_Map.new
return
end
end
return
end
# R ??????????
if Input.trigger?(Input::R)
# ???? SE ???
$game_system.se_play($data_system.cursor_se)
# ???????
@actor_index += 1
@actor_index %= $game_party.actors.size
# ????????????
$scene = Scene_Skill.new(@actor_index)
return
end
# L ??????????
if Input.trigger?(Input::L)
# ???? SE ???
$game_system.se_play($data_system.cursor_se)
# ???????
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# ????????????
$scene = Scene_Skill.new(@actor_index)
return
end
end
#--------------------------------------------------------------------------
# ? ?????? (???????????????????)
#--------------------------------------------------------------------------
def update_target
# B ??????????
if Input.trigger?(Input::B)
# ?????????????
@skill_window.active = true
@target_window.visible = false
@target_window.active = false
@command_window.active=false
@command_window.visible=false
return
end
# C ??????????
if Input.trigger?(Input::C)
# SP ????????????????
unless @actor.skill_can_use?(@skill.id)
# ??? SE ???
$game_system.se_play($data_system.buzzer_se)
return
end
# ???????????
if @target_window.index == -1
# ??????????????????
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
# ????????????
if @target_window.index <= -2
# ??????????????????????
target = $game_party.actors[@target_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
# ???????????
if @target_window.index >= 0
# ??????????????????????
target = $game_party.actors[@target_window.index]
used = target.skill_effect(@actor, @skill)
end
# ?????????
if used
# ??????? SE ???
$game_system.se_play(@skill.menu_se)
# SP ??
@actor.sp -= @skill.sp_cost
# ?????????????
@status_window.refresh
@skill_window.refresh
@target_window.refresh
# ?????
if $game_party.all_dead?
# ??????????????
$scene = Scene_Gameover.new
return
end
# ??????? ID ??????
if @skill.common_event_id > 0
# ?????????????
$game_temp.common_event_id = @skill.common_event_id
# ??????????
$scene = Scene_Map.new
return
end
end
# ????????????
unless used
# ??? SE ???
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# ? ?????????
# actor : ????
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 128, 640, 352)
@actor = actor
@column_max = 2
refresh
self.index = 0
# ????????????????????????????
if $game_temp.in_battle
self.y = 64
self.height = 256
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 = [] #liste contenant les pouvoir
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills[i]]
# ================================
permission=false # pas affiche
skill.description.gsub!($option_magie) do
permission=true #affiche
$option_magie
end
#================affiche===============
if permission
@data.push(skill) #ajout dans la liste
end
# ================================
end


@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 % 2 * (288 + 32)
y = index / 2 * 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
Revenir en haut
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum