• What's happening is that the object variables settings in the combatant's settings will only use a component placed on the root of the prefab, if there's none (or the ID/local setting don't match), it'll add a new component on the root.

    Child object variables will not be used by it :)
    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!
  • Ah, then definitely something was not working in my setup. Because I only had object variables settings in the combatant's settings setup. There were no object variable components on character prefab at all.
    Then as a child of character prefab I added event interaction with object variable component and it stopped working.

    I'll try to do more tests later this week.
  • edited June 2020
    How would I "reset the game" from code?
    That is unload all the save data and start a new game?

    Hmm, I'm also getting this error
    NullReferenceException: Object reference not set to an instance of an object
    ORKFramework.DataObject.GetXMLString (System.String name, System.String indent, ORKFramework.ORKDataFile file) (at <81f7efca5b284b7ea7234e1fa2c9d84c>:0)
    ORKFramework.DataObject.GetXMLString (System.String name, System.String indent, ORKFramework.ORKDataFile file) (at <81f7efca5b284b7ea7234e1fa2c9d84c>:0)
    ORKFramework.DataObject.GetXMLString (System.String name, System.String indent, ORKFramework.ORKDataFile file) (at <81f7efca5b284b7ea7234e1fa2c9d84c>:0)
    ORKFramework.DataObject.GetXMLString (System.String name, System.String indent, ORKFramework.ORKDataFile file) (at <81f7efca5b284b7ea7234e1fa2c9d84c>:0)
    ORKFramework.DataObject.GetXMLString (System.String name, System.String indent, ORKFramework.ORKDataFile file) (at <81f7efca5b284b7ea7234e1fa2c9d84c>:0)
    ORKFramework.DataObject.GetDataFile (System.String name, System.Boolean encrypt) (at <81f7efca5b284b7ea7234e1fa2c9d84c>:0)
    ORKFramework.SaveGameHandler.Save (System.Int32 index) (at Assets/ORK Framework/SourceCode/Handler/SaveGameHandler.cs:240)


    when I call ORK.SaveGame.Save(1);

    It happens on "GetDataFile" step here
    this.SaveFile(index, this.GetSaveData().GetDataFile(this.GetFileName(index), false).GetXML());
    Post edited by hellwalker on
  • You can clear the game like this:
    ORK.Clear(true, true);
    You might also want to set:
    ORK.Game.Running = false;


    Hm, hard to tell where this is coming from. Since it's happening pretty early, I assume it's caused by something in the GameHandler save data (called via ORK.Game.SaveGame()). Since you're using source code in your project, you could try to narrow it down, each call to a SaveGame function would cause a GetXMLString call when processing the data, so you could comment them out one by one and see where the issue is coming from.
    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!
  • Thank you!
    Sorry a bit confused, I should comment out call to which function?

    I tried to break down this call to multiple steps:
    this.SaveFile(index, this.GetSaveData().GetDataFile(this.GetFileName(index), false).GetXML());
    and it was this part that got null exception.
    GetDataFile(this.GetFileName(index), false)
  • That's to be expected, as that's the part that creates the XML data where you have an issue :)

    You need to go to the GameHandler class - the SaveGame function (at the bottom of the class). There you'll have different other parts being saved via calls to their own SaveGame functions, e.g. saving the logs:
    data.Set("logs", this.logHandler.SaveGame());
    That's where you have to comment out the whole lines until you hit the one that's causing the issue when converting to XML.
    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!
  • @gamingislove I think its happening for any of them. I upgraded to latest V of ORK and Unity is 2019.3.15f.
    I disabled all the code except object creation/return and then randomly enabled options and I would still get the bug.
    I even disabled all the XML code in that function and still same bug.

    Could it be something with source code ? are you building anything extra into Dll? for XML?
  • Hm, send me an email (contact@orkframework.com), I can send you a test version with some safeguards I put into place for the data serializer.
    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!
  • Thank the updated files worked for the bug.

    I have a question about scene splitting in Unity. Let's say I have a main game scene that loads first, then this scene has scripts that load other scenes in Awake/Start function.
    When the first scene is loaded, I guess the load call happens at that moment and how I could I propagate the loading to these additional scenes?
  • Not sure what you're asking - if you've got a script that loads the scenes (I assume additive?), the content in those scenes will also have their awake/start functions alled when the scene is loaded. All ORK components should also work with that, e.g. combatant spawners, etc.
    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 September 2020
    Hello!
    I'm coming back to saves after some pause and I'm fuzzy on probably what is a stupid/obvious question. :D But I wanted to ask your advise on how to handle this kind of case. (Custom Scripting)

    Short Version: I want to take a combatant instance from one scene, and in another scene modify its skills and custom component save data. And then come back to original scene and have this changes applied to combatant.

    I need advice on how to access the Combatant Instance in another scene, and modify its Custom Component Save Data.

    Long Version:
    So I have this item in game, a mirror in [game scene]. And when you click a mirror you are transported to another scene, [character creation scene], where character creation menus can be used to modify your character and then you can come back to original scene and have this new changes applied to your character.

    Character can be a player, or non-player. So it varies.

    The character in [game scene] is a design time prefab, that has ork Add Combatant Component, and Object Variable Components on it. Object variable ID matches the ID defined in Ork Editor Combatant entry's Object Variable section ID.
    Character also has a Custom component Save Data component to save custom appearance data on this character.
    Each character is unique and is linked with unique combatant entry in ORK DB.

    So, basically I have a design time placed prefab in a scene with custom save data and Add Combatant components on it.


    The part I'm unsure about is, how to access Combatants Instance from [game scene] in [character creation scene].

    Do I rebuild my character prefab with Object Variable ID and this will load correct instance of combatant on it?

    Or can I do it in simpler way and somehow access correct Combatant Instance without spawning it, and push save data on it without Custom Component Save Data component?
    Post edited by hellwalker on
  • For the player (or player group members) it'd be pretty easy, you just have to spawn the combatant in the other scene, which loads the component data - now you can do your changes and the data will be saved again when leaving the scene, restoring it in the previous scene when loading.

    For combatants that are only remembered via the spawner/add combatant components, it's a bit more complicated, due to them no longer existing and only their save data remaining.
    You need to do some custom scripting, getting the combatant's data from ORK's scene data handler, create/load the combatant and spawn it, do the changes and save it into the scene data again.
    Best check out the Add Combatant component, there are 2 calls to ORK.Game.Scene, one to get the data (and create the combatant afterwards) and one to store the data.
    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'll give it a try.
  • edited September 2020
    Coming back to save question before. What if I don't want the save data of characters to be tied to specific scenes. Would something like this work?

    1) I create a Character Manager Class that tracks the data and design time prefabs for each character. It implements ISaveData component.
    2) When the game is changing scenes the game is saved.
    3) When the game is saved Character Manager queries all active Characters for its combatant component save data and custom save data and saved it.
    4) When combatant needs to spawn it queries Character Manager for its Combatant Component Save data and Custom Save data. (Via custom Add Combatant script).

    So in idea to recreate a save system but have it more controlable via Character Manager Class and ISaveData interface?
    Am I likely to come upon some pitfalls with this approach?
    Post edited by hellwalker on
  • Yeah, that'd work - the custom save data system is there to support stuff like that :)

    The combatants will automatically store their position and (save) component data when their game object is destroyed, so depending on when your save is called that data will already be available with the rest of the combatant's save data.
    If not, you can manually cause it using:
    combatant.Object.StorePosition();
    combatant.Object.StoreComponentData();

    Naturally, this only work as long as the combatant's game object is available and should be called before getting the combatant's save data.
    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!
Sign In or Register to comment.