Connexion automatique

Pas encore membre ? Inscrivez-vous ici !
Vous avez oublié votre mot de passe ? On vous aide ici

AccueilPage d'accueilFAQRechercherS'enregistrerConnexion

Sélecteur de thème :


Partagez | .
Warsmith Script

Gwen
Maître Traducteur

Maître Traducteur
avatar

Nombre de messages : 23
Distinction : aucune
Date d'inscription : 25/07/2008

MessageSujet: Warsmith Script   Dim 27 Juil 2008 - 9:17

Author : lb_guilherme
Modified by : Lifa (alchemy and repair function added)

screen:


Script:
Code:


####################################################################
###################### FORGE, ALCHIMIE & REPARATION ########################
#### V 1.1.1 ###########################################################
####################################### Par: lb_guilherme #################
#### translation by : Douk ##################################################
#### comments, Alchemy and repair function added by : Lifa ########################
####################################################################

# To make an event  triggering the wharsmith function, insert a script call with inside : $scene = Scene_Refinar3.new
# By défault, the 10th first items of your items list  will be the ingredient.
#Your are able to modifythe number of ingredient in your game (de 1 à 14) at line 56 (Minerios_id)
# You can, at this same line, modify the ingredient's slotin your item list.

# at line 40, you are able to set the different item group in the forge.
# At line 43,put the type you need for each groups :
# 1 = Armors (All is in your armor list count, helmet, accessories, etc...)
# 2 = Weaons
# 3 = Items (It's possible to create ingredient from other ingredient ^^')
# Line 51 to *** : Set so many line that items group of your forge !
# Then, set on the right of each line the numbers of armors / weapons / items
#the player will be able to create
# To finish, line ~70 to ***, set the ingredient needed for each armor, weapon,
# (the number of numbers in brackets must match with the numbers of differents ingredients)
#It must be one line per ingredient.

# *************** Modification by repair *******************
# Minerios_id has been changed and include 2 lines.the first set the id and
# the 2nd set the armor, weapons or items type which be the ingredient.
# For example, Set weapon "Rusty sword" as ingredient, add some things, and create a "shinning sword" with it, or set a sword and fire ingredient and make #a fire sword.
module Refiner3

Grupos_arms = []
Grupos_atr = []
Grupos_atr[1] = []
Grupos_atr[2] = []
Grupos_atr[3] = []
Minerios_id = []
# ----------------------------------------------------
Grupos_name = ["Potions","Runes"] #weapon type to make
# item groups name
# ----------------------------------------------------
Grupos_tips = [3,3]
# Type d'objets des groupes (retain the same order and number)
# 1 = armor
# 2 = weapon
# 3 = item
# ----------------------------------------------------
# stuff id contained in each group
# Max = 15 per group
Grupos_arms[0] = [1,2,3]
Grupos_arms[1] = [4,5,6]
# ----------------------------------------------------
#item id which be ingredient
# Max = 14
Minerios_id[0] = [1,2,1,2,1,2]
Minerios_id[1] = [1,1,2,2,3,3]
# ----------------------------------------------------
# quantity of ingredient needed,in order of the ingredient as said before.
# Grupos_atr[TYPE][ID]
# TYPE:
# 1 = armor
# 2 = weapon
# 3 = item
# ID:
# armor/weapon/item id
# ----------------------------------------------------
# armor :
# item :
Grupos_atr[3][1] = [1,1,0,0,0,0]
Grupos_atr[3][2] = [10,15,0,0,0,0]
Grupos_atr[3][3] = [5,0,0,0,10,0]
Grupos_atr[3][4] = [5,5,5,5,5,5]
Grupos_atr[3][5] = [8,45,0,0,0,0]
Grupos_atr[3][6] = [0,0,0,0,1,0]

# ---------------------------------------------------- #
# SETTING ENDED - SCRIPT INITIALISATION #
# ---------------------------------------------------- #

end
class Window_Minerios3 < Window_Base
def initialize(icons, x = 420, y = 5)
super(x, y, 120, WLH * Refiner3::Minerios_id[0].size + WLH + 32 + 10)
@icons = icons
self.contents.font.name = "UmePlus Gothic"
refresh
end
def refresh
self.contents.clear
y = 10
x = 5
for i in 0...Refiner3::Minerios_id[0].size
y = y + WLH
icon = @icons[i]
draw_icon(icon, x, y)
end
end
end

class Scene_Refinar3 < Scene_Base
def start
super
create_menu_background
start_vars
@min_window = Window_Minerios3.new(@icons)
@min_window.visible = false
@grupo_window = Window_Command.new(160, Refiner3::Grupos_name)
@grupo_window.x = 5
@grupo_window.y = 5
@equips_window = Window_Command.new(160, [""])
@equips_window.visible = false
@equips_window.active = false
@confirm_window = Window_Confirm.new
@confirm_window.x = 5
@confirm_window.y = 331
@confirm_op_window = Window_Command.new(75, ["Yes","No"])
@confirm_op_window.x = 90
@confirm_op_window.y = 331
@confirm_op_window.opacity = 0
@confirm_window.visible = false
@confirm_op_window.visible = false
@confirm_op_window.active = false
@confirm_op_window.index = 1
end
def start_vars
@groups_names = []
@groups_icons = []
for a in 0...Refiner3::Grupos_name.size
@groups_names[a] = []
@groups_icons[a] = []
for i in 0...Refiner3::Grupos_arms[a].size
id = Refiner3::Grupos_arms[a][i]
if Refiner3::Grupos_tips[a] == 1
@groups_names[a][i] = $data_armors[id].name
@groups_icons[a][i] = $data_armors[id].icon_index
else
if Refiner3::Grupos_tips[a] == 2
@groups_names[a][i] = $data_weapons[id].name
@groups_icons[a][i] = $data_weapons[id].icon_index
else
@groups_names[a][i] = $data_items[id].name
@groups_icons[a][i] = $data_items[id].icon_index
end
end
end
end
@icons = []
for i in 0...Refiner3::Minerios_id[0].size
id = Refiner3::Minerios_id[0][i]
type_id = Refiner3::Minerios_id[1][i]
if type_id == 1
@icons[i] = $data_armors[id].icon_index
else
if type_id == 2
@icons[i] = $data_weapons[id].icon_index
else
@icons[i] = $data_items[id].icon_index
end
end
end
end
def terminate
super
dispose_menu_background
@equips_window.dispose
@grupo_window.dispose
@min_window.dispose
@confirm_op_window.dispose
@confirm_window.dispose
end
def update
super
update_menu_background
@equips_window.update
@min_window.update
@grupo_window.update
@confirm_op_window.update
@confirm_window.update
if @grupo_window.active == true
grupo_update
elsif @equips_window.active == true
equips_update
elsif @confirm_window.visible == true
confirm_update
end
end
def confirm_update
if @confirm_op_window.active == false
@confirm_window.contents.clear
@confirm_window.contents.draw_text(0, 0, 130, 24, "You don't have")
@confirm_window.contents.draw_text(0, 24, 130, 24, "needed items")
end
if Input.trigger?(Input::B)
Sound.play_cancel
un_active
end
if Input.trigger?(Input::C)
case @confirm_op_window.index
when 0
Sound.play_decision
refinar
un_active
@icon_window.dispose
update_Refiner3
desactive_options
@confirm_op_window.index = 1
when 1
Sound.play_cancel
un_active
end
end
end
def refinar
v1 = Refiner3::Grupos_tips[@grupo_window.index]
v2 = Refiner3::Grupos_arms[@grupo_window.index][@equips_window.index]
for i in 0...Refiner3::Minerios_id[0].size
v = Refiner3::Grupos_atr[v1][v2][i]

if v == nil
v = 0
end
type_id = Refiner3::Minerios_id[1][i]
if type_id == 1
$game_party.lose_item($data_armors[Refiner3::Minerios_id[0][i]], v)
else
if type_id == 2
$game_party.lose_item($data_weapons[Refiner3::Minerios_id[0][i]], v)
else
$game_party.lose_item($data_items[Refiner3::Minerios_id[0][i]], v)
end
end
end
if v1 == 1
t = $data_armors[v2]
else
if v1 == 2
t = $data_weapons[v2]
else
t = $data_items[v2]
end
end
$game_party.gain_item(t,1)
end
def un_active
@confirm_window.visible = false
@confirm_op_window.visible = false
@confirm_op_window.active = false
@equips_window.active = true
@confirm_window.contents.clear
@confirm_window.contents.draw_text(0, 0, 80, 24, "Confirm?")
end
def equips_update
if Input.trigger?(Input::B)
Sound.play_cancel
@equips_window.visible = false
@equips_window.active = false
@grupo_window.active = true
@min_window.visible = false
@icon_window.dispose
end
if Input.trigger?(Input::C)
Sound.play_decision
trocar
end
if Input.repeat?(Input::DOWN)
update_Refiner3
end
if Input.repeat?(Input::UP)
update_Refiner3
end
end
def grupo_update
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
Sound.play_decision
@equips_window.dispose
@equips_window = Window_Command2.new(245, @groups_names[@grupo_window.index])
@equips_window.x = 170
@equips_window.y = 5
@min_window.visible = true
@grupo_window.active = false
desactive_options
update_Refiner3
end
end
def troc_list
for i in 0...@troc.size
if @troc[i] != false
@troc[i] = true
end
end
end
def update_Refiner3
v1 = Refiner3::Grupos_tips[@grupo_window.index]
v2 = Refiner3::Grupos_arms[@grupo_window.index][@equips_window.index]
@min_window.refresh
y = 10
x = 35
@min_window.contents.font.color = @min_window.normal_color
@min_window.contents.draw_text(0, 0, 100, 24, "Needed :")
for i in 0...Refiner3::Minerios_id[0].size
y = y + 24
@min_window.contents.font.color = @min_window.normal_color
@min_window.contents.draw_text(x, y, 80, 24, "→")
text = Refiner3::Grupos_atr[v1][v2][i]
if text == nil
text = 0
end
type_id = Refiner3::Minerios_id[1][i]
if type_id == 1
if $game_party.item_number($data_armors[Refiner3::Minerios_id[0][i]]) < text
@min_window.contents.font.color = @min_window.knockout_color
end
else
if type_id == 2
if $game_party.item_number($data_weapons[Refiner3::Minerios_id[0][i]]) < text
@min_window.contents.font.color = @min_window.knockout_color
end
else
if $game_party.item_number($data_items[Refiner3::Minerios_id[0][i]]) < text
@min_window.contents.font.color = @min_window.knockout_color
end
end
end
@min_window.contents.draw_text(x + 20, y, 80, 24, text.to_s)
end
end
def desactive_options
@troc = []
v1 = Refiner3::Grupos_tips[@grupo_window.index]
v2 = Refiner3::Grupos_arms[@grupo_window.index].size
for a in 0...v2
for i in 0...Refiner3::Minerios_id[0].size
v3 = Refiner3::Grupos_arms[@grupo_window.index][a]
v = Refiner3::Grupos_atr[v1][v3][i]
if v == nil
v = 0
end
type_id = Refiner3::Minerios_id[1][i]
if type_id == 1
if $game_party.item_number($data_armors[Refiner3::Minerios_id[0][i]]) < v
@equips_window.draw_item(a, false)
@troc[a] = false
end
else
if type_id == 2
if $game_party.item_number($data_weapons[Refiner3::Minerios_id[0][i]]) < v
@equips_window.draw_item(a, false)
@troc[a] = false
end
else
if $game_party.item_number($data_items[Refiner3::Minerios_id[0][i]]) < v
@equips_window.draw_item(a, false)
@troc[a] = false
end
end
end
end
end
@icon_window = Window_Icon.new
@icon_window.opacity = 0
troc_list
x = 0
y = -24
for i in 0...@groups_names[@grupo_window.index].size
y = y + 24
icon = @groups_icons[@grupo_window.index][i]
@icon_window.draw_icon(icon, x, y, @troc[i])
end
end
def trocar
if @troc[@equips_window.index] == false
Sound.play_cancel
@confirm_window.visible = true
@equips_window.active = false
else
@confirm_window.visible = true
@confirm_op_window.visible = true
@confirm_op_window.active = true
@equips_window.active = false
end
end
end
class Window_Confirm < Window_Base
def initialize
super (0, 0, 160, WLH * 2 + 32)
self.contents.draw_text(0, 0, 80, 24, "Confirm ?")
end
end
class Window_Icon < Window_Base
def initialize
super (170, 5, 100, WLH * 14 + 32)
end
end
class Window_Command2 < Window_Selectable
attr_reader:commands
def initialize(width, commands, column_max = 1, row_max = 0, spacing = 32)
if row_max == 0
row_max = (commands.size + column_max - 1) / column_max
end
super(0, 0, width, row_max * WLH + 32, spacing)
@commands = commands
@item_max = commands.size
@column_max = column_max
refresh
self.index = 0
end
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
def draw_item(index, enabled = true)
rect = item_rect(index)
rect.x += 30
rect.width -= 8
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(rect, @commands[index])
end
end

Put it before main.
Call the script with $scene = Scene_Refinar.new