Tag Archives: victory

Taking Home Victory

There is already quite some stuff possible in Defusing but one important thing about the game play that’s still missing is the actual winning of rounds in order to win with your team.
Today I’m going to show you how to realise that.

First of all I’ve included a Nadeo script called “Victory.Script.txt”. It’s very useful in order to manage the winners of rounds and matches.
For that it’s necessary to call a few functions of the script at certain points of the game execution, e.g. when a round begins so that it can reset the former round winners.
Whenever you want to use another script (library) you will have to check if there are such functions.

In order to allow players or server admins to customise the way matches are played I’ve added several settings.
For example there are settings for the duration of a round and the number of rounds a team has to win in order to win a whole map.
Additionally there is a setting called “S_BombExplosionTime” which will define how long an activated bomb takes to finally explode.

Any setting that defines a time (duration) uses seconds or minutes as units in order to make it easy for the users. Keep in mind that you have to multiply the setting values with 1000 (and 60) in order to get the amount of milliseconds which the script is using.

The amounts of won rounds are saved in the array “ClanScores” (from CSmMode). Via the keys 1 and 2 you can set and get the round scores for the Blue and Red team. They will also be shown on the scoreboard (if you use this array).
When a map begins I reset these scores to 0.

Rounds end if the time runs out, if the bomb has been defused or if it exploded. By setting the “EndTime” property the countdown at the top is ticking down until this specific point. That’s done at the beginning of each round and as soon as the bomb has been activated which lets the clock show the time left until the bomb explodes.

If the bomb has been completely defused in-time the round winner is set to the defending team (using the Victory script).
Furthermore if the time runs out the winner is set based on the bomb activation status (activated bomb means that the bomb exploded, so the attacking team won).

If a round winner has been found the variable “MB_StopRound” of the ModeBase script is set to True which lets the round end so that the script enters the “EndRound” label.
In this label’s implementation I announce the winning team and grant the score.
Also there is a check done if the whole match is won by now.

Please note that the score summary overlay at the top showing the team names and their scores isn’t updated automatically. The class CUIConfig (representing player UIs) has various properties in order to set the data for the summary.
Each time the team scores changed the data is updated via my method “UpdateClanScoresSummary”.

The overlay needs the team points and a player Id for each team to fill the color and name.
Via the Boolean “OverlayScoreSummary” you can finally turn the complete overlay on and off.

For the current version of the game mode I’ve also implemented a label called “LogVersion” which is declared in the ModeBase. Inside it I simply log the name and the version of my own script and each library script I’ve included.

Please find the new version of the script here: Defusing5.Script.txt