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

Foraven

Major
17 Badges
May 14, 2016
544
168
  • Sword of the Stars II
  • Stellaris: Humanoids Species Pack
  • Stellaris: Necroids
  • Stellaris: Federations
  • Stellaris: Lithoids
  • Stellaris: Ancient Relics
  • Stellaris: Megacorp
  • Shadowrun Returns
  • Stellaris: Distant Stars
  • Stellaris: Apocalypse
  • Stellaris: Synthetic Dawn
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris
I have this error that keep poping up when i run my reworked Pirate_events :

Code:
[22:20:05][trigger_impl.cpp:842]: Error in scripted trigger, cannot find: ROOT
[22:20:05][trigger_impl.cpp:842]: Error in scripted trigger, cannot find: =
[22:20:06][trigger_impl.cpp:842]: Error in scripted trigger, cannot find: ROOT
[22:20:06][trigger_impl.cpp:842]: Error in scripted trigger, cannot find: =
[22:20:12][trigger_impl.cpp:842]: Error in scripted trigger, cannot find: ROOT
[22:20:12][trigger_impl.cpp:842]: Error in scripted trigger, cannot find: =

But i can't figure out what this bug is all about. I have lots of "ROOT = " in the file, no idea if any of them are the cause or i'm supposed that add one somewhere.

I do have some coding knowledge but i admit it's quite basic and i haven't coded anything in years.

Here the faulty code :

Code:
############################
#
# Pirate Events
#
# Re-Written by Philippe Raymond (aka Foraven)
#
# FRB Mod
#
############################

namespace = pirate

# Birth of Space Piracy
country_event = {
    id = pirate.1
    title = "pirate.1.name"
    picture = GFX_evt_exploding_ship
    show_sound = event_space_battle

    is_triggered_only = yes  # i guess that means it must be called by another event
   
    desc = { # Spiritual
        text = pirate.1.desc_01
        trigger = {
            OR = {
                has_government = theocratic_republic
                has_government = transcendent_republic
                has_government = theocratic_oligarchy
                has_government = transcendent_oligarchy
                has_government = divine_mandate
                has_government = transcendent_empire
            }
        }
    }

    desc = { # Militarist
        text = pirate.1.desc_02
        trigger = {
            OR = {
                has_government = military_dictatorship
                has_government = martial_empire
                has_government = military_junta
                has_government = ordered_stratocracy
                has_government = military_republic
                has_government = martial_demarchy
            }
        }
    }

    desc = { # Materialist
        text = pirate.1.desc_03
        trigger = {
            OR = {
                has_government = despotic_hegemony
                has_government = ai_overlordship
                has_government = science_directorate
                has_government = illuminated_technocracy
                has_government = direct_democracy
                has_government = subconscious_consensus
            }
        }
    }

    desc = { # Pacifist
        text = pirate.1.desc_04
        trigger = {
            OR = {
                has_government = moral_democracy
                has_government = irenic_democracy
                has_government = peaceful_bureaucracy
                has_government = irenic_protectorate
                has_government = enlightened_monarchy
                has_government = irenic_monarchy
            }
        }
    }

    desc = { # Generic Autocracy
        text = pirate.1.desc_05
        trigger = {
            OR = {
                has_government = despotic_empire
                has_government = star_empire
            }
        }
    }

    desc = { # Generic Oligarchy
        text = pirate.1.desc_06
        trigger = {
            OR = {
                has_government = plutocratic_oligarchy
                has_government = mega_corporation
            }
        }
    }

    desc = { # Generic Democracy
        text = pirate.1.desc_07
        trigger = {
            OR = {
                has_government = indirect_democracy
                has_government = democratic_utopia
            }
        }
    }

    trigger = {
        is_country_type = default
        NOT = { has_country_flag = birth_of_piracy }
        exists = capital_scope
        capital_scope = {
            solar_system = {
                ROOT = {
                    any_controlled_planet = {
                        OR = {
                            has_mining_station = yes
                            has_research_station = yes
                        }
                        solar_system = {
                            NOT = { is_same_value = PREVPREVPREV }
                        }
                    }
                }
            }
        }
    }


    immediate = {
        set_country_flag = birth_of_piracy
        capital_scope = { save_event_target_as = capital }
        capital_scope = {
            solar_system = { save_event_target_as = capital_system }
        }
        save_event_target_as = pirate_target
        owner_species = { save_event_target_as = owner_species }
     
        # Define what FTL we have
        if = {
            limit = {
                AND = {
                    has_technology = "tech_warp_drive_1"
                    NOT = { 
                        has_technology = "tech_hyper_drive_1" 
                        has_technology = "tech_wormhole_generation_1" 
                    }
                }
            }
            set_country_flag = warp_pirates   
        }       
        if = {   
            limit = {
                AND = {
                    has_technology = "tech_hyper_drive_1"               
                    NOT = {
                        has_technology = "tech_warp_drive_1" 
                        has_technology = "tech_wormhole_generation_1" 
                    }   
                }
            }
            set_country_flag = hyper_pirates
        }   
        if = {   
            limit = {
                AND = {
                    has_technology = "tech_wormhole_generation_1"               
                    NOT = { 
                        has_technology = "tech_warp_drive_1" 
                        has_technology = "tech_hyper_drive_1" 
                    }
                }
            }
            set_country_flag = wormhole_pirates                   
            else = {set_country_flag = jump_pirates}   
        }
   
        # Define what weapon tech we have

        if = {
            limit = {
                OR = {
                    has_technology = "tech_mass_drivers_3"
                    has_technology = "tech_lasers_3"
                    has_technology = "tech_missiles_3"
                }
            }
            # We will use tier 3 pirates designs
            set_country_flag = tier3_pirates  
        }   
        if = {
            limit = {
                OR = {
                    has_technology = "tech_mass_drivers_2"
                    has_technology = "tech_lasers_2"
                    has_technology = "tech_missiles_2"
                }
            }
            # We will use tier 2 pirates designs
            set_country_flag = tier2_pirates
        }   
       if = {
            limit = {
                OR = {
                    has_technology = "tech_mass_drivers_1"
                    has_technology = "tech_lasers_1"
                    has_technology = "tech_missiles_1"
                }
            }
            # We will use wimpy tier 1 pirates designs
            set_country_flag = tier1_pirates
        }

        # We set our home now

            random_system = {
                limit = {
                    distance = {
                        source = event_target:capital
                        max_distance = 120
                        min_distance = 20
                    }
                    any_planet = { is_colonizable = no }
                    NOT = { 
                        ROOT = {
                            any_owned_planet = {
                                is_homeworld = no 
                            }
                        }   
                        has_star_flag = hostile_system 
                    }   
                    OR = {
                        has_owner = no
                        is_owned_by = ROOT
                    }
                }   
           
                random_system_planet = {
                    limit = { 
                        AND {
                            is_colonizable = no
                            is_star = no
                        }
                    }
                    save_event_target_as = pirate_home
                    create_country = {
                        name = "Pirates"
                        type = pirate
                        species = event_target:owner_species
                        name_list = "PRT1"
                        flag = {
                            icon = {
                                category = "pirate"
                                file = "flag_pirate_7.dds"
                            }
                            background = {
                                category = "backgrounds"
                                file = "00_solid.dds"
                            }
                            colors ={
                                "red"
                                "red"
                                "null"
                                "null"
                            }
                        }
                    }
                    if = {
                        limit = { 
                            ROOT = {
                                has_country_flag = wormhole_pirates
                            }
                        }   
                                       
                        solar_system = {
                            create_wormhole_station = {
                                owner = last_created_country
                                angle = random
                            }
                        }                   
                    }
                        # We just created a country, now we name it
                        last_created_country = {
                            set_name = random
                            save_event_target_as = pirate_band
                            set_relation_flag = {
                                who = ROOT
                                flag = pirate_relation
                            }
                            establish_communications_no_message = ROOT                           
                                           
                   
                            # Now creating home base inside said country
               
                            create_fleet = { name = "Pirate Station" }
                            random_list = {
                                33 ={
                                    if = {
                                        limit = {
                                            ROOT = { has_technology = "tech_mass_drivers_1" }
                                        }
                                        last_created_fleet = {
                                            set_owner = PREV
                                            create_ship = {
                                                name = random
                                                design = "Pirate Nest"
                                                graphical_culture = "pirate_01"
                                            }
                                            set_location = PREVPREV
                                        }
                                    }
                                }
                                33={
                                    if = {
                                        limit = {
                                            ROOT = { has_technology = "tech_lasers_1" }
                                        }
                                        last_created_fleet = {
                                        set_owner = PREV
                                        create_ship = {
                                            name = random
                                            design = "Pirate Lair"
                                            graphical_culture = "pirate_01"
                                            }
                                            set_location = PREVPREV
                                        }
                                    }
                                }
                                33 = {
                                    if = {
                                        limit = {
                                            ROOT = { has_technology = "tech_missiles_1" }
                                        }
                                        last_created_fleet = {
                                            set_owner = PREV
                                            create_ship = {
                                                name = random
                                                design = "Pirate Den"
                                                graphical_culture = "pirate_01"
                                            }
                                            set_location = PREVPREV
                                        }
                                    }
                                }
                            }   

                            # Now creating an admiral for our first fleet

                            create_leader = {
                                type = admiral
                                species = owner_main_species
                                name = random
                                skill = 100
                            }               

                            # Now that scummy fleet
               
                            create_fleet = { name = "Pirate Fleet" }
                            last_created_fleet = {
                                set_fleet_stance = aggressive
                                set_aggro_range_measure_from = self
                                set_aggro_range = 150
                                set_owner = PREV
                           
                            # What design we will use for first fleet
                            random_list = {   
                                33 = { 
                                    if = {
                                        limit = { 
                                            ROOT = { has_technology = "tech_mass_drivers_1" }
                                        }   
                                        create_ship_design = {
                                            design = "Reaver"
                                            ftl = ROOT
                                        }
                                    }
                                }
                                33 = { 
                                    if = {
                                        limit = {
                                            ROOT = { has_technology = "tech_lasers_1" }
                                        }   
                                        create_ship_design = {
                                            design = "Hunter"
                                            ftl = ROOT
                                        }
                                    }
                                }   
                                33 = { 
                                    if = {
                                        limit = { 
                                            ROOT = { has_technology = "tech_missiles_1" }
                                        }   
                                        create_ship_design = {
                                            design = "Vagabond"
                                            ftl = ROOT
                                        }
                                    }
                                }                               
                            }
                            # We spawn a few ships
                            create_ship = {
                                name = random
                                design = last_created_design
                                graphical_culture = "pirate_01"
                            }   
                            create_ship = {
                                name = random
                                design = last_created_design
                                graphical_culture = "pirate_01"
                            }
                            create_ship = {
                                name = random
                                design = last_created_design
                                graphical_culture = "pirate_01"
                            }
                            create_ship = {
                                name = random
                                design = last_created_design
                                graphical_culture = "pirate_01"
                            }  
                            # We assign leader to fleet
                       
                            assign_leader = last_created_leader
                            set_location = PREVPREV   
                       
                            # Now sending that fleet on rampage
                   
                            queue_actions = {
                                repeat = {
                                    find_random_system = {
                                        trigger = {
                                            id = "pirate.1.trigger.1"
                                            NOT = {
                                                has_star_flag = hostile_system
                                                is_same_value = event_target:capital_system
                                            }
                                            any_planet = {
                                                OR = {
                                                    has_mining_station = yes
                                                    has_research_station = yes
                                                }
                                                # Attacking system with wormhole station or a starport is suicidal
                                                NOT = { 
                                                    has_spaceport =yes       
                                                }
                                                exists = controller
                                                controller = { is_same_value = event_target:pirate_target }
                                            }
                                            distance = {
                                                source = PREV
                                                max_distance = 200
                                                min_distance = 20
                                            }
                                        }
                                        found_system = {
                                            move_to = THIS
                                        } 
                                    }
                                    # We find a juicy target to kill
                                    find_closest_planet = {
                                        trigger = {
                                            id = "pirate.1.trigger.2"
                                            OR = {
                                                has_research_station = yes
                                                has_mining_station = yes
                                            }
                                        }
                                        found_planet = {
                                            orbit_planet = THIS
                                            wait = {
                                                duration = 20
                                            }
                                        }
                                    }
                                    # We go back to home system
                                    find_random_system = {
                                        trigger = {
                                            id = "pirate.1.trigger.3"
                                            any_planet = {
                                                is_planet = event_target:pirate_home
                                            }
                                        }   
                                        found_system = { move_to = THIS } 
                                    }
                                    # We go to base for some rest
                                    find_closest_planet = {
                                        trigger = {
                                            id = "pirate.1.trigger.4"
                                            is_planet = event_target:pirate_home
                                        }
                                        found_planet = {
                                            orbit_planet = THIS
                                            wait = {
                                                duration = 200
                                                random = 150
                                            }
                                        }
                                    }   
                                }   
                            }
                        }   
                    }
                }   
            }                          
    }
       

    option = {
        name = pirate.2.a
        trigger = {
            OR = {
                has_government = theocratic_republic
                has_government = transcendent_republic
                has_government = theocratic_oligarchy
                has_government = transcendent_oligarchy
                has_government = divine_mandate
                has_government = transcendent_empire
            }
        }
    }
    option = {
        name = pirate.2.b
        trigger = {
            OR = {
                has_government = military_dictatorship
                has_government = martial_empire
                has_government = military_junta
                has_government = ordered_stratocracy
                has_government = military_republic
                has_government = martial_demarchy
            }
        }
    }
    option = {
        name = pirate.2.c
        trigger = {
            OR = {
                has_government = despotic_hegemony
                has_government = ai_overlordship
                has_government = science_directorate
                has_government = illuminated_technocracy
                has_government = direct_democracy
                has_government = subconscious_consensus
            }
        }
    }
    option = {
        name = pirate.2.d
        trigger = {
            OR = {
                has_government = moral_democracy
                has_government = irenic_democracy
                has_government = peaceful_bureaucracy
                has_government = irenic_protectorate
                has_government = enlightened_monarchy
                has_government = irenic_monarchy
            }
        }
    }
    option = {
        name = pirate.2.e
        trigger = {
            OR = {
                has_government = despotic_empire
                has_government = star_empire
            }
        }
    }
    option = {
        name = pirate.2.f
        trigger = {
            OR = {
                has_government = plutocratic_oligarchy
                has_government = mega_corporation
            }
        }
    }
    option = {
        name = pirate.2.g
        trigger = {
            OR = {
                has_government = indirect_democracy
                has_government = democratic_utopia
            }
        }
    }
}

# Building a new fleet (HIDDEN)

country_event = {
    id = pirate.2
    hide_window = yes
   
    trigger = {
        is_country_type = pirate
        OR = {
            num_fleets < 2
            num_ships < 5
        }
        any_owned_ship = {
            is_ship_size = pirate_station
        }
    }
   
    mean_time_to_happen = {
        days = 180
    }
   
   
    immediate = {
   
        random_country = {
            limit = {
                has_relation_flag = { flag = pirate_relation who = ROOT }
            }
            save_event_target_as = pirate_target
            capital_scope = {
                solar_system = { save_event_target_as = capital_system }
            }
        }
        # If we get to spawn a new fleet, we want a better admiral to run it
        create_leader = {
            type = admiral
            species = owner_main_species
            name = random
            skill = 300
        }
       
        # We take any pirate station as our new spawn point
       
        random_owned_ship = {
            limit = { is_ship_size = pirate_station }
            save_event_target_as = pirate_home
            create_fleet = { name = "Pirate Fleet" }
           
            last_created_fleet = {
                set_fleet_stance = aggressive
                set_aggro_range_measure_from = self
                set_aggro_range = 150
                set_owner = ROOT
   
                # Lets see what kind of arsenal we have    
           
                if = {
                    limit = {
                        OR = {
                            ROOT = { has_technology = "tech_mass_drivers_3" }
                            ROOT = { has_technology = "tech_lasers_3" }
                            ROOT = { has_technology = "tech_missiles_3" }
                        }
                        NOT = {
                            ROOT = {
                                has_country_flag = tier3_pirates
                            }
                        }       
                    }
                    # We will use tier 3 pirates designs
                    ROOT = { set_country_flag = tier3_pirates }
                }   
                if = {
                    limit = {
                        OR = {
                            ROOT = { has_technology = "tech_mass_drivers_2" }
                            ROOT = { has_technology = "tech_lasers_2" }
                            ROOT = { has_technology = "tech_missiles_2" }
                        }
                        NOT = {
                            ROOT = {
                                has_country_flag = tier2_pirates
                            }
                        }                               
                    }
                    # We will use tier 2 pirates designs and lower
                    ROOT = { set_country_flag = tier2_pirates }
                }
                if = {
                    limit = {
                        OR = {
                            ROOT = { has_technology = "tech_mass_drivers_1" }
                            ROOT = { has_technology = "tech_lasers_1" }
                            ROOT = { has_technology = "tech_missiles_1" }
                        }
                        NOT = {
                            ROOT = {
                                has_country_flag = tier1_pirates
                            }
                        }                               
                    }
                    # We will use wimpy tier 1 pirates designs
                    ROOT = { set_country_flag = tier1_pirates }       
                }
               
                # What design we will use for our brand new fleet
                # The first set of ships
                random_list = {   
                    33 = { 
                        if = {
                            limit = { 
                                ROOT = {
                                    has_country_flag = tier1_pirates
                                }
                            }   
                            create_ship_design = {
                                design = "Reaver"
                                ftl = ROOT
                            }
                        }
                    }
                    33 = { 
                        if = {
                            limit = { 
                                ROOT = {
                                    has_country_flag = tier1_pirates
                                }
                            }   
                            create_ship_design = {
                                design = "Hunter"
                                ftl = ROOT
                            }
                        }
                    }   
                    33 = { 
                        if = {
                            limit = { 
                                ROOT = {
                                    has_country_flag = tier1_pirates
                                }
                            }   
                            create_ship_design = {
                                design = "Vagabond"
                                ftl = ROOT
                            }
                        }
                    }
                    33 = { 
                        if = {
                            limit = { 
                                ROOT = {
                                    has_country_flag = tier2_pirates
                                }
                            }   
                            create_ship_design = {
                                design = "Brigand"
                                ftl = ROOT
                            }
                        }
                    }
                    33 = { 
                        if = {
                            limit = { 
                                ROOT = {
                                    has_country_flag = tier2_pirates
                                }
                            }   
                            create_ship_design = {
                                design = "Skull"
                                ftl = ROOT
                            }
                        }
                    }   
                    25 = { 
                        if = {
                            limit = { 
                                ROOT = {
                                    has_country_flag = tier2_pirates
                                }
                            }   
                            create_ship_design = {
                                design = "Marauder"
                                ftl = ROOT
                            }
                        }
                    }
                    25 = { 
                        if = {
                            limit = { 
                                ROOT = {
                                    has_country_flag = tier2_pirates
                                }
                            }   
                            create_ship_design = {
                                design = "Corsair"
                                ftl = ROOT
                            }
                        }
                    }                                                       
                    10 = { 
                        if = {
                            limit = { 
                                ROOT = {
                                    has_country_flag = tier3_pirates
                                }
                            }   
                            create_ship_design = {
                                design = "Strife"
                                ftl = ROOT
                            }
                        }
                    }
                    10 = { 
                        if = {
                            limit = { 
                                ROOT = {
                                    has_country_flag = tier3_pirates
                                }
                            }   
                            create_ship_design = {
                                design = "Raven"
                                ftl = ROOT
                            }
                        }
                    }                                       
                }                                       
                # We spawn a few ships
                create_ship = {
                    name = random
                    design = last_created_design
                    graphical_culture = "pirate_01"
                }   
                create_ship = {
                    name = random
                    design = last_created_design
                        graphical_culture = "pirate_01"
                }
                create_ship = {
                    name = random
                    design = last_created_design
                    graphical_culture = "pirate_01"
                }
                create_ship = {
                    name = random
                    design = last_created_design
                    graphical_culture = "pirate_01"
                } 
                create_ship = {
                    name = random
                    design = last_created_design
                    graphical_culture = "pirate_01"
                } 
                create_ship = {
                    name = random
                    design = last_created_design
                    graphical_culture = "pirate_01"
                }            
                # For the second set
                random_list = {   
                    33 = { 
                        if = {
                            limit = { 
                                ROOT = {
                                    has_country_flag = tier1_pirates
                                }
                            }   
                            create_ship_design = {
                                design = "Reaver"
                                ftl = ROOT
                            }
                        }
                    }
                    33 = { 
                        if = {
                            limit = { 
                                ROOT = {
                                    has_country_flag = tier1_pirates
                                }
                            }   
                            create_ship_design = {
                                design = "Hunter"
                                ftl = ROOT
                            }
                        }
                    }   
                    33 = { 
                        if = {
                            limit = { 
                                ROOT = {
                                    has_country_flag = tier1_pirates
                                }   
                            }   
                            create_ship_design = {
                                design = "Vagabond"
                                ftl = ROOT
                            }
                        }
                    }
                    33 = { 
                        if = {
                            limit = { 
                                ROOT = {
                                    has_country_flag = tier2_pirates
                                }
                            }   
                            create_ship_design = {
                                design = "Brigand"
                                ftl = ROOT
                            }
                        }
                    }
                    33 = { 
                        if = {
                            limit = { 
                                ROOT = {
                                    has_country_flag = tier2_pirates
                                }
                            }   
                            create_ship_design = {
                                design = "Skull"
                                ftl = ROOT
                            }
                        }
                    }   
                    25 = { 
                        if = {
                            limit = { 
                                ROOT = {
                                    has_country_flag = tier2_pirates
                                }
                            }   
                            create_ship_design = {
                                design = "Marauder"
                                ftl = ROOT
                            }
                        }
                    }
                    25 = { 
                        if = {
                            limit = { 
                                ROOT = {
                                    has_country_flag = tier2_pirates
                                }
                            }   
                            create_ship_design = {
                                design = "Corsair"
                                ftl = ROOT
                            }
                        }
                    }                                                       
                }                                       
                # We spawn 2 more
                create_ship = {
                    name = random
                    design = last_created_design
                    graphical_culture = "pirate_01"
                }   
                create_ship = {
                    name = random
                    design = last_created_design
                    graphical_culture = "pirate_01"
                }
   
                # And the leader's ship
                random_list = {   
                    25 = { 
                        if = {
                            limit = { 
                                ROOT = {
                                    has_country_flag = tier2_pirates
                                }
                            }   
                            create_ship_design = {
                                design = "Marauder"
                                ftl = ROOT
                            }
                        }
                    }
                    25 = { 
                        if = {
                            limit = { 
                                ROOT = {
                                    has_country_flag = tier2_pirates
                                }
                            }   
                            create_ship_design = {
                                design = "Corsair"
                                ftl = ROOT
                            }
                        }
                    }                                                       
                    10 = { 
                        if = {
                            limit = { 
                                ROOT = {
                                    has_country_flag = tier3_pirates
                                }
                            }   
                            create_ship_design = {
                                design = "Strife"
                                ftl = ROOT
                            }
                        }
                    }
                    10 = { 
                        if = {
                            limit = { 
                                ROOT = has_country_flag = tier3_pirates }
                            }   
                            create_ship_design = {
                                design = "Raven"
                                ftl = ROOT
                            }   
                        }
                    5 = {}                       
               
                }                                       
                # We spawn the last ship
                create_ship = {
                    name = random
                    design = last_created_design
                    graphical_culture = "pirate_01"
                }   
               
                # We assign leader to fleet
                     
                assign_leader = last_created_leader
                set_location = PREVPREV   
           
                queue_actions = {
                    repeat = {
                        find_random_system = {
                            trigger = {
                                id = "pirate.2.trigger.1"
                                NOT = {
                                    has_star_flag = hostile_system
                                    is_same_value = event_target:capital_system
                                }
                                any_planet = {
                                    OR = {
                                        has_mining_station = yes
                                        has_research_station = yes
                                    }
                                    # Attacking a spaceport is suicidal
                                    NOT = { 
                                        has_spaceport = yes
                                    }
                                    exists = controller
                                    controller = { is_same_value = event_target:pirate_target }
                                }
                                distance = {
                                    source = PREV
                                    max_distance = 200
                                    min_distance = 20
                                }
                            }
                            found_system = {
                                move_to = THIS
                            } 
                        }
                        # We find a juicy target to kill
                        find_closest_planet = {
                            trigger = {
                                id = "pirate.2.trigger.2"
                                OR = {
                                    has_research_station = yes
                                    has_mining_station = yes
                                }
                            }
                            found_planet = {
                                orbit_planet = THIS
                                    wait = {
                                    duration = 20
                                }
                            }
                        }
                        # We go home to heal
                        find_random_system = {
                            trigger = {
                                id = "pirate.2.trigger.3"
                                any_planet = {
                                    is_planet = event_target:pirate_home
                                }
                            }   
                            found_system = { move_to = THIS } 
                        }
                        # We go to base for some rest
                        find_closest_planet = {
                            trigger = {
                                id = "pirate.2.trigger.4"
                                is_planet = event_target:pirate_home
                            }
                                found_planet = {
                                orbit_planet = THIS
                                wait = {
                                    duration = 200
                                    random = 150
                                }
                            }
                        }
                    }   
                }           
            }       
        }
    }
} # the end of new fleet

#Starting the pirate chain
ship_event = {
    id = pirate.3
    hide_window = yes
    is_triggered_only = yes

    trigger = {
        owner = { is_country_type = default }
        from = {
            solar_system = {
                NOT = {
                    any_planet = {
                        is_homeworld = yes
                    }
                }
            }
        }
        NOT = {
            owner = {
                has_country_flag = outer_system_mining_stations_constructed
                has_country_flag = birth_of_piracy 
            }
        }
    }

    immediate = {
        owner = {
            if = {
                limit = {
                    NOT = {
                        check_variable = {
                            which = outer_system_mining_stations
                            value > 0
                        }
                    }
                }
                set_variable = {
                    which = "outer_system_mining_stations"
                    value = 1
                }
                else = {
                    change_variable = {
                        which = "outer_system_mining_stations" 
                        value = 1
                    }
                }
            }
            if = {
                limit = {
                    check_variable = {
                        which = outer_system_mining_stations
                        value > 4
                    }
                }
                set_country_flag = outer_system_mining_stations_constructed
            }
        }
    }
}

event = {
    id = pirate.4
    hide_window = yes
    is_triggered_only = yes
   
    immediate = {
        every_country = {
            limit = {
                # is_ai = no we want ais to suffer too :D
                NOT = { has_country_flag = birth_of_piracy }
            }
            country_event = { id = pirate.5 }
        }
    }
}           
           
#yearly pulse event to start the "birth of piracy" somewhere
country_event = {
    id = pirate.5
    hide_window = yes
    is_triggered_only = yes
    trigger = {
        is_country_type = default
        OR = {
            has_country_flag = outer_system_mining_stations_constructed
            any_owned_planet = {
                is_homeworld = no
            }
        }
    }
   
    immediate = {   
        random_list = {
            30 = { country_event = { id = pirate.1 days = 50 random = 45 } }
            30 = { country_event = { id = pirate.1 days = 500 random = 450 } }
            40 = {  }
        }
    }
}           

# Look for an existing Pirate Country that lost it's pirate station so it can spawn another one elsewhere.
country_event = {
    id = pirate.6
    hide_window = yes
   
    trigger = {
        is_country_type = pirate
        any_owned_ship = {
            NOT {
                is_ship_size = pirate_station
            }       
        }
    }
   
    mean_time_to_happen = {
        Months = 12
    }
   
    immediate = {
        capital_scope = { save_event_target_as = capital }
        capital_scope = {
            solar_system = { save_event_target_as = capital_system }
        }
        save_event_target_as = pirate_target
        owner_species = { save_event_target_as = owner_species }
   
        # Define what weapon tech we have

        if = {
            limit = {
                OR = {
                    has_technology = "tech_mass_drivers_3"
                    has_technology = "tech_lasers_3"
                    has_technology = "tech_missiles_3"
                }
                NOT = {
                    ROOT = {
                        has_country_flag = tier3_pirates
                    }
                }                       
            }
            # We will use tier 3 pirates designs
            set_country_flag = tier3_pirates  
        }   
        if = {
            limit = {
                OR = {
                    has_technology = "tech_mass_drivers_2"
                    has_technology = "tech_lasers_2"
                    has_technology = "tech_missiles_2"
                }
                NOT = {
                    ROOT = {
                        has_country_flag = tier2_pirates
                    }
                }                       
            }               
            # We will use tier 2 pirates designs
            set_country_flag = tier2_pirates
        }   
       if = {
            limit = {
                OR = {
                    has_technology = "tech_mass_drivers_1"
                    has_technology = "tech_lasers_1"
                    has_technology = "tech_missiles_1"
                }
                NOT = {
                    ROOT = {
                        has_country_flag = tier1_pirates
                    }
                }                       
            }               
            # We will use wimpy tier 1 pirates designs
            set_country_flag = tier1_pirates
        }

        # We set our new home now

            random_system = {
                limit = {
                    distance = {
                        source = event_target:capital
                        max_distance = 120
                        min_distance = 20
                    }
                    any_planet = { is_colonizable = no }
                    NOT = { 
                        ROOT = {
                            any_owned_planet = {
                                is_homeworld = no 
                            }
                        }   
                        has_star_flag = hostile_system 
                    }   
                    OR = {
                        has_owner = no
                        is_owned_by = ROOT
                    }
                }   
           
                random_system_planet = {
                    limit = { 
                        AND {
                            is_colonizable = no
                            is_star = no
                        }
                    }
                    save_event_target_as = pirate_home


                        # We just created a country, now we name it
                        last_created_country = {
                            set_name = random
                            save_event_target_as = pirate_band
                            set_relation_flag = {
                                who = ROOT
                                flag = pirate_relation
                            }
                            establish_communications_no_message = ROOT                           
                                           
                   
                            # Now creating home base inside said country
               
                            create_fleet = { name = "Pirate Station" }
                            random_list = {
                                33 ={
                                    if = {
                                        limit = {
                                            ROOT = { has_technology = "tech_mass_drivers_1" }
                                        }
                                        last_created_fleet = {
                                            set_owner = PREV
                                            create_ship = {
                                                name = random
                                                design = "Pirate Nest"
                                                graphical_culture = "pirate_01"
                                            }
                                            set_location = PREVPREV
                                        }
                                    }
                                }
                                33={
                                    if = {
                                        limit = {
                                            ROOT = { has_technology = "tech_lasers_1" }
                                        }
                                        last_created_fleet = {
                                        set_owner = PREV
                                        create_ship = {
                                            name = random
                                            design = "Pirate Lair"
                                            graphical_culture = "pirate_01"
                                            }
                                            set_location = PREVPREV
                                        }
                                    }
                                }
                                33 = {
                                    if = {
                                        limit = {
                                            ROOT = { has_technology = "tech_missiles_1" }
                                        }
                                        last_created_fleet = {
                                            set_owner = PREV
                                            create_ship = {
                                                name = random
                                                design = "Pirate Den"
                                                graphical_culture = "pirate_01"
                                            }
                                            set_location = PREVPREV
                                        }
                                    }
                                }
                            }   

                            # Now creating an admiral for our first fleet

                            create_leader = {
                                type = admiral
                                species = owner_main_species
                                name = random
                                skill = 100
                            }               

                            # Now that scummy fleet
               
                            create_fleet = { name = "Pirate Fleet" }
                            last_created_fleet = {
                                set_fleet_stance = aggressive
                                set_aggro_range_measure_from = self
                                set_aggro_range = 150
                                set_owner = PREV
                           
                            # What design we will use for first fleet
                            random_list = {   
                                33 = { 
                                    if = {
                                        limit = { 
                                            ROOT = { has_technology = "tech_mass_drivers_1" }
                                        }   
                                        create_ship_design = {
                                            design = "Reaver"
                                            ftl = ROOT
                                        }
                                    }
                                }
                                33 = { 
                                    if = {
                                        limit = {
                                            ROOT = { has_technology = "tech_lasers_1" }
                                        }   
                                        create_ship_design = {
                                            design = "Hunter"
                                            ftl = ROOT
                                        }
                                    }
                                }   
                                33 = { 
                                    if = {
                                        limit = { 
                                            ROOT = { has_technology = "tech_missiles_1" }
                                        }   
                                        create_ship_design = {
                                            design = "Vagabond"
                                            ftl = ROOT
                                        }
                                    }
                                }                               
                            }
                            # We spawn a few ships
                            create_ship = {
                                name = random
                                design = last_created_design
                                graphical_culture = "pirate_01"
                            }   
                            create_ship = {
                                name = random
                                design = last_created_design
                                graphical_culture = "pirate_01"
                            }
                            create_ship = {
                                name = random
                                design = last_created_design
                                graphical_culture = "pirate_01"
                            }
                            create_ship = {
                                name = random
                                design = last_created_design
                                graphical_culture = "pirate_01"
                            }  
                            # We assign leader to fleet
                       
                            assign_leader = last_created_leader
                            set_location = PREVPREV   
                       
                            # Now sending that fleet on rampage
                   
                            queue_actions = {
                                repeat = {
                                    find_random_system = {
                                        trigger = {
                                            id = "pirate.6.trigger.1"
                                            NOT = {
                                                has_star_flag = hostile_system
                                                is_same_value = event_target:capital_system
                                            }
                                            any_planet = {
                                                OR = {
                                                    has_mining_station = yes
                                                    has_research_station = yes
                                                }
                                                # Attacking a spaceport is suicidal
                                                NOT = { 
                                                    has_spaceport = yes
                                                }
                                                exists = controller
                                                controller = { is_same_value = event_target:pirate_target }
                                            }
                                            distance = {
                                                source = PREV
                                                max_distance = 200
                                                min_distance = 20
                                            }
                                        }
                                        found_system = {
                                            move_to = THIS
                                        } 
                                    }
                                    # We find a juicy target to kill
                                    find_closest_planet = {
                                        trigger = {
                                            id = "pirate.6.trigger.2"
                                            OR = {
                                                has_research_station = yes
                                                has_mining_station = yes
                                            }
                                        }
                                        found_planet = {
                                            orbit_planet = THIS
                                            wait = {
                                                duration = 20
                                            }
                                        }
                                    }
                                    # We go back to home system
                                    find_random_system = {
                                        trigger = {
                                            id = "pirate.6.trigger.3"
                                            any_planet = {
                                                is_planet = event_target:pirate_home
                                            }
                                        }   
                                        found_system = { move_to = THIS } 
                                    }
                                    # We go to base for some rest
                                    find_closest_planet = {
                                        trigger = {
                                            id = "pirate.6.trigger.4"
                                            is_planet = event_target:pirate_home
                                        }
                                        found_planet = {
                                            orbit_planet = THIS
                                            wait = {
                                                duration = 200
                                                random = 150
                                            }
                                        }
                                    }   
                                }   
                            }
                        }   
                    }
                }   
            }                          
    }
}   

# Respawn Wormhole Station for the Wormholes Pirates   
country_event = {
    id = pirate.7
    hide_window = yes
   
    trigger = {
        is_country_type = pirate
        has_country_flag = wormhole_pirates
        any_owned_ship = {
            is_ship_size = pirate_station
        }
        NOT = {
            any_owned_ship = {
                is_ship_size = wormhole_station
            }
        }
    }
   
    mean_time_to_happen = {
        Months = 4
    }   

    immediate = {
   
        random_system = {   
            limit = {
                is_pirate_system = yes
            }
            solar_system = {
                create_wormhole_station = {
                    owner = last_created_country
                    angle = random
                }
            }                               
        }
    }   
}
 
Code:
                    10 = {
                        if = {
                            limit = {
                                ROOT = has_country_flag = tier3_pirates }
                            }  
                            create_ship_design = {
                                design = "Raven"
                                ftl = ROOT
                            }  
                        }
                    5 = {}

should be...
Code:
                    10 = {
                        if = {
                            limit = {
                                ROOT = {
                                    has_country_flag = tier3_pirates 
                                }
                            }  
                            create_ship_design = {
                                design = "Raven"
                                ftl = ROOT
                            }  
                        }
                    5 = {}

According to the error, it thinks that ROOT and = are separate arguments. Also, "trigger_impl.cpp:842" signifies that the exception in question is line 842, which I assume that this is the line that it is referring to.

Edit: Upon further investigation, it appears that it does not occur on line 842, but instead on line 998. Looks very similar to how java exceptions work which point to the specific line. My bad. Still, fixing that bit of code "should" allow it to work. Got to love it when a small oversight leads to BIG problems XD
 
Last edited:
  • 2
Reactions:
According to the error, it thinks that ROOT and = are separate arguments. Also, "trigger_impl.cpp:842" signifies that the exception in question is line 842, which I assume that this is the line that it is referring to.

Edit: Upon further investigation, it appears that it does not occur on line 842, but instead on line 998. Looks very similar to how java exceptions work which point to the specific line. My bad. Still, fixing that bit of code "should" allow it to work. Got to love it when a small oversight leads to BIG problems XD

Thanks, that's a big help. The error was a bit cryptic and misleading, but at least i know what to look for next time i get something similar. By the way, is there a better way to find error in my code than running the game and looking at the logs as things pop up in it? It's slow and inefficient, and some bugs may take a while to show up. I did take a programming course long ago but never finished it so there are plenty of things i'm missing...
 
Well, in order to find the error in your code I hit ctrl + f and searched for all instances of ROOT and scrolled through the code. Since it was trying to find ROOT and = separately i knew there had to be a line with ROOT = together but in a different format than the norm. But sadly I'm not sure if there is an easier way to test your code. Someone with more experience than I will have to answer. I have very limited modding experience and I only know the error you describe from my java classes.