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.

Character Changer + Different Responses

First I would really like to thank anybody beforehand who looks at this topics and puts any sort of effort into helping me. I really appreciate it~!

What I want is this: By Pressing L or R, you will change the party leader to the next party member(or the last party member depending on button). And, by checking who is the party leader, certain NPC's will react differently.
Heres a diagram: http://i56.photobucket.com/albums/g182/Musashi999/PartyChangerDiagram.jpg

Thanks again!
 
Credit XRXS
Code:
#################################################################
######################### XRXS ##################################
#################################################################
#O script permite que você possa mudar o char que está no mapa
#apenas apertanto a tecla Q ou W.
#Para entender as cofigurações de botões aperte a tecla F1
#quando estiver jogando. Press Q and W to switch leaders
#################################################################

class Scene_Map
#Definina aqui quais os botões irão mudar o char no mapa.

def lr_variable_id
return 10
end
end
class Game_Player
def controlable?
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
return true
end
return false
end
end
class Scene_Map
alias xrxs41ax_update update
def update
xrxs41ax_update
if $scene.is_a?(Scene_Map) and $game_party.actors.size > 0 and $game_player.controlable?
if Input.trigger?(Input::L) or Input.trigger?(Input::R)
index = 0
for actor in $game_party.actors
if $game_variables[lr_variable_id()] == actor.id
index = $game_party.actors.index(actor)
end
end
if Input.trigger?(Input::L)
index = (index + $game_party.actors.size - 1) % $game_party.actors.size
elsif Input.trigger?(Input::R)
index = (index + 1) % $game_party.actors.size
end
$game_variables[lr_variable_id()] = $game_party.actors[index].id
$game_player.refresh
end
end
end
end
module XRXS41
MAPCHAR_VARIABLE_ID = 10
end
class Game_Player < Game_Character
alias xrxs41_refresh refresh
def refresh
xrxs41_refresh
id = $game_variables[XRXS41::MAPCHAR_VARIABLE_ID]
if id != 0
actor = $data_actors[id]
@character_name = actor.character_name
@character_hue = actor.character_hue
end
end
end
class Interpreter
alias xrxs41_command_122 command_122
def command_122
xrxs41_command_122
if @parameters[0] == XRXS41::MAPCHAR_VARIABLE_ID
$game_player.refresh
end
end
end
Watch out for MAPCHAR_VARIABLE_ID = 10 I'm not sure what it does :P

Couldn't tell you how to make it so its different dialog...maybe you could try switches controlled by when Q and W are pressed, im not sure..

The conditional branches will only allow if In Party, and not If Leader of Party.
 
A bit much, don't you think?

Code:
class Game_Party
  def rotate_party_forward
    @actors << @actors.shift
    $game_player.refresh
  end
  def rotate_party_backward
    @actors.insert(0, @actors.pop)
    $game_player.refresh
  end
end

class Game_Player
  alias_method :seph_rotateparty_gmplyr_update, :update
  def update
    seph_rotateparty_gmplyr_update
    if Input.trigger?(Input::L)
      $game_party.rotate_party_forward
    elsif Input.trigger?(Input::R)
      $game_party.rotate_party_backward
    end
  end
end

You might want to add $game_map.need_refresh = true under $game_player.refresh.


Then, all you need is something like

Code:
Conditional Branch : Script : $game_party.actors[0].id == n
 
Musashi;163705 said:
Just one question, is there a way to disable rotation?

Code:
ROTATION_AVAILABLE = 1 #ID of the switch used to make the rotating available. If the switch with this ID is off, you can't rotate
class Game_Party
  def rotate_party_forward
    @actors << @actors.shift
    $game_player.refresh
  end
  def rotate_party_backward
    @actors.insert(0, @actors.pop)
    $game_player.refresh
  end
end

class Game_Player
  alias_method :seph_rotateparty_gmplyr_update, :update
  def update
    seph_rotateparty_gmplyr_update
  if $game_switches[ROTATION_AVAILABLE]
     if Input.trigger?(Input::L)
      $game_party.rotate_party_forward
     elsif Input.trigger?(Input::R)
      $game_party.rotate_party_backward
      end
    end
  end
end
 

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