Jump to content
sn0wsh00

[CS:GO] Round-to-round map randomization guide

Recommended Posts

A few months ago, I wrote a guide on how to vary CS:GO maps round-to-round using logic_case and logic_eventlistener entities. Would be nice to hear some feedback from you guys regarding my guide's accuracy, as well as any additions I should add:

How to Randomize Your Map Round-to-Round in Hammer

I owe of lot of the guide's contents to Reddit user Nymphalow and Valve's developer wiki. I do have some questions regarding some game_player_equip flags, however. Specifically, if you scroll down to the "Starting Weapons" section, you'll see that, for the game_player_equip entity named "equip_players," I say that you should only enable the "Only Strip Same Weapon Type" flag. In Nymphalow's original post, on the other hand, Nymphalow says that the "equip_players" game_player_equip entity only enable the "Use Only" flag. In my experience, though, having only "Use Only" checked caused a crapton of weapons to spawn, while having only the "Only Strip Same Weapon Type" flag checked caused the trigger_multiple entity to correctly spawn only 1 weapon. Hopefully, someone knowledgeable can help clear up this issue. I think I figured out how to use "Use Only" with game_player_equip and trigger_multiple. See my post here.

You probably won't be using many of these randomization techniques in a competitive map (heard people really disliked cs_havana for doing just that). However, I do think there's a bunch of potential for round-to-round variation in AIM, Coop and obstacle course maps, for those who want to give those maps more replayability. In fact (self-promotion ahead!), here are some maps I've created that uses some of the concepts explained in my guide:

Edited by sn0wsh00
wording

Share this post


Link to post
Share on other sites

Ok, so I probably figured out the whole "use only" thing with regards to game_player_equip. It turns out what Nymphalow probably meant to say was:

  1. For "equip_player", make sure that "Use Only" and "Only Strip Weapon Type" are checked
  2. In the trigger_multiple output, the "Via this input" field should be "Use" instead of "TriggerForActivatedPlayer." Given that "Use" is by default a non-FGD input, "Use" will appear red.

I'll update the guide to incorporate this new way to randomize weapons once I get close to finishing my aim_six_arenas spinoff.

Shoutout to @Kokopelli's Snowball Fight - Country House map for showing how to correctly do this.

Edited by sn0wsh00
Formatting, credit

Share this post


Link to post
Share on other sites

Talk about really randomizing your stuff: OrelStealth has just released a map with procedural generation:

https://steamcommunity.com/sharedfiles/filedetails/?id=2362387875

Skimming through the decompiled files, it looks like most of the procedural generation was done through Vscript combined with a bunch of prop_dynamic entities.

Edited by sn0wsh00
link

Share this post


Link to post
Share on other sites

Just added a new way to randomize weapons to the guide. You can read how I did it on Steam, but I'll post the method here on Mapcore as well because it's always good to have a backup.

So, suppose you want a round where the terrorists and counter-terrorists spawn with a Tec-9 and Five-Seven respectively, and another round where they spawn with a Glock and a USP-S. To do this,

  1. Create a logic_eventlistener entity and name it ListenRoundStart. Set "Event Name" to round_start.
  2. Create two filter_activator_team entities. Name one filter_t and the other filter_ct
  3. Create two math_counter entities. Name one counter_ct and the other counter_t. For both counters, set the minimum legal value to 0 and the maximum legal value to 20.
  4. Create four game_player_equip entities. Name them equip_ct_usps, equip_t_glock, equip_ct_57 and equip_t_tec9
  5. For all four game_player_equip entities, make sure the "Use Only" and "Strip All Weapons First" flags are checked
  6. Disabling SmartEdit, add entries for weapon_knife for the four game_player_equip entities.
  7. Keeping SmartEdit disabled, add an entry of weapon_usp_silencer for equip_ct_usps, weapon_glock for equip_t_glock, weapon_fiveseven for equip_ct_57 and weapon_tec9 for equip_t_tec9. You should have two weapon entries for each game_player_equip, as shown here.
  8. Create a logic_case entity called counter_chooser and create two outputs for OnCase01 and two outputs for OnCase02
  9. For the first OnCase01 output, set target entity to counter_ct and input to SetValue. For the other OnCase01 output, set target entity to counter_t. For both OnCase01 outputs, set parameter override to 10. Do the same thing for the two OnCase02 outputs, but set the parameter override value for those outputs to 20. The output table for counter_chooser should look like this.
  10. Create two more logic_case entities named logic_ct_chooser and logic_t_chooser
  11. Under class info for both logic_ct_chooser and logic_t_chooser, set the Case 01 value to 10 and the Case 02 value to 20, as shown here.
  12. Under logic_ct_chooser outputs tab, create an output for OnCase01 with a target entity of equip_ct_usps and a "Via this input" of Use. Because Use is not a default FGD input, the word "Use" will appear red. Don't worry about this, though, as CS:GO will recognize this input.
  13. Create an output for OnCase02, and do the same thing you did with OnCase01, but replace the target entity with equip_ct_57. The logic_ct_chooser outputs tab should now look like this.
  14. For logic_t_chooser, do what you did with logic_ct_chooser, but replace the the target entities of equip_ct_usps and equip_ct_57 with equip_t_glock and equip_t_tec9 respectively
  15. Returning to counter_t, go the output table and create an output named OnGetValue with a target entity of logic_t_chooser and a "Via this input" of InValue. Do the same for counter_ct, replacing logic_t_chooser with logic_ct_chooser. Keep the parameter override fields blank.
  16. Back at the ListenRoundStart logic_eventlistener outputs table, create an output named OnEventFired, set target entity to counter_chooser and "Via this input" to PickRandom.

Now it's time to create the trigger_multiple brushes:

  1. Create a single trigger_multiple brush around CT spawn and a single trigger_multiple brush around T spawn. Name those trigger_multiples wep_spawn_ct and wep_spawn_t respectively. Once again, if you have multiple group spawns, simply copy the trigger_multiple brushes to the other spawn areas, keeping the same entity and filter names. The output table should look like this.
  2. Set "Filter Name" for wep_spawn_ct and wep_spawn_t to filter_ct and filter_t respectively
  3. Set "Delay Before Reset" to -1
  4. In wep_spawn_t, set "My output named" to OnStartTouch, "Targets entities named" to counter_t, "Via this input" to GetValue and a delay of at least 0.01 seconds (this delay is necessary for the game_player_equip entities to work). Also make sure "Fire once only" is unchecked
  5. Do the same thing with wep_spawn_ct, but change "Targets entities named" to counter_ct.

As you can tell, there's a lot of entities that need to be created to randomize player weapons round-to-round. Fortunately, I made a chart to visually show how all these entities relate to each other:

Spoiler

 


RandomWeaponChart.png.f0582ac216c8020be34880a66d3b87c2.png

 

 

 

I made a map that shows off all the concepts in this post. You can download it at the link below:

https://drive.google.com/file/d/1GcBfx7_NaKbL025XegK3Kgzpp5znNGet/view

Edited by sn0wsh00
link to map, wording, corrected mislabeled chart

Share this post


Link to post
Share on other sites

If you had taken a look at the Steam guide, you'll see that I recommend the math_counter method to randomize weapons in CS:GO. This is because having a single trigger_multiple for each side makes it much easier when you want to enable or disable random weapons depending on game mode.

Suppose you want random weapons to be only enabled in custom. Also say that you want buy zones to be enabled in casual/competitive modes. To do this:

  1. Follow the steps in the previous post for weapon randomization, but this time, set the Start Disabled property for the two trigger_multiple entities to Yes.
  2. Create func_buyzone entities and give them a name such as buyzone_ent
  3. Create the following .nut VScript and place it somewhere in the in the CS:GO scripts folder (as usual, special thanks to @Kokopelli for providing the original code):
	function FixGameMode()
{
       local nMode = ScriptGetGameMode();
       local nType = ScriptGetGameType();
       local nRounds = ScriptGetRoundsPlayed();
	    if (nMode == 0 && nType == 3)
    {
    EntFire("buyzone_ent", "Disable", 0, 0);    
    if (nRounds == 0)
    {
    SendToConsole("mp_respawn_immunitytime 0; mp_roundtime 3; mp_maxrounds 30; mp_warmuptime 1; mp_timelimit 0; bot_chatter normal; mp_friendlyfire 1; ff_damage_reduction_bullets 0; ff_damage_reduction_other 0; mp_randomspawn 0; bot_quota_mode fill");
    } //Allows cvars to be changed later
    EntFire("wep_spawn_t", "Enable", 0, 0);    
    EntFire("wep_spawn_ct", "Enable", 0, 0);    
                                        // custom. Random weapons
    }
	    if (nMode == 1 && nType == 0)
    {
    
    SendToConsole("mp_warmuptime 1; bot_quota_mode normal");
                                    // competitive. Changed bot_quota_mode
    }
    
    if (nMode == 2 && nType == 1)
    {
    
    SendToConsole("bot_quota 2");
                                    // deathmatch. Changed bot_quota
    }    
}

What the script above will do is disable the func_buyzone entities and enable the trigger_multiple entities when game_type is set to 3 (aka custom game mode). This code also sends commands to the console so that custom mode can feel more classic-mode like, but only sends those commands in round 0, so that you can still change cvars such as mp_maxrounds without those cvars resetting every round. Because I already set trigger_multiple to be disabled in Hammer, I do not need to send additional console commands for the other game modes to disable trigger_multiple.

Back in Hammer:

  1. Create a logic_auto entity and and a logic_script entity. Name the logic_script entity to something like map_script
  2. Under map_script's Entity Scripts, add the .nut file you created
  3. In logic_auto's output table, create an output named OnMapSpawn, a target of map_script, a Via this input of RunScriptCode and a parameter override of FixGameMode(). Weapon randomization will now only work in custom mode

I've made a map showing off these concepts here:

https://drive.google.com/file/d/1O87dIP_xc7RTe5fttYW6sNsRKoRPqSRd/view?usp=sharing

Or if you want a more complex map that utilizes these concepts, check out my map Showdown Planet.

Edited by sn0wsh00
wording

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...