Hi,
I had a few questions regarding the Save System and how it works with Combatants.
1)I'd like to enable the ability to create a character with different race. After some forum digging it seems my best option for race might be conditional prefabs with a global race variable? This would enable me to have multiple race prefabs with different skeletal animations. Does this seem like a good use case for conditional prefabs?
2) I'd like to be able to modify the appearance of the conditional prefab at runtime. Both in the character creation screen and during game play. From what I understand, the Save System can handle some combatant save state but probably not what sprites are currently on a character? Does this mean I have to create custom save data or save this info on game variables?
3) How would I go about saving a list or dictionary in ORK? I'm thinking if ORK doesn't save the information about the instance of the prefab, a list of body parts and current sprites would be used to generate this information on load through a custom script.
4) What information does get saved about combatants?
5) does the combatant need to be spawned in a specific way for saving/loading to work properly (IE. using spawn combatant vs having combatant prefabs placed in the scene beforehand)?
Thanks!
Or, you can use defence attributes for that as well.
But yeah, generally you'd want to use conditional prefabs for that if you just want to change the appearance. Alternatively, you can also set up separate combatants and join the combatant you want to the player group based on the player's choice.
2) You could use equipment for that, e.g. using hidden equipment parts that define the look of the combatant.
Other than that, if you use a custom system, you can save the state of it via custom component save data.
3) See the custom component save data for this. You can't save assets (like sprites) in a save game, though. You'd have to be able to retrieve that information some other way, e.g. having an array of sprites on your component and just saving the index of the one that's used.
4) Everything status related (status values, abilities, equipment, status effects, etc.), inventory, group ... everything important. It doesn't save battle related states (e.g. turn).
5) Loading a game will spawn your combatant at the position it had, unless you disable that in the save game menu settings (in which case you can load at a defined scene).
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
If a combatant who is an NPC changed their equipment. How would I access this new prefab?
The prefab you select for the combatant in ORK is used to create a completely new, separate instance when spawning a combatant. Each spawned combatant is a separate instance and have no real connection to the prefab, i.e. any changes to them in-game will have no effect on the prefab.
Changing equipment on your NPC/combatant will only affect that combatant, e.g. using equipment viewers to visualize them.
5) Oh, ok - well, yeah, it matters.
Usually only the player group will be saved, for saving other combatants, you have to enable saving them with save games (Spawned Combatants setting in Menus > Save Game Menu) and use the Remember Combatant options in Combatant Spawners or Add Combatant components.
Also, just manually placing a combatant's prefab in your scene doesn't make it a combatant, so you'll have to use an Add Combatant component to actually put a combatant on that game object :)
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
You could also use equipment viewers to display them on your combatant.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Nvm, I got it.
GameObject prefab = e.GetPrefabSettings().prefab.itemPrefab.prefab;
Sprite sprite = prefab.GetComponent [SpriteRenderer] ().sprite;
For anyone in the future.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Example:
Even if you make the equipment viewer a child of the object that has the spriteRenderer/spriteSkin and keep the bones intact but spawn the sprite as a child, the sprite doesn't animate correctly.
I'm following the (new?) 2d rigging method in Unity.
I implemented a race swap by using equipment parts, inventory, and having a script change to the correct outfit on Awake. But if ORK allows me to do this in a better way I'd love to know how.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
@foxx what was your solution to this?
@gamingislove is there an update to the equipment viewer to work with Unity's 2D rigging system?
Also, will the equipment viewer work with the mecanim animator?
Thanks!
Instead, use a Game Object Manager to enable/disable stuff based on conditions, e.g. what's equipped.
Equipment viewers (and game object managers) work with both legacy and mecanim animations.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Thanks for the explanation.
Hope you're feeling better too!