Checking if actor is in party:
$game_party.actors.include?($game_actors[actor_id])
Checking if battler uses a skill (In Scene_Battle 4)
#--------------------------------------------------------------------------
# * Make Skill Action Results
#--------------------------------------------------------------------------
def make_skill_action_result
if @active_battler.is_a?(Game_Actor)
# learn skill by @active_battler.current_action.skill_id
end
# ...
end
Syntax to learn a skill:
$game_actors[actor_id].learn_skill(skill_id)
This script should take care of everything:
module WatchAndLearn
Actors = []
Skills_That_Can_Be_Learned = []
Can_Learn_From_Enemies = false
end
class Scene_Battle
alias_method :seph_watchandlearn_scnbtl_msar, :make_skill_action_result
def make_skill_action_result
if @active_battler.is_a?(Game_Actor) || WatchAndLearn::Can_Learn_From_Enemies
skill_id = @active_battler.current_action.skill_id
if WatchAndLearn::Skills_That_Can_Be_Learned.include?(skill_id)
for actor in $game_party.actors
if WatchAndLearn::Actors.include?(actor.id)
actor.learn_skill(skill_id)
end
end
end
end
seph_watchandlearn_scnbtl_msar
end
end
Setup
Foe each actor that can learn skills from watching, add their actor ids to the Actors array:
- Example: Actor 3 & 5
For each skill that can be learned this way, add the skill id into the Skills_That_Can_Be_Learned list (as you did above)
Finally, if you can learn from enemies, make that line = true
Let me know how it works