edited September 2014 in ORK Scripting
I've managed to put together a little character generator. Within it, you can select a portrait for the characters. Here is a little code snippet that I am using to get the combatant and set the portrait:

CombatantSetting cs;
PortraitWithType p = new PortraitWithType();
Group g = ORK.Game.ActiveGroup;

//here is where I get the selected portrait
p.image = portrait[selectedPortrait[charIndex]]; //this is a Texture2D array containing the textures of the various portraits

Combatant c = g.Leader;
cs.portrait[0].image = p.image; //set the portrait


This works fine. The portrait changes. Now my problem is with loading a saved game.
I'm modifying the combatants that I created in the ORK database (in case you just want to use the default party). When I load a save game, the portraits are back to the original. All of the other data appears to be correctly saving and re-loading (class, level, xp, stats, etc)

Is there something else I need to do to save/load the correct portrait image? I haven't dug around in the load game functions yet. I suspect there is nothing that loads the portraits since these are set in the database.
  • That's simply not possible that way without doing custom scripting in the save game code.
    Stuff like the stats will be saved, but the portraits will be loaded according to the settings you've done in the editor and not saved with a save game.

    If you want to have different portraits, you'll need to make different combatants for each portrait and use the combatant based on the player's selection.
    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!
  • Kind of figured that. Thanks for the info
Sign In or Register to comment.