Jump to content
Owll

How to remove a dead character from followers on map

Recommended Posts

Ok...when a character dies and his hp are 0, it acquires the state of death. But when you have chosen the player followers option, the dead character is still following! I would like to remove it from the party when he dies.

If I run an event (hp =0) from the troop event box during the battle, it works.

But if I want that situation for all game situations, I tried using a common event:

  - Condition branch if that character is dead

  - Remove the character in change party member

It doesn't work...do I need a trigger? I want this to work on any map not just on the world map.

 

Please help...tried many things...

Thanks in advance

Owll

 

Share this post


Link to post
Share on other sites

If you're trying to use the comment event, to work on all maps, did you set trigger to Parallel Process? If that didn't work, then I don't know, you might need modify a script, like Galv said.

Share this post


Link to post
Share on other sites

This is as close as I could get.  I don't think there is a way to make it so that you can remove the party leader if he dies.  I tried everything I could think of and nothing worked.  It will remove the other followers, though.  Copy and Paste underneath Materials but above Main.  Everything is aliased properly so there shouldn't be any conflicts with anything you're already using.

module BattleManager
  
  class << BattleManager
    alias new_battle_end battle_end
    def battle_end(result)
      $game_player.followers.refresh
      new_battle_end(result)
    end
  end
  
end


class Scene_Menu < Scene_MenuBase
  
  alias new_return return_scene
  def return_scene
    $game_player.followers.refresh
    new_return
  end
  
end


class Game_Follower < Game_Character
  
  def get_x
    return @real_x
  end
  
  def get_y
    return @real_y
  end
  
  def get_d
    return @direction
  end
  
end


class Game_Followers
  
  attr_reader   :leader
  
  alias new_init initialize
  def initialize(leader)
    @leader = leader
    new_init(leader)
  end
  
  alias new_refresh refresh
  def refresh
    foobar = @data.pop
    x = foobar.get_x
    y = foobar.get_y
    d = foobar.get_d
    @data = []
    count = 1
    leader_not_established = true
    while count < $game_party.members.length
      if leader_not_established
        @data.push(Game_Follower.new(count, @leader)) unless $game_party.members[count].hp < 1
        leader_not_established = false unless $game_party.members[count].hp < 1
      else
        @data.push(Game_Follower.new(count, @data[-1])) unless $game_party.members[count].hp < 1        
      end
      count = count + 1
    end
    synchronize(x, y, d)
    new_refresh
  end
  
end

Share this post


Link to post
Share on other sites

That's a bit over complicated for what it's doing. Here's a more simplistic solution...



 

class Game_Follower < Game_Character
  
  def actor
    $game_party.battle_members.keep_if{|actor|actor.alive?}[@member_index]
  end
  
end


class Game_Follower < Game_Character
  
  alias zsnip_8305i initialize
  def initialize(member_index, preceding_character)
    zsnip_8305i member_index, preceding_character
    @actor = actor
  end
  
  alias zsnip_4893u update
  def update
    update_actor
    zsnip_4893u
  end
  
  def update_actor
    if @actor != actor
      @actor = actor
      refresh
    end
  end
  
end

 

Share this post


Link to post
Share on other sites

Thanks all of you.

I will try all the ideas you have submitted...

 

I let you know...

 

What a great site for Rpg maker.

 

Thanks

 

owll

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×