Follower Event Touch

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,230
Reaction score
3,075
First Language
English




In RPG Maker, the "event touch" trigger allows you to create events that will execute when they touch the player.

"Touch" means when they try to move in a certain direction, but are unable to move because there is something blocking the way. In this case, the only object they check for is the player.

If one of the player's followers is in the way, they will not be able to move, but they won't run their commands either.

With this plugin, you can have events triggered when they touch either the player or the player's followers.
 
More information and downloads available at HimeWorks
 

KillerGin

Freddie
Veteran
Joined
Dec 18, 2015
Messages
335
Reaction score
168
First Language
English
Primarily Uses
N/A
Hello Hime,

The plugin is not working for me. When you say create a comment and type <follower touch>, where exactly do I type this? Do you mean plug in command? It is also worth noting that I am also using a smart path finder plugin to cause my event to intelligently find the target. 

Thanks
 

KillerGin

Freddie
Veteran
Joined
Dec 18, 2015
Messages
335
Reaction score
168
First Language
English
Primarily Uses
N/A
Hello Hime, 

Perhaps I spoke to soon. It works, just not 100% correctly. Sometimes the event touch on follower doesn't trigger, when I move around a bit then it will trigger. Just not 100% of the time when the event first touches one of the followers. Of course I am still going to use it. Thanks a lot. Great work. If you update the plugin please let me know. 
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,230
Reaction score
3,075
First Language
English
Hello Hime,


The plugin is not working for me. When you say create a comment and type <follower touch>, where exactly do I type this? Do you mean plug in command? It is also worth noting that I am also using a smart path finder plugin to cause my event to intelligently find the target. 


Thanks
There is an event command called "Comment". Look at the screenshot for an example.

Hello Hime, 


Perhaps I spoke to soon. It works, just not 100% correctly. Sometimes the event touch on follower doesn't trigger, when I move around a bit then it will trigger. Just not 100% of the time when the event first touches one of the followers. Of course I am still going to use it. Thanks a lot. Great work. If you update the plugin please let me know.
Determine whether it works without the pathfinding plugin.


I don't know how it is doing pathfinding, but my event touch builds on the existing event touch logic.


Specifically, it DOESN'T run if there's an event already running on the map. This is why when an event touches you during a message, nothing happens.


If the pathfinding takes over the map interpreter, then it's possible that while it's calculating a path, the event will touch a follower and do nothing since it's still trying to pathfind to the player.
 
Last edited by a moderator:

KillerGin

Freddie
Veteran
Joined
Dec 18, 2015
Messages
335
Reaction score
168
First Language
English
Primarily Uses
N/A
Hello Hime,

Yes, it seems to work without a hitch when I do not use the smart path finding plug in. I pasted the smart pathfinding script below to show you how it works.

//=============================================================================

// Smart Pathfinding
// by Shaz
// Last Updated: 2015.10.21
//=============================================================================

/*:
* @plugindesc Allows events or players to do smart Pathfinding
* @author Shaz
*
* @help
*
* Plugin Command:
* SmartPath eventId1 eventId2 # Makes event 1 find path to event 2
* SmartPath eventId x y # Makes event find a path to location x, y
* SmartPath eventId cancel # Cancel Pathfinding for event
*
* event = number for specific event
* event = 0 for "this" event
* event = -1 for player
* event = $gameVariables.value(x) to get the event id from variable x
*
* x, y = coordinates or $gameVariables.value(#) to use a variable coordinate
*
*/

(function() {
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);

if (command.toUpperCase() === 'SMARTPATH') {
subject = this.character(eval(args[0]));
if (args[1].toUpperCase() === 'CANCEL') {
subject.clearTarget();
} else if (args.length > 2) {
subject.setTarget(null, eval(args[1]), eval(args[2]));
} else {
subject.setTarget(this.character(eval(args[1])));
}
}
};

var _Game_CharacterBase_initMembers = Game_CharacterBase.prototype.initMembers;
Game_CharacterBase.prototype.initMembers = function() {
_Game_CharacterBase_initMembers.call(this);
this._target = null;
this._targetX = null;
this._targetY = null;
};

Game_CharacterBase.prototype.setTarget = function(target, targetX, targetY) {
this._target = target;
if (this._target) {
this._targetX = this._target.x;
this._targetY = this._target.y;
} else {
this._targetX = targetX;
this._targetY = targetY;
}
};

Game_CharacterBase.prototype.clearTarget = function() {
this._target = null;
this._targetX = null;
this._targetY = null;
};

var _Game_CharacterBase_updateStop = Game_CharacterBase.prototype.updateStop;
Game_CharacterBase.prototype.updateStop = function() {
_Game_CharacterBase_updateStop.call(this);

if (this._target) {
this._targetX = this._target.x;
this._targetY = this._target.y;
}

if (this._targetX != null) {
direction = this.findDirectionTo(this._targetX, this._targetY);
if (direction > 0)
{
this.moveStraight(direction);
}
}
};
})();
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,230
Reaction score
3,075
First Language
English
I put my player in a corner surrounded by followers, and when the enemy touches the follower it triggers the touch.


I will need a reproduce-able situation where the pathfinding causes problems.
 

KillerGin

Freddie
Veteran
Joined
Dec 18, 2015
Messages
335
Reaction score
168
First Language
English
Primarily Uses
N/A
This is an instance where it happens (or doesn't happen)... Death is suppose to cause an automatic game over and only in this one position it does it not work. The death event just sits there doing nothing as it rests against my follower.... None of the follows causes the event to trigger. Only when I move away from this initial downward position does it work without a problem. it works 90% of the time... this is the only case I can find where it doesn't..

Screenshot 2016-01-04 15.13.17.png
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,230
Reaction score
3,075
First Language
English
The event is facing downwards, instead of right, which suggests it's not trying to move right.


Take out the last 2 party members and see if the event is actually moving.
 

KillerGin

Freddie
Veteran
Joined
Dec 18, 2015
Messages
335
Reaction score
168
First Language
English
Primarily Uses
N/A
hmmm, interesting observation... I will do you one better and change death to a graphic that shows the direction they are facing... That graphic only ever faces downwards.
 

KillerGin

Freddie
Veteran
Joined
Dec 18, 2015
Messages
335
Reaction score
168
First Language
English
Primarily Uses
N/A
LOL, your observation is correct... The event is facing downwards! Thats why its not triggering follower touch. 
 

KillerGin

Freddie
Veteran
Joined
Dec 18, 2015
Messages
335
Reaction score
168
First Language
English
Primarily Uses
N/A
Awesome!

Thanks Hime for taking the time to make the plug-in and also for solving my issue! 
 

hardqueen

Crazy Talker
Veteran
Joined
Oct 26, 2015
Messages
78
Reaction score
15
First Language
Chinese
I feel that plugins created by Tsukihime is equal to high quality and reliability. Currently, five plugins provided by this amazing scripter have been adopted in my commercial game series.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,230
Reaction score
3,075
First Language
English
hmmm, interesting observation... I will do you one better and change death to a graphic that shows the direction they are facing... That graphic only ever faces downwards.


LOL, your observation is correct... The event is facing downwards! Thats why its not triggering follower touch.
It's not the fact that it's facing down.


It's the way the pathfinding is done.


If you took out the pathfinding and did a normal "approach" movement, the event will be triggered.


It's when the event is diagonal to the player does it try to move vertically instead of horizontally.


You can verify this by removing the vertical tile that blocks the way and see the event preferring to approach you from the side instead of from behind.
 
Last edited by a moderator:

KillerGin

Freddie
Veteran
Joined
Dec 18, 2015
Messages
335
Reaction score
168
First Language
English
Primarily Uses
N/A
Hello Hime,

Yes, if I did (move obstacles out of the way) then the event would be triggered. This is a very rare instance that is hard to duplicate on the fly in 99% of instances. 

I am going to keep the smart pathfinding because I need the event to intelligently navigate through the complex environments (mazes) in my game. The normal approach movement is much to dumb to navigate 99% of the environments (mazes) in my game.

So basically we found the reason why it didn't work in this very rare instance and it had everything to do with pathfinding and nothing to do with your follower touch script. I consider it a non issue and your plugin works fantastic! Thanks Hime!
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,230
Reaction score
3,075
First Language
English



This is because the event is ONLY trying to walk towards the player; it will treat any followers the same as obstacles.


I think a solution would be to find a way to have the event try to move towards both the player OR one of the followers somehow, since then the event would just figure out which one is the closest and go for that.


This isn't TOO rare, since any configuration where you cut the event off with a follower and you're standing diagonal to it would result in this problem.


Both screenshots demonstrate the problem, except on the right, I left the path open.
 
Last edited by a moderator:

KillerGin

Freddie
Veteran
Joined
Dec 18, 2015
Messages
335
Reaction score
168
First Language
English
Primarily Uses
N/A
Hello Hime,

That is very true. Since you are the first one to come up with follower event touch on RPG maker MV (as far as I am aware of) perhaps, if you have the time, you can figure it out and solve this new problem.

The reason why it isn't so bad in my game is because death spawns randomly around the map and runs at the player at high speed. If death cannot reach the player after a certain amount of time then he will randomly teleport to another random position on the map and try again... at least 3 different times.... so in my case the player is always on their toes. So it works pretty well, its pretty scary!

However, if you ever do fix this issue then I would be happy to use that script. (Maybe you can make it so that followers are not considered obstacles? I am just throwing ideas out there lol)

Thanks Hime for your time and your script!
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,230
Reaction score
3,075
First Language
English
The issue would fall outside of the scope of the plugin, since the issue is related to the pathfinding logic.


It would be up to the pathfinding plugin to treat followers the same as players or something.
 

KillerGin

Freddie
Veteran
Joined
Dec 18, 2015
Messages
335
Reaction score
168
First Language
English
Primarily Uses
N/A
I know it would be outside the scope of the follower event touch plugin. 

I was merely suggesting if that was something you may be interested in tackling some time down the line.... or informing Shaz (the creator of the path finding logic) of the issue then that would be cool. Obviously totally optional and up to you. Again I was just throwing ideas out there.

Anyways thanks again Hime.
 

KillerGin

Freddie
Veteran
Joined
Dec 18, 2015
Messages
335
Reaction score
168
First Language
English
Primarily Uses
N/A
Hey @Tsukihime My demo is ready! If you want to check it out please do so. Also let me know how I can give you proper credit for your work. I will make the necessary arrangements
 

McSundae

Veteran
Veteran
Joined
Oct 28, 2015
Messages
213
Reaction score
218
First Language
German
Great script, i wonder if it would be possible to enhance that script that far that you can run a specific common event when the player tries to talk with one of the follower - that way we could interact with our followers like in mass effect or other great rpg's :D  
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Writing out an idea for the No Travel Game Jam. I have a general plot and challenge written out, it's just a matter of filling the rest in and making it interesting.
A definite difficult time right now. How is everyone doing during this pandemic? I already have seen furloughs and layoffs.
Hollow 1977 wrote on Archeia's profile.
Hope you and your family are doing well during this difficult time. :)
My elderly neighbor whom I've been buying groceries for just got carried out of his home on a stretcher by guys with hazmat suits. Considering I've been his only point of contact for the past month it's probably safe to say my boss was right to tell me to stay home once I developed a mild cough after all.
Damn. All these new features to the forums. Takes some getting used to.

Forum statistics

Threads
95,642
Messages
930,673
Members
125,962
Latest member
seogenics
Top