Haiiiiiii! Okay, I hope I'm not a bother here, but I'm TOTALLY new to RGSS and I'm itching to learn. I tried making a "follow me" script in the built-in edit event thingy, and it went pretty well. Here's how I set it up:
And the explanation:
Now, it LOOKS like I have everything figured out already, but that is false. ^^ Actually, this little gizmo I made is quite buggy... the sprite DOES follow the player, but it often gets in the player's way. You can copy this script into the event editor of your own test game and you'll see what I mean. Well, seeing how I'm learning RGSS, I would like to start out with a simple "follow me" script written in RGSS. But, I don't know how ^^;. Could someone show me how I would do that? I'm totally new to the language and... it would help if I knew which parts of the script does what and why. I suppose I'm asking for too much there but thought it was worth asking! Thanks in advance!
Code:
@>Conditional Branch: The X button is being pressed
@>Conditional Branch: The Right button is being pressed
@>Set Move Route: Player
: :$>Change Freq: 4
: :$>Change Speed: 4
@>Set Move Route: This event (Repeat Action, Ignore If Can't Move)
: :$>Change Speed: 4
: :$>Change Freq: 4
: :$>Move toward Player
@>
: Branch End
@>Conditional Branch: The Down button is being pressed
@>Set Move Route: Player
: :$>Change Freq: 4
: :$>Change Speed: 4
@>Set Move Route: This event (Repeat Action, Ignore If Can't Move)
: :$>Change Speed: 4
: :$>Change Freq: 4
: :$>Move toward Player
@>
: Branch End
@>Conditional Branch: The Left button is being pressed
@>Set Move Route: Player
: :$>Change Freq: 4
: :$>Change Speed: 4
@>Set Move Route: This event (Repeat Action, Ignore If Can't Move)
: :$>Change Speed: 4
: :$>Change Freq: 4
: :$>Move toward Player
@>
: Branch End
@>Conditional Branch: The Up button is being pressed
@>Set Move Route: Player
: :$>Change Freq: 4
: :$>Change Speed: 4
@>Set Move Route: This event (Repeat Action, Ignore If Can't Move)
: :$>Change Speed: 4
: :$>Change Freq: 4
: :$>Move toward Player
@>
: Branch End
: Else
@>Conditional Branch: The Right button is being pressed
@>Set Move Route: Player
: :$>Change Freq: 3
: :$>Change Speed: 3
@>Set Move Route: This event (Repeat Action, Ignore If Can't Move)
: :$>Change Speed: 3
: :$>Change Freq: 3
: :$>Move toward Player
@>
: Branch End
@>Conditional Branch: The Down button is being pressed
@>Set Move Route: Player
: :$>Change Freq: 3
: :$>Change Speed: 3
@>Set Move Route: This event (Repeat Action, Ignore If Can't Move)
: :$>Change Speed: 3
: :$>Change Freq: 3
: :$>Move toward Player
@>
: Branch End
@>Conditional Branch: The Left button is being pressed
@>Set Move Route: Player
: :$>Change Freq: 3
: :$>Change Speed: 3
@>Set Move Route: This event (Repeat Action, Ignore If Can't Move)
: :$>Change Speed: 3
: :$>Change Freq: 3
: :$>Move toward Player
@>
: Branch End
@>Conditional Branch: The Up button is being pressed
@>Set Move Route: Player
: :$>Change Freq: 3
: :$>Change Speed: 3
@>Set Move Route: This event (Repeat Action, Ignore If Can't Move)
: :$>Change Speed: 3
: :$>Change Freq: 3
: :$>Move toward Player
@>
: Branch End
@>
: Branch End
@>Conditional Branch: The Y button is being pressed
@>Text: Sonya: We have to cut down these
: : fiends first!
@>Conditional Branch: Switch [0002: First_battle] == OFF
@>Text: Sonya: Find one and I'll show you how
: : to fight!
@>
: Branch End
@>
:Branch End
@>
#This event was set to "parallel process" as a trigger.
And the explanation:
This is a basic "follow me" script that I wrote with rpgxp event editor. It features a "running" portion and it also features an "ask me" portion. The script basically says to "increase speed and frequency while button X is being pressed, all the while moving wherever the player's current position is." So, both the player and the event this script is assigned to change speed and frequency at the same time depending on whether button X is being pressed. And the "repeat movement" is there to make sure that the event is ALWAYS near the player. The last portion of the script "ask me" is a little extra thing I added that whenever button Y is pressed, you can "talk" to your partner, the one following you. The switch is there to determine whether or not your first battle was encountered and you have undergone the tutorial.
Now, it LOOKS like I have everything figured out already, but that is false. ^^ Actually, this little gizmo I made is quite buggy... the sprite DOES follow the player, but it often gets in the player's way. You can copy this script into the event editor of your own test game and you'll see what I mean. Well, seeing how I'm learning RGSS, I would like to start out with a simple "follow me" script written in RGSS. But, I don't know how ^^;. Could someone show me how I would do that? I'm totally new to the language and... it would help if I knew which parts of the script does what and why. I suppose I'm asking for too much there but thought it was worth asking! Thanks in advance!