• 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
44 Badges
Apr 7, 2018
3.375
12.290
  • 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
  • Magicka: Wizard Wars Founder Wizard
  • Stellaris: Nemesis
  • Europa Universalis IV
  • Stellaris: Necroids
  • Sword of the Stars
  • Crusader Kings III
  • War of the Roses
  • Cities: Skylines
  • Stellaris: Federations
  • Cities: Skylines - After Dark
  • 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 been pissing about working on a planet-features mod, and was trying to figure out how to add [GetTechnicianPlural] to work in the tooltips (custom_tooltips in static modifiers do NOT take [] commands)

BUT then i remembered, scripted modifiers are a thing. So i made one - 3 infact, for my planet modifier.
1664573341211.png


And this worked great [the modifiers themselves dont immediately do anything - though thats fine i've got workarounds**, its the UI text that i'm concerned with].
1664574287169.png


But then I realised, the localize_with_value_key = y/n function lets you convert the classic "String: value" syntax in to " str$value$str.". This lets you write in prose!.
1664573719902.png

1664573397429.png

I did a quick and dirty test with my static_modifier's scripted_modifier loc string:
1664573251405.png


I may be getting ahead of myself here, but if i'm understanding this right, it should mean it is now possible to create modifiers, plug them in to leader traits and use those to reference values elsewhere. For example a leader "loyalty" variable could be fed in to 'mod_custom_loyalty_modifier = xxx', which is placed within trait_mod_admiral_loyalty. And have that trait read "This admiral has $value$% loyalty to our empire.". Now either that can dynamically reference a variable in the admiral (separately updated in script) or a script is needed to switch between traits (e.g. 20, in 5% stages) - but that's just one example.

Additionally, as this is a scripted_modifier and not a custom_tooltip it should be possible to feed [scope.scope.whatever] text in to the "mod_custom_loyalty_modifier" loc string to have it say whatever you like, too.

Has anyone used the scripted_modifiers / "localize_with_value_key" much? I'm wondering if there are any other examples I can look at from other mods, to see what the limitations are, as there are literally no examples in vanilla right now.

** workarounds using script_values
I wanted to avoid manipulating job files, and as it is impossible to feed a script_modifier in to a job directly, I have to place a deposit and run the maths there, instead:
1664578452297.png

The maths:
1664578013520.png

The outcome:
+N TV and amenities, where N = ( modifier [1 by default] * employed technicians ) - if you hire/suppress technician jobs, it updates in real-time.
Provides reduced deviance if a hive mind.
1664578042152.png

Edit: it looks like it works, but at face value looks like it will only consider country scope of the current empire (i.e. your one, or someone elses if playing as them), not the leader itself (or even their fleet) which makes things a little more annoying... but not unworkable.
1664584108294.png

1664584089924.png
 
Last edited:
  • 2
Reactions:
Bearing in mind the scoping limitations above, something like this isnt balanced at all but works well as an illustration.
Variable updates (and is done by reapplying a diff version of the trait, though one referencing a empire-wide variable "empire faith" as some part of a deus vult origin, would work) biannually + on ships killed (it doesnt just reference [this.variable]). Could probably add a extra condition to halve/reset the value if you emergency retreat like a lil punk.
1664584946799.png
 
Last edited: