RafaelMatos's Recent Forum Activity

  • I'm using Advanced Random plugin. I'm also creating land chunks and destroying them when the player is far enough. But It seams that the time when it happens also matters, not just the coordinates. Is it possible to eliminate the time factor of the RNG system and get the same random results for the same seed so I can recreate the same land chunk in the same coordinate as needed?

    Tagged:

  • I’ve found wait 0 is more like, run at the end of the event sheet.

    You can test that with something like:

    Var prev=0
    Every tick
    — set prev to tickcount
    — wait 0
    — subtract tickcount from prev
    
    Compare: prev =0
    — set text to “same tick”
    Else
    — set text to “another tick”

    And yes, wait should pass the selected object list to when it’s done.

    Thanks!

  • R0J0hound Could you also clarify something else for me before 'closing' this thread please? Do you know if 'wait 0' action is the same as waiting for the next tick? Also, is the current instance list of the block guaranteed to be retrieved using the wait action?

  • Besides using browser.log() you can use sprite.pickedcount to see how many objects are picked.

    In general I assume most triggers just have the one relevant object picked at a time. “On created” for example will be run for each object you created. So no for each needed in triggers.

    I did, just look at the image I posted. The first test, the pathfinding trigger, have 2 entries, both with just 1 instance, as expected. But the second test, the timer trigger, had 1 entry with 2 instances. Both tests occur at the same tick, which is the whole point of my question, because if each instance would trigger the event in a different tick then of course I'd get just one instance

    Triggers are like functions, they will be jumped to. But there is something called a fake trigger that’s used sometimes that looks like a trigger but is run in place.

    “Keyboard: On key pressed” is a trigger.

    “Gamepad: on button pressed” is a fake trigger, which is the same as:

    Game pad: button down

    Trigger once.

    I Didn't know that. How should we know that and why this isn't in the manual too? I always use input events in the first event sheet so I might have avoided any problems because of that at some point.

  • That may be because pathfinding -> find path is one of the "asynchronous" actions.

    I believe these few special actions are designed a little differently. Calculating a path can take anywhere from one tick to five seconds depending on the layout, CPU speed, etc, so it needs to run in parallel or the program will hang until it's done. Each sprite looking for a path may take different times to find its path, or the same time.

    So it basically has a "for each Sprite" built into it. The timer trigger does not, like most triggers. So on a tick where multiple identical timers go off, your single timer trigger will be considered enabled, and it'll go off a single time.

    If all this is true, you should always use a "for each" condition on synchronous actions (like timer). Try putting a "for each sprites" condition on your timer trigger and see what happens.

    But they happened in the same tick, as you can see the tick count in the log. I'm now using 'for each' after triggers, without distinction. I think this is the safer way.

    What I don't understand at all is why important information like these are missing in the manual, knowing how it works exactly makes all the difference and many bugs could be avoided. Yet, in many situations you just find too simple or too superficial explanations in the manual. I found myself countless times searching for answers on how this or that feature works internally and rarely got an answer and this case is a perfect example of that.

    Thank you for your time!

  • There are much smarter folks on here than I, but I think conditions will pick a random instance from all possible objects that meet its criteria.

    So using For Each is a great way to ensure that every object that either triggered the condition or meets the condition are picked for the subsequent actions.

    I use the Browser log as an quick way to see what's getting triggered, especially when a function gets called. You can also put browser logs inside for/repeat loops, if you want to track what's being done within each loop. It's a really handy tool!

    First result is the pathfinding, the second is timer.

    Does that mean that the pathfinding trigger brings one instance at a time and because of that It entered 2 times? I didn't expect that, not all triggers seams to work in the same way

  • If I understand your question right, you can test this (and many situations like it) easily using the browser object.

    Try adding the browser object to your project. Then add the action Browser -> Log to your "on path found" trigger, and just log something like "path found“.

    Finally, run your project in a web browser and press F12 and view the console. You'll see it will have logged "path found" for every time that condition triggered.

    It's a quick way to test if your code is running as intended. In this case, my hunch is you'll need a "for each -> enemies" condition to your "on pathfinding path found" trigger, but this test should tell you for sure.

    That's exactly my question. Thank you!

    Btw, the pathfinding was just an example. My question is about triggers in general that happens simultaneously on the same tick for the same object and how they treat its instances.

    I'll try that later. If you have any other tips regarding the use of the browser log for debugging, please, let me know. Thank you.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I know the trigger happens once for all instances that found a path, but my question goes beyond that. Take into account the example I gave:

    Situation: 3 enemies found a path at the same Tick

    ➽On pathfinding path found <-

    action....

    Will this event block always contain just one instance per entry and therefore trigger 3 times independently for each instance or will this event run once and brings all 3 instances at once in the SOL?

  • It depends on SOL. One event might continue in loop while other executed once. Here a discussion about it:

    https://www.construct.net/en/forum/construct-2/closed-bugs-22/pick-create-bug-114401?kws=sol

    I'm sorry man, but It has nothing to do with my question. What I want to know is how trigger event works internally regarding the pick instance. Here It's a trigger event example:

    object = enemies

    ➽On pathfinding path found <-(my question starts here)

    >if enemies.can_move

    >action....

    In this tick, If there is only one object triggering this event, of course I'd have only one instance. But if I have multiple enemies triggering this EVENT TRIGGER at the same TICK, will it bring all instances in the SOL like any other normal event would do? Or triggers work differently, like triggering multiple times for each instance and therefore each time I'm inside a trigger I'd have only one instance at a time in the SOL?

  • If certain condition met then it will take action for instances that picked based filter parameter.

    I'm not sure if you got what I mean. My question is: If a trigger event happens to be triggered by different instances of the object in the same tick, internally, will this trigger work like a loop? or will it be triggered one by one for each instance? And my ultimate question is: do I need to use a for each instance loop after a trigger or It's certain that the trigger will always bring one instance at a time?

  • In case the same trigger happens multiple times at the same tick for different instances of a family object, do this trigger get all instances at once and runs for each of them or the same trigger runs separately for each instance?

    This is an old question of mine as I don't see this explanation on manuals, I never know If I need to use a for each after the trigger to ensure I get all instances or not

    Thank you!

    Tagged:

  • A vendor guy I did for the asset that I've just released on my Itchio page ❤️

RafaelMatos's avatar

RafaelMatos

Member since 8 Mar, 2014

Twitter
RafaelMatos has 1 followers

Connect with RafaelMatos

Trophy Case

  • 10-Year Club
  • Entrepreneur Sold something in the asset store
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • Enduring Visitor Visited Construct.net 90 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

18/44
How to earn trophies