02-26-2010, 09:04 AM
Let's say you have a "Magic Shepter" as an enhanced weapon in the database with id= 45, and you give your party exactly one with the "Change Weapons..." event command. The system clones the weapon and gives the party a "Magic Shepter" with a new id, and, at the same time, sets an internal variable within the newly created weapon, the ref_id, with the value of the prototype weapon's id from which it was created.
Moreover, the new weapon is stored within the @enhanced_weapons array of the $game_party object.
Let's also assume that the two gems are enhancements for weapons (that is they are weapons too), with ids 61 and 62.
At this point a script can be used to test if a specific weapon enhanced has the two specified enhancements attached.
A call to this script can be used within a "Conditional Branch..." event command. On the fourth page, within the Script field, you just have to put change_to_key? as the condition. The rest is up to you.
You can do the same with armors of course. I guess you could want to set the scepter and the gems as accessories in the database...
Moreover, the new weapon is stored within the @enhanced_weapons array of the $game_party object.
Let's also assume that the two gems are enhancements for weapons (that is they are weapons too), with ids 61 and 62.
At this point a script can be used to test if a specific weapon enhanced has the two specified enhancements attached.
Code:
class Interpreter
def change_to_key?
result = false
for weapon in $game_party.enhanced_weapons
if weapon.ref_id == 45 # This is the "clone" of the Magic Shepter
if weapon.accessories.has_value?($data_weapons[61]) and weapon.accessories.has_value?($data_weapons[62])
return true
end
end
end
end
end
A call to this script can be used within a "Conditional Branch..." event command. On the fourth page, within the Script field, you just have to put change_to_key? as the condition. The rest is up to you.
You can do the same with armors of course. I guess you could want to set the scepter and the gems as accessories in the database...