Ads keep us online. Without them, we wouldn't exist. We don't have paywalls or sell mods - we never will. But every month we have large bills and running ads is our only way to cover them. Please consider unblocking us. Thank you from GameBanana <3

Persistent Round State System

A Map Prefab for Counter-Strike: Source

Members see zero ads. Membership is 100% free

A system which can be used to keep the state of a level per round.

Important!env_global is not in the cstrike FGD. You will either need to add the half-life 2 FGD to your CS:S config or work with smartedit off to work with the env_global entities. I suggest adding halflife2.fgd and ignoring the counter parts of the entity.
DescriptionThis is a system useful for minigame mappers (and possibly others) which allows for persistent round states. Basically what this means is that once something is triggered in the level it will stay that way until it is reset.

The example shown is not the best example as it simply takes advantage of func_brush entities not resetting on new rounds, but you could control them using the env_global and logic_auto entities provided anyway. When an area is entered it is blocked off for the remaining rounds until all of the areas have been entered. This can be extended and modified for use in minigame maps for map selection, so that each minigame must be chosen and played before one of them can be chosen again.

This would have been simpler if the counter function of env_globals worked in CS:S, but it doesn't appear to.
How It WorksThe system works using a fairly well known method of using env_global and logic_auto entities to change what happens on new rounds. The env_global, when enabled, sets the game state "game01" (for the first trigger). The logic_auto is tied to the game state set in its properties ("game01"), and so, only fires when that game state is enabled (when the env_global is enabled). The logic_auto then outputs whatever you want to change on the new round. At the moment all it does is add 1 to a math_counter.

The math_counter is there to reset everything after all of the triggers have been triggered. The max value of the counter is set to one less than the total number of triggers. When the counter hits the max, it enables an env_global which enables a reset state, which then enables a logic\_auto which will reset everything on the next round (after the last). It also disables all env_globals (the "global*" wildcard selects all entities with a targetname starting with "global"), except for the one that resets everything, so that they don't do anything after the last round. Lastly, it disables all the logic_relay entities (using the "relay*" wildcard).

The logic_relay entities are there to stop the triggers from enabling the env_global entities on the last round. The triggers, instead of directly enabling the env_global entities, trigger the logic_relay entities, which then trigger the env_global entities. When the math_counter hits max, it disables the logic_relay entities which stops them from enabling the env_global entities they're linked to. This is done so that the last env_global entity isn't enabled on the last round. If it is enabled, it will still be enabled after the reset.
Usage and EditingFirstly, a logic_relay, env_global and logic_auto are needed for each trigger. Link up the entities in that same way as the others. It should be obvious. Trigger to relay, relay to global. In the env_global set the "Global State to Set" ("globalstate" key with smartedit off) to a new state (eg "game05") and in the logic_auto set the "Global State to Read" to the state in the env_global.

Set the math_counter entity's maximum value to one less than the total number of triggers/env_global entities. If you named the new entities in the same manner as the ones already there then you shouldn't need to change the math_counter's outputs as it uses wildcards. Be sure to check that none of your other entities start with "global" or "relay" though, as it will also select those.

To reset everything on the "first" round (after all triggers have triggered) use the reset logic_auto which is above the math_counter (it reads the "reset" global stste). You should/can also use this entity to have certain things happen on the "first" round, such as a message declaring that everything has been reset.

You may want to remove the point_servercommand and the output on the math_counter pointing to it as all this does is say "Last round." on the last round for testing purposes. If you want you could change this or leave it in for special things to happen for the last round.
Preview Video Thanks to IppE.



Sign up to access this!
  • Logan Dougall avatar
    Logan Dougall username pic Joined 13y ago
    Half Life Storm Flag Affiliation: Half Life Storm
    20,221 points Ranked 254th
    40 medals 3 legendary 9 rare
    • Achieved Admin clearance Medal icon
    • 500 posts awarded Exemplary Feedback Medal icon
    • 10 years a member Medal icon
    • 50 posts awarded Exemplary Feedback Medal icon
    • 100 posts awarded Exemplary Feedback Medal icon
    • 200 posts awarded Exemplary Feedback Medal icon
    Logan Dougall avatar
    Logan Dougall
    Half Life Storm Flag
    Half Life Storm
    access_time 7y
    If you don't win June Prefab of the month then that's just sad. Well done. Impressive work-around I have to say.
    • Thanks x 1
    Structural Designer / Dad :)
    URL to post:
  • KeNnY1337 avatar
    KeNnY1337 Joined 9y ago
    access_time 7y
    Awesome! It works, thank you really much for creating that for me!
    Mapper avatar
    URL to post:


Share banner
Image URL
HTML embed code
BB embed code
Markdown embed code


Guy Who Did The Things and Stuff
Special Thanks
Preview video


Fibbs avatar
Fibbs username pic Joined 12y ago
32,089 points Ranked 142nd
24 medals 1 rare
  • 6 years a member Medal icon
  • Prefaber of the Month, June 2012 Medal icon
  • MiPper of the Month, June 2012 Medal icon
  • Prefaber of the Month, March 2013 Medal icon
  • Texturer of the Month, July 2014 Medal icon
  • Became a Studio Leader Medal icon
Fibbs avatar

Sign up to access this!
Sign up to access this!
Sign up to access this!


Sign up to access this!





  • Share on Reddit
  • Share on Twitter
  • Share on Facebook
  • favorite 3
  • cloud_download 339
  • remove_red_eye 4.1k
  • mode_comment 2
  • access_time 7y
  • access_time 4y

More from Submitter


More Other/Misc Prefabs