Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Guest Character

If anyone has played FFIII (at least the DS version), you should know what I'm talking about. Basically, I'm requesting a system whereupon a fifth party member is added, that party member becomes a hidden, "guest" party member. Enemies do not attack the guest, nor does the guest even appear in the battle interface. Instead, the guest might randomly use a skill on a random turn.

I'd like this system to do two things: One, give the power to have a fifth party member. Two, make it so certain actors have the behavior like above. They are sort of ghosts. They can't be attacked, and generally can't attack, except sometimes doing so randomly. The chance of them acting should be editable in the script. Also, the "random action" should always be to use a skill. In the case of one of these actors having more than 1 skill, it is chosen at random.

If anyone can do this, I'd be greatful. And if you've played FFIII, try to make the system exactly like that.

Of course, anyone who does this will get credit. That goes without saying....but I'll say it anyway.
 
Here you go:

Code:
class Game_Party < Game_Unit
  
  attr_accessor :guests
  
  alias ffiii_initialize initialize
  def initialize
    ffiii_initialize
    @guests = [5, 6]
  end
  
end

class Game_Actor < Game_Battler
  
  def make_guest_action
    self.action.clear
    case @actor_id
    when 5
      if rand(99) < 60 # 60%
        self.recover_all
        self.action.kind = 0
        self.action.basic = 0
        self.action.decide_random_target
        return true
      end
    when 6
      x = rand(99)
      if x < 20 # 20%
        self.recover_all
        self.action.kind = 1
        self.action.skill_id = 56
        self.action.decide_random_target
        return true
      end
      if x < 40 # 20%
        self.recover_all
        self.action.kind = 1
        self.action.skill_id = 44
        self.action.decide_random_target
        return true
      end
      if x < 60 # 20%
        self.recover_all
        self.action.kind = 1
        self.action.skill_id = 55
        self.action.decide_random_target
        return true
      end
      if x < 80 # 20%
        self.recover_all
        self.action.kind = 1
        self.action.skill_id = 79
        self.action.decide_random_target
        return true
      end
    end
    return false
  end
  
  
end


class Scene_Battle < Scene_Base
  
  alias ffiii_make_action_orders make_action_orders
  def make_action_orders
    ffiii_make_action_orders
    
    unless $game_troop.surprise
      action_battlers2 = @action_battlers.clone
      @action_battlers = []
      for guest in $game_party.guests
        if $game_actors[guest].make_guest_action
          @action_battlers.push($game_actors[guest])
        end
      end
      for battler in action_battlers2
        @action_battlers.push(battler)
      end
    end
  end
  
  def set_next_active_battler
    loop do
      if $game_troop.forcing_battler != nil
        @active_battler = $game_troop.forcing_battler
        @action_battlers.delete(@active_battler)
        $game_troop.forcing_battler = nil
      else
        @active_battler = @action_battlers.shift
      end
      return if @active_battler == nil
      return if @active_battler.index != nil
      return if $game_party.guests.include?(@active_battler.id)
    end
  end
  
end

It should be quite clear how to use but:
To set the guest members:
$game_party.guests = []
With the ids in the [] e.g. [1] is Ralph , [6, 7] is Oscar and Vera etc
To add:
$game_party.guests.push(i)
Where i is the id
To remove:
$game_party.guests.delete(i)
Where i is the id

And to set up what actions they do and how often look at the examples in the script, I hope that's enough instructions wise.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top