Start an event when having a technology researched

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

Bartazar

Private
Jun 19, 2020
12
0
Hello,
I'm trying to launch an event after researching a technology, but I don't know how to do it.
I don't know if you have to add some script in the technology or add everything to the event.

Can someone explain how to do that?


this is the event:

Code:
namespace = irassian_tech_chain


country_event = {

    id = irassian_tech_chain.1000

    title = "irassian_tech_chain.1000.name"

    desc = "irassian_tech_chain.1000.desc"

    picture = GFX_irassian_tech_chain_01

    show_sound = event_wind_ruins

    location = from


    is_triggered_only = yes


    trigger = {

        owner = {

            has_technology = tech_irassian

        }

    }


    option = {

        name = "Continue further investigations"

    }


}
 
is_triggered_only = yes means this event won't fire on it's own, it has to be fired from elsewhere.
You have a few options:
a)fire this event monthly on_monthly_pulse_country
on_monthly_pulse_country = {
events = {
irassian_tech_chain.1000
}
}

b) make sure event fires DAILY by changing from is_triggered_only = yes to fire_only_once = yes . Not recommended.

c) use on_tech_increased = { on action - preferable if possible. see vanilla on_action files
 
yes, having you event triggered on tech researched would be the best:

Code:
### In /common/on_actions/your_on_actions_file.txt

on_tech_increased = {
   events = {
       # these events will be triggered every time an empire researches a tech
       <your event id>
   }
}

Code:
### In /events/your_event_file.txt

# ... namespace declaration and other events

country_event = {
   id = <your event id> # same as the one in on_actions
   is_triggered_only = yes
   # name, desc, etc...

   trigger = {
      last_increased_tech = <your triggering tech> # tech_irassian ?
   }

   # do stuff here....
}

I have a somewhat similar case (an empire is to gain an access to an additional tech through a special project given once prerequisite techs have been researched. You can peek at how I did it:

nhsc_events.txt look for the event with id = nhsc.40 and for event with id = nhsc.130 to see actual usage of last_increased_tech
 
Last edited:
  • 1
Reactions:
Thanks for your answers!

Gonna try your propositions!

Edit:

Works good:
here his the event:

Code:
namespace = irassian_tech_chain

country_event = {
    id = irassian_tech_chain.1000
    is_triggered_only = yes

    title = "irassian_tech_chain.1000.name"
    desc = "irassian_tech_chain.1000.desc"
    picture = GFX_irassian_tech_chain_01
    show_sound = event_wind_ruins
    location = from

    trigger = {
        last_increased_tech = tech_irassian
    }

    option = {
        name = "Continue further investigations"
    }

    immediate = {
        if = {
            limit = { is_ai = no }
            add_research_option = tech_irassian_concordat_02_architecture
        }
    }
}

thanks again!
 
Last edited:
update: otherwise the event is pop on the begining of every month
Code:
namespace = irassian_tech_chain

country_event = {
    id = irassian_tech_chain.1000
    is_triggered_only = yes

    title = "irassian_tech_chain.1000.name"
    desc = "irassian_tech_chain.1000.desc"
    picture = GFX_irassian_tech_chain_01
    show_sound = event_wind_ruins
    location = from

    trigger = {
        OR = {
            last_increased_tech = "tech_vanguard_battlescanner"
        }
        NOT = { has_global_flag = tech_vanguard_battlescanner_researched }
    }

    option = {
        name = "Continue further investigations"
        add_resource = { minor_artifacts = 5 }
    }

    immediate = {
        if = {
            limit = { is_ai = no }
            add_research_option = tech_irassian_concordat_01_sleeping
            set_global_flag = tech_vanguard_battlescanner_researched
            add_tech_progress = {
                tech = tech_irassian_concordat_01_sleeping
                progress = 0.1
            }
        }
    }
}
 
if it popped at the beginning of each month, you probably attached it to on_monthly_pulse rather than to on_tech_increase.

EDIT: on_tech_increase called each time a new tech is researched. And since a new tech *has been* researched, the value of last_increased_tech changes as well. Thus, you can probably do without additional flags.

ALSO: global_flag is global and every empire in the game will obey it. Granted, there can be only one empire that gets the precursor homeworld and associated techs, you might still want to use country_flag instead.
 
Last edited:
I thought that I had to put it in both "conditions"

Code:
on_tech_increased = {
    events = {
# these events will be triggered every time an empire researches a tech
        irassian_tech_chain.1000
        irassian_tech_chain.2000
        irassian_tech_chain.3000
        irassian_tech_chain.4000
        irassian_tech_chain.5000
        irassian_tech_chain.6000
        irassian_tech_chain.7000
        irassian_tech_chain.8000
        irassian_tech_chain.9000
        irassian_tech_chain.10000
        irassian_tech_chain.11000
    }
}

on_monthly_pulse_country = {
    events = {
        irassian_tech_chain.1000
        irassian_tech_chain.2000
        irassian_tech_chain.3000
        irassian_tech_chain.4000
        irassian_tech_chain.5000
        irassian_tech_chain.6000
        irassian_tech_chain.7000
        irassian_tech_chain.8000
        irassian_tech_chain.9000
        irassian_tech_chain.10000
        irassian_tech_chain.11000
    }
}

So, it would be better if I use only "on_tech_increased" ?
 
I thought that I had to put it in both "conditions"

No, you need only one on_action per event is in almost all cases.

The only case where you might want multiple on_actions for single event that I can think of is on_building_complete / on_building_replaced / on_building_destroyed for an event that (re)calculates some empire-specific value based on the number of buildings across the empire.
 
is_triggered_only = yes means this event won't fire on it's own, it has to be fired from elsewhere.
You have a few options:
a)fire this event monthly on_monthly_pulse_country


b) make sure event fires DAILY by changing from is_triggered_only = yes to fire_only_once = yes . Not recommended.

c) use on_tech_increased = { on action - preferable if possible. see vanilla on_action files
I'm just confused why you gave those first two as options at all. The second one is very much the wrong way to do it, and the first fires a lot more than necessary, making it also the wrong way to do it.
 
No, you need only one on_action per event is in almost all cases.

The only case where you might want multiple on_actions for single event that I can think of is on_building_complete / on_building_replaced / on_building_destroyed for an event that (re)calculates some empire-specific value based on the number of buildings across the empire.

Ok, I have keep on_tech_increase only.
Thanks!