Planet culture system - Any way to put a country name into a **tooltip** dynamically?

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

Pancakelord

Lord of Pancakes
43 Badges
Apr 7, 2018
3.374
12.268
  • Cities: Skylines - Green Cities
  • Stellaris: Leviathans Story Pack
  • Cities: Skylines - Natural Disasters
  • Hearts of Iron IV: Together for Victory
  • Stellaris: Ancient Relics
  • Cities: Skylines - Mass Transit
  • Surviving Mars
  • Hearts of Iron IV: Death or Dishonor
  • Imperator: Rome
  • Stellaris: Digital Anniversary Edition
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Cities: Skylines - Parklife
  • Stellaris: Distant Stars
  • Shadowrun Returns
  • Cities: Skylines Industries
  • Imperator: Rome Deluxe Edition
  • Cities: Skylines - After Dark
  • Stellaris: Nemesis
  • Europa Universalis IV
  • Stellaris: Necroids
  • Crusader Kings III
  • War of the Roses
  • Cities: Skylines
  • Stellaris: Federations
  • Magicka: Wizard Wars Founder Wizard
  • Cities: Skylines - Snowfall
  • Stellaris: Lithoids
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Stellaris - Path to Destruction bundle
  • Stellaris: Megacorp
  • Stellaris: Synthetic Dawn
  • Crusader Kings II
  • Stellaris
  • Cities: Skylines Deluxe Edition
  • Sword of the Stars II
  • March of the Eagles
  • Darkest Hour
So I've written up the basics of a dejure territory or planet culture system, which will track current owners + former owner of a world (and if I can work this out for 3.0 upto the last 5 owners of a world) + their holding period
Essentially I can say something like:
  • Empire X colonised this world in 2209.03,
  • Empire X2 annexed it in 2246.11,
  • Empire X reclaimed it in 2301.02,
  • Empire X4 annexed it in 2400.12
  • Empire X5 was gifted it as part of a vassalisation in 2555.04
    • And a bunch of other variables (like the relative control period between 2209.03 and 2246.11, or the number of times a planet changed hands in X years)
    • This is handled by giving every empire its own Unique Country ID (UCID) and tracking this globally - along with a serial dating system - basically my own implementation of country IDs, as, when modding, you cant really do anything with coutntry IDs directly.
1618105756194.png
1618106114321.png

We see my empire (UCID = 2) founded this colony on month 151, which is when it took control of it too. It is also the current and only known owner of it.
colony founded date in human form = 151/12+2200 = 2212.58 = 05.2212 -- the maths for 151 > 05.2212 can be done in a scripted localisation.

These can be used to compute planet loyalty to one empire or another, so after you annex a world
  1. its population are openly hostile to you, causing debuffs (like primitive culture shock)
  2. its population Will remember its former owner AND is still loyal to its former owner (the degree to which scales with size of planet population + length of former owners control over the planet)
Or this can even drum up separatism turning the planet into a "march" world - a world that has seen so much bloodshed (by having too many owners in a short time period - a few decades) it doesnt want to be allied to any great empire until this cools off and will aggressively resist any outside force.
And this all works - more or less, its a bit hackish with the 2.8x scripts (cant wait for those variable scripts in 3.0, even if it means rewriting the 5 pages ive written today).

My real issue is in presenting this in the UI.
I know, with a bit of work, I could create an event window that fires whenever you activate a planet decision ("GIVE ME PLANET INFO NAO") and prints this out for the player to read (Get Former Owner UCID, Search all countries till you find the empire that matches up with the code, print its name - fallback = "A lost Empire" if that country is dead).
But using a popup is clunky and means doing "Decisions > GIVE INFO" regularly for updates. A better way would be to contain this all in a special tooltip in a planet modifier on the main planet screen, so you just mouse over the "Planet Info" modifier and read the tooltip.

There is only one planet modifier I know of that can read another nation's name (or even get its flag) and print it in a tooltip. The occupation modifier. I also know its possible to make custom tooltips for events
Code:
custom_tooltip_with_params - Displays a specific localization string with parameters in tooltip
custom_tooltip_with_params = {
    description = <loc key>
    description_parameters = {
        <value key> = <string/int/num/bool>
    }
}
Supported Scopes: all

country_list_tooltip - Prints a list of the countries that match the limit triggers in a tooltip, each separated by a line break.
country_list_tooltip = { limit = { <triggers> } }
Supported Scopes: all

owned_planet_list_tooltip - Prints a list of the country's planets that match the limit triggers in a tooltip, each separated by a line break.
owned_planet_list_tooltip = { limit = { <triggers> } }
Supported Scopes: country
So there must be a way to do this... I'm trying to copy how the planet occupation code works, but it doesnt seem to exist anywhere in the game files?
1618105818441.png
1618107766214.png
1618108170156.png

Literally all I find on it is a "Country" Variable [ $ |Y$ just sets the font colour to yellow] in the localisation files (and a static modifier that isnt useful to me).
But no scripts or files that say how it figures out that country or scopes to it? Or even how it dynamically grabs its flag?

Does anyone know how to create dynamic scripted tooltips ON Planet Modifier Icons to reference other scopes/ countries? (Essentially running an event IN a tooltip) I have a feeling the occupation modifier is hardcoded which lets it do this, but wanted to check if anyone knew first, before falling back on making a planet decision/popup menu.
 
Last edited:
  • 2Like
Reactions:
After wasting a few hours on this, I think i'll have to shelve it, it feels like the scopes just arent set up the way I'm imagining they are for planet static modifiers, no matter what combination of strings I try I cant get it to print a variable name, variable value or even a flag / dynamic flag (i.e. TEXT@SOMETHING).
1618158414917.png

1618158506029.png
1618158575037.png

Maybe i'll take another go at this in 3.0 saw some localisation changes in a DD.

Or give up on country-linked modifiers showing in the UI and use a generic "This planet is not loyal to us", and just have the event scripts running in the background anyway. I suppose it doesnt really matter who the world is loyal to, if it isnt you, it needs fixing.
 
You could use decisions to create a popup and show all data there. In 3.0 you also can use planet specific effectbuttons, which itself can use dynamic text, so then it definitively is possible, but not very compatible to other mods ;)
 
You could use decisions to create a popup and show all data there.
Yeah thats what I was trying to avoid as I can imagine burying things may get annoying fast. I definitely dont want to edit the UI, I use the UI scaling mod and would hate to have to support a compatibility patch lol. I could try Hard-binding it to a key. E.g. you click on the planet and hit, say, Left Alt, and the popup triggers that way. I imagine thats possible but never tried setting a modded binding.

I think the best bet is to create a coloured scale for a generic loyalty planet modifier, like the below, that simply handles the debuffs and says "X% of this planets' population remains loyal to its former owner" - and have extra details buried in a popup in the decision menu. That way at least you know at-a-glance the planet hates you, and you can find out who it prefers if you need to by looking in decisions.
1618215679349.png

And if you re-capture a planet loyal to you, within X years (before they become loyal to the new guy), I can just play a notification at the top of the screen (like a ground invasion popup) saying loyal citizens on [Planet] welcome the return of your soldiers, or something.
 
Last edited:
Literally all I find on it is a "Country" Variable [ $ |Y$ just sets the font colour to yellow] in the localisation files (and a static modifier that isnt useful to me).
But no scripts or files that say how it figures out that country or scopes to it? Or even how it dynamically grabs its flag?
That information is probably generated and then forwarded by some other part the engine specifically to create this modifier, not grabbed by the modifier-code itself.
So it's likely not possible to recreate the effect for other contexts.

[ /edit: No, it's not even a modifier. It's just presented as such. ]

Overall, the inability to create dynamic tooltips is indeed very annoying. With the changes to variables in 3.0, it's really the last barrier to a world where we can create dynamic gameplay systems and display them in a way that feels like they're a natural part of the game. I don't think 3.0 changes anything about this, but with the many improvements to modding that are coming with this patch (and really the ones we already had in the past - Stellaris is FAR better in terms of modability than it was in the past), I'm hopeful that this issue too can be addressed in the future.
 
Last edited:
  • 1
Reactions:
That information is probably generated and then forwarded by some other part the engine specifically to create this modifier, not grabbed by the modifier-code itself.
Yeah I came to that conclusion in the end too, the game seems to track 2 distinct properties: Planet Owner & Planet Controller
I imagine there is some tiny check buried in the executible that says if 1 =/=2 do that occupation modifier.
Overall, the inability to create dynamic tooltips is indeed very annoying. With the changes to variables in 3.0, it's really the last barrier to a world where we can create dynamic gameplay systems and display them in a way that feels like they're a natural part of the game. I don't think 3.0 changes anything about this,
I did see a few small comments in the DD about tooltips but yeah probably nothing substantive for this. The biggest benefit are probably button changes and the like, being able to create interactive menus could be a high-effort work-around. With how the files are set up, it should be possible to make "stand-alone" menu elements that dont clash with the vanilla UI or modded UI in any appreciable way (without using edicts or decisions to open them).
 
Did you try it with 3.*?

This works:

l_english: automation_progress:0 "Automation Progress:" automation_progress_desc:0 "[PLANET.automation_progress]/100 for fun: [PLANET.OWNER.GetName] [PLANET.GetName]"

1619098622998.png
 
  • 2
Reactions:
Did you try it with 3.*?

This works:

l_english: automation_progress:0 "Automation Progress:" automation_progress_desc:0 "[PLANET.automation_progress]/100 for fun: [PLANET.OWNER.GetName] [PLANET.GetName]"

View attachment 707798
Well, shit. Civil wars are back on the menu! I'd been screwing with espionage and hadn't had a chance to look at this yet, will have a play with it later for sure.
 
Finally got around to implementing what I wanted to do, planet tooltips seem to work well with variables now. Sadly unless there is an extra step needed for leaders that ive missed, it looks like the localisation changes do not extend to leader tooltips / certain parts of the UI, too. I havent been able to get a single [ ] command to work on trait tooltips.
1620006991339.png
1620006628655.png

Whilst it's OK here (ive just used 5-tiers of coloured icons to show governor loyalty), there is no way to represent other modded variables like governor personality or ethos, without adding more traits - which gets a bit cluttered as they level up.
1620008828112.png
1620008680704.png

(and I dont fancy creating a 5x8 array of combined traits for the 5 levels of loyalty and 8 ethos, just because conditional descriptions arent a thing).
 
Last edited:
This looks like it'll be a highly interesting mod