Changing the Party Leader
Mon, 14 Jan 2008 20:03:13 -0500 - Author:
In the default scripts in RPG Maker XP, the actor located at index 0 of $game_party.actors is considered the "leader" of the party. Therefore, the idea here is to move the actor to index 0 of the party. Here's how you can change the leader:
def makeLeader(actorID) # Makes the actor with ID _actorID_ the leader added=false for i in 0...$game_party.actors.size if $game_party.actors[i].id==actorID actor=$game_party.actors.delete_at(i) $game_party.actors.unshift(actor) added=true end end if !added # Add actor to party $game_party.actors.unshift($game_actors[actorID]) # Maximum 4 party members while $game_party.actors.length>4 $game_party.actors.delete_at(4) end end # Refresh player $game_player.refresh end
The example below changes the first actor to actor 2 (which, by default, is Basil):
makeLeader(2)
