Advertisement
Zetu

Z04 v1.03

Dec 18th, 2011
1,731
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.                             #======================#
  2.                             #  Z-Systems by: Zetu  #
  3. #===========================#======================#===========================#
  4. #           *  *  *  Z04 Executable Actions Extention v1.03  *  *  *           #
  5. #=#==========================================================================#=#
  6.   #  Add regular expression NOCONDITIONAL into any skill to make it appear   #
  7.   #  in the Window_ActorCommand, instead of Window_SkillList.  All commands  #
  8.   #  will be placed where :exact is inside the CMDS array, unless you place  #
  9.   #  :skillid, <skill.id> where you wish for it to be instead.               #
  10.   #==========================================================================#
  11. module Z04
  12.     CMDS = [
  13.         :attack,
  14.         :exact,
  15.         :skill,
  16.         :guard,
  17.         :skillid, 5,
  18.         :item
  19.     ]
  20.   NOCONDITION = /<exact>/i
  21.   CONDITIONAL = /<exact[:]*\s*(\d+)>/i
  22. #========#======================#====#================================#========#
  23. #--------#                      #----# DO NOT EDIT PAST THIS POINT!!! #--------#
  24. #--------# End of Customization #----# Editing will cause death by    #--------#
  25. #--------#                      #----# brain asplosions.              #--------#
  26. #========#======================#====#================================#========#
  27. end
  28.  
  29. class Window_ActorCommand < Window_Command
  30.     attr_reader :skillsincmd
  31.     def make_command_list
  32.         return unless @actor
  33.         index=0
  34.         while index<Z04::CMDS.size
  35.             case Z04::CMDS[index]
  36.             when :attack;  add_attack_command
  37.             when :skill;   add_skill_commands
  38.             when :guard;   add_guard_command
  39.             when :item;    add_item_command
  40.             when :skillid; add_skill_command_by_id(Z04::CMDS[index+1]); index +=1
  41.             when :exact;   add_noninclusive_skill_commands
  42.             end
  43.             index+=1
  44.         end
  45.     end
  46.    
  47.     def add_noninclusive_skill_commands
  48.         for skill in @actor.skills
  49.             add_skill_exact(skill) unless Z04::CMDS.include?(skill.id)
  50.         end
  51.     end
  52.    
  53.     def add_skill_command_by_id(id)
  54.         add_skill_exact($data_skills[id])
  55.     end
  56.  
  57.     def add_skill_exact(skill)
  58.         return unless skill.command_condition_met?
  59.         add_command(skill.name, :exactskill, @actor.skill_conditions_met?(skill),
  60.         skill.id)
  61.     end
  62.    
  63. end
  64.  
  65. class Scene_Battle < Scene_Base
  66.    
  67.     def skill_exact
  68.         @skill = $data_skills[@actor_command_window.current_ext]
  69.         BattleManager.actor.input.set_skill(@skill.id)
  70.         BattleManager.actor.last_skill.object = @skill
  71.         if !@skill.need_selection?
  72.             next_command
  73.         elsif @skill.for_opponent?
  74.             select_enemy_selection
  75.         else
  76.             select_actor_selection
  77.         end
  78.     end
  79.    
  80.     alias z04cacw create_actor_command_window unless $@
  81.     def create_actor_command_window
  82.         z04cacw
  83.         @actor_command_window.set_handler(:exactskill, method(:skill_exact))
  84.     end
  85.    
  86. end
  87.  
  88. class Window_BattleSkill < Window_SkillList
  89.     def include?(item)
  90.         (item && item.stype_id == @stype_id) and not item.command?
  91.     end
  92. end
  93.  
  94. class RPG::Skill < RPG::UsableItem
  95.     def command?
  96.         self.note.scan(Z04::NOCONDITION){return true}
  97.         self.note.scan(Z04::CONDITIONAL){return true}
  98.     return false
  99.     end
  100.    
  101.     def command_condition_met?
  102.         self.note.scan(Z04::CONDITIONAL){return false unless $game_switches[$1.to_i]}
  103.         return command?
  104.     end
  105.    
  106. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement