Hi, I'm working on a turn-based PvP. My plan is to upload players' PvP combatant group data to server, and when PlayerA wants to challenge PlayerB, the data of PlayerB will be downloaded to PlayerA, then PlayerA can fight the AI which use PlayerB's data. I'm not going to upload players' whole save data in PvP due to security.
So, I'm wondering if there is a way (via script of course) to get some necessary data of players. The data I currently think of as needed are: For equipped equipment: Bonus Settings, Equipment Variables. For Combatants: Abilities assigned to shortcut, equipped equipment list, level and status values. For abilities assigned to shortcut: Ability Variables, Ability Level.
And after getting these data, I also need to set them back to the "basic"&"clean" equipment/ability/combatant. I know this could be complicated, but PvP is an important mode for my game, So if there is a way to achieve it, I am willing to spend time to implement it.
Sure, if you have the instance of the combatant, you can simply call SaveGame on it to get a DataObject representing the combatant's data, which in turn can be converted into an XML string that you can upload.
Saving data and getting XML string: DataObject data = combatant.SaveGame(); string xml = data.ToXML("combatant");
Turning XML string into data and loading combatant: DataObject data = new GamingIsLove.Makinom.IO.XMLParser(xml, null); Combatant combatant = new Combatant(data, false, new Group(faction)); faction is the FactionSetting of the faction the combatant/group should be part of.
Or, if you want to use the whole group, the combatant's group also has a SaveGame function, working the same way.
Post edited by gamingislove on
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Saving data and getting XML string:
DataObject data = combatant.SaveGame();
string xml = data.ToXML("combatant");
Turning XML string into data and loading combatant:
DataObject data = new GamingIsLove.Makinom.IO.XMLParser(xml, null);
Combatant combatant = new Combatant(data, false, new Group(faction));
faction is the FactionSetting of the faction the combatant/group should be part of.
Or, if you want to use the whole group, the combatant's group also has a SaveGame function, working the same way.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Thanks :)