XAS Battle System, changing Leader

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
  1.  
  2. SKILL_CHANGE = Input::L
  3. #Usar Item.
Expand to see the code.

to
  1. SKILL_CHANGE = Input::R
  2. #Usar Item.
Expand to see the code.

- 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
  1. #------------------#
  2. #Dod Change Leader #
  3. #by:Dodoop #
  4. #version:1.0 #
  5. #------------------#
  6. #
  7. # Edited by: Night_Runner
  8. # Date: 15/Sept/09
  9. #
  10. # Designed to: Turn on the switch corresponding with the leading player's ID
  11. # (and turn off the switch from the last leading player). And update the
  12. # leading player before battle (designed to be compatable with MOG XAS Hud
  13. # V2.6.
  14. #
  15. #-----------------#
  16. #Muda o líder quando uma certa tecla for pressionada no mapa.
  17. module Dodoop
  18. #Tecla que devera ser pressiona para mudar o líder.
  19. CHANGE_LEADER_INPUT = Input::L
  20. end
  21. class Scene_Map
  22. alias change_leader update
  23. def update
  24. change_leader
  25. if Input.trigger?(Dodoop::CHANGE_LEADER_INPUT)
  26. leader_read
  27. end
  28. $game_switches[$game_party.actors[0].id] = true # Turns on the switch of
  29. # the leading hero
  30. end
  31.  
  32. def leader_read
  33. $game_switches[$game_party.actors[0].id] = false # Turns off the switch of
  34. # the last hero
  35. @actors = []
  36. for i in 0...$game_party.actors.size
  37. @actors[i] = $game_party.actors[i]
  38. end
  39. for i in [email hidden]
  40. $game_party.actors[i - 1] = @actors[i]
  41. end
  42. $game_party.actors[@actors.size - 1] = @actors[0]
  43. $game_player.refresh
  44. $game_party.refresh # Needed to update the party order.
  45. @sthero.refresh # Only to be used with MOG's XAS, refreshes the HUD.
  46. @sthero.update if @sthero != nil
  47. @sthero.refresh if @sthero != nil
  48. @sthero.update if @sthero != nil
  49.  if @sthero != nil
  50. @sthero.dispose
  51. @sthero = Window_HUD.new
  52. @sthero.x = XAS_HUD::XASHUD_X
  53. @sthero.y = XAS_HUD::XASHUD_Y
  54. if $game_switches[XAS_HUD::DISABLE_STATUS_HUD_SWITCH] == false
  55. @sthero.visible = true
  56.    else
  57.     @sthero.visible = false
  58.   end
  59.     @sthero.update
  60.  end
  61. end
  62. end
  63.  
  64. #================================================#
  65. # Game_Party
  66. #================================================#
  67.  
  68. class Game_Party
  69. def remove_actor(actor_id)
  70. # Delete actor
  71. @actors.delete($game_actors[actor_id])
  72. # Refresh player
  73. $game_player.refresh
  74. $game_switches[actor_id] = false # If the actor is removed, they cannot
  75. # be the leading hero.
  76. end
  77. end
Expand to see the code.


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
  1. class Scene_Map
  2.  
  3.   alias modern_algebra_change_leader_modification update
  4.   def update
  5.     modern_algebra_change_leader_modification
  6.     if Input.trigger? (Input::A) and Input.trigger?(Input::C)#gameface edit
  7.       # Remove the Lead Actor
  8.       old_lead = $game_party.actors.shift
  9.       # Add the old leader back into the party
  10.       $game_party.add_actor (old_lead.id)
  11.     end
  12.     if Input.trigger? (Input::A) and Input.trigger?(Input::B)#gameface edit
  13.       # Remove the last actor in the party
  14.       new_lead = $game_party.actors.pop
  15.       # Insert him as the lead actor
  16.       $game_party.actors.unshift (new_lead)
  17.       # Refresh $game_player to reflect new leader
  18.       $game_player.refresh
  19.     end
  20.   end
  21. end
Expand to see the code.


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|=
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
Thanks man I await your reply...

BTW you might wanna just start on a fresh XAS - ABS Hero 3.6 and make those adjustments I mentioned above.
@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:

  1.            $game_system.xas_skill_id = 48 #-------fire 1
  2.            $game_system.xas_skill_index = 1 #loads classes index in data base
  3.            $game_system.xas_item_id = 1 #-------potion
  4.            $game_system.xas_item_index = 1 #loads classes index in data base
Expand to see the code.


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|=
Hanging on very Tight
@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|=
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
Quote:
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....

Content Hidden Show
  1. #===============================================================================
  2. # ** Player : Swap Dead Actor 2.5 by Kain Nobel
  3. #===============================================================================
  4.  
  5. #-------------------------------------------------------------------------------
  6. # * SDK Log
  7. #-------------------------------------------------------------------------------
  8. #SDK.log('Player.SwapDeadActor', 'Kain Nobel  ©', 2.5, '12.10.2008')
  9. #-------------------------------------------------------------------------------
  10. # * SDK Enabled Test : BEGIN
  11. #-------------------------------------------------------------------------------
  12. #if SDK.enabled?('Player.SwapDeadActor')
  13.  
  14. #===============================================================================
  15. # ** Scene_Map
  16. #===============================================================================
  17.  
  18. class Scene_Map
  19.   #-----------------------------------------------------------------------------
  20.   # * Alias Listings
  21.   #-----------------------------------------------------------------------------
  22.   alias_method :swap_dead_leader_scene_map_update, :update
  23.   #-----------------------------------------------------------------------------
  24.   # * Update
  25.   #-----------------------------------------------------------------------------
  26.   def update
  27.      swap_dead_leader_scene_map_update
  28.      unless $game_party.actors.empty?
  29.         if ($game_party.actors[0].hp).zero?
  30.            unless $game_party.all_dead?
  31.               $game_party.actors << $game_party.actors.shift
  32.               $game_player.refresh
  33.            else ; $game_temp.gameover = true
  34.            end
  35.         end        
  36.      end
  37.   end
  38. end
  39.  
  40. #-------------------------------------------------------------------------------
  41. # * SDK Enabled Test : END
  42. #-------------------------------------------------------------------------------
  43. #end
Expand to see the code.


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|=
Cheers for that mate, it works well..
@pez - right on! glad I was able to help... ~g
Any help on changing the shield function to a secondary item or magic attack?
@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|=
Has any progress been made on changing leader?
@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:
  1. ################################################################################
  2. #
  3. #                              XAS Change Leader
  4. #                                    v 0.2
  5. #                            by (G/A/M/E/F/A/C/E 101
  6. #                                  10-5-2009
  7. #
  8. # v 0.3 - temporary setting to clear equipped item or skill
  9. #         (currently working on having shift equip actor specific skill/item)
  10. #
  11. # v 0.2 - two button configuration to leave default buttons as is.
  12. #       - sound effect and animation when shifting leader
  13. #       - refreshes game so XAS will register new Leader
  14. #
  15. # v 0.1 = one button to shift leader
  16. #########################################################################[CLASS]
  17. class Scene_Map#-------------------------=[main scene for any ABS]
  18. alias swap_xas_leader update#------------=[alias method for compatibility]
  19.  
  20. def update##############################################################[UPDATE]
  21. swap_xas_leader
  22. if Input.trigger? (Input::A) and Input.trigger?(Input::X)#two buttons to switch!
  23. # $game_system.se_play(RPG::AudioFile.new("087-Action02", 100, 150))#--=[no XAS]
  24. $game_system.se_play(XAS::REFLECT_SE)#-----------------------=[sound when shift]
  25. $game_player.animation_id = 220#-------------------------=[animation when shift]
  26. xas_leader#---------------------------------------------------=[load xas_leader]
  27. end#----------------------------------------------------=[end update definition]
  28.  
  29. def xas_leader#------------------------------------[define how to change leader]
  30.      
  31.       last_act = $game_party.actors.shift #define how to shift actors
  32.       $game_party.add_actor (last_act.id) #shift leader to last act
  33.       $game_player.refresh #refresh actors new sequence
  34.       $game_system.xas_skill_id = 0 #to clear equipped skill
  35.       $game_system.xas_item_id = 0 #to clear equipped item
  36.       $scene = Scene_Map.new#refresh game for new leader to be XAS active]
  37.  end#------------------------------------------------=[end global variables "$"]
  38.  end#-----------------------------------------------=[end xas_leader definition]
  39. end#---------------------------------------------------------------=[end it all]
  40.  
  41.  
Expand to see the code.


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|=
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. :)
Click "Line Number On/Off" in the upper right corner of the code box.
Thank you bwdyeti it was so simple all along...
Hi there... ^^

I've edited the script a little bit and finished it with common events (because I am not that good at ruby)... ^^

Now you can change the leader and he got all the weapons and Skills the leader before had equiped...

I also inserted the Game-over-Leader-Change Script I found and edited it a little bit, so it will automatically change the new leader weapon etc. ^^

There can be bugs, because I copied it over from my game to the XAS Demo... on my game it works very well... ^^ And the few times I tested it on the demo, it worked too ^^

The only thing I can't get working is the exp points being parted.. ^^

Oh and if you would like to have the clothes changed also to the leader you have to do it the same way in the common events... ^^ But I don't like that... so you can also deactivate the change "shield" thing.. etc...

Maybe it will help the scripters out there to work on a script that have got all inside without common events.... ^^
Feel free to experiment with it.. ^^

Wish ya all fun with it... DOWNLOAD

Greetz,
Darkwonder

P.S. Sorry for my bad english, I am from Germany ^^
For the ones who don't know how to change leader "Press Button A and X" together.. for me it is Run and Shield button ^^
Hackel to the rescue! ^,^
now this script remembers equipped skills and items
for each actor. (thanks Hackel you are the man!)
and I've included a way to switch when an actor dies.
so that it won't gameover when you have more actors
in the party.

enjoy people ...this job is done! :D

must give credit and free to use ~ GO XAS! ^,^
Content Hidden Show
  1. =begin
  2.  
  3. SWITCH XAS LEADER script V.5
  4. by gameface101
  5. 1-3-10
  6.  
  7. special thanks to Hackel
  8. for help with remember skills and items
  9.  
  10. *free to use and must give credit
  11.  
  12.  
  13. =end
  14.  
  15. class Game_Temp
  16.       attr_accessor :remember_skill
  17.       attr_accessor :remember_item
  18. alias swap_initialize initialize
  19. def initialize
  20.       @remember_skill = []
  21.       @remember_item = []
  22. swap_initialize
  23. end
  24. end
  25. class Scene_Map
  26.   alias switch_xas_leader update
  27. def update
  28. switch_xas_leader
  29. if Input.press? (Input::A) and Input.press?(Input::X)
  30. $game_system.se_play(RPG::AudioFile.new("009-System09", 100, 100))
  31. $game_player.animation_id = 220
  32. xas_leader
  33. end
  34. def xas_leader
  35.       $game_temp.remember_skill[$game_party.actors[0].id] = $game_system.xas_skill_id
  36.       $game_variables[1] = $game_temp.remember_skill[$game_party.actors[0].id]
  37.       $game_temp.remember_item[$game_party.actors[0].id]= $game_system.xas_item_id
  38.       last_act = $game_party.actors.shift
  39.       $game_party.add_actor (last_act.id)
  40.       $game_player.refresh
  41.       unless $game_temp.remember_skill[$game_party.actors[0].id] == nil
  42.       $game_system.xas_skill_id = $game_temp.remember_skill[$game_party.actors[0].id] #to clear equipped skill
  43.     else
  44.       $game_system.xas_skill_id = 0
  45.     end
  46.     unless $game_temp.remember_item[$game_party.actors[0].id] == nil
  47.       $game_system.xas_item_id = $game_temp.remember_item[$game_party.actors[0].id] #to clear equipped item
  48.     else
  49.       $game_system.xas_item_id = 0
  50.       end
  51.       $scene = Scene_Map.new
  52.  end
  53.  
  54.  end
  55. end
  56.  
  57. class Scene_Map
  58.   alias_method :switch_dead_actor_scene_map_update, :update
  59.   def update
  60.      switch_dead_actor_scene_map_update
  61.      unless $game_party.actors.empty?
  62.         if ($game_party.actors[0].hp).zero?
  63.            unless $game_party.all_dead?
  64.               $game_party.actors << $game_party.actors.shift
  65.               $game_player.refresh
  66.            else ; $game_temp.gameover = true
  67.            end
  68.         end        
  69.      end
  70.   end
  71. end
  72.  
Expand to see the code.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=67470