Follower's Commands
(also known as Follower's Move Routes v.2.2)
Introduction
This little script is a new approach to my Follower's Move Routes that allows the usage of other event commands such as Show Animation, Show Balloon and Set Event Position, and of course, Set Move Route.
It also allows making the followers wait.
(v.2.1)
You can also use the actor database name instead of following index.
(v.2.2)
Features
- Easy to use.
- Compatibility friendly.
- Lemonade friendly.
Screenshots
Spoiler
How to Use
Simple put a call script command before each event command that you want to direct to a follower.
The call script command should be like this →
Code:
- $game_temp.lfmr_follower = index
复制代码
Where index, the index of the follower. Example →
Code:
- $game_temp.lfmr_follower = 1
复制代码
You can also use the follower name, like this →
Code:
- $game_temp.lfmr_follower = 'Natalie'
复制代码
If you want to use the name, remember to put it inside '' or "".
To make the followers wait while the player is still able to move, use this command →
Code:
- $game_temp.lfmr_wait = true
复制代码
Replace true with false if you want to make the followers follow the player again.
Script
Spoiler Code:
- #==============================================================================
- # ** Follower's Commands (also known as Follower's Move Routes v.2.2.1)
- #------------------------------------------------------------------------------
- # * This little script allows to use in followers any editor command designed
- # to work with events, this includes Show Animation, Show Balloon Icon,
- # Set Event Location and Set Move Route.
- #------------------------------------------------------------------------------
- # * To use it, simple put a script call with the following before each of the
- # previously mentioned commands.
- # $game_temp.lfmr_follower = follower index OR folower name
- # Use $game_temp.lfmr_wait = true/false to make the followers wait/follow again.
- # Example
- # $game_temp.lfmr_follower = 1 OR 'Name' : $game_temp.lfmr_wait = true
- #==============================================================================
- #==============================================================================
- # ** Game_Temp, Alias to initialize.
- #------------------------------------------------------------------------------
- # Adds variable to contain follower's index and to turn on/off following.
- #==============================================================================
- class Game_Temp
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :lfmr_follower ; attr_accessor :lfmr_wait
- #--------------------------------------------------------------------------
- # * Initialize Alias
- #--------------------------------------------------------------------------
- alias lemony_moveroute_initialize initialize
- #--------------------------------------------------------------------------
- # * Initialize
- #--------------------------------------------------------------------------
- def initialize
- lemony_moveroute_initialize
- @lfmr_follower, @lfmr_wait = nil, false
- end
- end
- #==============================================================================
- # ** Game_Interpreter
- #------------------------------------------------------------------------------
- # Alias to get_character to return the desired follower if an index was set.
- #==============================================================================
- class Game_Interpreter
- #--------------------------------------------------------------------------
- # * Get Character Alias
- #--------------------------------------------------------------------------
- alias lemony_moveroute_get_character get_character
- #--------------------------------------------------------------------------
- # * Get Character
- #--------------------------------------------------------------------------
- def get_character(param)
- i, $game_temp.lfmr_follower = $game_temp.lfmr_follower, nil
- fc = $game_player.followers[i] if i.is_a?(Integer)
- fc ||= $game_player.followers.each {|f| return f if f.actor.name == i} if !i.nil?
- i.nil? ? lemony_moveroute_get_character(param) : fc
- end
- end
- #==============================================================================
- # ** Game_Follower
- #------------------------------------------------------------------------------
- # Alias to chase_preceding_character for preventing the execution if a move
- # route exist for this character or for the preceding one.
- #==============================================================================
- class Game_Follower < Game_Character
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_reader :move_route
- attr_reader :original_move_route
- #--------------------------------------------------------------------------
- # * Chase Preceding Character Alias
- #--------------------------------------------------------------------------
- alias lemony_moveroute_chase_preceding_character chase_preceding_character
- #--------------------------------------------------------------------------
- # * Pursue Preceding Character
- #--------------------------------------------------------------------------
- def chase_preceding_character
- p_c = @preceding_character if p_c.nil?
- return if (@move_route != @original_move_route) || (p_c != $game_player &&
- (p_c.move_route != p_c.original_move_route) || $game_temp.lfmr_wait)
- lemony_moveroute_chase_preceding_character
- end
- end
复制代码
Author's Notes
Free for use in commercial/noncommercial games, no credits needed.
本贴来自国际rpgmaker官方论坛作者:♥SOURCE♥处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/followers-move-routes.737/