Non-Linear Multi-Stage Map Completion

A Map Prefab for Counter-Strike: Source

A system that allows players to complete a multi-stage map in any order. There are some limitations and quirks, however. There is a limitation of a mere four areas due to the way I've done this, however this has the benefit of only using 5 entities per player. Other methods, such as duplicating teleporters and triggers for each player or creating every combination of filters for every situation are a huge waste of entities and a pain to manage. There are also some issues due to player properties not being reset when they respawn, and the lack of any means to clear them. If a player completes a couple of levels and dies then respawns, they will be able to carry on where they left off, which may be a good thing. However, if a player completes some levels then leaves, if another player joins and receives the same targetname as the person who left, then the new player will be able to carry on where the previous left off. This may be an issue if the server allows players to spawn at any time (ghost respawn server plugins are untested, so the behaviour in regards to ghost players is unknown).

How It Works:

If you are unfamiliar with anything below, please refer to the Developer Wiki. This system makes use of AddOutput, OnUser1-4 and FireUser1-4 to have the players keep track of their own entities. Each spawn point has a trigger, a logic\_branch for each level and a logic\_branch\_listener to keep track of them. The triggers are filtered to ignore any entity with a name beginning with "player", and when a player triggers the trigger, their name is set to player1 ("1" will be whichever spawn point it is, e.g "player2" for the second spawn point). All spawn triggers will then ignore any player who has already touched a spawn trigger. The other outputs on the trigger add outputs to the player who touched the trigger (the !activator) to set each branch to true when the relative output is fired. OnTrigger, !activator, AddOutput, OnUser1 branch1_t1:SetValue:1:0:-1 adds the output: OnUser1, branch1_t1, SetValue, 1, 0, -1 to the player who touched the trigger. Then when the player's FireUser1 input is fired, it will do whatever we told it to do in its OnUser1 output (FireUser1 -> OnUser1, FireUser2 -> OnUser2 etc). In this case it sets the player's first logic\_branch to true. As you may have guessed already, the teleport at the end of each stage does the above. When a player triggers the teleport, their FireUser# input is fired, which then sets the linked branch to true, indicating that the level has been completed. Doing it this way instead of adding to a counter means that when the player finishes the level again, the branch is still true, but with a counter you'd still increase it (we can't filter the player name for the teleport as we can't change it, else other things will go wrong). Why can't we change their name? Well, for one, they would be able to trigger the spawn triggers again which would enable them to control multiple sets of branches at once (as we can't remove the outputs we added with AddOutput and they don't reset) and possibly mess with other people (this could possibly be worked around by keeping the spawn separate in some way). Secondly, when the logic\_branch\_listener finds that all the branches are true, and thus the player has finished, it can't reference the player without their name (how can we tell which player's listener it is? There's no hierarchy!). With a consistent player name, when the player has finished, we can 'teleport' them to the end area using their name. Usually you would do this by changing their name to a filter allowed by an ending trigger\_teleport, but we can't change their name. To get around this, we need to use somewhat of a little trick by directly setting the player's origin property to where we want them to be. If you look at a branch listener, you'll see the output "OnAllTrue, player#, AddOutput, origin x y z". This sets their position to the coordinates x y z. You'll need to change these coordinates to your ending area if you use this prefab. To get an entity's coordinates, select it and look at the bottom right of Hammer (eg 16w 16l 16h @(-128 128 8)).

How To Use:

Each spawn needs the 1 trigger, 4 branches and 1 branch listener. To add more spawns, copy the group of entities around the info\_player\_terrorist. Some of the names should work with automatic renaming if you use Paste Special to paste the copies. It should be obvious which names to change, but if it isn't: Spawn 1 -> New spawn (3)
targetname:
branch1(-4)\_t1 -> branch1(-4)\_t3
branchListener\_t1 -> branchListener\_t3 Outputs:
(branchListener)
OnAllTrue, player1, ... -> OnAllTrue, player3, ...
OnAllTrue, branch1(-4)\__t1, ... -> OnAllTrue, branch1(-4)\_t3, ... (trigger)
OnTrigger, !activator, AddOutput, targetname player1 -> targetname player3
OnTrigger, !activator, AddOutput, OnUser1 branch1(-4)\_t1:SetValue:1:0:-1 -> OnUser1 branch1(-4)\_t3

Video:

A small part at the start is missing but it's just completing the first stage. One of the issues highlighted above is displayed in the video (the last run through).

Files

Posts

  • Fibbs avatar
    Fibbs username pic Joined 11y ago
    Offline
    29,089 points Ranked 148th
    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
    5y
    And what happens when another person tries to finish that level, Big Al? The output only fires once. When others finish nothing will happen. If only one person was playing, then yes, this would be incredibly simple, but there IS more than one person playing. The prefab makes it so that _anyone_ can finish in any order and _only they_ will be teleported to the end (or whatever you set it up to do). It's easy enough to count which stages have been completed, but not _who_ completed them all.
  • Big Al avatar
    Big Al Joined 5y ago
    Offline
    268 points Ranked 15897th
    5y
    > **Posted by Fibbs** > > **Posted by Big Al** > > > > **Posted by Fibbs** > > > > > > **Posted by Big Al** > > > > > > > You SERIOUSLY over-complicated this. All that would be needed for something like this is a math_counter to count each stage being completed, a teleport trigger at the end of each level that adds 1 to the counter, and when the counter hits its maximum, enable a teleport trigger that sends players to the finish. > > > > > > That would allow players to just complete the same level over and over again and finish easily. > > > > So then only fire the "Add 1" output once on each teleport > > So you'd then need a teleport for each player? I don't know what's hard to understand here. trigger_teleport destination: (room where you pick which level you want to go to) Outputs OnTrigger target: (math_counter entity) input: Add override: 1 Fire Once: Yes It's literally that simple.
    Mapper
  • Fibbs avatar
    Fibbs username pic Joined 11y ago
    Offline
    29,089 points Ranked 148th
    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
    5y
    > **Posted by Big Al** > > **Posted by Fibbs** > > > > **Posted by Big Al** > > > > > You SERIOUSLY over-complicated this. All that would be needed for something like this is a math_counter to count each stage being completed, a teleport trigger at the end of each level that adds 1 to the counter, and when the counter hits its maximum, enable a teleport trigger that sends players to the finish. > > > > That would allow players to just complete the same level over and over again and finish easily. > > So then only fire the "Add 1" output once on each teleport So you'd then need a teleport for each player?
  • Big Al avatar
    Big Al Joined 5y ago
    Offline
    268 points Ranked 15897th
    5y
    > **Posted by Fibbs** > > **Posted by Big Al** > > > You SERIOUSLY over-complicated this. All that would be needed for something like this is a math_counter to count each stage being completed, a teleport trigger at the end of each level that adds 1 to the counter, and when the counter hits its maximum, enable a teleport trigger that sends players to the finish. > > That would allow players to just complete the same level over and over again and finish easily. So then only fire the "Add 1" output once on each teleport
    Mapper
  • Fibbs avatar
    Fibbs username pic Joined 11y ago
    Offline
    29,089 points Ranked 148th
    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
    5y
    > **Posted by Big Al** > You SERIOUSLY over-complicated this. All that would be needed for something like this is a math_counter to count each stage being completed, a teleport trigger at the end of each level that adds 1 to the counter, and when the counter hits its maximum, enable a teleport trigger that sends players to the finish. That would allow players to just complete the same level over and over again and finish easily.
  • Big Al avatar
    Big Al Joined 5y ago
    Offline
    268 points Ranked 15897th
    5y
    You SERIOUSLY over-complicated this. All that would be needed for something like this is a math_counter to count each stage being completed, a teleport trigger at the end of each level that adds 1 to the counter, and when the counter hits its maximum, enable a teleport trigger that sends players to the finish.
    Mapper

Embed

Share banner
URL da imagem:
HTML embed code:
BB embed code:
Markdown embed code:

Credits

Key Author
Fibbs
Everything

Submitter

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

Attributes

Share

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

Stats

  • 309 Downloads
  • 3,616 Views
  • 6 Posts
  • 6y Submitted
  • 3y Modified

Scores

91 bScore
10 Rating

3 voters

Sign up to access this!

More from Submitter

bcp.crwdcntrl.net tracking pixel