Is there a way to make "wait" like events run at the same time?

0 favourites
  • 3 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • For my game I'm making to learn code and whatnot, I've got the player and lots of enemy/allies units that are walking around and moving to places.

    Here I've made a small arena with some points to go to and some enemies for the units to stop and kill. As shown in the next image, each point has a neutral/allied/enemy mode, when the unit is in the circle it captures it for that team.

    My problem is that when there is more than 4 units, my wait commands really show through as I'm not sure if you're able to make them run per unit.

    Here is the code used to make them run, they'll spawn in, wait a bit then run. But when there is alot of units, each unit has to wait for another unit to move before going themselves. So it comes down to wondering if there is a way to change my events to allow 2 units to wait individually so they don't conga-line into the enemy one after the other...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The first event on your screenshot will repeat on every tick if any soldier has a line of sight, and it will create lots and lots of delayed threads because of the Wait action. This is a common and very serious mistake.

    You need to use Timer behavior instead of "waits". Something like this:

    Soldier has LOS to target
    Soldier timer "attack" is NOT running: Soldier start a timer "attack" for random (0.5, 3) seconds
    
    
    Soldier on timer "attack" : Soldier stop
    .. Soldier has LOS to target: Soldier fire a bullet at target
    .. Else: Soldier find path to another target
    
  • Thanks for the help!, i've changed the waits out for timers and everything seems to be working exactly as i wanted it to :) I'll just have to finish some things off then i can show the new event list to see if anything can be improved.

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