• 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.

hart30

Field Marshal
18 Badges
May 13, 2017
3.732
2.475
  • Stellaris: Distant Stars
  • Stellaris: Nemesis
  • Stellaris: Necroids
  • Stellaris: Federations
  • Age of Wonders: Planetfall - Revelations
  • Stellaris: Lithoids
  • Age of Wonders: Planetfall
  • Stellaris: Ancient Relics
  • Stellaris: Megacorp
  • Warlock 2: The Exiled
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Age of Wonders III
  • Stellaris: Synthetic Dawn
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris
I have created a mod, that changes the Placement rules for Habitats, so that they can only be built over ressource deposits. This is an Incredible help against Habitat spamming and also helps the AI economy a lot. The only Problem is, that the Player is not exempt from those new Placement rules. So the Player is also limited, which a consider a flaw.
Because of that I want to Limit this only to the AI. The Problem is, that i seem unable to find a code, that enables me to do so.

Here is what i tried so far in the Habitat file:

OR = {
is_ai = no
custom_tooltip = {
fail_text = "requires_no_orbital_station"
has_orbital_station = yes
} }

custom_tooltip = {
fail_text = "requires_no_orbital_station"
OR = {
is_ai = no
has_orbital_station = yes
}}

custom_tooltip = {

OR = {
fail_text = "requires_no_orbital_station"
is_ai = no
has_orbital_station = yes
}}

None of those worked. The Habitat file doesnt seem to recognize is_ai at all. Do you have any idea, how this issue could be solved?
 
  • 1Like
Reactions:
None of those worked.
What does the error logs say?

Thinking about it a bit more, the issue might be of scope. The scope is on the planet. That is why you got access to "has_orbital_station = yes" and all those other planet checks.

I think they suvey check actually access the player controling the system somewhat. I am just not sure how to turn that into something usefull for a check:

Code:
is_surveyed = {            # prevent leaking habitability information
    who = prev.from
    status = yes
}

As does the single possible check:
Code:
possible = {
    exists = starbase
    custom_tooltip = {
        fail_text = "requires_inside_border"
        is_inside_border = from
    }
}
I just have no idea how to check from for being a ai. Or if we can even use from, in the placement rules.

The scopes as I would guess them:
potential - looks like county
possible - the system I would guess
placement_rules - the planet, definitely
 
Last edited:
This is what the error.log says:
[09:35:57][trigger.cpp:525]: Invalid Scope type for trigger is_ai in common/megastructures/habitats.txt line : 72. Got planet
[09:36:14][trigger.cpp:421]: invalid scope for trigger. got [planet], expected {country}. file: common/megastructures/habitats.txt line: 72
 
This is what the error.log says:
[09:35:57][trigger.cpp:525]: Invalid Scope type for trigger is_ai in common/megastructures/habitats.txt line : 72. Got planet
[09:36:14][trigger.cpp:421]: invalid scope for trigger. got [planet], expected {country}. file: common/megastructures/habitats.txt line: 72
Just as I thought.

Given that System Ownership is already handeled by the possible check, we just need a way to get from planet to planet or system owner - wich we then can check for being a AI.

Unfortunately I have 0 experience with Scope Switches in the Clausewitz engine, but I can try anyway:
You could try
Code:
owner.is_ai = no
and
Code:
prev.solar_system.space_owner.is_ai = no
 
This is what it gives me for owner.is_ai = no:

[14:55:04][trigger_impl.cpp:1201]: Scripted Trigger owner.is_ai is invalid at file: common/megastructures/habitats.txt line: 72
[14:55:05][trigger_impl.cpp:1190]: [ file: common/megastructures/habitats.txt line: 72]: Error in scripted trigger, cannot find: owner.is_ai

and the other one is Pretty similar:

[14:58:45][trigger_impl.cpp:1201]: Scripted Trigger prev.solar_system.space_owner.is_ai is invalid at file: common/megastructures/habitats.txt line: 72
[14:58:45][trigger_impl.cpp:1190]: [ file: common/megastructures/habitats.txt line: 72]: Error in scripted trigger, cannot find: prev.solar_system.space_owner.is_ai

Both dont work. Maybe something with country? As the first error log said something about expecting that?
 
  • 1Like
Reactions:
You're checking is_ai from the system scope. You need to check from the owner scope. In the megastructure files, from scopes to the owner, so you'd want:
FROM = { is_ai = no }
The checks are called "planet_possible". And maybe 1 of the 5 checks makes a remote sense for a system (is_surveyed).

So I seriously doubt they run on the System scope. Asuming anything but planet seems extremly unlikely:
Code:
planet_possible = {
    custom_tooltip = {
        fail_text = "requires_surveyed_planet"
        is_surveyed = {            # prevent leaking habitability information
            who = prev.from
            status = yes
        }
    }
    custom_tooltip = {
        fail_text = "requires_no_anomaly"
        NOT = { has_anomaly = yes }
    }
    custom_tooltip = {
        fail_text = "requires_no_existing_megastructure"
        #can_build_megastructure_on_planet = yes
        NOR = {
            has_planet_flag = megastructure
            has_planet_flag = has_megastructure
            solar_system = {
                has_star_flag = ring_world_built
            }
            is_planet_class = pc_ringworld_habitable
            is_planet_class = pc_ringworld_habitable_damaged
            is_planet_class = pc_ringworld_tech
            is_planet_class = pc_ringworld_tech_damaged
            is_planet_class = pc_ringworld_seam
            is_planet_class = pc_ringworld_seam_damaged
            is_planet_class = pc_habitat
        }
    }

    # balance for habitats
    custom_tooltip = {
        fail_text = "requires_not_minor_planetary_body"
        NOR = {
            is_asteroid = yes
            is_moon = yes
        }
    }
    custom_tooltip = {
        fail_text = "requires_not_star"
        is_star = no
    }
} # use these for all non-star megastructures
 
  • 1Like
Reactions:
Omniscient was right. It worked with FROM. When i tried "owner" i was able to build habitats over colonized planets and planets with stations, but not over planets without any ressource/colonization. Also the error log triggered. "FROM" however did not trigger the error.log and also allowed habitats over empty planets. Both restricted the AI. Thank you very much. You two were a huge help!