1. Forums
  2. Discord
  3. About Mapcore
  4. Patreon Supporters
  • Login
  • Register
  • Search
This Thread
  • Everywhere
  • This Thread
  • This Forum
  • Articles
  • Pages
  • Forum
  • More Options
  1. Mapcore
  2. Discussions
  3. Level Design

[HELP] Check which team won the round

  • NickMBR
  • November 25, 2014 at 3:46 AM
  • NickMBR
    • November 25, 2014 at 3:46 AM
    • #1

    I'm trying to create a map that adjust itself based on the number of victories of each team. (CSGO SDK)


    For this I need to run a vscript file at every round checking which team won.

    I tried to use the logic_eventlistener using the event "round_end" and running a vscript file with no sucess.

    It works with a event that happen more often, like "bullet impact" but not with round_end.


    Is there any way I can check the team than won at the end of each round ?

  • ESToomere
    • November 25, 2014 at 7:09 AM
    • #2

    Assuming you mean TF2:
    http://www.nodraw.net/2012/02/sorting-winners-from-losers/

  • NickMBR
    • November 25, 2014 at 7:35 AM
    • #3

    Sorry, didn't specify the game, it's for CSGO.

  • Spherix
    • November 25, 2014 at 8:15 AM
    • #4

    I read/replied to your question on Facepunch; if you would be so kind as to explain what gamemode and such you have in mind, then I can probably write the Vscript needed for you. A simple snippet won't be helpful if I have no idea how you plan on ending rounds.

  • NickMBR
    • November 25, 2014 at 9:18 AM
    • #5
    Quote from Spherix

    I read/replied to your question on Facepunch; if you would be so kind as to explain what gamemode and such you have in mind, then I can probably write the Vscript needed for you. A simple snippet won't be helpful if I have no idea how you plan on ending rounds.


    Thanks,


    What I want to do is simple, I want to check which team won the round. The gamemode is custom, so it can't run on events like bomb_defused or bomb_exploded (same for hostage/vip/gg)


    For example, if CT won the round then it increments a var "CTWinnings", when it reachs certain value it starts to modify the map via entfire and propspawn functions.


    I don't want to force a round to end, what I want is simple to check which team won.


    I'd tried to use the events like round_end and the logic_eventlistener but it don't work. Only works with other game events when the round is active.

  • Spherix
    • November 25, 2014 at 2:38 PM
    • #6

    Do the players spawn;

    - once

    - in waves

    - instant respawn (deathmatch)


    Does the round end when:

    - All players on a certain team have died

    - The time has run out

    - An objective has been achieved


    Check which apply so I know what the options are

  • NickMBR
    • November 25, 2014 at 5:53 PM
    • #7

    As I said, it's pretty simple, round ends when the all players of one of the teams die. I don't know yet if I'll make them respawn, but let's say they spawn only once.


    More detailed, at the end of each round, check which team won, if it's the CT, then run a function called CTWon() incrementing a count var to make changes in the future. Same thing with the TR's using a function TRWon() also incrementing/decrementing as they won or lose.


    This functions will then be called when they reach a certain value in the count vars, making the map changes for the next round. Using for example func_brushes, wall_toggles, EntFire, EntSpawn, PropSpawn, etc.


    For example, the CT's won 3 consecutives rounds, incrementing a value of 1 each, the count var will have 3, when the 3 is compared in the Vscript, it will them make changes to the map. What happens if they lose ? Decrement a value of one. Same for the Tr's.


    I can run functions with the logic_eventlistener but not the one that I need, that is the "round_end" one.


    L4D2 has a OnGameEvent_Event_x function, not implemented in CSGO tho.


    Hope you understand.

  • Spherix
    • November 26, 2014 at 9:10 AM
    • #8

    One of the options that comes to mind is to have a script constantly check for the presence of a CT/T on the map; as soon as the result is 0 for either one of them, that means the opposite team would still have a member left.


    For example;

    Code
    while (Entities.FindByModel(variable, "models/player/tm_phoenix.mdl") != null) {
      printl("Terrorists are still alive");
    }

    If that returns null, then all the terrorists should be dead; in which the CT's have won the round.


    I'm not sure if going by models alone is doing the trick though, dead bodies could share the shame model and that would cause issues. Another way is to check for player team ID's and health, and go by that.


    All in all this feels a bit too dirty, I was pretty sure the eventlistener should do the trick. I'll do some testing when I get home to see what is causing the issue.


    Edit: Another entity-based option would be to have a trigger_multiple over your entire map with a teamfilter, and have it trigger a script event as soon as nobody from that team is touching it anymore (meaning they're dead).


    Edit2 (Solution): Was able to do a small test during my lunch break, it seems to work fine after I killed the last bot outside of warmup.

    Code
    Firing: (game_playerdie)
    Firing: (game_playerkill)
    (22.92) output: (NULL,NULL) -> (round_end_script,RunScriptCode,0.0)(RoundEnded())
    +++++Bot Keith with Max Difficulty 1 will become Bot Chad with Max Difficulty 2
    +++++Bot Ron with Max Difficulty 1 will become Bot Joe with Max Difficulty 2
    +++++Bot Ian with Max Difficulty 1 will become Bot Xavier with Max Difficulty 2
    Achievements disabled: cheats turned on in this app session.
    Achievements disabled, ignoring achievement progress for SILENT_WIN
    (22.94) input <NULL>: round_end_script.RunScriptCode(RoundEnded())
    ======================ROUND ENDED==========================

    The ==ROUND ENDED== is the Vscript outputting a line after the logic_eventlistener has been triggered by round_end.


    Attached the VMF and .NUT files for the heck of it, you'll notice I haven't done anything strange.

    round_end.zip

  • NickMBR
    • November 26, 2014 at 12:18 PM
    • #9

    Well, the eventlistener just runs the round_end when the team filter is "don't care", it don't fire when the filter is team(orange) or (blue).


    I did almost the same thing you did in this test map, the difference is that I was using the team filter.


    I know that the round_end event returns 3 vars:


    (byte) Winner Team

    (byte) Reason

    (string) Round End Message


    Is there any way I can read the logic_eventlistener inside the Vscript and get this vars ?


    BTW, the trigger_multiple with the filter_activator_team for both teams can do the trick for a while, as it takes only 4 entities and the rest the vscript will handle.


    Thank you !

  • Spherix
    • November 26, 2014 at 1:52 PM
    • #10

    Managed to do some small tests and it seems to be either broken or just not parsing the team ID's at all. The game event is always round_end. I noticed a round_officially_ended as well (which fires a splitsecond before the round is actually restarted), but a logic_eventlistener didn't even pick those up.


    What you could do after the generic round_end is detected, is do a count of the amount of players per team left. That should be done quick enough for the script to figure out which team should be awarded points as it has or hasn't got any players left.

  • ESToomere
    • November 26, 2014 at 2:18 PM
    • #11

    Doesn't CS:GO just restart the map after every round versus TF2 restarting OR just tidying it up a little on certain gametypes.

  • Spherix
    • November 26, 2014 at 3:42 PM
    • #12

    The map ain't restarted fully afaik, I've noticed that when I was testing a map where I used an env_texturetoggle so change a scoreboard; a round end kept the texture as it was last set.

  • NickMBR
    • November 28, 2014 at 9:47 PM
    • #13

    There's some entities that keep their last values between rounds, like func_brush(es)


    Anyway thanks for the help !

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!

Register Yourself Login
Discord

The Mapcore Discord is our lively IRC channel of the 2000s reborn. Chat about level design, gaming, and more.

Latest Posts

  1. Tangerine

    Harry Poster
    July 18, 2026 at 11:10 AM
  2. Any of the old guard still around? D:

    Warby
    July 12, 2026 at 8:23 PM
  3. About our archived forums

    Thrik
    June 30, 2026 at 2:12 PM
  4. Mapcore Discord

    mason_fan123
    June 24, 2026 at 8:52 PM
  5. [CS2] Valley

    Serialmapper
    June 22, 2026 at 11:56 AM
  6. Free Music / SFX Resource - Over 2500 Tracks

    Eric Matyas
    June 18, 2026 at 12:32 PM
  7. Pango [WIP]

    Elowen
    June 11, 2026 at 10:13 AM
  8. [CS2] Dvina

    Jeremy Rivera
    June 11, 2026 at 10:03 AM
  9. Bridges 2.0 by NEXSIDE, MAP SHOWCASE. ( Steam Workshop )

    MrTrane18
    June 1, 2026 at 7:46 PM
  10. Classic Maps Reborn For CS2

    SillySpaceCat
    May 31, 2026 at 10:33 PM
  1. Privacy Policy
  2. Contact
Powered by WoltLab Suite™