[RM2K3] MAKING AN NPC FOLLOW, W/O USING COMMON EVENTS

Posts

Pages: 1
Is it possible to make an NPC follow the hero, like Caterpillar System, without relying on Common Events?

Because I need it for a game where I have to take some NPCs to a certain point, much like bringing hostages to the extraction point.
arcan
Having a signature is too mainstream. I'm not part of your system!
1866
Create new event > movement: custom pattern > define pattern > add move towards hero and check repeat patter. Making more than one follower will probably result in a much more complicated system.
So that means, take one prisoner at a time? Now, how about taking it to the "extraction point". I believe it may have to do with

Extraction Point event: Touched by Hero
IF Prisoner1_FollowHero ON
Prisoner1 says "Thanks!"
Prisoner1 Freed ON.
I just posted a caterpillar system tutorial on the website. It's still pending, but should be available any time.

With this system you can only have one event following you at a time, but it's not hard to adapt it to have more than one event following you. You just need the second event to follow the first, and a way to detect which event is first in line, which is second, etc.
well, in lieu of a common event, you can use a parallel process event on the map (or maps) that the caterpillar will be on. It would essentially work the same way the common event would have, if you've been reading a tutorial that describes that.

More or less, it would memorize the hero's position, then enter a loop that wait for the character to press a key, when he does, it rechecks his position to see if he actually moved. if he did, break loop. then based on where he moved (is X higher/lower or the same old X, same with Y) it would set a variable for the follow event to know which direction to move on his next move. then it calls the page of the caterpillar event to make it move (to make sure it doesn't move all over the place.
This would work fine with mutiple follow events, you just need to add the moves to a queue system, and have the individual follow events check only their move.

Example parallel process event:

<>memorize position, [X001,Y002,Z003]
<>start loop
label1
<>key input (wait till pressed)
<>memorize position [X004,Y005,Z006)
<>if var 001 is NOT = var 004
// moved then [ goto label2]
elseif var 002 is NOT = var 005
//moved then [goto label3]
/didn't move else: goto label1
end case
end case
end case
<>end loop
label2:
//check if moved left or right
if var 001 > var 004 //moved right
then set var 007 moveDIR 1
call event "caterpillar follow event, movement page"
goto label1
else case //moved left
<> set var 007 moveDIR 2
call event "caterpillar follow event, movement page"
goto label1
end case
label3:
//check if moved up or down
if var 002 > var 005 //moved down
then set var 007 moveDIR 3
call event "caterpillar follow event, movement page"
goto label1
else case //moved up
<> set var 007 moveDIR 4
call event "caterpillar follow event, movement page"
goto label1
end case


the follow event page referenced would be a page the follow events that tells them to move once based on the value of the variable given to them. (so follower one would have a fork that says "if it's 1, move right, if it's 2 move left" etc. follower 2 would do the same thing, but with a second set of variables). also, to stop the player from talking to their followers, their top page should be one that has nothing on it.

if you want multiple follow events, add a queue system. basically it changes FOLLOW2MOVEDIR to the value of moveDIR before changing moveDIR's value to the direction you moved in. for more followers it would do the same thing with another variable, like a chain. I hope this helps you out.
Pages: 1