Stadler76

Actor Stepping Animation (MV+MZ)

Mar 20th, 2021 (edited)
961
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // Actor Stepping Animation
  3. // by Shaz
  4. // Last Updated: 2021.03.22
  5. //
  6. // Revisions:
  7. // 2015.10.30 Fixed TypeError: Cannot read property 'actor' of undefined.
  8. // 2021.03.20 Allow using the notetag for classes and states.
  9. // 2021.03.22 RMMV uses ECMA5 which doesn't support arrow functions yet.
  10. //=============================================================================
  11.  
  12. /*:
  13.  * @target MZ & MV
  14.  * @plugindesc Allows party leader/followers to have stepping anim on map
  15.  * @author Shaz
  16.  *
  17.  * @help This plugin does not provide plugin commands.
  18.  *
  19.  * Add <stepanim> to the note box of an Actor, a Class or a State to turn on
  20.  * stepping animation for the actor's sprite on the map, as the party leader
  21.  * or a follower.
  22.  *
  23.  */
  24.  
  25. (function() {
  26.     var setSteppingAnimation = function(thiz, character) {
  27.         if (character) {
  28.             thiz.setStepAnime(
  29.                 character.actor().meta.stepanim ||
  30.                 character.currentClass().meta.stepanim ||
  31.                 character.states().some(function(s) { return s.meta.stepanim; }) ||
  32.                 false
  33.             );
  34.         }
  35.     };
  36.  
  37.     var _Game_Player_update = Game_Player.prototype.update;
  38.     Game_Player.prototype.update = function(sceneActive) {
  39.         _Game_Player_update.call(this, sceneActive);
  40.         setSteppingAnimation(this, $gameParty.leader());
  41.     };
  42.  
  43.     var _Game_Follower_update = Game_Follower.prototype.update;
  44.     Game_Follower.prototype.update = function() {
  45.         _Game_Follower_update.call(this);
  46.         setSteppingAnimation(this, this.actor());
  47.     };
  48. })();
Add Comment
Please, Sign In to add comment