Looks like
LAi_boarding.c is doing this as well using
DeleteCharacter.
DeleteCharacter just removes a character from the scene, I think.
ClearCharacter erases all that character's attributes. I added that a while back and it's been causing unexpected trouble once in a while.
But if we sort out those issues, I do think it is cleaner and safer to do that for character IDs that are continuously being reused.
Since it worked, might it be easier to do it as I did originally with ClearCharacter?
What exactly did you do there again?
If I recall, you aborted that function if sea is active or you're in a boarding, right?
I'd really rather not have to do that....
Also, I assume this is correct?
Looks correct to me.
In what way is it not working? The fact that ClearCharacter is being called is not actually a problem.
It is meant to be called. Just not on any characters who are still needed.
You'll need to enable the Trace line to indicate which character is being cleared.
EDIT: See here:
Fixed - Empty officer appearing in Passengers | PiratesAhoy!
If the captain or an officer of the ship you're boarding is being cleared, that is not good.
But if any other random character who already served his purpose is being cleared, that is exactly what it is supposed to do.
Since the character IDs are being recycled, an "available slot" needs to be found.
That slot is then completely erased before a new character is placed into it.
Problems occur when the game thinks a slot is "available" when it really isn't.