edited January 2020 in ORK Support
Hey!
I have a few questions about the saving system. Mostly to make sure I got it right.


1) Local variables for Object Variables (not events), exist only for one runtime? They are not saved?
2) What is the effect of always initialize option on Object Variables?
3) If I define Object ID in Combatant's Base Settings-> Object Variable Settings will these variables be automatically shared between all instances of this combatant? For example, if I update variable on Combatant Instance A, will this also automatically update Combatant Instance B?

About saving Non-Player combatant information.

4) Save Game Menu -> Save Settings -> Spawned Combatant Option
Do I need to change this to current or to all to save combatant data for combatants added through Add Combatant component?
5) Will ORK remember Add Combatant component added NPC's during Save/Loading? Or do I need to provide a unique key somehow?
6) So I have Design Time placed Combatants in Scene, and I have the same combatants fighting in battles. But, the way I'm approaching this now is I'm hiding design time combatant and spawning copy of it for Battle. What is the best way to sync changes between them? For example if Design Time NPC status value changes or equipment, to sync it to combat version. And to sync combat data back to Design Time NPC. Custom code is no problem for this, I just wanted to ask your opinion on how to best approach this. Can I change the Combatant "Template" in project data at runtime, or do I use like Custom Component Save Data thing for this?


Post edited by hellwalker on
  • 1) Correct - local object variables are not saved.
    However, a combatant's local object variables will be saved with the combatant.

    2) They'll always use the defined variable changes, each time the component is created. Otherwise they'll only be used the first time object variables are initialized. Naturally, when using local object variables, this doesn't really matter, as it'll always be the first initialization.

    3) Everything sharing the same object ID will have the same, shared variables. So yes, chaing something on combatant A will also update combatant B's variable (or rather, they're the same variable instance).

    4) That's only for Combatant Spawners that use Remember Combatants. Combatants added via Add Combatant components are not saved.
    Current means that it'll only save combatants from the current scene, All saves combatants from all scenes - but still, only for combatant spawners :)

    5) No, they're not saved.
    Currently, you'd have to do this with custom save data.

    6) Hm, easiest way would be a custom node/script that simply copies the data from one to the other via the SaveGame and LoadGame functions on the combatant.
    The combatant's settings in the project and a combatant's instance are 2 separate things :)
    What's the goal here - or better, why are you separating NPC and fighting combatant? E.g. if it's just for different appearance, you could do that with Conditional Prefabs on the combatant.

    I'll look into adding save options for Add Combatant components.
    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!
  • edited January 2020
    Thanks!
    What's the goal here - or better, why are you separating NPC and fighting combatant? E.g. if it's just for different appearance, you could do that with Conditional Prefabs on the combatant.
    I need to have NPC's in scene during non-fight scenes, for which I cannot use non-combatant models as I'm using ORK equipment to generate their appearance, so they also need to be combatants.

    And then I need to start battles with specific handed picked groups of these combatants.

    So, for example, there is an enemy camp where you see enemies walking around and you approach them and through dialogue, it can either result in battle, in the battle against only some of the enemies while others join your side, or it can result in a peaceful solution.

    At the moment I guess this is the easiest method I know to set up battles with specific combatants, without requiring custom battle start event for each battle to build the combatant group with found objects.

    I thought about trying to override battle event component to take a list of game objects and start the battle with combatant on those specific objects, so Grid battles could be started on specific design time combatants but have not tried it yet.
    Post edited by hellwalker on
  • Well, the hand picked combatants can still be the combatants in the scene (via Add Combatant component). The Start Battle node also allows you to add additional combatants (from actors) to join the battle.
    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!
  • And of course there was a built solution that I missed :D Neat! I'll try that out.
  • Of course there is :)
    Also, Add Combatant components will get save options in the next update (same as the combatant spawners).
    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!
  • edited January 2020
    Awesome, thanks!
    Post edited by hellwalker on
  • Is there any built in pipeline to remember stuff like Game Object Active state or Component Enabled state or Object Position etc?
  • Yes, the custom save data can do that. You can also contact me if you want to commission something like that :)
    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!
  • Thanks! I was actually halfway to making bunch of Custom Save Data scripts, but "maybe it's already in ORK" paranoia struck and I decided to check with you :D
  • Hey!
    So, here is the behavior I want to achieve.
    I have design time combatants added through Add Combatant component. I have a custom script component with some data in it. I want this data to be saved/loaded on combatants during all relevant situations.
    For example when the scene is loaded, and Add Combatant component adds a combatant for data to be loaded and when I save game or change scene the data to be saved. When save game is loaded, for data to be loaded etc.

    What is the best way to approach this? Should I use Custom Component Save Data or Custom Save Data? or neither of them works by default?

    If I understood this right, Custom Save Data is not really useful here as it does not support scene change(?) and Add Combatant will be triggered after the game is loaded?

    Custom Component Save Data seems a better fit, but the documentation states that this only works for player group. Is this right, or Add Combatant components new remember combatant options override this?
  • edited February 2020
    Custom Component Save Data components Load should be triggered when the game first starts too right? For player at least?
    Do I need to register it somehow or adding it to the combatant game object is enough?
    Post edited by hellwalker on
  • Custom Component Save Data is the way to go here - have the components on your combatant's game object and have them be saved with ORK, i.e. the Add Combatant component needs to use the remember settings and save games also need to save the combatants (Spawned Combatants setting in Menus > Save Game Menu).
    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!
  • edited April 2020
    Hey.
    Hmm, I'm having one problem. I want to have object variables on my Combatant Entry in the ork database. But, I also added an event object with object variable component inside child of the character prefab that I use for all combatants. (It opens dialogue for that combatant).

    So, what happens I think is that because ORK finds OV component in children, it no longer creates one from the database.
    Is there any way around this?
    Post edited by hellwalker on
  • edited April 2020
    Hm, I'll do some tests.

    Code-wise, the combatant's object variable settings only check for the component on the spawned prefab itself, not on any child objects.
    Child objects are only checked if you access the combatant's variables and there is no variable handler set at the time, but since checking the child objects is only possible after spawning, that should already have the variables attached to the root object.

    Edit: Tested it and definitely works as explained on my end.
    Having an object variables component on a child object of the combatant's prefab didn't influence adding the set up object variables to the root object.

    Might be something specific to your setup, so I'd need some more details on that :)
    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!
  • I didn't have the component on Root prefab. Only on child.
    I now tried adding component on root, and matching the combatant ID on each design time isntance. and this seems to work.

    ORK is now taking data from DB, and transfering to design time component.
Sign In or Register to comment.