Advertisement
TheSixth

Custom Enemy Placement by Sixth

Sep 2nd, 2015
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 8.46 KB | None | 0 0
  1. #===============================================================================
  2. # * [ACE] Custom Enemy Placement
  3. #===============================================================================
  4. # * Made by: Sixth (www.rpgmakervxace.net, www.forums.rpgmakerweb.com)
  5. # * Version: 1.0
  6. # * Updated: 25/01/2015
  7. # * Requires: -------
  8. #-------------------------------------------------------------------------------
  9. # * < Change Log >
  10. #-------------------------------------------------------------------------------
  11. # * Version 1.0 (25/01/2015)
  12. #   - Initial release.
  13. #-------------------------------------------------------------------------------
  14. # * < Description >
  15. #-------------------------------------------------------------------------------
  16. # * This script adds new ways to setup the position of your enemies in battle.
  17. #   - You can set the X and Y position of the enemy directly.
  18. #   - You can make offset values to the default position of the enemy.
  19. #   - Includes Yanly's and Tsukihime's methods of calculating the enemy's position.
  20. #   - And for completion's sake, includes the default placement type.
  21. # * Works in battle test mode, so you can quickly edit the positions of the
  22. #   enemies!
  23. #-------------------------------------------------------------------------------
  24. # * < Installation >
  25. #-------------------------------------------------------------------------------
  26. # * Place this script below Materials but above Main!
  27. # * If you are using Yanfly's Core Engine script, place this script below it!
  28. # * If you are using Dekita's Core script, place this script below it!
  29. # * If you are using Tsukihime's Battle Sprites Auto-Position script, don't
  30. #   use it, it is not necessary with this script! Or don't use this one...
  31. #-------------------------------------------------------------------------------
  32. # * < Compatibility Info >
  33. #-------------------------------------------------------------------------------
  34. # * Won't work with ABS systems... No kidding, ehh? :P
  35. #-------------------------------------------------------------------------------
  36. # * < Known Issues >
  37. #-------------------------------------------------------------------------------
  38. # * No known issues.
  39. #-------------------------------------------------------------------------------
  40. # * < Terms of Use >
  41. #-------------------------------------------------------------------------------
  42. # * Free to use for whatever purposes you want.
  43. # * You can credit me (Sixth) in your game, thought this was too easy to ask
  44. #   credit for, so it is your choice... :P
  45. # * Posting modified versions of this script is allowed as long as you notice me
  46. #   about it with a link to it!
  47. #===============================================================================
  48. $imported = {} if $imported.nil?
  49. $imported["SixthEnemyPlacement"] = true
  50. module Sixth_Enemy_Placement
  51. #===============================================================================
  52. # Settings:
  53. #===============================================================================
  54.   # Setup the type of the placement used for enemies.
  55.   # Several options are available:
  56.   #  :direct = If you choose this, the co-ordinates entered in the below settings
  57.   #            will be the direct positions for the enemies in battle.
  58.   #  :offset = If you choose this, the co-ordinates entered in the below settings
  59.   #            will be offset values for the positions of the enemies in battle.
  60.   #            Meaning the values will be added to the default enemy positions.
  61.   #  :yanfly = This type will use Yanfly's method to calculate the enemy position.
  62.   #            Yanfly's Core Engine has this method.
  63.   #  :tsuki  = This type will use Tsukihime's method to calculate the enemy
  64.   #            position. I guess this method is used in his troop reposition
  65.   #            script. I never used it, so I can't know. :P
  66.   # :default = RPG Maker VX Ace's default position type.
  67.   Placement_Type = :direct
  68.  
  69.   # The new position settings.
  70.   # You can setup the positions of the enemies in battle here.
  71.   # All troop must have a setting here and all enemies in the troop must have a
  72.   # value set up for their position too!
  73.   # These settings work only if you have set the above setting to
  74.   # :direct or :offset!
  75.   # The sample settings are the default positions of the enemies for the 30
  76.   # default troops setup in the database.
  77.   #
  78.   # Format:
  79.   #
  80.   #   troop_id => { enemy_index => [x,y], enemy_index => [x,y], ... },
  81.   #
  82.   # troop_id    = The ID of the troop, obviously. Starts from 1.
  83.   # enemy_index = The index of the enemies in the troop.
  84.   #               The index starts from 0. The first enemy placed in the troop
  85.   #               got the ID of 0, the second one got the ID of 1, the third one
  86.   #               got the ID of 2, and so on...
  87.   #       [x,y] = The X and Y position for the enemy measured in pixels.
  88.   #               If you set the above setting to :direct, than this will be the
  89.   #               direct position for the enemies.
  90.   #               If you set the above setting to :offset, than this will be an
  91.   #               offset value and will be added to the enemy's default X and Y
  92.   #               position.
  93.   #               The X position defines the position of the horizontal center
  94.   #               of the battler's image, and the Y position defines the bottom
  95.   #               position of the battler's image on the screen!
  96.   Setup_Pos = { # <-- No touchy-touchy!
  97.     1 => { 0 => [196,288], 1 => [348,288] },
  98.     2 => { 0 => [207,288], 1 => [337,288] },
  99.     3 => { 0 => [227,288], 1 => [317,288] },
  100.     4 => { 0 => [112,288], 1 => [272,288], 2 => [432,288] },
  101.     5 => { 0 => [154,288], 1 => [272,288], 2 => [390,288] },
  102.     6 => { 0 => [110,288], 1 => [272,288], 2 => [434,288] },
  103.     7 => { 0 => [170,288], 1 => [374,288] },
  104.     8 => { 0 => [105,288], 1 => [272,288], 2 => [439,288] },
  105.     9 => { 0 => [183,288], 1 => [361,288] },
  106.    10 => { 0 => [101,288], 1 => [272,288], 2 => [443,288] },
  107.    11 => { 0 => [146,288], 1 => [272,288], 2 => [398,288] },
  108.    12 => { 0 => [181,288], 1 => [363,288] },
  109.    13 => { 0 => [136,288], 1 => [272,288], 2 => [408,288] },
  110.    14 => { 0 => [201,288], 1 => [343,288] },
  111.    15 => { 0 => [112,288], 1 => [272,288], 2 => [432,288] },
  112.    16 => { 0 => [233,288], 1 => [321,288] },
  113.    17 => { 0 => [160,288], 1 => [272,288], 2 => [384,288] },
  114.    18 => { 0 => [171,288], 1 => [373,288] },
  115.    19 => { 0 => [272,288] },
  116.    20 => { 0 => [272,288] },
  117.    21 => { 0 => [183,288], 1 => [361,288] },
  118.    22 => { 0 => [149,288], 1 => [395,288] },
  119.    23 => { 0 => [272,288] },
  120.    24 => { 0 => [156,288], 1 => [388,288] },
  121.    25 => { 0 => [272,288] },
  122.    26 => { 0 => [272,288] },
  123.    27 => { 0 => [272,288] },
  124.    28 => { 0 => [272,288] },
  125.    29 => { 0 => [272,288] },
  126.    30 => { 0 => [272,288] },
  127.     # Add as many as you want!
  128.   } # <-- No touchy-touchy!
  129.  
  130. end # <-- No touchy-touchy!
  131. #===============================================================================
  132. # End of Settings! Editing anything below may lead to... You know what, right?
  133. #===============================================================================
  134.  
  135. class Game_Troop < Game_Unit
  136.  
  137.   def setup(troop_id)
  138.     clear
  139.     @troop_id = troop_id
  140.     @pos = Sixth_Enemy_Placement::Setup_Pos[@troop_id]
  141.     @enemies = []
  142.     troop.members.each_with_index do |member,i|
  143.       next unless $data_enemies[member.enemy_id]
  144.       enemy = Game_Enemy.new(@enemies.size, member.enemy_id)
  145.       enemy.hide if member.hidden
  146.       if Sixth_Enemy_Placement::Placement_Type == :direct
  147.         enemy.screen_x = @pos[i][0]
  148.         enemy.screen_y = @pos[i][1]
  149.       elsif Sixth_Enemy_Placement::Placement_Type == :offset
  150.         enemy.screen_x = member.x + @pos[i][0]
  151.         enemy.screen_y = member.y + @pos[i][1]
  152.       elsif Sixth_Enemy_Placement::Placement_Type == :yanfly
  153.         enemy.screen_x = member.x + (Graphics.width - 544)/2
  154.         enemy.screen_y = member.y + (Graphics.height - 416)
  155.       elsif Sixth_Enemy_Placement::Placement_Type == :tsuki
  156.         enemy.screen_x = member.x * Graphics.width / 544.0
  157.         enemy.screen_y = member.y * Graphics.height / 416.0
  158.       else
  159.         enemy.screen_x = member.x
  160.         enemy.screen_y = member.y
  161.       end
  162.       @enemies.push(enemy)
  163.     end
  164.     init_screen_tone
  165.     make_unique_names
  166.   end
  167.  
  168. end
  169. #==============================================================================
  170. # !!END OF SCRIPT - OHH, NOES!!
  171. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement