Advertisement
TheSixth

Direction Based Animations for Falcao's ABS by Sixth

Sep 2nd, 2015
647
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 27.41 KB | None | 0 0
  1. #===============================================================================
  2. # * [ACE] Direction Based Animations for Falcao's Pearl ABS Liquid v3
  3. #===============================================================================
  4. # * Made by: Sixth (www.rpgmakervxace.net, www.forums.rpgmakerweb.com)
  5. # * Version: 1.1
  6. # * Updated: 02/09/2015
  7. # * Requires: Falcao's Pearl ABS Liquid v3
  8. #-------------------------------------------------------------------------------
  9. # * < Change Log >
  10. #-------------------------------------------------------------------------------
  11. # * Version 1.0 (09/08/2015)
  12. #   - Initial release.
  13. # * Version 1.1 (02/09/2015)
  14. #   - Added zoom options (separate width and height zoom levels).
  15. #   - Added fully direction based animations. Now you can play an entirely
  16. #     different animation depending on the direction of the tools.
  17. #-------------------------------------------------------------------------------
  18. # * < Description >
  19. #-------------------------------------------------------------------------------
  20. # * Falcao surely provided many ways of making your tool animations.
  21. #   One of the options is to use the animated iconset version.
  22. #   But that one will not really work with non-symmetric icons, such as axes
  23. #   or scythes. Also some weapons should use a thrusting animation and not a
  24. #   swing animation, such as spears, for example.
  25. #   With this script, you can make thrust animations, or animations for
  26. #   non-symmetric weapons too. And you can even make a separate icon animation
  27. #   for each of your tools if you want.
  28. #   All of this is done without any graphic editing program! The only thing you
  29. #   need to do is to make your custom animation frames in the setting and
  30. #   tag your tools with the provided (already built-in) note-tag!
  31. # * The sample settings include the default icon animation (if you would simply
  32. #   tag the tool as "User Iconset = animated", this icon animation would be
  33. #   played) which is perfectly suitable for symmetric weapons, a setup for
  34. #   non-symmetric weapons, and a thrusting icon animation.
  35. # * All of the old note-tags will still work!
  36. # * Another bummer is that non-symmetric animations (real ones from the database)
  37. #   can not be used in this ABS. It simply looks bad if a sword leaves the same
  38. #   slash after-effects when it is swung from the left to right, and when it is
  39. #   swung from right to left, right?
  40. #   Well, in case you wanted to add cool effects for your weapons, you can now
  41. #   do it! A flaming sword which really burns opponents and shows real flame
  42. #   effects upon usage in a way that is visually appealing! How about that? :P
  43. #   In short, you can now make direction based animations too! Yay!
  44. # * From v1.1 you can use an entirely different animation for each directions!
  45. #-------------------------------------------------------------------------------
  46. # * < Note-tags >
  47. #-------------------------------------------------------------------------------
  48. # * To use your custom icon animations, you can use the following note-tag:
  49. #
  50. #     User Iconset = animation_key *or* Projectile Iconset = animation_key
  51. #
  52. #   Yeah, the same note-tag as Falcao provided, but from now on, you can use
  53. #   your custom animation keys with it, so you got a more flexible version.
  54. #   Simply replace the 'animation_key' with one of your custom animation setup's
  55. #   key from the module settings.
  56. #
  57. #   Examples: User Iconset = sword / User Iconset = axe / User Iconset = spear
  58. #
  59. #   You can use this note-tag on all of your tools.
  60. #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  61. # * To set a tool's animation based on it's direction, use this note-tag:
  62. #
  63. #     <dir anim: DOWN, LEFT, RIGHT, UP>
  64. #
  65. #   Replace the directions above with the ID of the animation to be played when
  66. #   the tool is in those directions.
  67. #   The tool's direction is based on the user's direction at the time of using
  68. #   the tool in most cases. The exceptions are the "autotarget", "random" and
  69. #   "common event ID" note-tagged tools, these can move freely on the map.
  70. #   This feature only supports 4 directions (no diagonals)!
  71. #
  72. #   Examples:
  73. #    
  74. #     <dir anim: 12, 46, 28, 17>
  75. #
  76. #   The tool will use the following animations:
  77. #   When it's direction is down, it uses the 12th animation from the database,
  78. #   when it's direction is left, it uses the 46th animation, when it's
  79. #   direction is right, it uses the 28th animation, and when it's direction is
  80. #   up, it uses the 17th animation from the database.
  81. #-------------------------------------------------------------------------------
  82. # * < Installation >
  83. #-------------------------------------------------------------------------------
  84. # * Place this script below all of Falcao's ABS scripts but above Main!
  85. #-------------------------------------------------------------------------------
  86. # * < Compatibility Info >
  87. #-------------------------------------------------------------------------------
  88. # * No known incompatibilities.
  89. #-------------------------------------------------------------------------------
  90. # * < Known Issues >
  91. #-------------------------------------------------------------------------------
  92. # * No known issues.
  93. #-------------------------------------------------------------------------------
  94. # * < Terms of Use >
  95. #-------------------------------------------------------------------------------
  96. # * Free to use for whatever purposes you want.
  97. # * Credit me (Sixth) in your game, pretty please! :P
  98. # * Posting modified versions of this script is allowed as long as you notice me
  99. #   about it with a link to it!
  100. #===============================================================================
  101. $imported = {} if $imported.nil?
  102. $imported["SixthABSAnimEX"] = true
  103. #===============================================================================
  104. # Settings:
  105. #===============================================================================
  106. module ABSAnimEX
  107.   #-----------------------------------------------------------------------------
  108.   # Custom Icon Animation Settings
  109.   #-----------------------------------------------------------------------------
  110.   # This is the place where you can make your own icon animations.
  111.   # It might be confusing at first (it was confusing for me, at least :P), but
  112.   # if you examine the sample settings in the game and read the explanation
  113.   # here, you should have no problem making your own icon animations.
  114.   #
  115.   # Format:
  116.   #
  117.   #   "animation_key" => {
  118.   #     direction => {
  119.   #       0 => { :x => val, :y => val, :a => val, :z => val, :m => true/false, :zx => val, :zy => val },
  120.   #       1 => { :x => val, :y => val, :a => val, :z => val, :m => true/false, :zx => val, :zy => val },
  121.   #       2 => { :x => val, :y => val, :a => val, :z => val, :m => true/false, :zx => val, :zy => val },
  122.   #     },
  123.   #     # 3 more hashes go here with the same format, but different direction!
  124.   #   },
  125.   #
  126.   # So, what do we have here?
  127.   #
  128.   # "animation_key" = This is the identifier/key of the animation setting.
  129.   #                   You use this in your note-tags! Must be a string!
  130.   #
  131.   # direction = The direction of the user. You must set up all 4 directions!
  132.   #             2 = Down, 4 = Left, 6 = Right, 8 = Up.
  133.   #             When the user is facing up, the setting with the direction of 8
  134.   #             will be used on tool usage, when the user is facing left, the
  135.   #             direction of 4 will be used from the settings, and so on!
  136.   #
  137.   # Each direction setting got 3 frames! These are numbered 0, 1 and 2!
  138.   # Each direction setting must have a setup for each frames!
  139.   # These frames will be shown in order when the tool is used.
  140.   # That will be the actual iconset animation, just 3 simple frame settings.
  141.   # Let's see each of the settings for the frames:
  142.   #
  143.   # :x = The X offset for the icon graphic. Positive numbers move the icon right
  144.   #      on the screen, while negative ones will move it left.
  145.   #      It is relative to the user's X position on the screen!
  146.   #      Measured in pixels!
  147.   # :y = The Y offset for the icon graphic. Positive numbers move the icon down
  148.   #      on the screen, while negative ones will move it up.
  149.   #      It is relative to the user's Y position on the screen!
  150.   #      Measured in pixels!
  151.   # :a = The angle of the icon graphic. Use this to rotate the icon.
  152.   #      Use positive numbers to rotate the icon counterclockwise, or use
  153.   #      negative numbers to rotate the icon clockwise.
  154.   # :z = The Z value to be added for the icon graphic. The default value is
  155.   #      always the user's Z value. The value you set up here will be added
  156.   #      on that one! -1 makes the icon be behind the user.
  157.   #      Note that each frame will reset the Z value to the default, so if you
  158.   #      want all of your frames to be displayed behind the user, for example,
  159.   #      you must set this to -1 for all of your frames!
  160.   # :m = The mirror flag of the icon graphic. If you set this to true, the
  161.   #      icon will be flipped horizontally. If it is false, it will not be
  162.   #      flipped. This is the only way to design a working icon animation for
  163.   #      non-symmetric icons, such as axes, scythes, or curved swords, etc.
  164.   # :zx = The zoom level on the X axis for the icon. 1.0 is the default value.
  165.   #       Higher numbers will make the icon bigger in width, while lower values
  166.   #       will make it smaller in width. You can omit this setting if you don't
  167.   #       need it.
  168.   # :zy = Same as :zx, but this one is on the Y axis and manipulates the icon's
  169.   #       height. You can omit this one too if you don't need it.
  170.   #
  171.   # Now that you know what these settings mean, you can start to make your own
  172.   # icon animations!
  173.   # The sample settings are made for icons which are positioned this way on the
  174.   # iconset:
  175.   #
  176.   #   \\        Excuse the crappy ASCI drawing, it's meant to be a sword! :P
  177.   #    \\       So, they are placed between the top-left corner and bottom-right
  178.   #     \\      corner, rotated ~45 degrees.
  179.   #      \\     If you have some icons placed differently on the iconset, you
  180.   #     ------  will need to make new animation settings for them!
  181.   #        \\  
  182.   #-----------------------------------------------------------------------------
  183.   IconAnims = {
  184.     "sword" => { # The default, same as Falcao's "animated" icon animation
  185.       2 => { # User facing down
  186.         0 => { :x => 10, :y => -12, :a => -166, :z => 0, :m => false }, # 1st frame
  187.         1 => { :x => 8, :y => -5, :a => -210, :z => 0, :m => false }, # 2nd frame
  188.         2 => { :x => 0, :y =>  0, :a => -266, :z => 0, :m => false }, # 3rd frame
  189.       },
  190.       4 => { # User facing left
  191.         0 => { :x => -8,  :y => -26, :a => -46, :z => -1, :m => false },
  192.         1 => { :x => -20,  :y => -10, :a => 12, :z => -1, :m => false },
  193.         2 => { :x => -10, :y => 2, :a => 52, :z => -1, :m => false },
  194.       },
  195.       6 => { # User facing right
  196.         0 => { :x => -8,  :y => -26, :a => -46, :z => -1, :m => false },
  197.         1 => { :x => 7,  :y => -20, :a => -78, :z => -1, :m => false },
  198.         2 => { :x => 8, :y => -15, :a => -126, :z => -1, :m => false },
  199.       },
  200.       8 => { # User facing up
  201.         0 => { :x => -22, :y => -10, :a => 0, :z => 0, :m => false },
  202.         1 => { :x => -8, :y => -26, :a => -46, :z => -1, :m => false },
  203.         2 => { :x => 10, :y => -16, :a => -100, :z => -1, :m => false },
  204.       },
  205.     },
  206.     "spear" => { # Spear thrust
  207.       2 => { # User facing down
  208.         0 => { :x => 4, :y => -6, :a => 142, :z => 0, :m => false }, # 1st frame
  209.         1 => { :x => 4, :y => -3, :a => 142, :z => 0, :m => false }, # 2nd frame
  210.         2 => { :x => 4, :y =>  0, :a => 142, :z => 0, :m => false }, # 3rd frame
  211.       },
  212.       4 => { # User facing left
  213.         0 => { :x => -6,  :y => 0, :a => 44, :z => 0, :m => false },
  214.         1 => { :x => -6,  :y => 0, :a => 44, :z => 0, :m => false },
  215.         2 => { :x => -12, :y => 0, :a => 44, :z => 0, :m => false },
  216.       },
  217.       6 => { # User facing right
  218.         0 => { :x => -2, :y => -16, :a => -130, :z => 0, :m => false },
  219.         1 => { :x => 4,  :y => -16, :a => -130, :z => 0, :m => false },
  220.         2 => { :x => 10, :y => -16, :a => -130, :z => 0, :m => false },
  221.       },
  222.       8 => { # User facing up
  223.         0 => { :x => -4, :y => -26, :a => -40, :z => -1, :m => false },
  224.         1 => { :x => -4, :y => -29, :a => -40, :z => -1, :m => false },
  225.         2 => { :x => -4, :y => -32, :a => -40, :z => -1, :m => false },
  226.       },
  227.     },
  228.     "axe" => { # Non-symmetric weapons
  229.       2 => { # User facing down
  230.         0 => { :x => 7, :y => 4, :a => -76, :z => 0, :m => true }, # 1st frame
  231.         1 => { :x => -10, :y => 1, :a => -130, :z => 0, :m => true }, # 2nd frame
  232.         2 => { :x => -20, :y => -9, :a => -176, :z => 1, :m => true }, # 3rd frame
  233.       },
  234.       4 => { # User facing left
  235.         0 => { :x => -8,  :y => -26, :a => -46, :z => -1, :m => false },
  236.         1 => { :x => -20,  :y => -10, :a => 12, :z => 0, :m => false },
  237.         2 => { :x => -10, :y => 2, :a => 52, :z => 0, :m => false },
  238.       },
  239.       6 => { # User facing right
  240.         0 => { :x => 9, :y => -26, :a => 46, :z => -1, :m => true },
  241.         1 => { :x => 19,  :y => -10, :a => -13, :z => 0, :m => true },
  242.         2 => { :x => 9, :y => 3, :a => -56, :z => 0, :m => true },
  243.       },
  244.       8 => { # User facing up
  245.         0 => { :x => -6, :y => -24, :a => 90, :z => 0, :m => true },
  246.         1 => { :x => 6, :y => -26, :a => 44, :z => -1, :m => true },
  247.         2 => { :x => 19, :y => -13, :a => 0, :z => 0, :m => true },
  248.       },
  249.     },
  250.     "bow" => { # Bows
  251.       2 => { # User facing down
  252.         0 => { :x => 8, :y => -14, :a => 135, :z => 1, :m => false, :zx => 0.8 }, # 1st frame
  253.         1 => { :x => 8, :y => -14, :a => 135, :z => 1, :m => false, :zx => 0.9 }, # 2nd frame
  254.         2 => { :x => 8, :y => -14, :a => 135, :z => 1, :m => false, :zx => 1.0 }, # 3rd frame
  255.       },
  256.       4 => { # User facing left
  257.         0 => { :x => -0, :y => -6, :a => 45, :z => -1, :m => false, :zy => 0.8 },
  258.         1 => { :x => -0, :y => -6, :a => 45, :z => -1, :m => false, :zy => 0.9 },
  259.         2 => { :x => -0, :y => -6, :a => 45, :z => -1, :m => false, :zy => 1.0 },
  260.       },
  261.       6 => { # User facing right
  262.         0 => { :x => -1, :y => -24, :a => -135, :z => -1, :m => false, :zy => 0.8 },
  263.         1 => { :x => -1, :y => -24, :a => -135, :z => -1, :m => false, :zy => 0.9 },
  264.         2 => { :x => -1, :y => -24, :a => -135, :z => -1, :m => false, :zy => 1.0 },
  265.       },
  266.       8 => { # User facing up
  267.         0 => { :x => -8, :y => -20, :a => -45, :z => -1, :m => false, :zx => 0.8 },
  268.         1 => { :x => -8, :y => -20, :a => -45, :z => -1, :m => false, :zx => 0.9 },
  269.         2 => { :x => -8, :y => -20, :a => -45, :z => -1, :m => false, :zx => 1.0 },
  270.       },
  271.     },
  272.     # Add more icon animation settings here!
  273.   }
  274.  
  275.   #-----------------------------------------------------------------------------
  276.   # Animation Rate Settings
  277.   #-----------------------------------------------------------------------------
  278.   # Here you can set up custom animation rates for each of your animations from
  279.   # the database. The iconset animations are not affected by this in any way!
  280.   # In theory, you can set up any integer numbers here.
  281.   #
  282.   # The animation rate will be calculated this way:
  283.   #   ani_rate = 60 / ani_setting
  284.   # So, if you set up 4 for an animation, the actual animation rate will be
  285.   # 60/4 = 15. This is the engine's default animation rate, in case you wonder.
  286.   #
  287.   # That final number (the 15) means that the animation frames which you set up
  288.   # in the database itself, will change after each 15 frames.
  289.   # 60 frames = 1 second, in case you want some comparison.
  290.   #
  291.   # Effectively, the lower the real animation rate (the 60/x value) the quicker
  292.   # your image frames will change, allowing you to make really smooth animations.
  293.   # But (and this is a warning!) the quicker they are, the more image frames
  294.   # are needed to make the animation actually visible for longer than a few
  295.   # frames!
  296.   # Also, the more image frames you use, the longer it will take to load
  297.   # the animation. To overcome this issue, I recommend you to use Moghunter's
  298.   # "Anti-Animation Lag" script (NOT the regular anti-lag one for events!).
  299.   # That script really makes wonders with animation buffering!
  300.   #
  301.   # Anyway, here are some good values you can set here for your animations:
  302.   #
  303.   #   Setting     Real
  304.   #    value      Speed
  305.   #      4   ---  15 fps
  306.   #      3   ---  20 fps
  307.   #      2   ---  30 fps
  308.   #      1   ---  60 fps
  309.   #
  310.   # You can see a setting named :default below, that one must be present all the
  311.   # time! If you don't set up a custom setting for an animation, that default
  312.   # value will be used instead.
  313.   # To setup your custom rates, you just have to add a new setting for it, where
  314.   # the ID of the animation will be the key, and the value will be the animation
  315.   # rate setting.
  316.   # Format: animation_id => ani_rate,
  317.   #
  318.   # Example: 12 => 4, 148 => 2, 84 => 3, etc.
  319.   #-----------------------------------------------------------------------------
  320.   Rates = {
  321.     :default => 1, # <-- The default rate setting, do NOT remove!
  322.     169 => 3,
  323.     174 => 3,
  324.     175 => 3,
  325.     177 => 3,
  326.     176 => 2,
  327.     # Add more custom animation rate settings here!
  328.   }
  329.  
  330.   #-----------------------------------------------------------------------------
  331.   # Direction Based Animation Settings
  332.   #-----------------------------------------------------------------------------
  333.   # Well, yeah... Just like with the icon animations, if an animation you made
  334.   # is not symmetric, it can't really be used in this ABS.
  335.   #
  336.   # Take the "Hit 2" type of animations from the default database, for example.
  337.   # You can't really use those for anithing here, even though those are perfect
  338.   # animations for a swinging weapon (I actually use them that way now), and
  339.   # you even got some element types set up for them right from the start, which
  340.   # saves hell of a lot time (or maybe it's just me not really being fond of
  341.   # making 10 thousand new animations :P).
  342.   #
  343.   # Anyway, you can set up position offsets, angle changes, mirror flag changes
  344.   # and Z value changes for your animations here for each directions separately.
  345.   # This will surely help to upgrade your game's visuals, like it did for mine.
  346.   # Let loose those fire element weapons, add real flames for them with
  347.   # animations, or strike the thunder above on a hit from a thunder based weapon!
  348.   # It is all doable now, and I can assure you, it makes your skills/weapons
  349.   # way more attractive and visually appealing! :)
  350.   #
  351.   # Here is how you use this cool thing:
  352.   # First, set up your animations. Adjust their zoom level (you will need to do
  353.   # this for a lot of animations if you use the default sized characters/weapons)
  354.   # and position all of them to be at the middle. You will adjust their position
  355.   # based on the directions here, so it is best to set them at the middle in the
  356.   # database. This means that the original X and Y position will be the position
  357.   # of the center of the tool (yes, the tool itself, NOT the user!). The X and Y
  358.   # values you set up here will be added to those values, so all of them means
  359.   # an offset value, and not a direct position!
  360.   # For the angle settings in the database, you can set it to any value, it
  361.   # doesn't really matter, since you will most probably need to adjust them here
  362.   # anyway. Same for the mirror settings.
  363.   #
  364.   # Okay, so, after the database settings, you come here.
  365.   # Here is the format of the settings:
  366.   #
  367.   #   animation_id => {
  368.   #     direction => {
  369.   #       :x => val, :y => val, :a => val, :z => val, :m => true/false, :zx => val, :zy => val,
  370.   #     },
  371.   #     # 3 more hashes go here with the same format, but different direction!
  372.   #   },
  373.   #
  374.   # Yeah, if it seems similar from somewhere, it is because it is the exact same
  375.   # format as for the icon animation settings, but this time, there are no frame
  376.   # settings (so only one setup for each direction).
  377.   # All of these settings do the same as there.
  378.   # A bit of a difference is the default Z value of the animations. The makers
  379.   # of VX Ace surely made sure that thee animation is displayed above any
  380.   # character... The default Z value is the user's Z value plus 300! Yeah, a
  381.   # whopping +300 is added. o.o
  382.   # So, in case you want to display an animation below the player, you will need
  383.   # to set the :z setting here to at least -301, but in case you use multiple
  384.   # images in a frame of the animation, you need to set even lower values.
  385.   # You should not need to adjust the Z value many times, but it is still good
  386.   # to know the defaults before trying to edit it, right?
  387.   #
  388.   # Of course, you don't need to setup a setting here for all of your animations.
  389.   # If an animation got no setting here, it will be played the default,
  390.   # non-direction based way.
  391.   #
  392.   # In case you are using the default battle system alongside this ABS (no idea,
  393.   # maybe someone really does o.O), you don't need to worry about the direction
  394.   # based changes. The animations played on the default battle scene (or on any
  395.   # other battle scene which uses battlers and not map characters) will be
  396.   # played the default way.
  397.   #
  398.   # The sample setting uses "Hit 2 Ice" from the default database. I modified
  399.   # it's zoom value to be 34% (much smaller than the original) and centered it
  400.   # in the database after. I used the animation on an "axe" based iconset type
  401.   # user animation tool, and the result was an icy axe which shows it's icon
  402.   # from the database in a slashing motion, and upon a slash, a cool ice effect
  403.   # is added. Everything is direction based, so perfect for this ABS!
  404.   #-----------------------------------------------------------------------------
  405.   AnimEX = {
  406.     181 => { # Ice Slash (3 lines)
  407.       2 => { # User facing down.
  408.         :x => 0, :y => -6, :a => 230, :z => 0, :m => true,
  409.       },
  410.       4 => { # User facing left.
  411.         :x => 20, :y => 0, :a => 13, :z => 0, :m => false,
  412.       },
  413.       6 => { # User facing right.
  414.         :x => -10, :y => 0, :a => -13, :z => 0, :m => true,
  415.       },
  416.       8 => { # User facing up.
  417.         :x => 0, :y => 16, :a => 40, :z => 0, :m => true,
  418.       },
  419.     },
  420.     # Add more direction based animation settings here!
  421.   }
  422.  
  423. end
  424. #===============================================================================
  425. # End of Settings! Editing anything below may lead to... you know it, right?
  426. #===============================================================================
  427.  
  428. module PearlKernel
  429.  
  430.   def self.check_iconset(item, tag, object)
  431.     data = item.tool_data(tag, false)
  432.     return if data.nil?
  433.     v = [item.icon_index, data.to_sym] if data == "animated" ||
  434.     data == "static" || data == "shielding" || ABSAnimEX::IconAnims.include?(data)
  435.     object.is_a?(Projectile) ? object.pro_iconset = v : object.user_iconset = v
  436.   end
  437.  
  438. end
  439.  
  440. class Sprite_Base < Sprite
  441.  
  442.   def set_animation_rate
  443.     if ABSAnimEX::Rates.include?(@animation.id)
  444.       @ani_rate = ABSAnimEX::Rates[@animation.id]
  445.     else
  446.       @ani_rate = ABSAnimEX::Rates[:default]
  447.     end
  448.   end
  449.  
  450. end
  451.  
  452. class Sprite_Character < Sprite_Base
  453.  
  454.   def set_angle_changes(type)
  455.     ani= @character.user.anime_speed.to_f/@character.original_speed.to_f * 100.0
  456.     case ani
  457.     when 80..100
  458.       perform_animated(0) if type == :animated
  459.       perform_custom_icon_anim(type,0) if ABSAnimEX::IconAnims.include?(type.to_s)
  460.     when 60..80
  461.       perform_animated(1) if type == :animated
  462.       perform_custom_icon_anim(type,1) if ABSAnimEX::IconAnims.include?(type.to_s)
  463.     when 0..60
  464.       perform_animated(2) if type == :animated
  465.       perform_custom_icon_anim(type,2) if ABSAnimEX::IconAnims.include?(type.to_s)
  466.     end
  467.     if type != :animated && !ABSAnimEX::IconAnims.include?(type.to_s)
  468.       perform_static       if type == :static
  469.       perform_shielding    if type == :shielding
  470.     end
  471.   end
  472.  
  473.   def perform_custom_icon_anim(key,pattern)
  474.     xo = ABSAnimEX::IconAnims[key.to_s][@character.user.direction][pattern][:x]
  475.     yo = ABSAnimEX::IconAnims[key.to_s][@character.user.direction][pattern][:y]
  476.     zxo = ABSAnimEX::IconAnims[key.to_s][@character.user.direction][pattern][:zx]
  477.     zyo = ABSAnimEX::IconAnims[key.to_s][@character.user.direction][pattern][:zy]
  478.     ao = ABSAnimEX::IconAnims[key.to_s][@character.user.direction][pattern][:a]
  479.     zo = ABSAnimEX::IconAnims[key.to_s][@character.user.direction][pattern][:z]
  480.     mo = ABSAnimEX::IconAnims[key.to_s][@character.user.direction][pattern][:m]
  481.     apply_angle_pattern(xo, yo, ao)
  482.     self.z = @character.user.screen_z + zo
  483.     self.mirror = mo
  484.     self.zoom_x = zxo if !zxo.nil?
  485.     self.zoom_y = zyo if !zyo.nil?
  486.   end
  487.  
  488.   def animation_set_sprites(frame)
  489.     cell_data = frame.cell_data
  490.     @ani_sprites.each_with_index do |sprite, i|
  491.       next unless sprite
  492.       pattern = cell_data[i, 0]
  493.       if !pattern || pattern < 0
  494.         sprite.visible = false
  495.         next
  496.       end
  497.       sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2
  498.       sprite.visible = true
  499.       sprite.src_rect.set(pattern % 5 * 192,
  500.         pattern % 100 / 5 * 192, 192, 192)
  501.       if @ani_mirror
  502.         sprite.x = @ani_ox - cell_data[i, 1]
  503.         sprite.y = @ani_oy + cell_data[i, 2]
  504.         sprite.angle = (360 - cell_data[i, 4])
  505.         sprite.mirror = (cell_data[i, 5] == 0)
  506.       else
  507.         sprite.x = @ani_ox + cell_data[i, 1]
  508.         sprite.y = @ani_oy + cell_data[i, 2]
  509.         sprite.angle = cell_data[i, 4]
  510.         sprite.mirror = (cell_data[i, 5] == 1)
  511.       end
  512.       sprite.z = self.z + 300 + i
  513.       sprite.ox = 96
  514.       sprite.oy = 96
  515.       sprite.zoom_x = cell_data[i, 3] / 100.0
  516.       sprite.zoom_y = cell_data[i, 3] / 100.0
  517.       if ABSAnimEX::AnimEX.include?(@animation.id)
  518.         sprite.x += ABSAnimEX::AnimEX[@animation.id][@character.direction][:x] if can_change_value?(:x)
  519.         sprite.y += ABSAnimEX::AnimEX[@animation.id][@character.direction][:y] if can_change_value?(:y)
  520.         sprite.angle += ABSAnimEX::AnimEX[@animation.id][@character.direction][:a] if can_change_value?(:a)
  521.         sprite.z += ABSAnimEX::AnimEX[@animation.id][@character.direction][:z] if can_change_value?(:z)
  522.         sprite.mirror = ABSAnimEX::AnimEX[@animation.id][@character.direction][:m] if can_change_value?(:m)
  523.         sprite.zoom_x += ABSAnimEX::AnimEX[@animation.id][@character.direction][:zx] if can_change_value?(:zx)
  524.         sprite.zoom_y += ABSAnimEX::AnimEX[@animation.id][@character.direction][:zy] if can_change_value?(:zy)
  525.       end
  526.       sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  527.       sprite.blend_type = cell_data[i, 7]
  528.     end
  529.   end
  530.  
  531.   def can_change_value?(type)
  532.     return !ABSAnimEX::AnimEX[@animation.id][@character.direction][type].nil?
  533.   end
  534.  
  535. end
  536.  
  537. class RPG::BaseItem
  538.  
  539.   def dir_anim
  540.     dir_anims = {}
  541.     if @note =~ /<dir anim: (\d+(?:\s*,\s*\d+)*)>/i
  542.       ind = 2
  543.       $1.scan(/\d+/).each { |id|
  544.         dir_anims[ind] = id.to_i
  545.         ind += 2
  546.       }
  547.     end
  548.     return dir_anims
  549.   end
  550.  
  551. end
  552.  
  553. class Projectile < Game_Character
  554.  
  555.   alias add_dir_anims9966 animation
  556.   def animation
  557.     if !@item.dir_anim[@direction].nil?
  558.       return @item.dir_anim[@direction]
  559.     else
  560.       add_dir_anims9966
  561.     end
  562.   end
  563.  
  564. end
  565. #==============================================================================
  566. # !!END OF SCRIPT - OHH, NOES!!
  567. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement