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.

XAS Battle System, changing Leader

pez

Member

Hello Again,

I'm just having a lil trouble with what I am trying to achieve, hopefully someone here can help me again...

Below I have Two links and a Script
-XAS Battle Script
-An Extra Set of Actor Graphics for XAS Hero
-Modified DoD Change Leader

The Problem I Having is....
Is when the Leader Changes, the Skill Button 'D' doesn't change. For example if say 'Actor 1' knows Fire 1 and 'Actor 2' knows Thunder 1, when you change leader from 'Actor 1' to 'Actor 2' the skill doesn't change over.
Another issue (although not a big problem) is the same effect above happens to items as well.
Also if a 'Actor 1' leaves with the equipped with a Bronze Sword and is added back into the party the Sword is lost.

What Works
- When you change Leader the info gets updated in the HUD.
- The Equipped weapon stays with the Actor

http://atelier-rgss.com/RGSS/Battle/XAS_00a.html - XAS battle System
Script - MISC
Line 14 Change
Code:
 

SKILL_CHANGE = Input::L

#Usar Item.
to
Code:
SKILL_CHANGE = Input::R

#Usar Item.
- This will make the Script below work to change Leader without having the menu pop up all the time.

http://tmnt-fsc.net/Characters.zip - Extra Hero Graphics

-DoD Change Leader Script
Code:
#------------------#

#Dod Change Leader #

#by:Dodoop #

#version:1.0 #

#------------------#

#

# Edited by: Night_Runner

# Date: 15/Sept/09

#

# Designed to: Turn on the switch corresponding with the leading player's ID

# (and turn off the switch from the last leading player). And update the

# leading player before battle (designed to be compatable with MOG XAS Hud

# V2.6.

#

#-----------------#

#Muda o líder quando uma certa tecla for pressionada no mapa.

module Dodoop

#Tecla que devera ser pressiona para mudar o líder.

CHANGE_LEADER_INPUT = Input::L

end

class Scene_Map

alias change_leader update

def update

change_leader

if Input.trigger?(Dodoop::CHANGE_LEADER_INPUT)

leader_read

end

$game_switches[$game_party.actors[0].id] = true # Turns on the switch of

# the leading hero

end

 

def leader_read

$game_switches[$game_party.actors[0].id] = false # Turns off the switch of

# the last hero

@actors = []

for i in 0...$game_party.actors.size

@actors[i] = $game_party.actors[i]

end

for i in [email=1...@actors.size]1...@actors.size[/email]

$game_party.actors[i - 1] = @actors[i]

end

$game_party.actors[@actors.size - 1] = @actors[0]

$game_player.refresh

$game_party.refresh # Needed to update the party order.

@sthero.refresh # Only to be used with MOG's XAS, refreshes the HUD.

@sthero.update if @sthero != nil

@sthero.refresh if @sthero != nil

@sthero.update if @sthero != nil

 if @sthero != nil

@sthero.dispose

@sthero = Window_HUD.new

@sthero.x = XAS_HUD::XASHUD_X

@sthero.y = XAS_HUD::XASHUD_Y

if $game_switches[XAS_HUD::DISABLE_STATUS_HUD_SWITCH] == false

@sthero.visible = true

   else

    @sthero.visible = false

  end

    @sthero.update

 end

end

end

 

#================================================#

# Game_Party

#================================================#

 

class Game_Party

def remove_actor(actor_id)

# Delete actor

@actors.delete($game_actors[actor_id])

# Refresh player

$game_player.refresh

$game_switches[actor_id] = false # If the actor is removed, they cannot

# be the leading hero.

end

end

For more details please check my last post here.
 
@pez - I like this night_runner edit for XAS... are you trying to switch your party leader in game?


if so... I simply use this:credit goes to modern algebra
Code:
class Scene_Map

 

  alias modern_algebra_change_leader_modification update

  def update

    modern_algebra_change_leader_modification

    if Input.trigger? (Input::A) and Input.trigger?(Input::C)#gameface edit

      # Remove the Lead Actor

      old_lead = $game_party.actors.shift

      # Add the old leader back into the party

      $game_party.add_actor (old_lead.id)

    end

    if Input.trigger? (Input::A) and Input.trigger?(Input::B)#gameface edit

      # Remove the last actor in the party

      new_lead = $game_party.actors.pop

      # Insert him as the lead actor

      $game_party.actors.unshift (new_lead)

      # Refresh $game_player to reflect new leader

      $game_player.refresh

    end

  end

end

hope this helps...have in mind I left my dual button configurations,
so it won't interfere with any default keys

~g/A\/\/\|E|F/A\(C|=
 

pez

Member

I can change the leader.

The problem is...

If Actor 1 knows Fire1
and Actor 2 knows Thunder1
When you change the Leader using the edited script I have provided below all the other details about the Leader (Status/Face Graphic/Weapon/HP/MP) will change except for the Skill, it will stay as the last Skill that was equipped, so if even Actor 2 doesn't know Fire1 if that was the last skill equipped and you change Leader from Actor1 to Actor2 the skill is still available for Actor 2.
 
ahh~ gotcha, sounds like a refresh or update error... for just your skills....hmm..
will it change once you call menu then exit out of menu return to game?

then maybe the changing leader script needs that command...
I'm using XAS_3.6, I'll check it out. ~g
 
@pez - by the looks of it, both change leader scripts are fine, cuz the one I use has the same issue.
so it has to be how XAS is setup to control skills and items. (tools)

by studying some of the events in the demo, you will come across
an autorun event that loads up alot of settings for the actor.
(usually the top left of the world map)

in the event's, list of event commands: window
you will see a call script:

Code:
            $game_system.xas_skill_id = 48 #-------fire 1

           $game_system.xas_skill_index = 1 #loads classes index in data base 

           $game_system.xas_item_id = 1 #-------potion

           $game_system.xas_item_index = 1 #loads classes index in data base

this is what sets the items and skills...

now here's the trick to find the right line of code and to where to place it...

hang tight, I'll try my best ~g/A\/\/\|E|F/A\(C|=
 
@pez - right on, we both need this to work for our XAS projects so I'm stuck on this thread til we get it to work. ^,^

Equipped Items and Skills don't change with Rotating Leader,
yet Equipped Weapons and Shields change just fine.

time to do some proof reading........ ~g/A\/\/\|E|F/A\(C|=
 

pez

Member

Also I noticed

If you change the leader the new Actor can not be attacked

Also EXP points go to the whole party and not the person who dealt the final blow or shared by the attackers...

Also you can change the Leader during attacks, like Magic skills and Charged attacks

I really am thankful for all your help mate
 
Noticing that if the Leader dies the whole party does...

I do remember there was a script that reads if the Hero is down he is swapped in the party, anything like that springing to mind?
@pez - I've been experimenting with this....

Code:
#===============================================================================

# ** Player : Swap Dead Actor 2.5 by Kain Nobel

#===============================================================================

 

#-------------------------------------------------------------------------------

# * SDK Log

#-------------------------------------------------------------------------------

#SDK.log('Player.SwapDeadActor', 'Kain Nobel  ©', 2.5, '12.10.2008')

#-------------------------------------------------------------------------------

# * SDK Enabled Test : BEGIN

#-------------------------------------------------------------------------------

#if SDK.enabled?('Player.SwapDeadActor')

 

#===============================================================================

# ** Scene_Map

#===============================================================================

 

class Scene_Map

  #-----------------------------------------------------------------------------

  # * Alias Listings

  #-----------------------------------------------------------------------------

  alias_method :swap_dead_leader_scene_map_update, :update

  #-----------------------------------------------------------------------------

  # * Update

  #-----------------------------------------------------------------------------

  def update

     swap_dead_leader_scene_map_update

     unless $game_party.actors.empty?

        if ($game_party.actors[0].hp).zero?

           unless $game_party.all_dead?

              $game_party.actors << $game_party.actors.shift

              $game_player.refresh

           else ; $game_temp.gameover = true

           end

        end         

     end

  end

end

 

#-------------------------------------------------------------------------------

# * SDK Enabled Test : END

#-------------------------------------------------------------------------------

#end

I'll look more into the other issues after I tackle a few more scripts that I've been trying to modify.
~g/A\/\/\|E|F/A\(C|=
 
@pez - are you familiar with making tools?

- there's a map named Tools with all the events for weapons, items, skills...
- in the script database there is a script for each event...
- also in the script database SKILL, ITEM scripts
- and most importantly the DATABASE, weapons tab, skill tab, item tab...

now in order to make it possible for the actor to replace the shield with an item or weapon...
one must study how the shield was setup in the areas above.
then all one must do is make a copy or create a new Item, Skill, Or Weapon in the areas above
so that it is called upon the same way as the shield.

Hope this helps... ~g/A\/\/\|E|F/A\(C|=
 
@pez - slowly but surely... I'm currently working on the following for XAS 3.6:

- face graphic (changes with switching character and when you attack, dash, use item, etc...)

- equipped item (changes with switching character)

- equipped skill (changes with switching character)

- experience points (to be assigned to the active player not the entire party)

if/when I get these to work, I'll be more than willing to share...~(G)

edit: going to post the face and leader scripts I made from scratch soon... stay tuned ~(G)
 
I just had to double post ^,^

@pez - here's a beta as to what I'm working on for us XAS'erz

still....a work in progress:
Code:
################################################################################

#

#                              XAS Change Leader

#                                    v 0.2

#                            by (G/A/M/E/F/A/C/E 101

#                                  10-5-2009

#

# v 0.3 - temporary setting to clear equipped item or skill

#         (currently working on having shift equip actor specific skill/item)

#

# v 0.2 - two button configuration to leave default buttons as is. 

#       - sound effect and animation when shifting leader

#       - refreshes game so XAS will register new Leader

#

# v 0.1 = one button to shift leader

#########################################################################[CLASS]

class Scene_Map#-------------------------=[main scene for any ABS]

alias swap_xas_leader update#------------=[alias method for compatibility]

 

def update##############################################################[UPDATE]

swap_xas_leader

if Input.trigger? (Input::A) and Input.trigger?(Input::X)#two buttons to switch!

# $game_system.se_play(RPG::AudioFile.new("087-Action02", 100, 150))#--=[no XAS]

$game_system.se_play(XAS::REFLECT_SE)#-----------------------=[sound when shift]

$game_player.animation_id = 220#-------------------------=[animation when shift]

xas_leader#---------------------------------------------------=[load xas_leader]

end#----------------------------------------------------=[end update definition]

 

def xas_leader#------------------------------------[define how to change leader]

      

      last_act = $game_party.actors.shift #define how to shift actors

      $game_party.add_actor (last_act.id) #shift leader to last act 

      $game_player.refresh #refresh actors new sequence

      $game_system.xas_skill_id = 0 #to clear equipped skill

      $game_system.xas_item_id = 0 #to clear equipped item

      $scene = Scene_Map.new#refresh game for new leader to be XAS active]

 end#------------------------------------------------=[end global variables "$"]

 end#-----------------------------------------------=[end xas_leader definition]

end#---------------------------------------------------------------=[end it all]

 

 

I will post a new thread once I iron out a few more features...
in the mean time enjoy the script in it's early development ~g/A\/\/\|E|F/A\(C|=
 

pez

Member

I appreciate the effort, but I'm getting a line 41 syntax error, also can you please use another type of code preview, it's hard to copy the code with...
1.
2.
3.
mixed in the code. It's a little confusing. Anyway good to see I'm still getting support here. :)
 

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