Pet Follower not visible

● ARCHIVED · READ-ONLY
Started by Napoleon 3 posts View original ↗
  1. I can't get a custom follower to work. It has a valid character name and character_index but they are not visible? What else is there to set?

    I'm also not sure if my override of max_battle_members is the proper way to add an extra pet to the party (who is not visible in battle or in the menu or anywhere else). It seems like a dirty solution...

    Calling Event:

    add_pet:)cat)Code (updated):

    Spoiler
    Code:
    $imported ||= {}$imported[:nap_pet_follower] = 1.00#===============================================================================# Settings#===============================================================================module Nap; module Pet_Conf  FOLLOWER_CNT = 4  ALLOW_ONLY_ONE_PET = true  DEF_FED_DECAY = 0.2  DEF_HAP_DECAY = 0.2  PETS = { # Case sensitive keys  # :pet_type => {character_name, character_index, hunger_decay, happiness_decay }    :dog => {      :char_name      => 'Animal',      :char_idx       => 0,      :fed_decay      => 0.2, # optional, for script "Nap | Pet Care"      :hapiness_decay => 0.2, # optional, for script "Nap | Pet Care"    },    :cat => {      :char_name      => 'Animal',      :char_idx       => 1,    },  }#===============================================================================# Settings end#===============================================================================PETS.values.each{ |p|  p[:fed_decay] = DEF_FED_DECAY if !p.has_key?(:fed_decay)  p[:fed_decay] = DEF_HAP_DECAY if !p.has_key?(:hapiness_decay)}end; endif Nap::Pet_Conf::FOLLOWER_CNT != 3  class Game_Party < Game_Unit    def max_battle_members      return Nap::Pet_Conf::FOLLOWER_CNT + 1    end  endend#===============================================================================# Class Game Follower#===============================================================================class Game_Follower < Game_Character  attr_accessor :is_pet  attr_accessor :pet_type  def pet_visible; return @pet_visible; end  def pet_visible=(value); @pet_visible = value; refresh; end   alias nap_pet_fol_initialize initialize  def initialize(member_index, preceding_character)    nap_pet_fol_initialize(member_index, preceding_character)    @is_pet = false    @pet_visible = true  end   alias nap_pet_fol_refresh refresh  def refresh    if !is_pet      nap_pet_fol_refresh    else      if @pet_visible && $game_player.followers.visible        @character_name  = Nap::Pet_Conf::PETS[@pet_type][:char_name]        @character_index = Nap::Pet_Conf::PETS[@pet_type][:char_idx]      else        @character_name = ''        @character_index = 0      end    end  endend#===============================================================================# Class Game Followers#===============================================================================class Game_Followers  def nap_rem_pets    @data.reject! { |f| f.is_pet }  end   def add_pet(pet_type)    # TODO: add pet cnt to index as well    pet = Game_Follower.new($game_party.battle_members.size + 1, @data[-1])#~     pet.set_graphic(Nap::Pet_Conf::PETS[pet_type][0], Nap::Pet_Conf::PETS[pet_type][1])    pet.is_pet = true    pet.pet_type = pet_type        @character_name  = Nap::Pet_Conf::PETS[pet_type][:char_name]    @character_index = Nap::Pet_Conf::PETS[pet_type][:char_id]        @data.push(pet)        p "new pet name: #{pet.character_name}" # <<<< works    pet.refresh    refresh    p "new pet name: #{pet.character_name}" # <<<< works    test # <<<<< works  end   def test    @data.each_with_index { |f, i| p "#{i + 1}: #{f.character_name}" }  endend#===============================================================================# Class Game Interpreter#===============================================================================class Game_Interpreter  def add_pet(pet_type)            raise "add_pet(#{pet}) Unknown pet #{pet_type}. Note that this parameter is case-sensitive." if !Nap::Pet_Conf::PETS.has_key?(pet_type)            rem_pets if Nap::Pet_Conf::ALLOW_ONLY_ONE_PET            $game_player.followers.add_pet(pet_type)    $game_player.followers.each { |f| p f.character_name} # Works    $game_player.followers.refresh  end   def rem_pets    $game_player.followers.nap_rem_pets  end   def hide_pets    $game_player.followers.each { |f| f.pet_visible = false if f.is_pet }  end   def show_pets    $game_player.followers.each { |f| f.pet_visible = true if f.is_pet }  endend
  2. I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.


    Do you see them in the menu? Do you need to create an Actor for them in the database?
  3. - I don't want the follower to show up in the menu or anywhere else. I just want a follower. But by checking out whether or not it appears in the menu I saw that the follower becomes visible after closing the menu... So there is a redraw/refresh problem somewhere... So I'm gonna check out what opening/closing the menu refreshes.

    - And the follower spawns at coordinate 0,0 which is of course not intended. That can be solved by:

    $game_player.followers.synchronize($game_player.x, $game_player.y, $game_player.direction)But that is just a dirty solution to patch a bug in the code.

    - And "Gather Followers" only moves the follower 1 tile closer instead of right on top of the player.

    - There must be something really wrong with my script. I just need to know the basics for making a follower visible. I know that adding a new Follower instance to the $game_player.followers.data is the first step. But what then...