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.