Page 1 of 1

Move_Bonus + UnitFlag problems

Posted: Thu Aug 21, 2025 12:55 am
by John Campbell
So I've been tinkering with Wonder effects in my custom ruleset. One of the things I've done is take away Marco Polo's embassies-with-literally-everyone effect, because it's way too powerful in the early game, and it doesn't make sense to be able to get free embassies with civs that you may not have even a theoretical way to contact at that point. I gave the effect to the UN instead, because its unit-regen effect has never made any kind of sense at all (and civ2civ3's replacement effect is actively bad).

Anyway, I haven't been able to figure out how to get it to do what I really want, which is automatic embassies with anyone you have a trade route with, so as filler, I gave it a sheaf of minor trade-related abilities. One of them was +1 MP to trader units, so Caravans with Marco Polo have 2 MP and Freight has 3 MP. I just copied the Lighthouse effect, changed "UnitClass", "Sea" to "UnitFlag", "TradeRoute", and changed the Wonder name. And this works fine, except that... it doesn't appear to be checking the Wonder requirement at all. It grants the bonus MP if you have Marco Polo. It also grants it if someone else has Marco Polo. It grants it if Marco Polo is obsolete. It even grants it if Marco Polo hasn't even been built yet. It always grants it. The effect is just a permanent extra MP for anything with the TradeRoute flag.

The Lighthouse still works fine. It grants the MP when you build it, not before, not if someone else builds it, and it goes away when it goes obsolete.

Code: Select all

[building_marco_polos_embassy]
name            = _("Marco Polo's Embassy")
genus           = "GreatWonder"
reqs    =
    { "type", "name", "range"
      "Tech", "Trade", "Player"
    }
graphic = "b.marco_polos_embassy"
graphic_alt     = "-"
obsolete_by     =
    { "type", "name", "range", "survives"
      "Tech", "Communism", "World", TRUE
    }
build_cost      = 200
upkeep          = 0
sabotage        = 0
sound           = "w_marco_polos_embassy"
sound_alt       = "w_generic"
helptext        = _("\
Caravans and Freight gain 1 MP, trade route limit is increased by 2\
 (to a maximum of 5, due to hard limits in the code),\
 and immediate revenue from establishing a trade route is doubled.\
")

Code: Select all

[effect_marco_polos_caravans]
type    = "Move_Bonus"
value   = 1
reqs    =
    { "type", "name", "range", 
      "Building", "Marco Polo's Embassy", "Player"
      "UnitFlag", "TradeRoute", "Local"
    }

Re: Move_Bonus + UnitFlag problems

Posted: Thu Aug 21, 2025 8:35 am
by cazfi
John Campbell wrote: Thu Aug 21, 2025 12:55 amMarco Polo's embassies-with-literally-everyone effect
Marco Polo has actually two effects that combine to that overall effect.

Variant2 has only "embassy with everyone you have contact with" effect, but you still need to get that contact by other means first.