Persistent Round State System

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.

Oh noes! You're not a Member!

Want access to cool stuff? As a member you can:

  • Post. Give the submitter your thoughts on this Prefab.
  • Say Thanks. Show your appreciation by sending the submitter points.
  • Stamp Posts. Let other posters know what you think of their posts.
  • Rate. Give this Prefab a rating out of 10.
  • Flag. Alert moderators and warn members of a problem with this Prefab.
  • Vote. Vote the submitter for the Monthly Awards.
  • Subscribe. Get notified when this submitter submits again.

Interested? Register or Login

Comments

  • Logan Dougall's Levels
    • P5: Peddler
      Points: 143,344
    • E6: Authority
      EF: 223
    • C5: Admin
    • A6: Elder
      Account Age: 7 years
    Posted 11 months ago

    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
    !MOVING! Contact another Admin
  • KeNnY1337's Levels
    • P2: Drudge
      Points: 1,408
    • C1: Member
    • A4: Graduate
      Account Age: 2 years
    Posted 11 months ago

    Awesome!

    It works, thank you really much for creating that for me!

    User Title
    Mapper

Credits

Submitter
Fibbs's Levels
  • P3: Peasant
    Points: 24,829
  • E2: Guide
    EF: 29
  • C2: Treehouse Member
  • A5: Veteran
    Account Age: 5 years
Username
Fibbs
(Creator/Co-creator)
Guy Who Did The Things and Stuff
Fibbs
Everything
Special Thanks
IppE
Preview video

Rating

10.00/10
Based off 3 rating(s)

Stats

Post Count
2
ViewCount
1,112
Downloads
135
Date Added
11 months ago
Date Modified
11 months ago

License

N/A

Share

Embed Code
Code to use:

More embeddable images

Bookmark and Share