(*Edit: Timer not relevant) Pick instance isn't calling for a specific object

0 favourites
  • 10 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • strikethrough textI have a character that I want to move to another object when a timer expires.

    * For some reason, with the current setup, the moveto event never gets called at all,but the rsMetal event works just fine.

    * When I change this to a function where I get the data and apply MoveTo it works great and is what I am going to do, but I don't understand why my current setup just skips that event entirely.

    I have put logs into that event to even just see if it gets called at all, but nothing appears. I have spent HOURS trying to get this to work, maybe it's just something stupid I am doing but could really use some help as it's for a professional project.

    Thanks!

  • Put this debug logging into the parent event, just after the fcnKilnworkerTakeMetalToToolmaker function call:

    Browser Log "chMiner UID:" & chMiner.UID & " target UID:" & chMiner.myBuildingTargetUID

    Then run the project in Debug Mode, find this message in the browser console, pause the project and check instances with these UIDs.

  • update: actually no, after that timer triggers then using Pick Instance with UID to get that object never gets called anywhere in the chain, the pick literally fails even though the uid matches the variable I am looking for.

    If I put that exact same event BEFORE the timer the character moves no problem. This is baffling :/

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If the second event on your screenshot doesn't work, it means that either the targetUID is wrong, or the toolmaker instance with that UID doesn't exist, or can't be picked for some reason.

    It isn't in a container with the chMiner by any chance, or maybe it's created in the same tick? This would explain why it can't be picked.

  • If the second event on your screenshot doesn't work, it means that either the targetUID is wrong, or the toolmaker instance with that UID doesn't exist, or can't be picked for some reason.

    It isn't in a container with the chMiner by any chance, or maybe it's created in the same tick? This would explain why it can't be picked.

    * The object being created is what sets all this off, so it's creation frame has been well finished by the time the character gets to the alarm

    * Like I said, if I literally drag the exact same event to before the timer triggers it works fine

    * In new image you can see my debug logs showing before and after that event, and in the debug info you can see that the instance UID and the variable are equal

  • The fact that it works if you move the event out of the "On Timer" trigger is not very helpful, because in this case the event will be run on every tick.

    The object being created is what sets all this off, so it's creation frame has been well finished by the time the character gets to the alarm

    So the bld03B... instance is not created in the same tick when the timer is triggered?

    Is it in the same container with the chMiner object? Or is it a part of some hierarchy?

    Is the whole "On Timer" event nested under some other events which may pick a different bld03B instance?

    Try adding "System Pick All bld03B" as the first condition in that sub-event, maybe it would help.

    Also try adding this log to the parent event:

    Browser Log "bld03B Count:" & bld03B.Count & " picked: " & bld03B.PickedCount

    If this doesn't help, I'm out of ideas. I'm sure there is an explanation why the instance is not picked, and it probably has nothing to do with the timer.

  • I have managed to reproduce without the timer! I am now curious if I could be getting race conditions when using the Pick event since it seems like as my character count goes up, so does the repro rate. Possibly specifically because I have a bunch of characters (it's like an RTS) but also various event sheets, one for each type of character. Would that be likely? Once I create the second character type that references this building type the even seems to start skipping once in a while.

    The problem with this theory is that the first building I posted only has a single character type that interacts with it, so that's probably not it unless the literal point in the sequence where "pick" gets set is vulnerable to a race condition.

  • These two objects are part of two families, but I have no containers or any other relationship between the two. I hesitate to remove them from the family since there are so many variables being used at the family level

  • Maybe this is a MoveTo + MoveTo Arrive issue!

    * I have removed pick from the equation. To do this, I am triggering a new destination via colliding with the object. This has removed the MoveTo Arrived as well, which might have been a part of the issue.

    * The character now no longer stops at either end of that loop, which is great. That part is solved as long as I am okay with using collision instead of MoveTo Arrived, which is okay for my purposes.

    * HOWEVER, after long enough I am seeing a character to to a MoveTo location that their event sheet does not reference... anywhere. There is no MoveTo event that sends this character to that location anywhere in the project.

    * The two destinations are in the same family, so maybe that's the issue? That's my next debugging option, but this is all pretty nuts.

    You can see in the linked video that the character is cruising back and forth just fine, until the new one is created. Once the new one is created then inevitably the original character goes to the "2b" building, which it doesn't reference. This happens 10/10 times once the new character is introduced

    youtu.be/KkoU2uh9CPc

  • I'm sorry, I lost track of all the issues you described, it's very difficult to understand what's going on without the project file.

    The fact that the object is a member of a family should not be causing any issues with picking. I also have never experienced any bugs with using MoveTo and its On Arrived event, and I use them a lot.

    Returning to your original question - if there are no containers, no hierarchies and no parent events which could've changed the picking scope, then there are really not many reasons left why the instance is not getting picked:

    1. It's not created yet, or maybe have just been created in the same tick.

    2. It's destroyed.

    Like I said, try adding System Pick All as the first condition. Add instance counters (Obj.count and Obj.pickedCount) to Browser Log outputs, they should help with debugging these problems.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)