I presume you're using an older version of essentials, but this is still possible on there:
Instead of changing the name, it would help to have it change based on variables.
So, what we need to do is go into where the name is stored in the Trainer class
It is stored in class PokeBattle_Trainer in your version, or class Player < Trainer in more modern version of Essentials.
So, anywhere you wish, (either in a page past the trainer pages, and before Main, or in a Plugin), put:
Code:
YOUR_ALTERNATE_NAME = 69 # Not the actual name, but rather the variable number attached to the name
def pbIsAlternateCharacter?
# Change this to match the conditions that make the player this other character
return true
end
class PokeBattle_Trainer
def name
if self == $Trainer # Stops it from affecting all NPCs. You DON'T need this line in more modern essentialls versions
return pbGet(YOUR_ALTERNATE_NAME) if pbIsAlternateCharacter?
end
return @name
end
end
However, this doesn't solve everything. there may be other problems that crop up as a result of changing only the name of the trainer. Everything else will be the same (Trainer type, pokemon party money etc.) Another suggestion is to create an entirely new Trainer object and save the old player using something like this)
Code:
ORIGINAL_PLAYER = 420
def pbChangeToAlternateCharacter
new_trainer = PokeBattle_Trainer.new(pbGet(YOUR_ALTERNATE_NAME), PBTrainers::TRAINER_TYPE)) # Ensure you change TRAINER_TYPE to the trainer type of your proposed alternative character
# Saves the original trainer into a variable
pbSet(ORIGINAL_PLAYER, $Trainer.clone)
$Trainer = new_trainer
end
To get the original trainer back:
Code:
def pbChangeFromAlternateCharacter
new_trainer = $Trainer.clone
$Trainer = pbGet(ORIGINAL_PLAYER)
# If you don't wish to save the alternate character, remove this below line
pbSet(ORIGINAL_PLAYER, new_trainer)
end
Hope this helps!
Swdfm