sorry to say, but this is an incredibly inefficient method of achieving what you're after.
Whether you do it as individual events on maps or as a common event, you're telling the game to check
every frame whether the player has a weapon equipped (not whether the player has
changed equipment), and if the weapon is equipped, you're telling it
every frame to forget and learn a list of skills. If the player has had that weapon equipped for the last 15 minutes, they are still forgetting and learning that same list of skills every frame.
I suspect you're going to see a LOT of lag due to this.
You need to change the skills at the same time you change the equipment. Once. That's it.
Here's a change to the Game_Actor script that will handle this very nicely (assuming the weapon id for sword is 1, and for gun is 2, and the skill id for double slash is 15, and for burst fire is 12):
def equip(equip_type, id)
case equip_type
when 0 # Weapon
if id == 0 or $game_party.weapon_number(id) > 0
change_weapon_skills(id) # Shaz - added to forget/learn skills when weapon is changed
$game_party.gain_weapon(@weapon_id, 1)
@weapon_id = id
$game_party.lose_weapon(id, 1)
end
.
.
end
end
# Shaz - new function to forget and learn skills based on equipped weapon
def change_weapon_skills(id)
# forget the skill for the current weapon
case @weapon_id
when 1 # Sword
forget_skill(15) # Double Slash
when 2 # Gun
forget_skill(12) # Burst Fire
end
# Learn skill for new weapon
case id
when 1 # Sword
learn_skill(15) # Double Slash
when 2 # Gun
learn_skill(12) # Burst Fire
end
end
This will also work if the player currently has no weapon equipped, or if they are simply unequipping a weapon without replacing it with something else.
If you intend to give the player one of these special weapons right at the start of the game (through default equipment in the Actors tab), you should also change the Game_Actor setup function, and call
change_weapon_skills(@weapon_id) after the line
@weapon_id = actor.weapon_id