edited April 2016 in ORK Support
Hello!

--------------------------The Situation:

Using the "Battle in a Different Scene" tutorial, I have a system so far like this:

--This is a 2D Top down Rpg Game--

1. There is a field monster - Prefab with an attached battle component

2. There is a battle monster- Monster prefab with only a Combatant Component

3. There is a Monster spawner event - Spawns 1 field monster prefab every 5 seconds (for testing purposes)

4. There is a Main scene: Where the field monster and monster spawner can be found

5. There is a battle scene- where the player gets teleported and fights the battle monsters that are assigned in an enemy group that is stored in the field monster's battle component. Battle spot positions were configured in the Real Time Battle settings.

The field monster has a trigger collider where when it comes into contact with the player, it will execute logic following the "Start Battle", "Escape Battle" and "Victory". The field monster also has a block combatant spawn in order to prevent it from being considered as a combatant since that automatically occurs when you use a battle component on a prefab.

Once coming into contact with the player, the event will store the scene, music, and scene positions (via set position of player group event) and then load a battle scene which contains a Real Time Battle Area

Because of this need to store the scene and all object's positions, I couldn't place the start battle event in the Real Time battle configuration under Battle Systems > Real Time Battles, otherwise the wrong scene (battle scene) would get stored.

The escape event is executed once the player leaves the defined boundaries of the Real Time Battle Area and reloads the stored scene and music (main scene).

-------------------The Problem:

The Field monster persists throughout the battle when I need it to exists solely for summoning the appropriate monster group in the next scene. Not only does it persist in the battle scene, but when I escape from the battle, it returns to the main scene.

Even though it has no combatant attached.

In addition, when returning to the main scene the monster randomly returns to a designated location in the game world (that I never set) and becomes un-interact-able (new term).

Because the field monster still "exists" the Monster spawner doesn't reset. (I think that's why)

In addition, my player character always returns to the main scene about 3 or so game world units "up"
------------------The Questions:

1. Why does this field monster persist? Is it because since the battle event is located ON the event itself, that it get's stored with the scene?

2. Why does my player character not reappear in the exact world space in the main scene where it first left to the new scene (even though I configured the set position to target the player and player group and store scene event)?

3. Is there a better way to handle configuring real time battles in a different scene? Maybe add some kind of local variable? That can destroy the object based on the if the player "Won" the battle, or keep the monster in the same spot on return if the player "Escaped?"

4. Was this post too long? :(

Post edited by twill14 on
  • 1) Yes. Don't place the battle component on the enemy game object. Usually you'd use the Combatant Spawner component to spawn combatants in the scene - you can define a game object with a Battle component to be used for fighting. Spawned combatants will use their Auto Start Battle Settings to determine when a battle will start (e.g. distance to the player).
    You can have different prefabs for the field and battle by using Conditional Prefabs for the combatants.

    2) Using Store Scene to store the player's position and Load Scene to load it will place the player at the position it was at. What happens afterwards is up to Unity (e.g. physics).

    3) See my answer to 1), from what I read in your post you have some kind of custom setup, which isn't needed as all of this can be handled in a built-in way.

    4) No, that's ok :)
    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!
  • Hmmm, I think I understand.

    1. I see, so I should not place the battle component on my field monster.

    2. For clarification to your other points:

    "Usually you'd use the Combatant Spawner component to spawn combatants in the scene"

    - So I should use the combatant spawner to spawn my battle monsters (the ones with the Combatant component) But in which scene? The main scene or the battle scene? (When you say 'usually', do you mean, that I should do this, or just in general that's what it's for?)

    "you can define a game object with a Battle component to be used for fighting."

    - In my situation which object? The battle object? Do you mean that I should be attaching the battle component to my battle object instead? Or create a new object that will tell the battle system which monster group to spawn in the next scene?

    "Spawned combatants will use their Auto Start Battle Settings to determine when a battle will start (e.g. distance to the player)."

    -Which spawned combatants? Assuming you mean that I should add my battle component to my battle monsters instead. Do you mean them? My current auto battle settings cause the current scene to be stored before loading the battle scene. So doesn't that mean that the stored scene event should be removed from the monster itself and maybe handled some other way?

    So do you mean to say that:

    In my main scene: the Combatant spawner should spawn the battle monster and the battle monster should have the battle component attached with configured start battle event settings?

    Or do you mean that I should do all of this in the battle scene instead of the main scene as I have it now?

    Sorry for the confusion! And thank you for being so patient!

    Haha
  • Scratch everything I just said...

    I figured out what you meant.

    Don't take this the wrong way....

    But I love you right now....

    Thank you so much!
  • You're welcome :)
    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.