NobleValerian's Recent Forum Activity

  • I used on Start of Layout, but that's interesting.

    I used On Start of Layout > Check if OR > For Each

    Maybe the best and worst thing about programming is how many different ways you can do the same thing.

  • brushfe

    The Object and ObjectAbove both exist on a layout called "Objects". Seems necessary to put every object in the game into a catch-all layout to make sure I can use it when I want to (Maybe that's not necessary in C3, but it was in C2).

    On the "Level" Layout I've placed a single instance of the Object, but not the ObjectAbove. And that's where I'm checking to see if ObjectAbove has been created.

    There's only one event sheet, all the code game logic is being shown in those images.

    And like I said, I checked in debug and the variable is correct:

    Edit: Also, yes, if I create the object at start of layout it works, but the objects are being placed in the editor, so it's important the object is already there to understand why this doesn't work.

    Aren't all the objects on a layout (placed in the editor) created when the layout starts?

    Edit:

    Actually, the only thing that makes sense to me right now is that they aren't.

    If I create the object at the start of the layout it works, but if it's already on the layout it doesn't.

    Maybe it's that simple (and annoying). If the objects are placed in the editor on the layout as a "pre-arranged set of objects", then they're created before the layout starts?

  • The issue is the variable being checked, not the OR block. Which makes no sense to me.

    (I've run the debug to make sure the variable was assigned correctly. But if all I do is swap those out, fails.)

    Edit: Also definitely worth mentioning that this doesn't work either, despite 1 being returned correctly.

    Edit: Also worth noting my actual project has too many events to justify doing this third option anyway. For some reason you can't just change the event type in the global variable. I sort of get how that could be a problem, but it seems way better than having to replace every instance.

  • > Almost. The condition is a string and it's an OR.

    >

    > Global string = Text

    >

    > YourVariable = "Five"

    > OR YourVariable = "Eight"

    >

    > That said, if I drop the OR block and only compare for the "Five", it still doesn't work.

    >

    > If I change the YourVariable from a string to a number and check if it equals 5, it does work. But I need to check a string, and I don't understand why checking for a string would break it if checking for a number works fine.

    I see — I don't think you can put OR blocks and Triggers in the same block, but I might be wrong.

    I've always separated them like this. This approach also stops the code from checking "YourVariable" every loop, which can slow things down, and just check whenever a Sprite object is created.

    But ROJOHound is right, it'd easier to see what your code looks like.

    The issue isn't the OR block. I'll show.

  • Is this what you're trying to do? Both of these work for me:

    Almost. The condition is a string and it's an OR.

    Global string = Text

    YourVariable = "Five"

    OR YourVariable = "Eight"

    That said, if I drop the OR block and only compare for the "Five", it still doesn't work.

    If I change the YourVariable from a string to a number and check if it equals 5, it does work. But I need to check a string, and I don't understand why checking for a string would break it if checking for a number works fine.

  • 1: We don't know what variable, global, or instance you are talking about.

    2: Objects can't be selected until the next tick.

    3: To deal with that you can manipulate them in the event they are created.

    Not sure how this relates to my issue.

  • The runtime will also move objects to a different layer if the layout doesn't have the same number of layers. For example if an object is on layer 5 and you move to a layer with just three layers, all the objects on the higher layers will be moved down to the top layer.

    Does that mean I need to be making every layout with the same number of layers, even if I don't need them on every layout?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I believe when you switch layouts, global objects are transferred to a layer with the same layer number, not with the same name.

    I think in your case it may be better to make the layer "UI" global. And disable global attribute for UI objects.

    This seems to be the behavior I'm looking for, Thanks! Is there a way to tell it not to override this layer on certain layouts?

  • Just use the condition compare variable as sub condition of On Created..

    You might think so, but no, it doesn't matter which order I did these things.

    But that's a good example of my problem. I *frequently* encounter situations where the most straightforward and logical option tends to be a time-consuming headache.

    I really, really want to do something when an object gets created, that makes perfect sense to me.

    In this case, I'm lucky that all the objects already exist when I start the level (manually placed where I want in the editor). So I can:

    (C)Start of Layout > (C)Check Condition > (C)For Each > (A)Do Stuff

    And maybe I can presume that for things created dynamically, the condition that allows them to be created might be the same one I would want to use with the (C)On Created, and that conflict doesn't come up.

    It just feels like I spend a lot of time doing something that makes perfect sense, and then have to trial and error my way around it without ever really understanding why I wasn't allowed to do it.

  • You can't do things that make logical sense, lol.

    I want to compare a variable. If the variable is true, then when an object is created, do some stuff. If it's not true, don't do anything.

    Construct won't let me, or just doesn't work if I manage to squeeze it in there anyway.

    Condition: On created > Do stuff

    Works fine.

    Condition: Compare Variable

    Sub Condition: On Created > Do stuff

    Broken.

    Thoughts?

  • I've got UI elements set to global. They're created on level one, and persist to the next level. They are on the correct layer until level five, then inexplicably get moved to another layer. The UI layer the objects are on exists on all levels, and no events change the layers the objects should be rendered to.

    For now, I'm forced to add an event that checks if they're on the right layer at the start of the layout, and if not, move them. But this really shouldn't be happening in the first place.

  • Seems crazy to me there is no opacity to set the strength of this effect. Am I just missing it?

NobleValerian's avatar

NobleValerian

Member since 1 Sep, 2016

None one is following NobleValerian yet!

Connect with NobleValerian

Trophy Case

  • 8-Year Club
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

11/44
How to earn trophies