LuxArdens / Stellaris---RPG-Traits-mod

Stellaris mod: RPG Traits
MIT License
11 stars 9 forks source link

This is why I cant have nice things #17

Closed TvoEx closed 6 years ago

TvoEx commented 6 years ago

There's a reason I stayed away from event scripting most of the time.

But I needed this to trigger when the species has Silent Observers trait and this is the nonsense I came up with

potential = { exists = owner owner = { owner_species = { pop_has_trait = trait_silent_observers } } }

LuxArdens commented 6 years ago

There was an old Silent Observer trait event already which you could use in "traits.txt":

event = {
    id = "trait.10"
    hide_window = yes
    is_triggered_only = yes

    immediate = {
        every_country = {
            limit = {
                has_trait = trait_silent_observers
            }
            add_modifier = {
                modifier = silent_observers
                days = -1
            }
        }
    }
}

I use the on_action file to trigger those on game start and after every gene modding project. Alternatively if you want to use normal triggers to set up a randomly timed event I'd suggest something like:

country_event = {
    id = "trait.801"
    hide_window = yes
    trigger = {
        has_trait = trait_silent_observers     # works on a country scope 
    }
    mean_time_to_happen = { months = <something> }

    immediate = {
            # <whatever you want to do here, on a country scope>
    }
}

But I don't recommend using random events for regulating background stuff

TvoEx commented 6 years ago

The full starbase building looks like this listening_post2 = { icon = "GFX_spaceport_module_navigators_guild" construction_days = 360 initial = yes cost = { minerals = 200 }

potential = {
    exists = owner
    owner = {owner_species = { pop_has_trait = trait_silent_observers }}
}   

station_modifier = {
    ship_sensor_range_add = 6
}

upkeep_resources = {
    energy = 2
}

ai_build_at_chokepoint = yes
ai_build_outside_chokepoint = no
ai_weight = {
    weight = 50
}   

}

TvoEx commented 6 years ago

I need Potential to report either true or false, if true it becomes buildable and visible to build, if false, you simply dont see it in the build menu

LuxArdens commented 6 years ago

Oh it was for a starbase module; you wrote event so I assumed you were working on those.

Looks good but I wouldn't really know because I haven't done any modules yet. Let me know if you get it to work!

TvoEx commented 6 years ago

Closing this for now