Welcome to PlagueFest.com! Log in or Sign up to interact with the Plague Fest community.
  1. Welcome Guest! to interact with the community and gain access to all the site's features.

Resource Round-crossed randomization.

Discussion in Resources & Tutorials started by enviolinador, Nov 29, 2013

  1. May 31, 2012
    One of the things you have probably noticed the most when you're doing a map and you want randomization is that Source's randoms are usually quite dumb to the point where the same choice gets chosen 4 consecutive times with a 1/8 probability in a logic_case. This is upsetting, at least to me.

    When cyberderp was being done, mojo wanted a system to randomize from all the remaining stages. I told him he could save the state of each level (beaten/not beaten), translate this into enabled/disabled relays and make it call back to the randomizer if an already chosen choice was chosen. This would create a few inputs back and forth but, eventually, should call the good one (at least with pickrandomshuffle, although pickrandom would eventually get there as the probabilities would grow/decrease).

    You could do the same for a round-to-round system, but I think it'd be a pain in the bummer, so I made this prefab.

    How does it work? Well, instead of firing trigger into the relays from the logic_case, which would lead to a 0-1 state, we use FireUser1. FireUser1 will make each relay fire itself (but if it is disabled it won't be fired, so the 0-1 state remains), but will also let us (with addoutput) to call FireUser2.

    When the relay is successfully fired, we do our normal logic (in the prefab we just display a console message) and we addoutput on our permanent entity of choice (I used a func_brush because most people recognize it as the to-go permanent entity, but an info target would probably be a better idea since it's a point entity which will save us a brush model from being compiled -but not an edict, which it will consume still...-) a new output on FireUser1 to call FireUser2 on the relay the round after (or whenever we want to load the state of the relay being 'blocked').

    When the round begins, the permanent entity is polled (firing FireUser1 on it) and it fires FireUser2 on the relays that were triggered the previous round. FireUser2 disables each of these relays and makes it so that if they are FireUser1'd, they call back to the randomizer (that is, if the randomizer calls them, they call to the randomizer again so that a different case is chosen).

    The end.

    Attached Files:

    • Like x 1
    • Wizard! x 1
    • Informative x 1
    • Mapping King x 1
    • Useful x 1
    • Artistic x 1
    • Mar 2, 2013
      Thats great man, thanks. :thumbsup:Thats sort of thing is not my strong point.
    • Apr 9, 2012
      This is very interesting! I might use this on SSBB, but I'm pretty sure I already had such a system, only in a different way. This seems easier, with better oversight on what's happening so I could consider using it! Of course, that is whenever I start again on that godforsaken map. Not sure if I will be using the same leveling system on Cathedral.

      Thanks for this info Envio!