edited July 2014 in ORK Support
HI,
I have many differents scenes inmy game where battles occurs.
I use the tutorial to 'Battle in different scenes' in my game. But all my fights redirect the battle to the same scene. I want to redirect them based in the actual scene.
Example: I have a 'cave' and 'wasteland' scenes in my game, when the battle begins in the cave scene, I want to redirect the battle to a scene called 'battle cave' scene. If the player is in the wasteland scene, I want the battle to be redirected to the 'battle wasteland scene'.
How I can do that?
Post edited by fabiobh on
  • edited June 2014
    You have to use a different Battle Start Event or use variables.

    On your battle object change the default start event.
    You should be able to edit the Teleport Start event by changing the Destination to the desired scene. then rename it.

    I'm using the variables method, just depends on what you are going for. I would say try and get comfortable using variables it opens up ideas for sure :)

    I am still learning :) Hope that helps!

    Below is from the tutorial:
    http://orkframework.com/gameplay/2014/03/12/battle-in-a-different-scene/

    Using different battle scenes

    Since you’ll most likely want to change to different battle scenes depending on where the player currently is, you’ll either need to create a battle start event for each scene, or use a Game Variable to store the target scene.

    To use a game variable, simply change the following settings in the Load Scene step of the battle start event.
    •Is Variable
    Enable this setting.
    The Target Scene is now used as the variable key of a game variable.
    •Target Scene
    Set to targetSceneName.
    The name of the scene that will be loaded is taken from a game variable with the key targetSceneName.

    For this to work, the variable targetSceneName has to be set to the name of a scene that will be loaded.

    You can do this by creating a simple game event that sets the game variable – and use this event as an Autostart event (Event Interaction with start type Autostart) in your scene.
    Post edited by gameintern on


  • As described in the gameplay tutorial and mentioned by gameintern, the easiest way is to use a variable for loading the battle scene.
    With that you can use the same battle start events for all battles and only need to change the variable holding the target scene (e.g. using a autostart game event in a scene with a Change Variable step).
    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!
  • Personally, i don't change scene in my game, but it is 2d, so i only need to change background, here it is my workflow.
    During exploration, when player enters new area, a variable is changes.
    When starting battle, in battle start event, there is a variable fork that check the variable.
    Each variable is linked to a different scene loading.
    Quite simple but effective, i hope it helps. :)
  • edited July 2014
    I create a GameObject and add a Variable Event to it, with a Start Type of Autostart. I check the 'Set Object Variables', I use a type float with 'Type' float and an 'Operator' Set. I put the value 1, but when I use the event to check the variable, the value not appear 1, it's 0.

    What can I be doing wrong?
    Post edited by fabiobh on
  • Did you also add an Object Variables component to the game object?
    Otherwise there are no object variables on the object.

    Also, object game variables are only available on the objects that share the same object variable ID (set in the object variable component). If you want the variable to be available everywhere, you shouldn't use object 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!
  • edited July 2014
    I not use a Object Variable component.

    I add an Component to the game object, the component that I add is an Variable Event.

    This is how I'm using the event
    http://snag.gy/vEkwR.jpg

    This is how I was trying to check the variable in the 'teleportStart' event
    http://snag.gy/L9MYb.jpg

    It was correct the way that I check and set the 'scenario' variable?
    Post edited by fabiobh on
  • Like I said - if you enable Set Object Variables it will try to set an object variable, which requires an Object Variables component.

    Disable Set Object Variables on the variable event and it should work. Also, if you have multiple scenarios, you can use the Game Variable Fork step to check for different values of a variable in a single step.
    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!
  • You are right, I disable the Set Object Variable and everything works now.
    Thanks
Sign In or Register to comment.