Advertisement
Vlue

Set Guard/Attack

Aug 5th, 2012
3,454
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.89 KB | None | 0 0
  1. #Set Guard/Attack Skills v1.3
  2. #----------#
  3. #Features: Let's you set different attack/guard actions for individual actors
  4. #
  5. #Usage:    Placed in note tags of actors, weapons, armors, classes:
  6. #             <Attack_Id skill_id> - changes default attack
  7. #             <Guard_Id skill_id>  - changes default guard
  8. #
  9. #          Weapons/Armors overrides Classes overides Actors.
  10. #          
  11. #
  12. #----------#
  13. #-- Script by: V.M of D.T
  14. #
  15. #- Questions or comments can be:
  16. #    posted on the thread for the script
  17. #    given by email: sumptuaryspade@live.ca
  18. #    provided on facebook: http://www.facebook.com/DaimoniousTailsGames
  19. #
  20. #--- Free to use in any project, commercial or non-commercial, with credit given
  21. # - - Though a donation's always a nice way to say thank you~ (I also accept actual thank you's)
  22.  
  23. #Sets Attack/Guard commands to name of skill
  24. SGAS_COMMAND_TO_SKILL_NAME = true
  25.  
  26. class Game_Actor
  27.   def guard_skill_id
  28.     @equips.each do |item|
  29.       next unless item.object
  30.       return $1.to_i if item.object.note.upcase =~ /<GUARD_ID (\d+)>/
  31.     end
  32.     return $1.to_i if self.class.note.upcase =~ /<GUARD_ID (\d+)>/
  33.     actor.note.upcase =~ /<GUARD_ID (\d+)>/ ? $1.to_i : 2
  34.   end
  35.   def attack_skill_id
  36.     @equips.each do |item|
  37.       next unless item.object
  38.       return $1.to_i if item.object.note.upcase =~ /<ATTACK_ID (\d+)>/
  39.     end
  40.     return $1.to_i if self.class.note.upcase =~ /<ATTACK_ID (\d+)>/
  41.     actor.note.upcase =~ /<ATTACK_ID (\d+)>/ ? $1.to_i : 1
  42.   end
  43. end
  44.  
  45. class Window_ActorCommand
  46.   def add_attack_command
  47.     text = $data_skills[@actor.attack_skill_id].name if SGAS_COMMAND_TO_SKILL_NAME
  48.     add_command(text ? text : Vocab::attack, :attack, @actor.attack_usable?)
  49.   end
  50.   def add_guard_command
  51.     text = $data_skills[@actor.guard_skill_id].name if SGAS_COMMAND_TO_SKILL_NAME
  52.     add_command(text ? text : Vocab::guard, :guard, @actor.guard_usable?)
  53.   end
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement