Status
Not open for further replies.

dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
1,101
Reaction score
568
First Language
German
Primarily Uses
RMMV
hi^^ , i was able to draw a not moving singel walking char img into a custom window..

But this had the usual loading issue (not displayed at first)..
and i would preffer the animated version anyway..
(because update/refresh functions will be needed anyway to solve the "loading issue")

can anybody show me how to do this?
 
Last edited:

dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
1,101
Reaction score
568
First Language
German
Primarily Uses
RMMV
i figured it out^^
Screenshot_1.png
I forgot to mention, this "custom window" is used in the menu, if you wanna use this solution outside of the menu,..
.. you will need to change the "this._actor"-data

JavaScript:
this._actor = $gameParty.menuActor();
// if not using this custom window in the menu, pls change the actor data


i will add my code solution into the Spoiler,
but pls Note the Char size is *2
that is made here:
(and can be changed here)
JavaScript:
      var dw = 2 * pw;
      var sh = 2 * ph;
// this makes the charsize *2
// can be changed easyly by using other numbers
// or edit the code to not use "dw" & "sh"

Custom Window Code :
JavaScript:
function Window_Custom() {
    this.initialize.apply(this, arguments);
}

Window_Custom.prototype = Object.create(Window_Base.prototype);
Window_Custom.prototype.constructor = Window_Custom;

Window_Custom.prototype.initialize = function(x, y, width) {
      this._actor = $gameParty.menuActor();
      var width = this.windowWidth();
      var height = this.windowHeight();
      var x = 145;
      var y = 195;
      this._x = x;
      this._y = y;
      this._updateCounter = 0;
      this._step = 0;
      this._characterName = this._actor.characterName;
      this._characterIndex = this._actor.characterIndex;
      Window_Base.prototype.initialize.call(this, x, y, width, height);
      this.drawActorCharacter(this._actor, x - 112, y - 140);
};

Window_Custom.prototype.update = function() {
      this._updateCounter += 1;
      if (this._updateCounter >= 25) {
          this._step += 1;
          if (this._step === 3) {this._step = -1};
          this.refresh();
          this._updateCounter = 0;
      }
};

Window_Custom.prototype.refresh = function() {
      if (this.contents) {
          this.contents.clear();
          this.drawActorCharacter(this._actor, this._x - 112, this._y - 140);
      }
};

Window_Custom.prototype.windowWidth = function() {
      return 150;
};

Window_Custom.prototype.windowHeight = function() {
      return 155;
};

Window_Custom.prototype.drawActorCharacter = function(actor, x, y) {
      if (this._step === 2) {var step = 0} else {var step = this._step};
      this.drawStepCharacter(actor.characterName(), actor.characterIndex(), x, y, step);
};
 
Window_Custom.prototype.drawStepCharacter = function(characterName, characterIndex, x, y, step) {
      var bitmap = ImageManager.loadCharacter(characterName);
      var big = ImageManager.isBigCharacter(characterName);
      var pw = bitmap.width / (big ? 3 : 12);
      var ph = bitmap.height / (big ? 4 : 8);
      var n = characterIndex;
      var sx = (step * 48) + ((n % 4 * 3 + 1) * pw);
      var sy = (Math.floor(n / 4) * 4) * ph;
      var dw = 2 * pw;
      var sh = 2 * ph;
      this.contents.blt(bitmap, sx, sy, pw, ph, x - pw / 2, y - ph, dw, sh);
};
also the custom Window is very small, xy & width and height,.. should be changed to whatever is needed in own projects

//this will be reported as solved and can be closed .thx

Incase you are looking for the "SV Battler Img" in a window, you can use this solution instead:
 
Last edited:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,647
Reaction score
15,738
First Language
English
Primarily Uses
RMMV

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.



Thanks for adding the solution. Next time, could you please edit your post and add it in, to avoid double posting? thanks :)


Edit: reopened

Edit: reclosed
 
Last edited:
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

“Battle not with monsters, lest ye become a monster, and if you gaze into the abyss, the abyss gazes also into you.”
gxQUtTE.gif
Don't you hate it when you play an mmo to pass some time then an update drops that makes your playing experience less enjoyable and quit because of it?
sigh...
SF_People3_6 added!
index.php

OcRam MZ and RETRO demo -projects are now also updated (includes all plugins released yesterday).
At work.
Co: "This bug drove me insane. I tried a lot of things to debug, it just stuck".
Me: "How did you debug it?"
Co: *shows a complicated debugging method using breakpoints and everything*
Me: "What about ... " *casually prints a stack trace in the try/catch exception
Co: "Wait, you can do that??"

Forum statistics

Threads
118,663
Messages
1,117,648
Members
155,768
Latest member
grc14
Top