robolab's Forum Posts

  • I found the main problem. Thanks for the ideas everyone.

    I looked at my conditions and realized the ordering of the conditions could be better, and also I had an "Every 1.0 seconds" condition in there too. That explains the delay in commands.

    In case someone googles this issue, here is what I find to be an ideal solution:

    Conditions:

    Miner = ReturnPayload

    Pick Random Miner

    This makes it so only objects taken with your first condition filtered out, resulting in choosing only ONE, instead of all.

  • the IIDs are just the objects number sequentially. 0-to how many you have..

    the UID is the unique number of the object in the entire game..

    I know that, but how would I make the game pick an object without having to create 200+ subevents for every single IID? It seems wrong.

  • pick random will only pick 1 object. you can combine it with a compare using the Object event itself... no need to use the System event again.

    I've been using the pick random combined with the object event, but it doesn't seem to be the optimal way to do it. For example, if I have 40 miners doing various tasks, and lets say 23 of them are done mining and set to "Return payload".

    If i have

    Miner Instance Variable =Return Payload

    Pick Random Miner

    It WILL do everything as intended, just not as fluidly. Some miners may sit there waiting for a command because the game engine hasn't randomly picked it yet.

  • Forgive me if I'm misunderstanding, but I won't know what their IID is. The units are automatically spawned based on the environment. In game 1 there may be 20 miners, game 2 there may be 3 miners spawned, game 3 might have 45 miners.

    I would have to make a separate sub-event for the Pick by IID which would mean to be safe I'd need to make over 200+ sub-events for each IID? Or am I missing something?

    Thanks!

  • Hi,

    I'd like to use "pick by comparison" but not pick ALL instances that match the comparison, because I don't want each of the picks to do the same thing. I want to pick all of the matching picks but have them all different assignments.

    I tried the "Pick by Comparison" combined with a "Pick a random instance" but this seems to lead to crashes once in a while, I think. It doesn't feel like the best option.

    Anyone else have any ideas?

    Extra info: I have randomly generated "ores" that Mining ships are automatically attracted to. The way I have it set up, if a Mining ship is not currently in the process of mining, moving to mines, or returning a payload, it "searches" for available ores and if it finds one, it sets a course and moves towards it. I don't want all Miners to choose the same ore, I want each Miner to set a course to a different ore. I've gotten this to work with my set up described above, but it doesn't feel optimal. The Miners often have delayed reactions (with the nature of choosing "random" ships of the compared picks to give commands to) and sometimes the game crashes.

  • That was actually pretty fun. I used the arrow keys.

  • I would assume you use the "anchor" behavior, no?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here is a go at it:

    1) create a instance variable for each "collection" area.

    workerUse = 0

    2)Create a instance variable for the worker:

    workerBusy = 0

    3) When a worker starts to use the "collection" area.

    System > set value > collectionArea.workerUse = 1

    System > set value > worker.workerBusy = 1

    4) On collection area destory:

    System > set value > worker.workerBusy = 0

    System > set value > collectionArea.workerUse = 0

    5)Have an event that tells the worker what do(move,fight,harvest) based off what worker.workerBusy is set too.. 1=fight 2=harvest 3=return to path etc...

    I actually have a similar set up right now! However, on step 4, if I were to set value to worker.workerBusy = 0, all Workers (since there will be multiple) will be set to stop working.

    I actually came up with an idea of perhaps using a For Each Collection Area condition combined with a "Pick Worker" condition to handle the collection zones, and then separately have a "dead mans switch" so when the above event stops, it will automatically change back to default actions...

    Unless you or anyone else has come up with a better idea!

    Thank you for putting a good effort in, I've actually been trying to figure this out for a few hours now..

    edit: Figured out a fix-- basically links a collection area with the worker.

    Saw a nifty trick here

    http(removethis)://www.scirra.com/tutorials/361/understanding-uid-iid-health-cards-and-rocket-smoke-trail

    Created a "number" instance variable called "parent" and just referred to the UID whenever I needed to pick it.

  • Hello, I hope someone will be able to help me.

    I'm making a game with one player controlled unit, and many tiny units that can be issued commands via keyboard + mouse clicks. I have no problem with this so far.

    The section that works properly:

    Right click, create a "Collection Area" sprite. One random unit that matches the requirements through instance variables (is not busy, is of a valid type, etc) is then issued the command to go to the Collection Area marked by the sprite, and perform his collection duties. He picks up an object, brings it to his destination, drops it off, and then goes back to the collection area, and repeats. This all works great.

    The issue I have is, I want to be able to 'cancel' specific Collection Area routes. I have the events based on an "On Creation of Collection Area" Sprite, so when the Sprite is deleted, nothing happens. I can't just have a 'send all' command to all the units, because I need each unit to be directly linked to each Collection Area.

    Essentially, I want each Collection Area to be 'linked' to the unit that is carrying out that command. When that specific Collection Area sprite is destroyed/canceled, I want the unit that was working on that to be notified he can go back to his normal duties.

    Any ideas?