[RESOLVED]Lead Actor Swapper Edit

Started by yuhikaru, February 08, 2010, 08:51:38 am

Previous topic - Next topic

yuhikaru

February 08, 2010, 08:51:38 am Last Edit: February 08, 2010, 11:45:56 am by yuhikaru
Hi, people  :D

I'm using RMXP and a neat lead actor swapper script, by Slipknot. I don't have a link, so I'm just gonna post it xD

Spoiler: ShowHide
#==============================================================
# ** Lead Actor Swapper
#------------------------------------------------------------------------------
# Slipknot (creationasylum.net)
# Version 1.01
# March 18, 2006
#==============================================================

class Game_System
 #--------------------------------------------------------------------------
 # * Alias Listing
 #--------------------------------------------------------------------------
 attr_reader :lead_actor
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 alias slipknot_las_init initialize
 #--------------------------------------------------------------------------
 # * Initialize
 #--------------------------------------------------------------------------
 def initialize
   slipknot_las_init
   @lead_actor = 0
 end
 #--------------------------------------------------------------------------
 # * Lead Actor
 #--------------------------------------------------------------------------
 def lead_actor=(n)
   @lead_actor = n
   $game_player.refresh
 end
end


class Game_Player
 #--------------------------------------------------------------------------
 # * Alias Listing
 #--------------------------------------------------------------------------
 alias slipknot_las_update update
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   if $game_party.actors.size == 0
     @character_name = ''
     @character_hue = 0
     return
   end
   actor = $game_party.actors[$game_system.lead_actor]
   @character_name = actor.character_name
   @character_hue = actor.character_hue
   @opacity = 255
   @blend_type = 0
 end
 #--------------------------------------------------------------------------
 # * Update
 #--------------------------------------------------------------------------
 def update
   slipknot_las_update
   if Input.trigger?(Input::R)
     $game_system.lead_actor = ($game_system.lead_actor + 1) % $game_party.actors.size
   end
   if Input.trigger?(Input::L)
     $game_system.lead_actor = ($game_system.lead_actor - 1) % $game_party.actors.size
   end
 end
end


It's very nice and all, but one problem I have is that everytime you use L/R the player sprite changes, and that includes the cutscenes. It's actually kind of funny....

What I'm looking for is a lead actor swapper script that has and on/off switch. Does anyone know of one? Or could edit Slipknot's one for me?  :naughty:

I tried solving it using events. Before the cutscene I tried to remove the unwanted party members from the group so the L/R thing would be useless, and then adding them all again after the cutscene was over, but I got a problem on line 50 O_o

Thanks in advance <3 Any help will be pretty much appreciated

G_G

Here ya go
#==============================================================
# ** Lead Actor Swapper
#------------------------------------------------------------------------------
# Slipknot (creationasylum.net)
# Version 1.01
# March 18, 2006
#==============================================================

# The switch number to turn the changing on and off
# if the switch is OFF you cant change, if its on you can change
CUTSCENESWITCH = 1

class Game_System
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  attr_reader :lead_actor
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  alias slipknot_las_init initialize
  #--------------------------------------------------------------------------
  # * Initialize
  #--------------------------------------------------------------------------
  def initialize
    slipknot_las_init
    @lead_actor = 0
  end
  #--------------------------------------------------------------------------
  # * Lead Actor
  #--------------------------------------------------------------------------
  def lead_actor=(n)
    @lead_actor = n
    $game_player.refresh
  end
end


class Game_Player
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias slipknot_las_update update
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if $game_party.actors.size == 0
      @character_name = ''
      @character_hue = 0
      return
    end
    actor = $game_party.actors[$game_system.lead_actor]
    @character_name = actor.character_name
    @character_hue = actor.character_hue
    @opacity = 255
    @blend_type = 0
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  def update
    slipknot_las_update
    return if $game_switches[CUTSCENESWITCH] == false
    if Input.trigger?(Input::R)
      $game_system.lead_actor = ($game_system.lead_actor + 1) % $game_party.actors.size
    end
    if Input.trigger?(Input::L)
      $game_system.lead_actor = ($game_system.lead_actor - 1) % $game_party.actors.size
    end
  end
end

yuhikaru

February 08, 2010, 09:10:27 am #2 Last Edit: February 08, 2010, 11:46:47 am by yuhikaru
 :^_^': lol, I spent more time checking my grammar than waiting for a reply xD Thank you! I can't test it now, but there shouldn't be a problem.

EDIT: It works perfectly ^^ Thanks <3