[VX] Aprender habilidad/hechizo cuando nos equipamos algo

OP
Mensajes
134
Reacciones
0
Puntos
0
¿Otra vez este? pues si, hoy me estoy poniendo las pilas en postear los mejores script para mis gustos.
Esta vez vengo con un script que permite aprender habilidades o conjuros cuando nos equipamos algo, y ademas
tambien puedes añadirle restriccion de niveles.
NOTA: Las habilidades desaparecen cuando desequipamos el arma u otro objeto.

-Nombre Del Script: Skill Teaching Equipment & Items

-Versión Del Script: 2.0b

-Rpg Maker: VX

-Introducción:Este script permite aprender hechizos cuando tenemos un arma equipada.

-Características: Esta nueva version incluye restrincion de niveles, muy útil en diversos casos

-Demo: No es necesario

-ScreenShot: tampoco

-Script: #==============================================================================
# Skill Teaching Equipment & Items
# Version 2.0b
# Author: modern algebra (rmrk.net)
# Date: February 20, 2010
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Instructions:
# Insert this script just above Main.
#
# To configure this script, merely go into the item, weapon, or armor in the
# database. In the Notes Field, put in this code:
#
# \ls[skill_id, level_min]
#
# where skill_id is the ID of the skill you want the item to teach and
# level_min is optional and makes it so that the skill the item teaches
# is only taught if the actor is at least that level. If it's left blank,
# it is assumed that there is no level requirement.
#
# You can put in as many of these as you like, so if, for example, an item
# has this in it's notes:
#
# \ls[5]
# \ls[8, 7]
#
# Then that item would teach skill 5 no matter what level the actor is, and
# once the actor reaches level 7 will teach skill 8. The script will take
# every instance of that code regardless of what else is in the Note Field
#==============================================================================
# ** RPG::BaseItem
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# new method - skill_ids
#==============================================================================

class RPG::BaseItem
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Skill IDs
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def skill_ids
# Only works for Item, Weapon, and Armor
return if self.class == RPG::Skill
learn_skills = []
# Dissect Note
text = self.note.dup
while text[/\\ls\[(\w+),*\s*(\d*?)\]/i] != nil
text.sub! (/\\ls\[(\w+),*\s*(\d*?)\]/i) { '' }
learn_skills.push ([$1.to_i, $2.to_i])
end
return learn_skills
end
end

#==============================================================================
# ** Game_Actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# aliased methods - change_equip, setup, level_up
#==============================================================================

class Game_Actor < Game_Battler
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Change Equipment
# equip_type : type of equipment
# id : weapon or armor ID (If 0, remove equipment)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias ma_skill_teaching_items_equipment_change change_equip
def change_equip (equip_type, item, test = false)
unless test
last_item = equips[equip_type]
# Forget the skills from what was previously equipped
skill_ids = last_item.nil? ? [] : last_item.skill_ids
skill_ids.each { |skill_id|
forget_skill (skill_id[0]) if @unnatural_skills.include? (skill_id[0])
@unnatural_skills.delete (skill_id[0])
}
end
# Run original method
ma_skill_teaching_items_equipment_change (equip_type, item, test)
unless test
last_item = equips[equip_type]
# Learn the skills from current_equipment
skill_ids = last_item.nil? ? [] : last_item.skill_ids
skill_ids.each { |skill_id|
unless skill_learn? ($data_skills[skill_id[0]]) || self.level < skill_id[1]
@unnatural_learning = true
learn_skill (skill_id[0])
@unnatural_learning = false
end
}
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Setup
# actor_id : actor ID
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias ma_skill_teaching_items_actor_setup setup
def setup (actor_id)
@unnatural_skills = []
# Run original method
ma_skill_teaching_items_actor_setup (actor_id)
for item in equips
next if item.nil?
item.skill_ids.each { |skill_id|
next if skill_learn? ($data_skills[skill_id[0]]) || self.level < skill_id[1]
@unnatural_learning = true
learn_skill (skill_id[0])
@unnatural_learning = false
}
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Level Up
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_skl_teacher_equip_actor_lvlup level_up
def level_up
modalg_skl_teacher_equip_actor_lvlup
# Check Equipment and learn skills if not already learned
equips.each { |item|
next if item == nil
item.skill_ids.each { |skill_id|
unless skill_learn? ($data_skills[skill_id[0]]) || self.level < skill_id[1]
@unnatural_learning = true
learn_skill (skill_id[0])
@unnatural_learning = false
end
}
}
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Learn Skill
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias ma_lrnskll_eqpmnt_8ik2 learn_skill
def learn_skill (skill_id, *args)
if @unnatural_learning
@unnatural_skills.push (skill_id) unless @unnatural_skills.include? (skill_id)
elsif skill_learn? (skill_id)
@unnatural_skills.delete (skill_id)
end
ma_lrnskll_eqpmnt_8ik2 (skill_id, *args)
end
end

#==============================================================================
# ** Game_Battler (Skill Teaching modification)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# aliased methods - item_test, item_effect
#==============================================================================

class Game_Battler
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Item Test
# user : person using item
# item : the item being used
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias ma_skill_teaching_items_test_item item_test
def item_test (user, item)
effective = ma_skill_teaching_items_test_item (user, item)
if self.class != Game_Enemy
item.skill_ids.each { |skill_id|
effective |= !skill_learn? ($data_skills[skill_id[0]]) && self.level > skill_id[1]
}
end
return effective
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Application of Item Effects
# item : item
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias ma_skill_teaching_items_effect_item item_effect
def item_effect (user, item)
# Run original method
ma_skill_teaching_items_effect_item (user, item)
item.skill_ids.each { |skill_id|
learn_skill (skill_id[0]) if self.class != Game_Enemy && self.level > skill_id[1]
}
end
end

-Instrucciones: C&P. Para poner las tecs, poner esto es notas de el equipable:
\ls[ID de la habilidad, Nivel mínimo]

-Compatibilidad:Creo que funciona con todo

-Créditos: modern algebra

-Créditos menores: a un servidor ^.^


Espero que les guste este script tanto como ami me gusta el Dragon quest XD

Saludos y buen dia
 
Arriba Pie