じ☆ve冰风 发表于 2026-8-2 19:15:16

FG7 - Simple Convoy

Simple Convoy
By: FamilyGamer7​

Introduction
                        This script simulates a party guest/convoy system. Very similar to the system used in Suikoden 2 (Convoy).               
Click to expand...


Features
                        The Convoy window is automatically hidden (by design) until you decide to add an actor within the Convoy. This script is purely designed to give a visual representation that other actors are with you outside of your normal party members (If an actor is in party, they will be removed).               
Click to expand...


Screenshot(s)





Click to expand...


Script
Spoiler: FG7 - Simple Convoy                Ruby:       
#==============================================================================
# Title: Simple Convoy
# Author: FamilyGamer7 (FG7)
# Version: 1.3
# Engine: RPG Maker VX Ace
#==============================================================================
# ** Change Log |
# ---------------
# 1.0 => Created Script
# 1.1 => Added removal of actor from party if available
# 1.2 => Reconfigured script call logic - easier to read + convoy text option
# 1.3 => Adjusted window placement (To the top) for Graphic resize purposes
#==============================================================================
# ** Description |
# ----------------
# This script simulates a party guest/convoy system. Very similar to the system
# used in Suikoden 2 (Convoy).
#==============================================================================
# ** Terms of Use |
# -----------------
# * Free to use in non-commercial projects and commercial projects
# * Feel free to modify and improve the script. Credit is still required.
# * Credit FamilyGamer7
#==============================================================================
# ** Usage |
# ----------
# * NOT Plug & Play (See notes below for more information)
#==============================================================================
# ** Notes |
# ----------
# The Convoy window is automatically hidden (by design) until you decide to
# add an actor within the Convoy. This script is purely designed to give a
# visual representation that other actors are with you outside of your normal
# party members (If an actor is in party, they will be removed).
#
# - The Convoy window is displayed on the Scene_Menu.
#
# Assign the actor id number that corresponds to the actor that you want to be
# apart of the convoy. Use $game_party.convoy_actor_slot_1 when you add the
# first actor to the convoy. See example below.
#
# (Ex: Actor 13 / $game_party.convoy_actor_slot_1 = 13)
#
# For Actor 1 Convoy Slot - Replace the # with an actor id value
# $game_party.convoy_actor_slot_1 = #
#
# For Actor 2 Convoy Slot - Replace the # with an actor id value
# $game_party.convoy_actor_slot_2 = #
#
# When you are done with the 1 actor being in your convoy, change the script
# call value to "0" to remove. When you are done with both actors, change both
# game script calls back to "0" and then the Convoy window will disappear.
#
# -----------------------------------------------------------------------------
#
# To add actors back into the party after removal from the convoy, use the
# following script call example below.
#
# $game_party.add_actor(#) - Replace the # with an actor id of your choice
# - Ex: $game_party.add_actor(5)
#==============================================================================

#==============================================================================
# ** Module: FG7::Simple_Convoy
#------------------------------------------------------------------------------
#This modules creates a static variable to be used within the script.
#==============================================================================

module FG7
module Simple_Convoy

#==============================================================================
# -------------------- ALLOWED TO EDIT BELOW THIS LINE ---------------------- #
#==============================================================================

    # Sets the convoy text for the window
    Convoy_Text = "Convoy"

    # Sets value for $game_variable on actor 1 - Convoy
    # (Change the value to a game variable not in use within your game)
    Game_Variable_Actor_Slot_1 = 18

    # Sets value for $game_variable on actor 2 - Convoy
    # (Change the value to a game variable not in use within your game)
    Game_Variable_Actor_Slot_2 = 19

#==============================================================================
# ---------- DO NOT EDIT BELOW THIS LINE (FOR ADVANCED USERS) --------------- #
#==============================================================================

end
end

#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
#This class handles parties. Information such as gold and items is included.
# Instances of this class are referenced by $game_party.
#==============================================================================

class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# * New Method: Convoy Actor 1 by Game Variable
#--------------------------------------------------------------------------
def convoy_actor_slot_1=(value)
    @convoy_actor_slot_1 = value
    $game_variables = @convoy_actor_slot_1
end
#--------------------------------------------------------------------------
# * New Method: Convoy Actor 2 by Game Variable
#--------------------------------------------------------------------------
def convoy_actor_slot_2=(value)
    @convoy_actor_slot_2 = value
    $game_variables = @convoy_actor_slot_2
end
#--------------------------------------------------------------------------
# * New Method: Convoy?
#--------------------------------------------------------------------------
def convoy?
    return true if $game_variables != 0 or $game_variables != 0
    return false
end
end

#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#This is a super class of all windows within the game.
#==============================================================================

class Window_Base < Window
#--------------------------------------------------------------------------
# * New Method: Draw Face Graphic
#   enabled : Enabled flag. When false, draw semi-transparently.
#--------------------------------------------------------------------------
def draw_face_for_convoy(face_name, face_index, x, y, enabled = true)
    bitmap = Cache.face(face_name)
    rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96, 69)
    contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
    bitmap.dispose
end
#--------------------------------------------------------------------------
# * New Method: Draw Actor Face Graphic
#--------------------------------------------------------------------------
def draw_actor_face_for_convoy(actor, x, y, enabled = true)
    draw_face_for_convoy(actor.face_name, actor.face_index, x, y, enabled)
end
end

#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
#This window displays party member status on the menu screen.
#==============================================================================

class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# * Alias Method: Get Window Height
#--------------------------------------------------------------------------
alias :fg7_simple_convoy_window_height :window_height
def window_height
    # Returns value if scene_menu and convoy
    return Graphics.height - 100 if SceneManager.scene_is?(Scene_Menu) && $game_party.convoy? == true
    fg7_simple_convoy_window_height
end
#--------------------------------------------------------------------------
# * Override Method: Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
    actor = $game_party.members
    enabled = $game_party.battle_members.include?(actor)
    rect = item_rect(index)
    draw_item_background(index)
    # If not on Scene_Menu and convoy is false - draw default
    if !SceneManager.scene_is?(Scene_Menu) or $game_party.convoy? == false
      draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled)
      draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)
    # On Scene_Menu and convoy is true - draw non default
    else
      draw_actor_face_for_convoy(actor, rect.x + 1, rect.y + 2, enabled)
      draw_actor_simple_status(actor, rect.x + 108, rect.y - 12 + line_height / 2)
    end
end
end

#==============================================================================
# ** Window_SimpleConvoy
#------------------------------------------------------------------------------
#This window displays up to 2 actors that follow the party (They gain no EXP)
#==============================================================================

class Window_SimpleConvoy < Window_Base
#--------------------------------------------------------------------------
# * Added Method: Object Initialization
#--------------------------------------------------------------------------
def initialize
    super(0, 0, window_width, window_height)
    refresh
end
#--------------------------------------------------------------------------
# * Added Method: Get Window Width
#--------------------------------------------------------------------------
def window_width
    Graphics.width - 160
end
#--------------------------------------------------------------------------
# * Added Method: Get Window Width
#--------------------------------------------------------------------------
def window_height
    100
end
#--------------------------------------------------------------------------
# * Added Method: Refresh - Draws 1 or 2 actor faces & names
#--------------------------------------------------------------------------
def refresh
    contents.clear
    draw_convoy_guests
end
#--------------------------------------------------------------------------
# * New Method: Draw Convoy Guests
#--------------------------------------------------------------------------
def draw_convoy_guests
    # Convoy Title Text & Nuumber Indicator
    change_color(system_color)
    draw_text(228, -90, 200, 200, FG7::Simple_Convoy::Convoy_Text)
    change_color(text_color(0))
    draw_text(228, -62, 200, 200, "1.")
    draw_text(228, -37, 200, 200, "2.")
    # Checks for Actor Slot 1 - If game variable has been changed
    if $game_variables != 0
      # Draw Convoy Actor #1 Face & Name
      draw_actor_face($game_actors[$game_variables], 0, 0)
      change_color(text_color(0))
      draw_actor_name($game_actors[$game_variables], 252, 25, 200)
      # Removes Actor #1 From Party (If available)
      $game_party.remove_actor($game_variables)
    end
    # Checks for Actor Slot 2 - If game variable has been changed
    if $game_variables != 0
      # Draw Convoy Actor #2 Face & Name
      draw_actor_face($game_actors[$game_variables], 115, 0)
      #change_color(text_color(0))
      draw_actor_name($game_actors[$game_variables], 252, 50)
      # Removes Actor #2 From Party (If available)
      $game_party.remove_actor($game_variables)
    end
end
#--------------------------------------------------------------------------
# * Added Method: Open Window
#--------------------------------------------------------------------------
def open
    refresh
    super
end
end

#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#This class performs the menu screen processing.
#==============================================================================

class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# * Alias Method: Start Processing
#--------------------------------------------------------------------------
alias :fg7_simply_convoy_start :start
def start
    fg7_simply_convoy_start
    # Return nothing if convoy is false
    return if $game_party.convoy? == false
    create_simple_convoy_window
end
#--------------------------------------------------------------------------
# * Alias Method: Create Status Window (Refreshes for Actor Removal)
#--------------------------------------------------------------------------
alias :fg7_simply_convoy_create_status_window :create_status_window
def create_status_window
    fg7_simply_convoy_create_status_window
    # Removes Actor # 1 From Party (If available)
    $game_party.remove_actor($game_variables) if $game_variables != 0
    # Removes Actor # 2 From Party (If available)
    $game_party.remove_actor($game_variables) if $game_variables != 0
    # Sets the actor(s) window "y" coordinates if convoy is enabled
    @status_window.y = 100 if $game_party.convoy? == true
    # Refresh Correct Scenes
    @status_window.refresh
end
#--------------------------------------------------------------------------
# * New Method: Creates Simply Convoy Window
#--------------------------------------------------------------------------
def create_simple_convoy_window
    @simple_convoy_window = Window_SimpleConvoy.new
    @simple_convoy_window.x = @command_window.width
    @simple_convoy_window.refresh
end
end


How to Use
                        Add this script in the script editor under in the "Materials" section and above "Main Process".
The instructions and setup for the script are held within the script header itself. No need to repeat here.               
Click to expand...


Terms of Use
                        - Free to use in non-commercial projects and commercial projects
- Feel free to modify and improve the script. Credit is still required.
- Credit FamilyGamer7               
Click to expand...




本贴来自国际rpgmaker官方论坛作者:FG7处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/fg7-simple-convoy.144648/
页: [1]
查看完整版本: FG7 - Simple Convoy