At the moment have a player character that I'm moving with my own script. The combatant has a prefab assigned, and a different prefab with a condition that he is in battle.
Going into the battle everything works fine. the scene is loaded and the combatants are spawned. At the end of the battle though, it seems like the player combatant for in battle stays spawned and out of combat prefab doesn't appear. Also he's not placed in the stored position.
The problem is probably that the whole prefab changes form a traveller, to a battler. I'm not sure. Does anyone know of any way to do this properly?
Regarding the stored position I'd need details on your setup. Did you follow this gameplay tutorial on fighting in a different scene?
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
I did indeed follow that tutorial and double checked the settings, but there doesn't seem to be anything in the store scene, or the load scene node that I could have missed. The scene does load, but the player stays in it's battler prefab, and I think keeps the same position as in battle? But I'll have to test more for that.
Maybe I should put something in the battle end event to remove all the combatants and a spawn player step. Then have the battle start store the position in a variable and change the position of the player to that after spawning it in the battle end. It's just significantly more difficult than I was hoping.
After the battle the original scene loads and in the Start() function I set the playerTraveler object position to the saved Vector3. The script then continues to move the playerTraveler towards the destination.
To do it completely in the event system, I think I might have had to reset the prefab from the event itself as part of the battle end? Although I don't really understand why it didn't work. Also, the positioning wasn't correct, don't know why that was.
Anyway, thanks for the initial reaction gamingislove, keep up the awesome work!
Regarding your image, you don't need to set up 2 conditional prefabs if the 2nd one is just the regular combatant prefab.
An alternative solution would be to do this using game variables, which gives you full control of when to change the prefabs to battle or field variants. E.g. using a global bool variable that you'd set to true in the battle start event and to false in the battle end event (or whenever you want to switch prefabs).
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!