Hi! I've been searching through the forum and tutorial for awhile and didn't find any tutorial or guide for custom battle event...can anyone help with this? This is what I'm trying to create:

1. MC have some dialogue with a npc, and he can choose to battle the npc.
2. Battle scene will load and MC group with fight the npc as their enemy, if they lose, game over, if they win, they will go back to the main event scene.

Problems I've been facing:
1) I tried using Start Battle event function to do this but when the battle scene is loaded one extra npc prefab is spawned in the centre of the battle event waypoint and the entire battle camera is off.
2) The battle couldn't continue smoothly as it will stop halfway without any particular reason

Appreciate any help given!
  • 1) Set up the battle on a different game object in your scene (e.g. an empty object) and use it as a scene actor in your event (this allows you to select the game object in the event interaction component).

    2) Hard to say without more details on your overall system setup. Could also be that the NPC spawned in the middle somehow blocks movement in battle events and they just wait forever?
    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! It worked but now I'm having a new problem...

    After the battle I want to destroy the npc I interacted with while keeping all the other npcs spawned through the combatant spawner including their position.

    This is what I tried:
    I used "destroy object" function but when the main scene loads the npc got spawned back (I used a combatant spawner area to spawn the npcs). I have the same type of event attached to every same type of npc spawned through the combatant spawner, and it seems that when I use 'store screen' and 'load screen' function to return back to the main scene after the battle the position of the npcs is not remembered, meaning they will appear in random positions and not the last position before the battle commence, plus the npcs that I interacted with is supposed to have been destroyed through "destroy object" function got spawned back.

    Any way I can tackle this problem? Any help is appreciated!
  • Use the Variable Conditions settings on the event interaction component in combination with the Auto Destroy setting. Before teleporting back to the scene, you'd change whatever variable you're using and the NPC will be destroyed when loading the 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!
  • Thanks for the comment! However, it doesn't completely solve my problem.

    Since I used a combatant spawner area to spawn a number of npcs with the same interaction event attached to them, once I used Auto Destroy they all will be destroyed. (I only want the one I interacted with to be destroyed, while keeping the others including their current position).

    Plus, everytime the scene reloaded the other npcs will get respawn in different location. For example, before the player triggers a battle, one of the npc is standing beside the player moving around, but after the battle that npc got respawned at an entirely different location.

    Is there a way I can achieve this?
  • edited February 2019
    Ah, in that case enable Remember Combatants in the combatant spawner's settings (and get an ID below that setting).

    This should prevent the defeated combatant from spawning (unless you're using the respawn settings) and remember the other combatants' positions.
    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!
  • Thanks for the comment! I tried using Remember Combatants but it doesn't work well...

    I used a separate gameobject for the Start Battle node with the combatant, and used Destroy Object to remove the combatant before Start Battle node. But when the battle ends and the main scene is loaded back the destroyed combatant is still there. (although it's previous position is remembered) I'm pretty sure the Destroy Object node had destroyed the combatant before the battle scene is loaded ...

    One more question is, I want the gameobject used to trigger the Start Battle node to stay there even after the battle ended, as I need to use it multiple times. How do I achieve this? I tried uncheck Auto Destroy but it still got destroyed after the battle ends.

    Thanks!
  • Don't use Destroy Object node to destroy the combatant/NPC, that'll cause the combatant to be stored.

    I'm a bit confused about your setup - so you're:
    - using a Combatant Spawner to spawn combatants
    - the combatants are also NPCs, that start a battle via a game event (i.e. event interaction)
    - the battle is handled in a different scene, fighting the NPC you interacted with (or a fixed combatant/group?)
    - after the battle, the NPC should still be there?
    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!
  • Well, basically I used a Combatant Spawner to spawn a group of combatants, which player can interact with them via the Event Interaction Component. And through the event interaction, player can talk and then choose to either battle the npc or ignore it or do other stuff (not a group but with the combatant itself). After the battle, the npc will be defeated and leave (so yeah it shouldn't be there), but other combatant spawned remains.

    I solved it yesterday, by setting up the battle with the event object and a game object as Battle Object referring to the 'nearest battle' tutorial. It worked perfectly! Thanks for taking your time for the reply :)
Sign In or Register to comment.