Player saved data location

wavydavy

Terrarian
Quick question:
How do I programmatically get the player folder: %userprofile%\Documents\My Games\Terraria\Players\xxx
In .net there are variables like Environment.SpecialFolder.Personal. Am I supposed to build the directory from there or is there a field somewhere inside the Terraria namespace that contains the current players data folder?

The reasons for the question:
I'm trying to create a mod that records player stats over a period of time. Initially I'll drive this as a buff. I was to write a CSV file during a boss battle so I can graph my performance of the battle. The rate of my decline in health, how close to death before I take a health potion. My usage of magic etc.
Not sure if I ultimately want to drive this from a buff or if I want to automatically start the "recording" once a boss battle has started. My 2nd question would be how should I listen for a boss battle start? But I'll stick with the simple workaround to start with.

Cheers

David
 
Main.PlayerPath is the player folder (%userprofile%\Documents\My Games\Terraria\Players). For boss, I guess just check Main.npc for any npc that is active and a boss. Someone on the tmodloader discord might have other ideas if you need them.
 
Back
Top Bottom