Ideas how to spawn 1 of 5 weapons randomly

Discussion in 'Halo and Forge Discussion' started by the_suicide_fox, Nov 25, 2014.

  1. the_suicide_fox

    the_suicide_fox Ancient
    Senior Member

    Messages:
    81
    Likes Received:
    5
    I'm currently building a map with a lot of scripting features, and I have a switch that activates everything with a timer to turn it all off after a point.

    I also wanted to add a script so when everything shuts off a weapon will spawn on the map. The idea was to have it randomly be one of five weapons, sort of like a slot machine type of thing.

    Any ideas? I can't seem to think of a way to make it work.
     
  2. ToRn1ne

    ToRn1ne Mythic

    Messages:
    114
    Likes Received:
    180
    I can't think of anything to make it truly random. The only idea I have is to make a set of timers for each weapon that are on and off separately from each other at different times. When a trigger is activated that is tied to every set of timers for each weapon it checks which one of the sets is 'on' and then spawns that weapon.

    For example:

    Assault Rifle Timers - On for three seconds, then off for three seconds
    Battle Rifle Timers - Off for three seconds, then on for three seconds

    When Switch: On is activated it checks both Assault Rifle and Battle Rifle Timers, which ever one is on at the time that item would spawn.

    The only other idea I have is to get creative with some of the other Forge resources, like have the set of weapons spawn a distance above a Grav Lift and let gravity sort it out. :p
     
  3. the_suicide_fox

    the_suicide_fox Ancient
    Senior Member

    Messages:
    81
    Likes Received:
    5
    I actually came up with a very similar idea last night, though I didn't get the chance to test it.

    Basically it's as you say, but a little different.

    Instead of having an toggle, I would have an on and off timer, each set to be 1 or 2 seconds apart. For the first weapon the timers would be 5 On, 6 OFF. The following 4 groups of timers would all be offset using a timer on once to spawn them at the time the OFF is activating for the previous timer. This makes it so that the weapon will or will not spawn at each second. The reason I don't want to use a toggle timer is because it will toggle at a set interval, so if it's set to say 5 seconds, it will turn on for 5 seconds then turn off, meaning that all the weapons will appear at once.

    Then set a timer on once for 30s and a timer off once for 31s both of which are broadcasting on the weapon timer's power channel.

    The end result should be that at 30 seconds 1 of the 5 spawn "randomly" when everything else shuts off, with that randomness actually being determined by the time you press the button.

    I'm going to have to start drawing schematics for this stuff LOL.
     

Share This Page