SHOW:
|
|
- or go back to the newest paste.
| 1 | //============================================================================= | |
| 2 | // Actor Stepping Animation | |
| 3 | // by Shaz | |
| 4 | - | // Last Updated: 2015.10.30 |
| 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 | - | * Add <stepanim> to the note box of an Actor to turn on stepping animation |
| 16 | + | |
| 17 | - | * for the actor's sprite on the map, as the party leader or a follower. |
| 17 | + | |
| 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 | - | var _Game_Player_update = Game_Player.prototype.update; |
| 22 | + | |
| 23 | - | Game_Player.prototype.update = function(sceneActive) {
|
| 23 | + | |
| 24 | - | _Game_Player_update.call(this, sceneActive); |
| 24 | + | |
| 25 | - | if ($gameParty.leader()) {
|
| 25 | + | |
| 26 | - | this.setStepAnime($gameParty.leader().actor().meta.stepanim || false); |
| 26 | + | var setSteppingAnimation = function(thiz, character) {
|
| 27 | - | } |
| 27 | + | if (character) {
|
| 28 | - | }; |
| 28 | + | thiz.setStepAnime( |
| 29 | character.actor().meta.stepanim || | |
| 30 | - | var _Game_Follower_update = Game_Follower.prototype.update; |
| 30 | + | character.currentClass().meta.stepanim || |
| 31 | - | Game_Follower.prototype.update = function() {
|
| 31 | + | character.states().some(function(s) { return s.meta.stepanim; }) ||
|
| 32 | - | _Game_Follower_update.call(this); |
| 32 | + | false |
| 33 | - | if (this.actor()) {
|
| 33 | + | ); |
| 34 | - | this.setStepAnime(this.actor().actor().meta.stepanim || false); |
| 34 | + | } |
| 35 | - | } |
| 35 | + | }; |
| 36 | - | }; |
| 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 | })(); |