tui có bài hướng dẫn này nè...không biết có giúp ích gì cho mấy ông không....
Restricting Skill Use with Weapons:
In RPG Maker 2000 and RPG Maker 2003, you could check the attribute box in the skill properties to give it elemental properties. In addition, weapons could also be given attributes (such as a sword attribute if it\'s a sword). Thus, if, for example, you checked the sword attribute on the skill properties, only characters who equipped a weapon with the sword attribute could use that skill.
Sounds all good right? Sorry, but this can't be done in RPG Maker XP without some scripting elements. I found the core of the information on the Alestian Story website, but I felt the need to convert it into English.
1. Set Up Attributes
On the below image, attributes have been separated into weapon (axe, sword, et cetera) and elemental attributes (fire, water, et cetera). This allows easy management.
2. Set Attributes to Skills and Weapons
Check the attribute the skills and weapons possess.
3. Set Up the Weapon Attribute Using a Script
Before we begin, it might be necessary to back up the scripts. Please read the RPG Maker XP RGSS section about backing up.
Set up the script editor and give a name. In this case, it seems to be called 'Weapon_Elements'. Now we must write a script so that the skill can recognize the equipped weapon's attribute.
CODE
# Attribute 1 - 10 are treated as a weapon attribute.
class Game_Actor < Game_Battler
def skill_can_use?(skill_id)
if not skill_learn?(skill_id)
return false
end
set = $data_skills[skill_id].element_set & [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
if set != [] and self.element_set & set == []
return false
end
return super
end
end
The above script makes the skills recognize weapon attribute ID001 to ID010 among the other attributes. Ofcourse, change the ID numbers of the weapon attributes as appropriate.
Here's what it should look like in the editor.
This ends the tutorial, but this was mostly only the set up progress. You would probably need to go into this further with the knowledge of scripting.