I apologize ahead of time if this is a simple thing. Normally, when you add an actor to the party, it gets added to the end of the list. I think years ago I found a way via scripts to add in actors into any specified slot. And to remove actors from slots instead of id's. Anyone know how to do this through script calls?
Adding (and removing) actors via scripting
● ARCHIVED · READ-ONLY
-
-
Place the following code under materials and above main.
Use the script call $game_party.add_actor_insert(n, a) n is the position in the party where the new actor will be placed, a is the actors id. (note if n is greater than the number of actors in your party -1 it will not add the actor).
Use the script call $game_party.del_actor_pos(n) n is the position of the actor in the party (i.e 0 means that the first actor in the list will be removed).
#script calls $game_party.add_actor_insert(n,a)# $game_party.del_actor_pos(n)class Game_Party < Game_Unit def add_actor_insert(n, actor_id) if @actors.size < n return else @actors.insert(n, actor_id) unless @actors.include?(actor_id) $game_player.refresh $game_map.need_refresh = true end end def del_actor_pos(n) @actors.delete_at(n) $game_player.refresh $game_map.need_refresh = true endendHope this is what you are looking for. :)
Let me know if you encounter any issues.
-
Thanks for the quick reply! I just tested it and nothing seems wrong with it. There is a bug where the game crashes if you reference an actor that doesn't exist, but that shouldn't ever actually come up.
-
Yea if you were to say call the default add_actor through a script call instead of event command you get the same error. For the del_actor_pos you should have a conditional branch that asks if there are at least two members in the party (otherwise you could have a party with no actors which creates an error if you go into battle).
Here's an updated script to prevent my last point:
Was writing the above script on the fly so forgot about this. :p
Just remember to not call a number for adding an actor that doesn't exist in the data base and you should now be fine.
Code:#script calls $game_party.add_actor_insert(n,a)# $game_party.del_actor_pos(n)class Game_Party < Game_Unit def add_actor_insert(n, actor_id) if @actors.size < n return else @actors.insert(n, actor_id) unless @actors.include?(actor_id) $game_player.refresh $game_map.need_refresh = true end end def del_actor_pos(n) if @actors.size < 2 return else @actors.delete_at(n) $game_player.refresh $game_map.need_refresh = true end endend