wofsauge/IsaacDocs

EntityPlayer:ChangePlayerType documentation

Closed this issue · 1 comments

I've been doing some testing with ChangePlayerType recently, and it didn't look like there was too much documentation available.

Changing the player type within MC_POST_PLAYER_INIT will result in the player getting the default items for that character. E.g. Maggy will get her Yum Heart without you having to explicitly add it. Exceptions here include unlockable items (e.g. Isaac's D6) and default numbers of hearts/keys/bombs/coins. You can change the player type after init, but then you're generally responsible for adding any items you might associate with that character.

I was able to successfully change from Isaac to all of the following within the init callback: PLAYER_ISAAC, PLAYER_MAGDALENA, PLAYER_CAIN, PLAYER_JUDAS, PLAYER_XXX, PLAYER_EVE, PLAYER_SAMSON, PLAYER_AZAZEL, PLAYER_LAZARUS, PLAYER_THELOST, PLAYER_LILITH, PLAYER_KEEPER, PLAYER_APOLLYON, PLAYER_THEFORGOTTEN, PLAYER_BETHANY, PLAYER_ISAAC_B, PLAYER_MAGDALENA_B, PLAYER_CAIN_B, PLAYER_JUDAS_B, PLAYER_XXX_B, PLAYER_EVE_B, PLAYER_SAMSON_B, PLAYER_AZAZEL_B, PLAYER_LAZARUS_B, PLAYER_THELOST_B, PLAYER_LILITH_B, PLAYER_KEEPER_B, PLAYER_APOLLYON_B, PLAYER_BETHANY_B, PLAYER_JACOB_B.

There's a few other characters that you can't normally select that I didn't test with.

PLAYER_JACOB and PLAYER_THEFORGOTTEN_B had various issues (freezing/crashing/spawning 3 instead of 2 characters) being changed to in init, but I was able to work around this by changing the player type on the next available instance of MC_POST_PEFFECT_UPDATE.

One thing to pay attention to is that changing to a character like Jacob will also spawn Esau. Esau will cause another instance of MC_POST_PLAYER_INIT to be called. Since I was using Isaac as my template character, I put in a check to only proceed with my logic if the character was Isaac.

PLAYER_LILITH's special Incubus didn't spawn correctly when changed to in init, but I was able to work around this by calling player:RespawnFamiliars() on the next available instance of MC_POST_PEFFECT_UPDATE.

In some cases, you need to give a secondary character health otherwise it won't show up. E.g. The Soul won't show up with The Forgotten unless you explicitly give it some health. You can get a reference to The Soul with player:GetSubPlayer().

Thanks for the tests you have done :) ive tried to add these informations to the docs now.

Relevant Commit: b279395

If you find any other things that need a change, please dont hesitate to write an issue or submit a Pull Request ;)