Josh64

New way of assigning the costume

Sep 19th, 2021 (edited)
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. local Mod = RegisterMod("your mod name", 1)
  2. local game = Game()
  3.  
  4. TrinketType.TRINKET_YOUR_OWN = Isaac.GetTrinketIdByName("Your Trinket") -- trinket
  5. Mod.COSTUME_YOUR_COSTUME = Isaac.GetCostumeIdByPath("gfx/characters/your_costume.anm2") -- costume
  6.  
  7. -- Option 1 assign the costume for your trinket at the very start of the game. It also works when you restart the game.
  8. function Mod:onNewStart(bool)
  9. if bool == false -- triggers on the start of a complete new game
  10. and CTC_API ~= nil then -- check if the 'Trinket Costume' mod is active
  11.  
  12. -- CTC_API:MakeTrinketAvailable(trinketID, costume path)
  13. CTC_API:MakeTrinketAvailable(TrinketType.TRINKET_YOUR_OWN, "gfx/characters/your_costume.anm2")
  14. end
  15. end
  16. Mod:AddCallback(ModCallbacks.MC_POST_GAME_STARTED, Mod.onNewStart)
  17.  
  18.  
  19. -- Option 2 assign the costume for your trinket at the first frame of the game. Also works upon restart.
  20. function Mod:onModUpdate(player)
  21. if game:GetFrameCount() == 1
  22. and CTC_API ~= nil then
  23.  
  24. -- CTC_API:MakeTrinketAvailable(trinketID, costume path)
  25. CTC_API:MakeTrinketAvailable(TrinketType.TRINKET_YOUR_OWN, "gfx/characters/your_costume.anm2")
  26. end
  27. end
  28. Mod:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, Mod.onModUpdate)
Advertisement
Add Comment
Please, Sign In to add comment