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?
  • What condition did you set up for the combatant's conditional prefabs? Make sure it's reset/removed at the end of the battle (i.e. battle end event).

    Regarding the stored position I'd need details on your setup. Did you follow this gameplay tutorial on fighting in a different scene?
    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!
  • Underneath are the conditional prefab settings, maybe I didn't set them up correctly?

    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.

    image

    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.
  • I've now just set up the control using my own script, which was easier for me in this case. So my script moves the player traveler (which is not the player combatant prefab) and then calls events and battles. Before a battle I save the position as a Vector3 using ORK and then just use all the ORK stuffs for the battle as described in the tutorials, which works great!

    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!
  • It's a bug - the In Battle condition doesn't notify the prefab of a change and thus didn't change the conditional prefab. Will be fixed in the next update (available next week).

    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).
    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 ok! Good to know I didn't mess up! Thanks! :D
Sign In or Register to comment.