Persistent Round State System

A Map Prefab for Counter-Strike: Source

Sign up to access this!

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.

Files

Posts

Embed

Сподели банер
URL на изображението:
HTML код за вграждане:
BB код за вграждане:
Markdown код за вграждане:

Credits

Guy Who Did The Things and Stuff
Fibbs
Everything
Special Thanks
IppE
Preview video

Submitter

Fibbs avatar
Fibbs username pic Joined 11y ago
Offline
29,089 points Ranked 149th
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
Fibbs

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

Game

Sign up to access this!

Category

License

Share

  • Share on Reddit
  • Share on Twitter
  • Share on Facebook
  • Share on Google+

Stats

  • 336 DLs
  • 3.7k Views
  • 2 Posts
  • 6ySubmitted
  • 3yModified

Scores

91 bScore
10 Rating

3 voters

Sign up to access this!

More from Submitter

More Other/Misc Prefabs

bcp.crwdcntrl.net tracking pixel