How do I rename heroes?
This article is about renaming heroes by script. If this isn't what you want, see How do I allow players to rename characters?
I'll take the example of Jason Bourne, who is going to remember his former name.
Notice that renaming a hero does not cause the constant for that hero ID (eg. hero:Jason Bourne) to change, and the name change affects a specific hero, not a hero type definition as found in Custom.
Rename a character that has already joined the party
# Jason discovers his real name $0="David Webb" set hero name(0, find hero(hero:Jason Bourne))
Rename a character that has never joined the party (but who is going to do so)
You may want to do this if the name change is part of an optional branch in the story. First thing to be aware of is that we can not do anything until the hero has joined. Therefore, you have to add the hero before you can rename them.
add hero (hero: Jason Bourne) #hero with his/her old name swap out hero (hero: Jason Bourne) #hero moves to the reserve lock hero (hero: Jason Bourne) #hero became invisible
And when you finally want the hero to join, you'll need:
unlock hero (hero: Jason Bourne) swap in hero (hero: Jason Bourne)