Advertisement
diamondandplatinum3

Transform Enemies based on Variables ~ RGSS2

Oct 1st, 2012
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.43 KB | None | 0 0
  1. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  2. #             Transform Enemies based on Variables
  3. #             Version: 1.0
  4. #             Author: DiamondandPlatinum3
  5. #             Date: September 25, 2012
  6. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  7. #  Description:
  8. #
  9. #    This script allows you to use multiple variables to differentiate when
  10. #    an enemy transforms. The usual method is quite heavy on Game Switches if
  11. #    you wish to use it that way, so this alternative has been created.
  12. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  13. #------------------------------------------------------------------------------
  14. #  Instructions:
  15. #    
  16. #     ~  In your Enemy noteboxes input these codes
  17. #           ~TransVarID: ?
  18. #           ~TransReqAmount: ?
  19. #           ~TransNextEnemyID: ?
  20. #           ~TransBattleAnimID: ?
  21. #
  22. #        Replacing the ?'s with a number.
  23. #
  24. #
  25. #         ~TransVarID         = The Variable ID you want to check
  26. #         ~TransReqAmount    = The Required Amount (or above) that the Variable must hold for the conditions to be met
  27. #         ~TransNextEnemyID  = The ID of the enemy you want this enemy to transform into
  28. #         ~TransBattleAnimID = The ID of the Battle Animation you want to see when this enemy transforms (this is not required)
  29. #
  30. #
  31. #        A Visual Explanation can be found
  32. #        Here: http://img4host.net/upload/242013385060a2d2f1c7c.png
  33. #
  34. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  35. #
  36. #
  37. #                  THERE IS NO EDITABLE REGION TO THIS SCRIPT
  38. #
  39. #==============================================================================
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51. class Scene_Battle < Scene_Base
  52.   #--------------------------------------------------------------------------
  53.   # * Basic Update Processing
  54.   #     main : Call from main update method
  55.   #--------------------------------------------------------------------------
  56.   alias dp3_enemynote_transformchecker_ojne832 update_basic
  57.   def update_basic(main = false)
  58.     # Call Original Method
  59.     dp3_enemynote_transformchecker_ojne832(main)
  60.    
  61.     # Call New Function
  62.     dp3_check_enemy_note_for_transform_commands
  63.   end
  64.   #--------------------------------------------------------------------------
  65.   # * Check Enemy Note For Transform Commands
  66.   #--------------------------------------------------------------------------
  67.   def dp3_check_enemy_note_for_transform_commands
  68.     $game_troop.members.each do |game_enemy|
  69.       note = $data_enemies[game_enemy.enemy_id].note
  70.    
  71.       var_id                  = nil
  72.       amount_req              = nil
  73.       transform_id            = nil
  74.       tranform_battle_anim_id = nil
  75.    
  76.      
  77.       note[/~TransVarID: ([-0-9]+)/]
  78.       var_id = $1.to_i if $1
  79.      
  80.       note[/~TransReqAmount: ([-0-9]+)/]
  81.       amount_req = $1.to_i if $1
  82.      
  83.       note[/~TransNextEnemyID: ([-0-9]+)/]
  84.       transform_id = $1.to_i if $1
  85.      
  86.       note[/~TransBattleAnimID: ([-0-9]+)/]
  87.       tranform_battle_anim_id = $1.to_i if $1
  88.      
  89.      
  90.       if var_id && amount_req && transform_id
  91.         if $game_variables[var_id] >= amount_req
  92.           game_enemy.animation_id = tranform_battle_anim_id if tranform_battle_anim_id
  93.           game_enemy.transform(transform_id)
  94.         end # if $game_variables
  95.       end # If not nil
  96.     end # Loop
  97.   end # Function
  98. end # Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement