My setup is that I have 3 scenes, the player's base, an overworld and a battle scene. The game calls an ORK load when the base scene loads and triggers a save when exiting the base scene, this works pretty well.

The problem is when I go into the battle scene, via two scene changes (base -> overworld -> battle). If I have combatants set to 'Current' or 'All' in the save game settings, the battle never starts (as I think nothing is getting loaded combatant-wise, as no combatant data is saved in the base scene save?).

If I set this setting to 'None', the battle starts OK. Once I leave the battle scene to the overworld and go back into it, it's still good to go.

But if I fight the battle, then make 2 scene hops (return to the overworld scene, then to the base scene), when I next visit the battle scene nothing spawns. Assuming here, perhaps, that the load/save in the base has nulled my battle data?

I'm using the Battle Start event as described in the tutorial and a Battle game object in the battle scene ("Battle 0"), what could I be missing?
  • Battles and combatant spawners optionally use a Scene ID to mark them as finished (i.e. the battle was already done). For recurring battles, you need to disable using a scene ID.
    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!
  • So, I'm not using a Spawner, it's a static arena battle with combatants defined in the Battle component and using scene IDs is disabled.

    It works fine if I fight a battle, return to my map scene and fight another battle. Where it seems to break is if I go from the battle scene to the map scene, then load my player base scene. I call ORK.SaveGame.Load(0) when entering the base scene and ORK.SaveGame.Save(0) when exiting the base back into the map scene.

    If I try the fight scene again at that point, it doesn't spawn anyone...
  • Astirian said: I call ORK.SaveGame.Load(0) when entering the base scene and ORK.SaveGame.Save(0) when exiting the base back into the map scene.
    Why?
    You basically cancel out anything that was going on since last leaving the base when returning.
    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!
  • That... is a really good point. :D

    I told a little accidental lie before, I'm not calling ORK.SaveGame.Save(0) on scene change but rather on application quit.

    I basically wired it up so that I have ORK.Game.NewGame(false) in my main menu, then the base scene loads as the default starting scene, it's where I put ORK.SaveGame.Load(0) to get the quests to load properly after an app quit.

    I just did a test with ORK.Game.NewGame(false) and ORK.SaveGame.Load(0) in a coroutine with a 1 second delay between them, which leads the game to never start the battle event in the battle scene. But that's led me to an epiphany of sorts, I just realised I'm not checking to see if a save file even exists when calling ORK.SaveGame.Load(0). I'm guessing that's not usually considered good practice! :)

    Side query though, these arena battles are meant to be semi-procedurally generated, I'm sort of made the assumption that I can populate the combatants on scene load regardless of how the Battle component is configured, using an AccessHandler I'd imagine -- but I just thought I'd double-check that this is the best way to achieve that... (I also assumed I'd potentially be able to instantiate various prefab flavors of the Battle component as another way to do it)
  • Yeah, if you call that stuff on your own you work around all the safeguards that otherwise would check for that when using the built-in menus or nodes :)
    Loading a not existing save game will probably stop the current game, clear it's data and not load the save file since it doesn't exist, so you're left with a not running game.

    The Battle component can be used in 2 ways, either for starting a battle with defined combatants, or as a placed battle to fight some other combatants, e.g. from scene changers, a Start Battle node, random encounters, etc.
    I don't think the access handler has options to inject there, since you can directly start battles on the battle component with provided combatants.
    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.