DE EN FR ES IT CZ
Back Back to top

Can an Object automatically check for multiple values?

This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials

  • #1, by jackie 6 years ago Quote
    Is there any way to make an object within a scene automatically check for multiple states of a value? For instance, in the "conditions" section on the properties tab there is an option for the object to check for a condition or value in order to become active. I need this object to automatically check for something like

    if (value)  >=100 and <= 200

    I'm new to Visionaire so maybe I'm missing something obvious but the only place I've found an option for multiple numbers like that is in the actions section. Unfortunately, I don't want the player to have to perform an input in order for this check to take place. I need it to be checked as soon as the scene loads as I'll be using this as a means to change the background to different times of the day as well as toggling the presence of certain NPCs.
    Is this something I'll have to write as a script? And if so, how would I go about automatically calling that script upon loading the scene?
  • New to Visionaire Studio?

    Create point and click adventures without coding. The free version covers up to 25 scenes per project. For more scenes or to earn money with your game, you need a license.

    See the Indie Bundle Try it for free
  • #2, by esmeralda 6 years ago Quote
    As far as I'm aware there is no possibiltiy to check multiple values without using lua.
    I guess there are multiple ways to do it. This is what I would do:

    You could use the action part "if lua result" to check if the value (or multiple values) is in the desiered range and if so change a condition (or an other value) that is connected to your object.

    Actionparts:
    If lua result  ...
     change condition "x" to true
    else
     change condition "x" to false
    end if

    "if lua result" must return a boolean (true/false)
    So in this action part you write:
    return Values["name"].Int <= 200 and Values["name"].Int >= 100

    You can call this action at the beginning of a scene. Add an action in the scenes action tab (next to waysystems tab) and choose the execution type "at the beginning of the scene"

    Edit:
    (Or you could do it all as a script and call the script at the beginning of the scene or use the execute script action part. )
    If the objects apear slightly after the scenes has loaded you might consider calling the action in the action when changing the scene. (call action "at the beginning of a scene", change scene) Of course then you could also use the execution typ "called by other action" instead of "at the beginning of the scene".
  • #3, by jackie 6 years ago Quote
    Thank you so much! This is exactly what I needed smile