• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

Ray3501

Corporal
68 Badges
May 28, 2016
27
13
  • Stellaris
  • Cities: Skylines Deluxe Edition
  • Steel Division: Normandy 44
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Cities: Skylines - Natural Disasters
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: Monks and Mystics
  • Age of Wonders: Planetfall Premium edition
  • Stellaris: Galaxy Edition
  • Cities: Skylines - Mass Transit
  • Hearts of Iron IV: Death or Dishonor
  • Stellaris: Synthetic Dawn
  • Cities: Skylines - Green Cities
  • Crusader Kings II: Jade Dragon
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Cities: Skylines - Parklife
  • Stellaris: Distant Stars
  • Cities: Skylines Industries
  • Crusader Kings II: Holy Fury
  • Victoria 2
  • Crusader Kings II: Charlemagne
  • Age of Wonders: Planetfall Deluxe edition
  • Age of Wonders: Planetfall
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Stellaris: Ancient Relics
  • Age of Wonders: Planetfall Season pass
  • Cities: Skylines - Campus
  • Stellaris: Galaxy Edition
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Prison Architect
  • Crusader Kings II: Conclave
  • Cities: Skylines - Snowfall
No, gateways do not need to be range-limited. But the option to allow that should exist.

Right now, gateways have unlimited range. Which is fine by me as a player, but when modding this poses problems when I try to find ways to limit the range of gateways through triggers (to make them function more like mass relays - yes I was thinking about the short-ranged omnidirectional relays). The issue has to do with this:
Code:
    country_can_use = {
        custom_tooltip = {
            fail_text = GATEWAY_COUNTRY_CANNOT_USE
            OR = {
                NOT = { exists = from }
                from = {
                    NOR = {
                        has_closed_borders = root
                        is_hostile = root
                    }
                }
            }
        }
    }

The three scopes available (this, root, and from; root seems to be the same as this) are all countries, which is useless because the departure and arrival systems cannot be used. Without the latter, I cannot use the distance function to check the distances, thus preventing me from being able to effectively set gateway range.

The alternative would be to use the on_action, which on the surface has enough information: this is the current fleet, from is the arrival system, and fromfrom is the departure one. But there, too, are problems:
  • The event happens after the bypass is complete. Which can seriously screw up AI pathfinding if I, say, sets the location of this to fromfrom...
  • Only... that does not even seem to work! I thought it was originally a parsing error (which happens to me, a lot), but the error log says otherwise. So I have this alternative code:
Code:
fleet_event = {
    id = ftl.1
    hide_window = yes
    is_triggered_only = yes
   
    trigger = {
        NOT = { distance = {
            source = FromFrom
            min_distance = 0
            max_distance = 50
        } }
    }
   
    immediate = {
        clear_fleet_actions = this
        set_event_locked = yes
        fleet_event = { id = ftl.2 }
    }
}

fleet_event = {
    id = ftl.2
    title = ftl.2.name
    desc = ftl.2.desc
    picture = GFX_evt_star_chart
    show_sound = event_ship_bridge
    location = this
   
    is_triggered_only = yes
   
    immediate = {
        fleet_event = { id = ftl.3 days = 30 random = 150 }
    }
   
    option = {
        name = UNFORTUNATE
    }
}

fleet_event = {
    id = ftl.3
    hide_window = yes
    is_triggered_only = yes
   
    immediate = {
        set_event_locked = no
    }
}
This is less AI pathfinding-screwy, but unless the fleet drops into a hostile system or a system nearby one, the event lock is basically a slap in the wrist as it only lasts at worst half a year. Not what I prefer, but it is thus far the only solution without borking the AI.

A simple fix that would enable more coding options would be to change country_can_use's three scopes to departure system for this and root and arrival system for from. The vanilla code would become this:
Code:
    country_can_use = {
        custom_tooltip = {
            fail_text = GATEWAY_COUNTRY_CANNOT_USE
            OR = {
                NOT = { exists = from.owner }
                from.owner = {
                    NOR = {
                        has_closed_borders = root.owner
                        is_hostile = root.owner
                    }
                }
            }
        }
    }

This allows vanilla game to keep unlimited range bypasses while allowing modders to do interesting things, such as writing code to effectively set gateway range, like this:
Code:
    country_can_use = {
        custom_tooltip = {
            fail_text = GATEWAY_COUNTRY_CANNOT_USE
            OR = {
                NOT = { exists = from.owner }
                from.owner = {
                    NOR = {
                        has_closed_borders = root.owner
                        is_hostile = root.owner
                    }
                }
            }
        }
        custom_tooltip = {
            fail_text = GATEWAY_OUT_OF_RANGE
            NOT = {
                distance = {
                    source = from
                    min_distance = 0
                    max_distance = 50
                }
            }
        }
    }

This should not be a hard change... unless changing this borks several functions... :p
 
Upvote 0