[SOLVED] Removing an Item from a logic_case?

Discussion in 'Mapping Questions & Discussion' started by 【EmNudge】, Jan 7, 2017.

  1. 【EmNudge】

    【EmNudge】 L4: Comfortable Member

    Messages:
    184
    Positive Ratings:
    38
    I don't think this is possible, but I've seen maps where a random action is done and then not done again.

    using a logic_case and the input of PickRandom I can get the logic_case to fire outputs from OnCase[numb], although each time a random option is picked it has the possibility of being picked again. How would make it that after a random option is picked, it's done with and the next time a PickRandom input is fired, only the other cases have the possibility of being picked?
     
  2. killohurtz

    aa killohurtz Distinction in Applied Carving

    Messages:
    1,018
    Positive Ratings:
    1,181
    If you send PickRandomShuffle instead of PickRandom, it will go though the cases in random order with no repeats, though it starts over after that so you'll have to suppress the I/O if you want it to stop there.
     
    • Thanks Thanks x 1
  3. worMatty

    aa worMatty Repacking Evangelist

    Messages:
    1,072
    Positive Ratings:
    836
    You can also set each output of the logic_case to 'Fire once only'.
     
  4. 【EmNudge】

    【EmNudge】 L4: Comfortable Member

    Messages:
    184
    Positive Ratings:
    38
    Won't that just make it so that if that case is picked twice, nothing happens?
    I want it to pick a different case, not just make nothing happen.
    killohurtz's suggestion works perfectly
     
    Last edited: Jan 7, 2017
  5. worMatty

    aa worMatty Repacking Evangelist

    Messages:
    1,072
    Positive Ratings:
    836
    A case output can't be picked if it doesn't exist. If logic_case worked like that, you would need to fill all sixteen case outputs. When an output is fired, and it has been set to fire only once, it is removed.

    If you only want each output to fire once and never be repeated, then you would need to limit the number of times the logic_case is used so it doesn't exceed the number of outputs. To do that, you would either set up individual inputs for each output (e.g. if you had sixteen case outputs, have sixteen input events rather than the same one reused) or a math_counter. The former option could be harder to debug and the latter would use an extra entity.