{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreie7apwknxmqzwwd7ju75uqxmrdeljdohyxpar5clmvl2aslsl4ite",
    "uri": "at://did:plc:i7budt2wflrcfy6jtvfocbix/app.bsky.feed.post/3mgdpf5y25ak2"
  },
  "path": "/viewtopic.php?p=1278397#p1278397",
  "publishedAt": "2026-03-05T19:22:15.000Z",
  "site": "https://www.tt-forums.net",
  "tags": [
    "MustBe"
  ],
  "textContent": "Hello, about town effects - with TEmodifier, cargos can be assigned to Town Effects and it works pretty well with NAI. I have a suggestion about the GoalTown::SetGoal() function:\n\n\nCode:\n\n\n    function GoalTown::SetGoal() { // ... this.SetCargoGoal(GSCargo.TE_PASSENGERS, MaxAsInt(((population / 10) - 5) * factor, 1)); this.SetCargoGoal(GSCargo.TE_MAIL, MaxAsInt(((population / 50) - 5) * factor, 0)); if (GSCargo.IsValidTownEffect(GSCargo.TE_GOODS)) { this.SetCargoGoal(GSCargo.TE_GOODS, MaxAsInt(((population / 20) - 5) * factor, 0)); } if (GSCargo.IsValidTownEffect(GSCargo.TE_FOOD)) { this.SetCargoGoal(GSCargo.TE_FOOD, MaxAsInt(((population / 50) - 5) * factor, 0)); } if (GSCargo.IsValidTownEffect(GSCargo.TE_WATER)) { this.SetCargoGoal(GSCargo.TE_WATER, MaxAsInt(((population / 100) - 5) * factor, 0)); }}\n\nI noticed in GoalTown::SetGoal() that the original function uses a switch on landscape types with different multipliers and preconditions for each TE (e.g., desert towns and water requirements). For easier integration with TEmodifier, I tried a simplified version using IsValidTownEffect() to check whether a TE is active before setting its cargo goal.\n\nThis simplifies the original function by using IsValidTownEffect() to check whether a TE is active. It keeps the general logic of setting cargo goals, but ignores the original climate-specific multipliers. This allows TEmodifier to dynamically enable or disable any TE in-game without altering the switch structure.\n\nI’m not sure if TE_WATER needs additional preconditions, and whether the unified numbers work well across all economies, but this approach makes it easier to adjust TE assignments on the fly.\n\nNote: this is just an example of how TEmodifier could integrate with GoalTown::SetGoal(). It does not intend to change the original climate-specific multipliers or balancing.\n\nStatistics: Posted by MustBe — 05 Mar 2026 19:22\n\n* * *",
  "title": "OpenTTD AIs and Game Scripts • Re: [NoGo] Neighbours are important",
  "updatedAt": "2026-03-05T19:22:15.000Z"
}