How to increase and decrease pop happiness on condition?

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

Weedes

First Lieutenant
30 Badges
Feb 11, 2017
253
7
  • Stellaris: Synthetic Dawn
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Pre-order
  • Crusader Kings III: Royal Edition
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Necroids
  • Stellaris: Nemesis
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II
  • Europa Universalis IV: Rights of Man
  • Stellaris
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Mount & Blade: Warband
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV
You would as far as I know need make a custom event with the conditions on when you want the modifier to apply to planets and then a second event to remove it when that condition is no longer present on that planet.

Prior to version 1.5 you could just make a triggered_modifier, which was a lot simpler all in all, but most people never used them for whatever reason in most mods and so they removed support for them in 1.5

Also, static_modifiers_01.txt in common/static_modifiers folder has the happiness and unrest effects for every planet as happiness goes up and down, if that helps at all.
 

Criperum

Corporal
48 Badges
Feb 6, 2017
27
1
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Third Rome
  • Crusader Kings II: Jade Dragon
  • Europa Universalis IV: Mare Nostrum
  • Crusader Kings II
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Republic
  • Crusader Kings II: Rajas of India
  • Europa Universalis IV
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Stellaris: Nemesis
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Stellaris: Distant Stars
  • Europa Universalis IV: Dharma
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Stellaris: Necroids
  • Europa Universalis IV: Mandate of Heaven
  • Stellaris - Path to Destruction bundle
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Crusader Kings II: Reapers Due
  • Stellaris
  • Crusader Kings II: Conclave
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Pre-order
  • Europa Universalis IV: El Dorado
  • Stellaris: Synthetic Dawn
Looks like the events are what I'm looking for. Thanks.

But can I refer to a custom resource count from the trigger? Like I created my own strategic resource and I want to trigger the event on specific amount of this event on a planet.
 

Weedes

First Lieutenant
30 Badges
Feb 11, 2017
253
7
  • Stellaris: Synthetic Dawn
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Pre-order
  • Crusader Kings III: Royal Edition
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Necroids
  • Stellaris: Nemesis
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II
  • Europa Universalis IV: Rights of Man
  • Stellaris
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Mount & Blade: Warband
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV
You should be able to yes, as long as the resource is set up properly and referred to properly in the condition.

Here are two events that I made to add and remove modifiers from my Stellaris campaigns that you can probably reverse engineer:

Code:
namespace = alone

country_event = {               #Adds the We are Alone modifier to new country
   id = alone.1
   title = alone.1.name
   desc = alone.1.desc
   picture = GFX_evt_star_chart
   show_sound = event_planetary_riot
 
   trigger = {
       num_communications < 1
       NOT = { has_modifier = alone_in_the_universe }
   }
 
   mean_time_to_happen = {
       months = 1
   }

   option = {               #Aliens, what nonsense!
       name = alone.1.a
       ai_chance = { factor = 33 }
       add_influence  = 50               #People feel assured the ruler is sane, no bad guys in space
       add_modifier = {
           modifier = "alone_in_the_universe"
           days = -1
       }    
   }
   option = {               #We should remain skeptical.
       name = alone.1.b
       ai_chance = { factor = 33 }
       add_physics_research = 25       #Scientists feel free
       add_society_research = 25
       add_engineering_research = 25
       add_modifier = {
           modifier = "alone_in_the_universe"
           days = -1
       }    
   }
   option = {               #We need to keep an open mind.
       name = alone.1.c
       ai_chance = { factor = 33 }
       add_influence  = -50           #Ridiculed, people distance themselves from ruler
       add_physics_research = 50       #Scientists are emboldened
       add_society_research = 50
       add_engineering_research = 50
       add_modifier = {
           modifier = "alone_in_the_universe"
           days = -1
       }    
   }
}

country_event = {           #Removes the We are Alone modifier to countries with first contact
   id = alone.2
   title = alone.2.name
   desc = alone.2.desc
   picture = GFX_evt_alien_city
   show_sound = event_radio_chatter
 
   trigger = {
       has_modifier = alone_in_the_universe
       num_communications > 0
   }
 
   mean_time_to_happen = {
       months = 3
   }

   option = {               #
       name = alone.2.a
       remove_modifier = alone_in_the_universe
   }
}

Most of the #'s and the words after it are notes to myself, just as an FYI, so I can remember what I was thinking when I wrote the event when/if I review it later.

It is important to note that these have country_event at the header and you will probably want to use planet_event up top instead.

Also, in Stellaris the equal sign = does not work like it does in most other Clausewitz engine titles, which is "equal to or higher", in Stellar it is just "equal to", and you should use the less than or greater than symbols unless you are referring to a very specific number on a condition, etc.

I mention that last bit because it gave me a headache or two before I realized it after moving to modding Stellaris from modding EU4.
 
Last edited:

Criperum

Corporal
48 Badges
Feb 6, 2017
27
1
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Third Rome
  • Crusader Kings II: Jade Dragon
  • Europa Universalis IV: Mare Nostrum
  • Crusader Kings II
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Republic
  • Crusader Kings II: Rajas of India
  • Europa Universalis IV
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Stellaris: Nemesis
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Stellaris: Distant Stars
  • Europa Universalis IV: Dharma
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Stellaris: Necroids
  • Europa Universalis IV: Mandate of Heaven
  • Stellaris - Path to Destruction bundle
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Crusader Kings II: Reapers Due
  • Stellaris
  • Crusader Kings II: Conclave
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Pre-order
  • Europa Universalis IV: El Dorado
  • Stellaris: Synthetic Dawn
Thank you very much for your help.
Can you tell me how to modify new tile.
Code:
immediate = {
		add_trait = trait_dwarven_pops
		while = {
					limit = { planet_size < 25 }
					change_planet_size = 1
										
				}
	}

After creating to new tile I want to place a blocker here. As I understand I cannot just use "set_blocker" because I'm in the planet scope now.
And is it possible to destroy specific tiles on the planet?
 

Weedes

First Lieutenant
30 Badges
Feb 11, 2017
253
7
  • Stellaris: Synthetic Dawn
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Pre-order
  • Crusader Kings III: Royal Edition
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Necroids
  • Stellaris: Nemesis
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II
  • Europa Universalis IV: Rights of Man
  • Stellaris
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Mount & Blade: Warband
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV
Thank you very much for your help.
Can you tell me how to modify new tile.
Code:
immediate = {
        add_trait = trait_dwarven_pops
        while = {
                    limit = { planet_size < 25 }
                    change_planet_size = 1
                                       
                }
    }

After creating to new tile I want to place a blocker here. As I understand I cannot just use "set_blocker" because I'm in the planet scope now.
And is it possible to destroy specific tiles on the planet?
I am not sure. I have not had a lot of experience with this particular aspect of modding in Stellaris. I mostly learn just enough for what I want to do with my own projects and designs for the game, and by learn I mean mostly trial and error. ;)