See this Reddit post for map/gametype downloads, gameplay footage, and other goodness. Here, I'll be showing you how to make your own custom weapon sets and add them to a map. If you just want to use my Gun Game prefab, you can grab it from here and skip the first section. Note that my scripts use a lot of labels, variables, and messages, so if you have scripts on your map already, they could conflict with mine. Further down, there's a list of all the scripting elements I used so that you can resolve any conflicts. Making a custom weapon set: Download my Gun Game Template map from here. Launch the map, and delete all of the existing weapons on the grid. Lay out your weapons on the A column of the grid. You can place up to 64 weapons. Orient them so that the tip is pointing downwards, unless it's the beam rifle (non-Halo 2 version). In that case, you need the tip pointing up or else the game won't let you pick it up. For each weapon, change the spawn order to match the number on the left. The first weapon should have a spawn order of 1, the second should have a spawn order of 2, and so on. Apply the labels minigame:include and user:alpha to all of the weapons. Apply a user:yankee label to all melee weapons, and a user:xray label to all turret (3rd person) weapons. If you want the last weapon to always be the final weapon, even in Gun Game Fiesta (which randomizes the weapon order), apply a user:zulu label to that weapon. Note that you can only apply this label to the very last weapon. If you apply it to any other weapon, you'll get bugs. Select all of the weapons and duplicate them. Move the duplicates over to column B, and change the user:alpha label to user:barvo. Repeat step 8 for each column. The label should match the letter of the column. On the left side of the grid, delete all of the cyan script brains that do not have a weapon in the same row as them. If you applied a user:zulu label to your last weapon, delete the script brain in that row as well. These brains handle the randomization process. You're done making the weapon set. Keep a backup of the map at this point. Now to package it all into a prefab. Select all of the script brains, weapons, and ball joints 64 items at a time (or fewer). Set their coordinates to the same position to get them nice and compact, then group them. Then, select all of the resulting groups, put them at the same coordinates, and group them. Now you should have all of the objects in a single group. Save the group as a prefab. It is now ready to be implemented into a map. Adding Gun Game to your map: First, make a backup of your map. THIS IS VERY IMPORTANT. There is a chance that your map could get corrupted. If your map has a lot of likes/bookmarks, I strongly advise against adding Gun Game to it directly. Work with a copy of it instead. This lesson was learned the hard way. Apply a minigame:exclude label to every existing weapon on your map. If you want to be able to disable explosives in the gametype settings, apply Disable scripts in the map options. We don't want weapons and stuff flying out of the prefab before we're done positioning it. Spawn your Gun Game prefab (or use mine). Place it somewhere out of reach of players, and preferably out of sight too. Re-enable scripts and save the map. You're done! If your map gets corrupted (you'll get an error each time you try to load it), try modifying your prefab to support only 8 players rather than 10. To do this, just leave out columns I and J when grouping everything into a prefab. When I say "column", that includes the weapons, script brains, and ball joints. If you're using my prefab, here's an 8-player version. Scripting elements used: Labels: user:alpha through user:kilo, user:quebec through user:tango, user:victor, user:xray through user:zulu, minigame:1:0bject, minigame:2:0bject, minigame:include Messages: alpha through juliet Numbers (global): alpha through juliet, romeo Numbers (team): alpha for every team Numbers (players): alpha through juliet for each player Power: not used How the scripts work: I'll go through the purpose of each script brain showed in the pictures. The 10 identical columns of script brains and ball joints each manage an individual player. Green Brains The first step is to apply a different label to every player, which is handled by the green brains. They each have a timer script that applies a label to any unlabeled player. They're set up so that no two players should get the same label. If that does somehow happen (like if you set the respawn timer too high and someone joins while a player is dead), it will remove the label from one of the players (hopefully the one that just joined). It also functions to check when a player spawns, which is necessary later on. Red Brains The red brains check whether the player has died. It does this by setting the brain's number to an object count, which counts how many players with a certain label are alive. This should be 1 if player is alive, or 0 if they are dead. The next script checks whether the number is 0, and if so, it despawns all of that player's weapons. This way, if someone manages to snag your weapon before you can pick it up, it will be taken away from them when you die. Column of 3 Brains Another setup task is assigning numbers to all of the weapons to determine their order. The column of 3 script brains handles this. The first script brain performs two miscellaneous setup tasks: setting a global variable to the number of weapons in one row (this equals the score needed to win), and setting the blue script brains's number to 1 (since the blue brain's number represents the player's score + 1). The second script brain just assigns each weapon a number matching that weapon's spawn order (this is for regular Gun Game). The third script brain assigns a random number to each of the cyan script brains to the left of the weapons (this is for Gun Game Fiesta). Each of those cyan brains has a number check script that fires when the setup brain gives it a random number. This script sets the numbers of all of the weapons in that row to the random number it received. The end result is a random weapon order that's the same for every player. Ball Joints The next step is to keep track of each player's score. This is trickier than it seems, and was probably the biggest hurdle in getting this all to work. When you set a variable to an individual player's score, there's no option to specify the player by label. You can only grab a player's score when they activate something (like a button or a boundary). My solution was to create a ball joint with a boundary that follows each player around to constantly grab their score and set a variable to its value (I used a ball joint because it's small, invisible, and collisionless). There was another problem: if another player activated your boundary, it would grab their score instead of yours, causing game-breaking bugs. Here's how I fixed this: in Forge, each player has 26 channels to store numbers. By default, each of these numbers is set to 0. Each boundary script assigns the activator's score (offset by 2) to the player's channel that corresponds to their label (so the player with the label user:alpha will have their score stored in their alpha channel). If the boundary does not belong to the activator, it will not change any of their number channels. Then, it grabs the activator's number from whatever channel corresponds to that boundary and sets the ball joint's number to that value. If the boundary does not belong to the activator, it will grab the number from one of their unused channels (which is 0 by default). Then, there's a number check script that checks whether the ball joint's number does not equal 0. It will only equal 0 if the wrong player had activated the boundary, since the score is offset by 2 when it is assigned to a player channel. Finally, the script sets a global variable to the object's number, subtracting 2 to account for the previous offset. You now have a global variable that reliably matches the player's score. Sorry if this part of the explanation was confusing. Just looking through the ball joint scripts might give you a better understanding of what's going on. Blue Brains Then, you need to detect when the player's score has increased, and despawn their current weapon/give them the next weapon. This is handled by the blue script brains. First, there's a number check script that checks whether the player's score is greater than the brain's number. If so, it plays a "Level up" sound, and increments the brain's number to match the player's score. If the player got two simultaneous kills, this script makes sure that their score only increments by 1 so that they don't skip a weapon. It also despawns their current gun in preparation for the next gun. The next script checks whether the player score is less than 0, and if so, it sets their score back to 0. The next script checks if the brain's number is greater than the player's score, which means the player has committed suicide and lost a point. All this does is set the player's global score variable to match the brain's number. For some reason this script fires whenever you gain a point as well, so I couldn't put anything else here (like a sound or something). The next script moves the weapon that has a number matching the brain's number to the player so that they can pick it up. The next script does the same thing, but only for turrets. This is because unlike regular weapons, turrets collide with players. They have to move a bit slower and be offset in one direction so that they don't splatter the player. The next script fires whenever the brain's number changes, regardless of which direction. Since I used up all 8 script slots on this brain, it assigns its value to the purple brain to allow for more actions. It also assigns its value to a team variable corresponding to the player's team, which I'll explain later. The last script sets the yellow brain's number to 1 if the player has a ranged weapon, or 2 if the player has a melee weapon. It's triggered whenever a player spawns (determined by the green brain), or when the previous script fires. More explanation on this in the next section. Yellow Brains If this brain's number is set to 1 (meaning the player is holding a ranged weapon), it applies a trait to the player with 10% melee damage (you can't set it to 0% for whatever reason). If it's set to 2 (meaning the player is holding a melee weapon), they get 100% melee damage. I ran into a bug where if I set the base player traits to have 10% melee damage and then applied a trait configuration with 100% melee damage, the player would still do only 10% melee damage (though any other traits applied just fine). I got around this by setting the base player traits to 100% melee damage, and the trait configuration to 10% melee damage. So, when a player has a ranged weapon, they have Trait Configuration Alpha applied to them, and when the player has a melee weapon, this trait configuration is cleared. Purple Brains These brains are basically just an extension of the blue brains. When a player reaches the last weapon, it plays "Next kill wins" for that player, and plays the infection woosh sound (the one when someone gets infected) for everyone else to notify them that someone is on the final weapon. It also ends the game if a player gets a kill with the final weapon. This is so that if you have a weapon set with say, 37 weapons, you can set the score to win to 50 in the gametype settings (there's no option for 37) and the game will still end when it's supposed to. Leftmost Column of Brains These brains handle team scoring. Remember, whenever a player scores, the blue brain sets a team variable to their score. Each team brain checks the team variable corresponding to its own team. If it's greater than that brain's object number, it will set its number to match the team variable and then set the team's score to that variable. In effect, the team score reflects the score of the top player on that team. If the top player leaves or suicides, the team score won't go down, but this doesn't affect gameplay in any way. If you have any questions, I'd be happy to answer them.
I watched the Forge Labs video of this last night. Very entertaining gametype (to watch at least, and I'll bet - to play as well!! ) great work... that is some amazing scripting, there!