The RPG Maker Resource Kit

RMRK RPG Maker Creation => XP => XP Event Systems => Topic started by: shaz on November 04, 2007, 03:37:38 AM

Title: [XP] [EVENT SYSTEM] Follow The Leader
Post by: shaz on November 04, 2007, 03:37:38 AM
[SIZE=8]Follow The Leader (Evented)[/SIZE]
By Shaz - Version 1.2
Introduction

This Follow the Leader event system has been made by shaz.
This is an experimental system that requires fine-tuning.
This system allows you to have any number of NPCs "following" the main character.
- they are not always in the same order
- they do not follow in the exact steps (they walk more as a "group")
- the demo shows how you can cater for the player going into buildings and have some/all of the group "follow"
- in the demo, the cat always follows, but the girl only follows once you have agreed to help her
- SHIFT makes a follower take a step backwards (if possible) in case you get stuck in a tight spot


Modifications
Version 1.1
Added ability to interact with followers

Version 1.2
Complete revamp of "follow" common event to follow PINEDAXP's MUCH simpler method
Removed use of variables to avoid one event interfering with another

Screenshots

(http://www.users.on.net/~mszhanlon/sh/forum/RMXP/FollowTheLeader/FTL02_InsideNoFollower.png)
Into a building, nobody following yet

(http://www.users.on.net/~mszhanlon/sh/forum/RMXP/FollowTheLeader/FTL03_OutsideNoFollower.png)
Leaving the building, girl not following, still in her default position

To have the girl follow, talk to her and agree to help her find her dog.

(http://www.users.on.net/~mszhanlon/sh/forum/RMXP/FollowTheLeader/FTL05_InsideFollower.png)
Once she starts following you, she will follow you into buildings (these ARE separate events on each map)

(http://www.users.on.net/~mszhanlon/sh/forum/RMXP/FollowTheLeader/FTL06_OutsideFollower.png)
Leaving the building, she is there and waiting to follow you.

(http://www.users.on.net/~mszhanlon/sh/forum/RMXP/FollowTheLeader/FTL04_TwoFollowers.png)
(http://www.users.on.net/~mszhanlon/sh/forum/RMXP/FollowTheLeader/FTL07_TwoFollowersReversed.png)
Followers' order is not always the same.

Copy the cat and duplicate it a few times (change the graphic) and you will see they don't always walk in a straight line either.

Issues

As NPCs don't follow in a straight line and duplicate the player's footsteps exactly, they CAN get caught in places and left behind - you have to go back and collect them.
Events could probably be made more efficient
Sometimes events seem to get stuck in limbo - they do nothing when they should be following.  I'm still trying to nut this one out.

Credits & Thanks

Written by shaz
Thanks to PINEDAXP - for his much simpler "follow" process


Am happy to hear any ideas for improvement/enhancement.
Title: Re: [EVENT SYSTEM] Follow The Leader
Post by: FruitBodyWash on November 04, 2007, 04:11:00 AM
I like this! this is what I had been hoping for, except I still can't talk to them.... *sighs* I'll keep trying, if I do figure it out, I'll post it on here. Thanks
Title: Re: [EVENT SYSTEM] Follow The Leader
Post by: shaz on November 04, 2007, 04:17:11 AM
Yeah, I think even taking the common event and putting it on each NPC wouldn't work, as you'd still have to make it a parallel process.  You COULD add a check in there for action button being pressed, but to make it apply to just one NPC and not all (as the SHIFT does), you'd have to check that the player is standing one step away from the current event AND facing in the direction of the event.  Of course that would be unnecessary if you only had one NPC following.


I did an experiment a week or two ago, to see if I could get the same effect as the above by just making the event move towards the player, and fiddling with the speed and refresh rate.  That allowed me to interact with them, and they GENERALLY went to where the player was (and had the same problems as this system in regard to getting stuck), but their movement was fairly erratic.


mmm - got an idea - let me experiment a bit...
Title: Re: [EVENT SYSTEM] Follow The Leader
Post by: shaz on November 04, 2007, 07:57:46 AM
here you go.  Now you can talk to the people following you.

(sorry for double-post - is that a no-no?)


*sigh* - you better go and look at this (http://rmrevolution.com/forum/index.php/topic,969.0.html) - PINEDAXP has done it in a MUCH more simple way than I have.  His is definitely the better one to use.
Title: Re: [EVENT SYSTEM] Follow The Leader
Post by: FruitBodyWash on November 04, 2007, 02:10:03 PM
Thaks for the tip :) It sounds like he's figured it out, but..... *sheepish* I don't know how to urm.... use the .rar  files..... *groan* I'm going to go look and see if it's mentioned in the info section, before I acctually ask and possible break a newbie rule that all those stickies try to prevent ;)

Edit: Ok, I found out how to use them!! and....

HUZZAH!!! It works, *does a little dance*
Title: Re: [EVENT SYSTEM] Follow The Leader
Post by: modern algebra on November 04, 2007, 04:01:54 PM
Hmm, I took a quick look at the system. It's nice, but a few things seem redundant. The double loop, for instance. Neither the first nor the second loop is ever broken. And of course, the event itself is set on parallel process, so the thing will loop every frame regardless. Secondly, the use of scripting is a bit strange when you could use event variables to make it seem more penetrable by non-scripters. Further, checking the event position versus player position directly could be a mistake, since ideally, with a caterpillar, the following events are never on the same square as the player. It might be a little more difficult, as you would need to account really for player's last position rather then current position, but the benefit to it would be that the user could set the follow events to through, which effectively eliminates the problem of getting stuck. Of course, you account for that with character interaction. All in all, a nice event system. I'll leave it here to get a bit of traffic before I move it to the database.
Title: Re: [EVENT SYSTEM] Follow The Leader
Post by: shaz on November 04, 2007, 09:21:12 PM
The inside loop is so the event continues moving until they're next to the player, rather than take one step at a time.  Not sure why the outer loop - maybe when I wrote that I didn't realise parallel processes automatically loop.

Don't move it to the database for a while - PINEDAXP's method of movement is WAY simpler than what I have here, so I'm going to change mine.  Won't be exactly like his, but that one entire common event will be almost done away with.  I'll revamp it this evening.


Edit:  done.  Used PINEDAXP's method for movement.  Also removed all variables from the following/interaction events.  Scripting is still there, and is fully explained - because all variable dependency has been removed, this should not have to be changed if someone copies/pastes into their own project.
Title: Re: [EVENT SYSTEM] Follow The Leader
Post by: Demonic Blade on December 23, 2007, 05:36:43 PM
I think this might be a bit too much like the catterpillar script, just different with the NPCs. Nice, also the thing about being able to talk to them, is a good idea! :)
Title: Re: [EVENT SYSTEM] Follow The Leader
Post by: shaz on December 23, 2007, 09:23:12 PM
yes, it's JUST like the caterpillar script - almost.  Big difference is evented.  That was the point ;)  People who don't want to get into scripts can still have this kind of system.

The NPCs in this case don't have to be in your party.  The girl "joined", but didn't have to.  The cat didn't.  And yes, you can talk to them and have them stop following at any time.

Title: Re: [EVENT SYSTEM] Follow The Leader
Post by: Demonic Blade on December 24, 2007, 09:45:19 AM
;) Nice, great job! :D