Guest follower appears only after I take a few steps

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,848
First Language
English
Started writing a plugin for "guest followers", which are actors that follow you around, but aren't in your party (and therefore do not participate in battle).


However, I've run into a strange issue.


Here is a copy of the plugin so far.


To test it, simply make a script call


$gameParty.addGuestActor( ACTOR_ID)




And you should see the specified actor appear in your party on the map.


Make sure you have "Display followers" enabled in the system tab.


The problem I'm having is that the guest follower doesn't appear immediately.


Instead, it appears after I take a few steps.


I checked the position of the follower, and it seems to be where I expect it to be.


The sprite reports that it's visible, with opacity 255, so it's definitely not invisible.


The sprite reports the position as the position where my player is, so that seems alright.


Why does this happen?
 

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,042
First Language
French
Primarily Uses
RMMV
@Tsukihime


my though is maybe you forgot to actually do a 'loadbitmap' 


MV not work likes Ace where's the sprite didn't need to be loaded.


in MV all the sprite should be loaded before hand.


where you do it's not loading the picture.


and you have to know that the maps is refresh EACH step is done.


so this probably why it's loaded like this. 


but after it's mostly a hypothesis 
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,848
First Language
English
@nio kasgami I thought that might be the case, so I tried it with an image that I know must have been loaded already (same as my party leader), but still the same issue.


It is reproducible as well: when the follower takes their first step, only then does it appear.
 

Victor Sant

Veteran
Veteran
Joined
Mar 17, 2012
Messages
1,694
Reaction score
1,452
First Language
Portuguese
Primarily Uses
The issue is with the player direction.


follower.setDirection($gamePlayer.direction);


it's a function, not a property.


Anyway, there is another issue. You're adding the guest after all the followers, so it the current party size is lower than the max battle party size, the guest will be shown far from the rest of the party.


If i were you, instead of controlling the guest followers sprites dinamically, i would add a max number for followes as a plugin parameter and add them to the Game_Followers data when it initializes.


I would make those changes, wich would also improve the compatibility with other plugins since it wouldn't mess with the spriteset. (that can be very problematic)

Code:
/*:
-------------------------------------------------------------------------------
@title Guest Followers
@author Hime --> HimeWorks (http://himeworks.com)
@version 1.0
@date Mar 20, 2016
@filename HIME_GuestFollowers.js
@url 

If you enjoy my work, consider supporting me on *******!

* https://www.*******.com/himeworks

If you have any questions or concerns, you can contact me at any of
the following sites:

* Main Website: http://himeworks.com
* Facebook: https://www.facebook.com/himeworkscom/
* Twitter: https://twitter.com/HimeWorks
* Youtube: https://www.youtube.com/c/HimeWorks
* Tumblr: http://himeworks.tumblr.com/

-------------------------------------------------------------------------------
@plugindesc v1.0 - 
@help 
-------------------------------------------------------------------------------
== Description ==

== Terms of Use ==

- Free for use in non-commercial projects with credits
- Free for use in commercial projects, but it would be nice to let me know
- Please provide credits to HimeWorks

== Change Log ==

== Usage ==


-------------------------------------------------------------------------------
 */ 
var Imported = Imported || {} ;
var TH = TH || {};
Imported.TH_GuestFollowers = 1;
TH.GuestFollowers = TH.GuestFollowers || {};

function Game_GuestFollower() {
  this.initialize.apply(this, arguments);
};

Game_GuestFollower.prototype = Object.create(Game_Follower.prototype);
Game_GuestFollower.prototype.constructor = Game_GuestFollower;

(function ($) {

  var TH_GameParty_initialize = Game_Party.prototype.initialize;
  Game_Party.prototype.initialize = function() {
    TH_GameParty_initialize.call(this);
    this._guestActors = []
  };

  Game_Party.prototype.guestActors = function() {
    return this._guestActors.map(function(actorId) {
		return $gameActors.actor(actorId);
	});
  };
  
  Game_Party.prototype.addGuestActor = function(actorId) {
    if (!this._guestActors.contains(actorId)) {
      this._guestActors.push(actorId)
      //$gamePlayer.addGuestFollower(actorId);
      $gamePlayer.refresh();     
      $gameMap.requestRefresh();
    }
  };
  
  Game_Party.prototype.removeGuestActor = function(actorId) {
    if (this._actors.contains(actorId)) {
      this._actors.splice(this._guestActors.indexOf(actorId), 1);
      //$gamePlayer.removeGuestFollower(actorId);
      $gamePlayer.refresh();
      $gameMap.requestRefresh();
    }
  };

  /***************************************************************************/
	  /* Overwritten function */
	  Game_Follower.prototype.actor = function() {
		var followers = $gameParty.battleMembers().concat($gameParty.guestActors())
		var fow = followers[this._memberIndex]
		return followers[this._memberIndex];
	  };
	  
  /*
  Game_Player.prototype.addGuestFollower = function(actorId) {
    this._followers.addGuestFollower(actorId);
  };
  
  Game_Player.prototype.removeGuestFollower = function(actorId) {
    this._followers.removeGuestFollower(actorId);
  };
  */
  /***************************************************************************/
 
	var TH_GameFollowers_initialize = Game_Followers.prototype.initialize;
	Game_Followers.prototype.initialize = function() {
		TH_GameFollowers_initialize.call(this)
		var partySize = this._data.length + 1;
		// Max number of guests
		var maxGuest  = 3
		for (var i = partySize; i < partySize + maxGuest; i++) {
			this._data.push(new Game_Follower(i));
		}
	};

  /*
  Game_Followers.prototype.addGuestFollower = function(actorId) {
    var follower = new Game_GuestFollower(actorId);
    follower.locate($gamePlayer.x, $gamePlayer.y);
    follower.setDirection($gamePlayer.direction());
	
    this._data.push(follower);
    
    // Hack
    if (SceneManager._scene instanceof Scene_Map) {
      SceneManager._scene._spriteset.createFollower(follower)
    }
  };
  */
  /***************************************************************************/
  /*
  Game_GuestFollower.prototype.initialize = function(actorId) {
    Game_Follower.prototype.initialize.call(this);
    this._actorId = actorId;
    this.setTransparent($dataSystem.optTransparent);
    this.setThrough(true);    
  };
  
  Game_GuestFollower.prototype.actor = function() {
    return $gameActors.actor(this._actorId);
  };*/
  /***************************************************************************/
  /*
  Spriteset_Map.prototype.createFollower = function(follower) {
    var spr = new Sprite_Character(follower);
    this._characterSprites.push(spr);
    this._tilemap.addChild(spr);
	spr.update();
  };*/

})(TH.GuestFollowers);
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,848
First Language
English
Lol direction was not a property...Trapped by MV's decision to arbitrarily specify certain things as properties.


Thanks for pointing that out.


For the display issues, yes, that's something that will be addressed later. I just wanted to deal with this issue first.
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,470
Members
137,821
Latest member
Capterson
Top