When I use the "battle 2D" component, after it triggers and sends player to battle scene, when exiting battle scene, the game object "battle 2D" is on is no longer there...

How do I stop this?

I need that object to persist after returning from battle scene, but I see no option on the component to stop it...
  • Teleport battles will be destroyed after the battle (i.e. after the battle end schematic), there's no preventing this. When returning to the scene, the scene's own battle game object (that's part of the original scene) will be loaded again, the one from the ending battle is just a left-over from the prevoius load of the scene and will not have any use any longer.

    What do you want to do that you need the battle object to still be alive?
    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!
  • Ok first. The "battle" component object was not returning at all to the original scene... But as far as what I was trying to do:

    Basically I was using a different asset pack using the "trigger by other": Tag: Player on the "Battle" component that was attached to an enemy from the different asset pack.

    It worked to trigger the "RPG quickstart " battle scene as desired, but it removed the enemy (with "battle" component attached) automatically which wasn't desired.

    ...

    I actually fixed this since then by just putting a "trigger machine" on the enemy (enabled after a timer on an separate auto machine on the same enemy) that set a global variable that caused another separate game object to activate a child spawner that spawned a renamed"battle prefab"...

    This allowed the battle prefab to keep respawning and running in the original scene after coming back from the battle scene which is what I wanted.

    ...

    The goal was to allow the player to; get attacked by the enemy which caused a battle scene, but if the player chose escape option, they would return to original scene with the enemy STILL THERE ready to trigger again after a 5 second countdown if the player didn't move out of the trigger in time...

    Basically the player had to STILL run away from the enemy after they escaped the battle with it.

    I actually got all this to work!

    ...

    But I ran into the new and (possibly) goal breaking problem of not knowing how to make ONLY that particular enemy die ONLY IF the player actually gets a victory in the battle scene... But this is kind of a problem on my end as your asset pack wasn't really designed to work with the other asset pack lol.

    (Brainstorming with fresh morning mind. Please disregard) Lol I actually may have, just now, thought of a solution... By adding a separate third auto machine set to "start" to the enemy to keep track of the trigger machine and change a local variable when triggered, while also checking for that local variable and also checking for a separate global variable to be set by the "battle end: Victory" schematic", where if both variables are true at original scene start, the enemy will be destroyed...

    (I guess writing out the problem can help in coming up with a solution) sorry for the long comment. I hope your question was answered somewhere in this message lol
  • Actually if you could give an explanation of how I can get a schematic that is on a root object to check if a trigger machine on its child object was triggered WITHOUT using a global variable, that would help a lot...?

    (Lol morning brain idea: if not, I could probably add a dummy game object as a child to the trigger machine child object lol that will be enabled by the trigger machine along with its initial function of setting original global variable... Then have the new root auto machine just check if the dummy child object was enabled in order to set the new local variable...)

    But either way I would also need to know whether local variables remain set through scene changes and also through game restarts?
  • ORK has built-in auto battle starting (see the general combatant setting's battle settings), so you don't really need a Battle component or trigger machine to start battles when coming near an enemy. You can use the battle start schematic to do additional things.
    Using a trigger machine does also work, though :)

    You can use Object variables to put variables on game objects - see the Object Variables component. Also, combatants have variables to (used via Object variable origin as well).
    Local variables in schematics are alive as long as the schematic runs, i.e. also during scene changes - but they're gone as soon as the schematic is finished.
    The object variables are bound to an object and available while the object is alive (when using local variables in the object variables setup). When using an object ID for those variables, they are also kept if the object is destroyed - in this case, evey object variable component with the same object ID will share the variables.
    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!
  • Ok I appreciate the answer, but I'm not sure if it will help.

    The player character and enemies I'm using in this scene are from another asset pack. I'm just using them as stand-ins for the battle scene combatants within that particular scene so they can interact with the other asset packs mechanics.

    Within that scene, only the ork player menu is there to connect the two systems. Basically the player is temporarily controlling the other asset pack's player controller for movement mechanics purposes (same with the enemys) but all interactions, stats and menus are still from the ork system (the combatants in the group etc). So as far as the player knows, they are still controlling the group that they see in battle scenes ...

    So basically the PC and enemy NPCs in this particular scene are not registered as combatants within ork. If I try to use them through the ork system, then when they spawn they don't work with the mechanics of the other asset pack.

    ...

    As far as the object variables... I don't remember those from any of the tutorials I seen... I guess if I have each spawned enemy it's own unique variable... Eh... I'm not sure.

    All of the enemies are just clones of the same game object and they have to be spawned by the other asset pack in order to function properly...

    ...

    Basically all I actually need a global variable set by the victory schematic to ONLY effect the specific (non-combatant) enemy clone that initiated the combat, but not any other enemy clone. If local variables don't persist if the machine it's running through isn't active, then I'm at a loss.

    Don't worry though. I already implemented my backup plan right after I made the op. I just threw a randomized timer in the schematic that spawns the "battle prefab" to mimic the "random battle" component from the original"RPG quickstart" overworld (because the random battle component doesn't have the "trigger by..." Option to let me trigger it by player tag). It's not ideal, but I can tweak it to make it good...
  • You could store that enemy game object into global selected data at the start of the battle (or in the schematic you use to start the battle). That way you have it referenced and can access it at the end of the battle, unless it's destroyed.

    Also, you can use the Set Combatant Game Object node to use a game object as a combatant's game object (destroying the currently spawned prefab) in case you want to connect the combatants to your 3rd party system that way.
    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!
  • Lol thanks for the response! But I had to scrap that whole setup because I found many other systems in that other asset pack that clash with important ork framework systems.

    Lol I removed that asset pack from the project all together (emphatically! For waisting a whole 2 days worth of work!)

    I'm now only using "Quest Machine" which has an option to fully integrate it's self with ork framework. And a few small assets that are easy to integrate lol.

    I'm bout to ask some questions about the ork framework turn based battle system specifically tho...
  • Sure, keep 'em coming :)
    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.