Mundo Maker
¡Bienvenid@ a Mundo Maker!

¿Quieres aprender todo sobre el RPG Maker?



Regístrate y forma parte de Mundo Maker.
Conectarse

Recuperar mi contraseña

Temas importantes
----------------------------------------
Páginas con recursos RPG Maker
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
Afiliados
Estadísticas
Tenemos 3821 miembros registrados.
El último usuario registrado es MikeWasauski.

Nuestros miembros han publicado un total de 86310 mensajes en 12305 argumentos.

[RPG XP] Requerimientos de equipacion

Ver el tema anterior Ver el tema siguiente Ir abajo

[RPG XP] Requerimientos de equipacion

Mensaje por Khaizen el 2009-12-12, 11:16

Con este script tendrás que cumplir ciertos requisitos para poder usar determinadas armas. Así­ podrás hacer que, por ejemplo, sólo puedas equipar un arma si has alcanzado cierto nivel.

Autor: Fomar0153
Version: ???
Plataforma: RPG maker XP

SCRIPT

Código:

class Window_EquipItem < Window_Selectable

#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []

#ADDED
weapon_req = [
{'WEAPON'=>1,'LEVEL'=>1,'STR'=>60,'DEX'=>0,'INT'=>0,'AGL'=>0},
{'WEAPON'=>2,'LEVEL'=>6,'STR'=>90,'DEX'=>0,'INT'=>0,'AGL'=>0},
{'WEAPON'=>3,'LEVEL'=>11,'STR'=>120,'DEX'=>0,'INT'=>0,'AGL'=>0},
{'WEAPON'=>4,'LEVEL'=>16,'STR'=>150,'DEX'=>0,'INT'=>0,'AGL'=>0}
]

armour_req = [
{'ARMOUR'=>1,'LEVEL'=>1,'STR'=>0,'DEX'=>0,'INT'=>0,'AGL'=>0},
{'ARMOUR'=>2,'LEVEL'=>6,'STR'=>0,'DEX'=>0,'INT'=>0,'AGL'=>0},
{'ARMOUR'=>3,'LEVEL'=>11,'STR'=>0,'DEX'=>0,'INT'=>0,'AGL'=>0},
{'ARMOUR'=>4,'LEVEL'=>16,'STR'=>0,'DEX'=>0,'INT'=>0,'AGL'=>0}
]
#END OF ADDED

# Add equippable weapons
if @equip_type == 0
weapon_set = $data_classes[@actor.class_id].weapon_set
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)

#MODIFICATION

level_needed = 1
str_needed = 0
dex_needed = 0
int_needed = 0
agi_needed = 0

weapon_req.each do |weap_req|
if weap_req['WEAPON'] == i
level_needed = weap_req['LEVEL']
str_needed = weap_req['STR']
dex_needed = weap_req['DEX']
int_needed = weap_req['INT']
agi_needed = weap_req['AGL']
end
end

if (@actor.level >= level_needed) and ((@actor.str >= str_needed and @actor.dex >= dex_needed) and (@actor.int >= int_needed and @actor.agi >= agi_needed))
@data.push($data_weapons[i])
end


#END OF MODIFICATION

end
end
end

# Add equippable armor
if @equip_type != 0
armor_set = $data_classes[@actor.class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i)
if $data_armors[i].kind == @equip_type-1

#MODIFICATION

level_needed = 1
str_needed = 0
dex_needed = 0
int_needed = 0
agi_needed = 0

armour_req.each do |arm_req|

if arm_req['ARMOUR'] == i
level_needed = arm_req['LEVEL']
str_needed = arm_req['STR']
dex_needed = arm_req['DEX']
int_needed = arm_req['INT']
agi_needed = arm_req['AGL']
end
end

if (@actor.level >= level_needed) and ((@actor.str >= str_needed and @actor.dex >= dex_needed) and (@actor.int >= int_needed and @actor.agi >= agi_needed))
@data.push($data_armors[i])
end

#END OF MODIFICATION

end
end
end
end
# Add blank page
@data.push(nil)
# Make a bit map and draw all items
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max-1
draw_item(i)
end
end
end

Añade esto en Game_Actor o sobre Main si usas el script por defecto:

Código:

class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :styles # weapon styles they can use
#--------------------------------------------------------------------------
# * Setup
# actor_id : actor ID
#--------------------------------------------------------------------------
def setup(actor_id)
actor = $data_actors[actor_id]
@actor_id = actor_id
@name = actor.name
@character_name = actor.character_name
@character_hue = actor.character_hue
@battler_name = actor.battler_name
@battler_hue = actor.battler_hue
@class_id = actor.class_id
@weapon_id = actor.weapon_id
@armor1_id = actor.armor1_id
@armor2_id = actor.armor2_id
@armor3_id = actor.armor3_id
@armor4_id = actor.armor4_id
@level = actor.initial_level
@exp_list = Array.new(101)
make_exp_list
@exp = @exp_list[@level]
@skills = []
@hp = maxhp
@sp = maxsp
@states = []
@states_turn = {}
@maxhp_plus = 0
@maxsp_plus = 0
@str_plus = 0
@dex_plus = 0
@agi_plus = 0
@int_plus = 0
@styles = []
# Learn skill
for i in 1..@level
for j in $data_classes[@class_id].learnings
if j.level == i
learn_skill(j.skill_id)
end
end
end
# Update auto state
update_auto_state(nil, $data_armors[@armor1_id])
update_auto_state(nil, $data_armors[@armor2_id])
update_auto_state(nil, $data_armors[@armor3_id])
update_auto_state(nil, $data_armors[@armor4_id])
end
end

Y después la actualización de Window_Equip:

Código:

class Window_EquipItem < Window_Selectable

#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []

#ADDED
weapon_req = [
{'WEAPON'=>1,'LEVEL'=>1,'STR'=>60,'DEX'=>0,'INT'=>0,'AGL'=>0,'STYLE'=>"Sword"},
{'WEAPON'=>2,'LEVEL'=>6,'STR'=>90,'DEX'=>0,'INT'=>0,'AGL'=>0,'STYLE'=>"Sword"},
{'WEAPON'=>3,'LEVEL'=>11,'STR'=>120,'DEX'=>0,'INT'=>0,'AGL'=>0,'STYLE'=>"Sword"},
{'WEAPON'=>4,'LEVEL'=>16,'STR'=>150,'DEX'=>0,'INT'=>0,'AGL'=>0,'STYLE'=>"Sword"}
]

armour_req = [
{'ARMOUR'=>1,'LEVEL'=>1,'STR'=>0,'DEX'=>0,'INT'=>0,'AGL'=>0,'STYLE'=>nil},
{'ARMOUR'=>2,'LEVEL'=>6,'STR'=>0,'DEX'=>0,'INT'=>0,'AGL'=>0,'STYLE'=>nil},
{'ARMOUR'=>3,'LEVEL'=>11,'STR'=>0,'DEX'=>0,'INT'=>0,'AGL'=>0,'STYLE'=>nil},
{'ARMOUR'=>4,'LEVEL'=>16,'STR'=>0,'DEX'=>0,'INT'=>0,'AGL'=>0,'STYLE'=>"Shield"}
]
#END OF ADDED

# Add equippable weapons
if @equip_type == 0
weapon_set = $data_classes[@actor.class_id].weapon_set
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)

#MODIFICATION

level_needed = 1
str_needed = 0
dex_needed = 0
int_needed = 0
agi_needed = 0
style_needed = nil

weapon_req.each do |weap_req|
if weap_req['WEAPON'] == i
level_needed = weap_req['LEVEL']
str_needed = weap_req['STR']
dex_needed = weap_req['DEX']
int_needed = weap_req['INT']
agi_needed = weap_req['AGL']
style_needed = weap_req['STYLE']
end
end

if (@actor.level >= level_needed) and ((@actor.str >= str_needed and @actor.dex >= dex_needed) and (@actor.int >= int_needed and @actor.agi >= agi_needed))
if style_needed == nil
@data.push($data_weapons[i])
else
for j in 0...$game_actors[@actor.id].styles.size
if $game_actors[@actor.id].styles[j] == style_needed
@data.push($data_weapons[i])
end
end
end
end


#END OF MODIFICATION

end
end
end

# Add equippable armor
if @equip_type != 0
armor_set = $data_classes[@actor.class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i)
if $data_armors[i].kind == @equip_type-1

#MODIFICATION

level_needed = 1
str_needed = 0
dex_needed = 0
int_needed = 0
agi_needed = 0
style_needed = nil

armour_req.each do |arm_req|

if arm_req['ARMOUR'] == i
level_needed = arm_req['LEVEL']
str_needed = arm_req['STR']
dex_needed = arm_req['DEX']
int_needed = arm_req['INT']
agi_needed = arm_req['AGL']
style_needed = arm_req['STYLE']
end
end

if (@actor.level >= level_needed) and ((@actor.str >= str_needed and @actor.dex >= dex_needed) and (@actor.int >= int_needed and @actor.agi >= agi_needed))
if style_needed == nil
@data.push($data_armors[i])
else
for j in 0...$game_actors[@actor.id].styles.size
if $game_actors[@actor.id].styles[j] == style_needed
@data.push($data_armors[i])
end
end
end
end

#END OF MODIFICATION

end
end
end
end
# Add blank page
@data.push(nil)
# Make a bit map and draw all items
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max-1
draw_item(i)
end
end
end

INSTRUCCIONES

Colocar sobre Main. Ahora, donde dice:
Código:

{'WEAPON'=>1,'LEVEL'=>1,'STR'=>60,'DEX'=>0,'INT'=>0,'AGL'=>0}

- 'WEAPON' => 1: es la ID del arma en la base de datos.
- 'LEVEL' => 1: es el nivel necesario para usarla.
- 'STR'=>60,'DEX'=>0,'INT'=>0,'AGL'=>0: es la cantidad de cada uno de esos parámetros necesaria para usar el arma (Fuerza, Destreza, Agilidad...).

- Para añadir estilos usa:
Código:

$game_actors[i].styles.push("style")
Por ejemplo:
Código:

$game_actors[1].styles.push("Sword")

Nada más. Saludos, Khaizen
avatar
Khaizen
Principiante
Principiante

0/3

Créditos 1457

Gracias : 5

Volver arriba Ir abajo

Re: [RPG XP] Requerimientos de equipacion

Mensaje por Ribbu el 2009-12-12, 12:08

Vaya, la verdad es que le da un punto más de realidad al proyecto.

Al tener X parámetros puedes usar un equipamiento y otro, me gusta.

Si gue así.

_________________
¡DESCARGA ARRYN!
avatar
Ribbu
Administrador
Administrador



Créditos 10086

Gracias : 87

Volver arriba Ir abajo

Re: [RPG XP] Requerimientos de equipacion

Mensaje por orochii el 2009-12-12, 23:21

Umm interesante propuesta, es como lo típico de ver en los sandbox :D.
Excelente aporte Khaizen y felicidades a Fomar153 por el script.

Saludos,
Orochii Zouveleki
avatar
orochii
Reportero

0/3

Créditos 7473

Gracias : 370

Volver arriba Ir abajo

Re: [RPG XP] Requerimientos de equipacion

Mensaje por Contenido patrocinado


Contenido patrocinado


Volver arriba Ir abajo

Ver el tema anterior Ver el tema siguiente Volver arriba


Permisos de este foro:
No puedes responder a temas en este foro.