You are viewing a potentially older version of this package. View all versions.
doms-CaptureTheFlag-1.1.0 icon

CaptureTheFlag

Two-team Capture the Flag for STRAFTAT. Grab the enemy flag, run it back to your base, first to three wins. Get killed and you respawn a few seconds later instead of sitting out the round.

By doms
Date uploaded 2 days ago
Version 1.1.0
Download link doms-CaptureTheFlag-1.1.0.zip
Downloads 7
Dependency string doms-CaptureTheFlag-1.1.0

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2305 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2305
straftatmodding-MyceliumNetworking-1.1.17 icon
straftatmodding-MyceliumNetworking

An easy to use networking library for sending custom RPCs through Steam.

Preferred version: 1.1.17

README

Capture the Flag

Two-team Capture the Flag for STRAFTAT.

Each team gets a flag and a base. Walk into the enemy flag to take it, bring it back to your own base to score. Getting killed drops the flag where you fell, and you respawn a few seconds later instead of sitting out the rest of the take. First team to three captures wins the round, and the match carries on exactly as it normally would.

Everything else about STRAFTAT is untouched — same weapons, same movement, same maps, same match-point progression.

Everyone in the lobby needs this mod, at the same version. The host will not start a CTF match until every player has reported it.

Installing

  1. In r2modman, pick STRAFTAT and the profile you play on.
  2. Install BepInExPack and MyceliumNetworking.
  3. Install CaptureTheFlag.
  4. Launch with Start modded.

Everyone you play with does the same. That is the whole setup — there is nothing to configure to get a game going.

Playing

Set the lobby to two teams and start a map. CTF picks the two furthest-apart spawn points as bases and works out which one belongs to which team from where each team spawned. In a lobby of more than four, players the game left without a team are sorted onto the two real ones for you — see More than four players.

  • Walk into the enemy flag to pick it up.
  • Bring it to your base to capture. By default your own flag has to be home for it to count.
  • Touch your own dropped flag to send it straight back.
  • A dropped flag returns on its own after 15 seconds. It flashes faster as the timer runs out.
  • Killing the carrier drops the flag where they died.
  • First to three captures wins the round.

The HUD shows the score, both flags' states, and what you should be doing. Off-screen markers point at the flags and, when you are carrying, at your own base.

Placing bases by hand

Automatic placement works on the official maps, but if a map puts a base somewhere awkward the host can override it:

Key What it does
F8 Save the first team's base where you are standing
F9 Save the second team's base where you are standing
F10 Forget this map's saved bases and go back to automatic

Positions are saved per map and reused next time. The keys are rebindable in the config.

More than four players

CTF works with moreStrafts, which raises the lobby from 4 players to 10. Install both, set the lobby to Teams, and start a map — there is nothing else to configure.

You do not have to sort everyone onto two teams yourself. STRAFTAT only ever assigns four players to teams, so in a bigger lobby everyone past the fourth ends up on a team of their own; the host is not doing anything wrong, and this used to be why CTF refused to start. CTF now puts those players on one of the two real teams as the map loads — smaller side first, so six players play 3 v 3 and ten play 5 v 5.

Teams you set yourself are left alone. A lobby that already has exactly two teams is used as it stands, however uneven, and a lobby where everyone has picked the same team is still refused rather than split up. Somebody joining part-way through goes onto the smaller side without interrupting the match.

Two things to expect at ten players that you would not see at four:

  • Spawns are tight. Maps carry about six distinct spawn points. CTF steps a respawn aside when the point it wanted is taken, but ten players sharing six places is crowded however it is placed.
  • The opening spawn of each map is still the game's own, and it deals players out by player number without regard to teams, so the first few seconds can put you near the wrong base. It sorts itself out after the first respawn.

Free-for-all is unchanged: it is meant to put everyone on their own team, so CTF stays out of it and says so. With more than two players you want Teams.

If CTF does not start

CTF tells you why on screen rather than failing silently. The usual reasons:

  • "every player is on the same one" — the whole lobby has picked one team. Split it with the team dropdowns in the main menu; CTF will not do this for you, because putting everyone on one team takes deliberate effort and is not something to undo behind your back.
  • "this is a free-for-all with N players on N teams" — switch the lobby to Teams. A free-for-all only works out as two teams when there are exactly two players in it.
  • "needs exactly two teams with players on them; this lobby has N" — three or more teams are in play and CTF could not reduce them. CTF only handles two.
  • "waiting for everyone to report Capture the Flag" — somebody in the lobby has not installed it, or has a different version.
  • "the two bases are only Xm apart" — the map's spawn points are too close together for a fair game. Place the bases by hand with F8 / F9.
  • "no usable base positions found" — a map with no usable spawn points. Same fix.

Configuration

Settings live in BepInEx/config/com.straftatmods.capturetheflag.cfg, or in Mod Menu if you have it. Worth knowing about:

Setting Default Notes
CapturesToWin 3 Set to 0 to follow the lobby's own "takes to win" setting instead
RespawnDelay 3 Seconds spent spectating after a kill
SmartRespawns true Choose where players come back instead of taking a random spawn point
RespawnUsesAllSpawnPoints true Use every spawn point in the map, not just the group the lobby size picked
RespawnVariety 0.35 How far the choice may wander from the best spawn point. Near 0 is safest and completely predictable
RespawnEnemyClearance 10 Metres of room to try to leave from an enemy who can see you
RespawnHazardRadius 6 Refuse a spawn point with a live mine, grenade or damage zone this close. 0 skips the check
RequireOwnFlagHome true Turn off for faster, messier games
DroppedReturnSeconds 15 How long a dropped flag stays contestable
CarrierSpeedPenalty 0 Optional handicap for the flag carrier
ShowFlagBeacons true The light shafts above flags and bases
ShowWorldMarkers true Off-screen pointers
HudScale 1 Size of the CTF HUD
VerboseLogging false Extra diagnostics, worth enabling before reporting a problem

Rule settings only matter on the host — it decides everything. Display and audio settings are per-player.

Good to know

  • The host decides everything. Who grabbed a flag, who scored, the score, respawns, when the round ends — all worked out on the host's machine. Nobody can cheat a capture from their end.
  • Late joiners are fine. Flags and bases are drawn fresh on each player's machine from whatever the host last sent, so someone joining part-way just picks up the current state. In a lobby of more than four they are also put on the smaller team as they arrive, so the match keeps its score instead of restarting.
  • You don't respawn at random. STRAFTAT normally drops you on any free spawn point, which works when everyone spawns together but not when you're coming back mid-fight. CTF tries to avoid putting you on top of an enemy, in their line of sight, next to a live mine, or right back where you just died, and leans toward your own half. It still picks randomly between the decent options so it doesn't get predictable. Set SmartRespawns = false for the old behaviour.
  • It uses the game's own systems. Winning a round goes through STRAFTAT's normal scoring, end-of-round screen and next-map load. Sounds are the game's own and follow your volume settings.
  • A game update won't break your match quietly. If STRAFTAT changes something the mod depends on, CTF switches itself off, says so in the log, and the game plays as normal.

Logs

BepInEx/LogOutput.log in your profile. Search for Capture the Flag. On a healthy start you should see the hooks applied, the version advertised to the lobby, and then the match starting once two teams are in.

Building from source

Needs the game installed, a profile with BepInEx and Mycelium, and a C# compiler (csc) plus mono.

./scripts/test.sh      # protocol and validation tests
./scripts/build.sh     # compile
./scripts/deploy.sh    # compile and install into a profile
./scripts/package.sh   # build a Thunderstore zip
./scripts/make-icon.sh # regenerate icon.png

Point them somewhere else with environment variables if your install is not in the default place:

STRAFTAT_DIR=/path/to/STRAFTAT R2_PROFILE=~/.config/r2modmanPlus-local/STRAFTAT/profiles/CTF ./scripts/deploy.sh

See PLAN.md for the design and STATE_OF_THE_PROJECT.md for current status and what has actually been tested.

CHANGELOG

Changelog

1.1.2

  • Fixed flags not appearing for non-host players in full 2v2 lobbies.
  • Fixed clients occasionally missing CTF state while a map was loading.
  • Fixed matches sometimes stopping or resetting when a player's version information was delayed.
  • Improved the warning shown when CTF state is not reaching a client.

1.1.1 was an unreleased test build, so this fix is numbered 1.1.2 to prevent the two builds from being mixed in the same lobby.

1.1.0

  • Added support for larger lobbies using moreStrafts, including 3v3 and 5v5.
  • Players left without a team are now placed on the smaller of the two teams.
  • Late joiners no longer reset an active match or its score.
  • Improved respawn placement when there are more players than spawn points.
  • Fixed teams occasionally being assigned the wrong base in larger lobbies.
  • Added clearer messages explaining why CTF cannot start.

moreStrafts is optional. Normal four-player lobbies still work as before.

1.0.5

  • Fixed rockets, grenades, mines and other projectiles sometimes failing for non-host players.
  • Fixed some loading events resetting an active CTF match.

1.0.4

  • Fixed living players occasionally being respawned and forced to drop a carried flag.
  • Added smarter respawns that avoid enemies, hazards and the place you just died.
  • Added the option to disable smart respawns.

The projectile fix included here was incomplete and was replaced in 1.0.5.

1.0.3

  • Fixed respawned players wearing the host's outfit.
  • Fixed slower-loading players occasionally cutting the opening countdown short.

1.0.2

  • Fixed CTF rules sometimes not activating even though the flags and HUD appeared.
  • Restored continuous respawns and prevented normal elimination rules from ending the take.

1.0.1

  • Fixed a team wipe ending the take and awarding a normal elimination point.
  • Fixed fast movement through a base occasionally failing to register a capture.

1.0.0

  • First complete release.
  • Two-team Capture the Flag with pickups, drops, returns and captures.
  • Continuous respawning instead of sitting out the take.
  • Configurable capture target, return timer and carrier penalty.
  • Animated flags, bases, HUD markers and game-matched sound effects.
  • Automatic base placement with optional manual overrides.

0.1.0

Internal test build.