Jump to content

Stellaris scripting help


genericuser27

Recommended Posts

Hello everyone. So I’m trying to make it so an event spawns a new species on one of my worlds. There are some thing I’m unclear about, I’m new to this and have been scratching my head at it.

 

create_species = {
            is_mod = yes
            name = "New alien"
            plural = "New aliens"
            class = Musceloid #is this right?
            portrait = #idk where to find them
            homeworld = #planet type they like?
                traits = {
                trait = trait_very_strong
             }
        }

 

Create_pop = { 
    Species = #im not sure what to put here

}

 

 

 

1. I’m unclear on the points with # up above

2. How do I tell the game where to spawn them at? I want to spawn them at my closest world hat has space.

3. Is this all possible to do from an anomaly?

4. I’m probably missing a lot of stuff and I just don’t know it. So I would appreciate if you would point it out.

5. How do I make this only trigger once?

 

Thank you for your time!

Link to comment

This is an event from the extra events mod that does something similar:

 

# Illegal Aliens
country_event = {
    id = popup.1
    title = "popup.1.name"
    desc = "popup.1.desc.d"
    picture = GFX_evt_smugglers_in_bar
    show_sound = event_mystic_reveal

    mean_time_to_happen = { months = 1200 }

    trigger = {
        is_ai = no
        NOT = { has_country_flag = had_alien }
    }

    immediate = { 
        set_country_flag = had_alien 
    }
    

    option = {
        name = popup.1.a    
        add_monthly_resource_mult = {
            resource = influence
            value = @tier2influencereward
            min = @tier2influencemin
            max = @tier2influencemax
        }    
    }

    option = {
        name = popup.1.b
        add_monthly_resource_mult = {
            resource = influence
            value = @tier2influencereward
            min = @tier2influencemin
            max = @tier2influencemax
        }
            create_species = {
                name = "Alien Trespasser"
                class = random
                portrait = random
                traits = random
            }
        
            random_owned_planet = {
                create_pop = {
                    name = random
                    class = random
                    portrait = random
                    traits = random
                    species = last_created
                }    
            }
    }
    
    option = {
        name = popup.1.c
        add_monthly_resource_mult = {
            resource = influence
            value = @tier2influencereward
            min = @tier2influencemin
            max = @tier2influencemax
        }
        immediate = { 
        
            create_species = {
                name = "Alien Trespasser"
                class = random
                portrait = random
                traits = random
            }
        
            random_owned_planet = {
                create_pop = {
                    name = random
                    class = random
                    portrait = random
                    traits = random
                    species = last_created
                }    
            }
        }
    }
}
}

 

So clearly you need to put that all in an immediate = {} and set the species = last_created.

I honestly have no idea what homeworld would do. Where did you get that argument from?

And are you trying to make a species that has a specific appearance? If so would that appearance be a modded one or vanilla?

Link to comment

you can try planet_class = "pc_continental" or whatever planet class you want them to use. I honestly don't know if that'll work though. Double checking the alien trespasser event, their preferred planet class appears to be random.

 

And this is from the stellaris wiki:

immediate = {
		#Effects that are applied the moment event fires. Can be effects that can't wait like setting a flag to prevent other events, or the undesirable effects you don't want player to be able to delay (For example, killing science ship's captain.) Also the only block you'll need on hidden events
	}

It may not be necessary in this context, but it might also be helpful.

 

I think this'll require a fair bit of experimentation to work. I'll do a bit on my end, but I've got a fair bit of work to do on my own mod, so don't expect much from me right now.

Link to comment

Okay so I've tried this and it doesn't spawn the pop, but it does give me the research rewards and xp. look at option C

 

ship_event = {                
    id = alien_species_planet.1                
    title = alien_species_planet.1.name            
    desc = alien_species_planet.1.desc        
    picture = #fill
    show_sound = event_swarm_started    
    location = root                
    is_triggered_only = yes    
    
    option = {
        name = alien_species_planet.1.a
        Leader = {
            add_experience = 200
            }
            
        owner = {
            add_monthly_resource_mult = {
                resource = society_research
                value = @tier1researchreward
                min = @tier1researchmin
                max = @tier1researchmax
                }
            
            }
        }
        
    option = {
        name = alien_species_planet.1.b
        trigger = { owner = { OR = {
            has_ethic = ethic_xenophobe
            has_ethic = ethic_fanatic_xenophobe
            } } }
        leader = { add_experience = 200}
        owner = {
            add_monthly_resource_mult = {
                resource = physics_research
                value = @tier2researchreward
                min = @tier2researchmin
                max = @tier2researchmax
                }
            }
        }
        
    option = {
        name = alien_species_planet.1.c
        trigger = { owner = { OR = {
            has_ethic = ethic_xenophile
            has_ethic = ethic_fanatic_xenophile
            } } }
        leader = { add_experience = 200}
        immediate = {       
            create_species = {
                name = random
                class = random
                portrait = random
                   traits = random
            }
            random_owned_planet = {
                create_pop = {
                    name = random
                    class = random
                    portrait = random
                    traits = random
                    species = last_created
                }    
            }
        }
        owner = {
            add_monthly_resource_mult = {
                resource = society_research
                value = @tier2researchreward
                min = @tier2researchmin
                max = @tier2researchmax
            }
        }
    }
}

Link to comment

Can we take a step back? What kind of event is this supposed to be? An anomaly? A colony event? A country event? And if its an anomaly are you trying to spawn the pop on the planet the anomaly was on or an just any random colony you own?

 

Edit: If this is both a planetary anomaly and you are trying to spawn the species on that planet, try changing  random_owned_planet to root.

 

root = {
                create_pop = {
                    name = random
                    class = random
                    portrait = random
                    traits = random
                    species = last_created
                } 

Link to comment

I have confirmed that this will make a single species on a planet. It most definitely needs refinement, but is functional as is.

 

namespace = test

# Species create Test
ship_event = {
    id = test.1
    title = "test.1.name"
    desc = "test.1.desc"
    picture = GFX_evt_animal_wildlife
    show_sound = event_default
    location = ROM

    is_triggered_only = yes
    
    
    option = {
        name = "test.1.a"
        FROM = {
            create_species = {
                name = "Test Race"
                class = random
                portrait = random
                traits = random
            }
            create_pop = {
                name = random
                class = random
                portrait = random
                traits = random
                species = last_created
            }
        }
    }
}

 

I don't mind if you use this code as is (minus any minor changes you need to do), just give me credit if you publish your work.

Link to comment

If I wanted to spawn the species on a random owned world would i just replace FROM with random_owned_planet? is there such thing as closest_owned_planet? Its a fun little alien breeding cartoon.

 

EDIT: Okay so now I don't want to make the traits random would that section look like this:

 

traits = {

        trait_thrifty

        trait_very_strong

}

 

edit2: I got the traits figured out, now the issue I’m tackling is if the habitability doesn’t fit, the species goes through a forced migration. I’m thinking I’m just going to narrow down to continental and give them a Trait that gives continental hability. How would I make sure a random species doesn’t get it when starting a new game?

Link to comment

Try: homeworld = this

or homeworld = pc_continentel

 

Random_owned_planet is a thing yes. 

 

random_owned_planet = {
                create_pop = {
                    name = random
                    class = random
                    portrait = random
                    traits = random
                    species = last_created
                }    
            }

 

Can you set it to happen at the closest owned planet? Maybe? I have no clue.

Link to comment

Thanks I’ll try it later, how would make an event happen x months after a player made a decision about something? It doesn’t have to be the exact amount, just a little wait. 

 

would it be:

 

mean_time_to_happen = {months = 5}

{

#stuff happens

}

 

 

or would I have to start a tart a whole new event or something

Link to comment

My recommendation is that you set a flag in that decision and then use that flag as a trigger for another event.

 

Your decision would:

set_planet_flag = [name of flag]

 

You could also do set_country_flag instead.

 

Then another event would have the mean_time_to_happen as well (note that this'll somewhat randomize when it'll happen) as a trigger checking for that flag you set up in your decision. 

 

trigger = { has_planet_flag = [name of flag] }

 

Alternatively you could try having your decision call the event directly by adding 

planet_event = { id = [event id] days = [number] }

Link to comment

Cool thank you so much for all your help. Could you help me with this also? I'm trying to have an event fire by checking if any pops on the planet have a certain trait.

 

namespace = planetrape

planet_event = {
    id =planetrape.1
    title =planetrape.1.name
    desc =planetrape.1.desc
    picture = #fill
    show_sound = event_swarm_started
    
    trigger = {
        has_owner = yes
        owner ={
            is_ai = no
        }
        has_ground_combat = no
        is_occupied_flag = no
        num_species > 1
        not = { has_planet_flag = rape_culture}
#
                     pop_has_trait = {
                          trait = trait_rape_culture
                     }
#
    }

Link to comment

Try:

any_pop = {
        has_trait = trait_rape_culture
    }

 

You can also require that that pop also has a specific ethic:

any_pop = {
        AND = {
            has_trait = trait_rape_culture
            has_ethic = ethic_authoritarian
        }
    }

 

Or each to see if they have either the trait or the ethic (either fanatic or normal):

any_pop = {
        OR = {
            has_trait = trait_rape_culture
            OR = {
                OR = {
                    has_ethic = ethic_xenophile
                    has_ethic = ethic_fanatic_xenophile
                }
            }
        }
    }

Link to comment

Ah thank you. I've been searching around and even the moding wiki doesn't really help me with this:

 

so if I create a new species via script I know I can just use

 

species = last_created

 

but what if i create multiple species? how would I reference the first create one? I tried species = testspecies and id = testspecies

 

 

Also I have some questions about events:

 

1. Can you have multiple in one script?

planet_event = {

#stuff

}

planet_event = {

#stuff2

}

planet_event = {

#stuff3

}

 

2. So if I have triggers in an event, does the event fire once all triggers are met? Or do I have to call the event somehow?

Link to comment

You have to call the event. Funny story. I'd actually forgotten to add any method of calling my planet events and only noticed this fact last night. lol

 

This is how I'm setting up my planet events: I have an 00_on_actions file in which I have the code:

on_colony_1_year_old = {
    events = {
        sexyplanet_mod.1 #Sexyplanet Modifiers Gatekeeper
    }

    random_events = {
        300 = 0

        #### Colony Events & Chains
        #1 = sexycolony.1 #Invasive Tentacles
        #1 = sexycolony.2 #Xeno Zoo Breakout
    }
}

 

So what this does is once a colony is 1 year old it'll call the event sexy_planet_mod.1. The on_colony argument can use any number. I currently have it set up to 15 years. On the second year it begins to have a chance of calling the sexycolony events.

 

The sexyplanet_mod.1 event is a 'normal' hidden planet event that randomly selects one of two events to fire off.

 

planet_event = {
    id = sexyplanet_mod.1
    hide_window = yes
    is_triggered_only = yes

    trigger = { has_modifier = tentacled_lifeforms }
    
    immediate = {
        if = {
            limit = { 
                has_modifier = tentacled_lifeforms
                NOT = { has_modifier = "aggressive_tentacled_lifeforms" }
                NOT = { has_modifier = "coexisting_tentacled_lifeforms" }
                has_ground_combat = no
                num_pops > 0
            }
            random_list = {
                #50 = { planet_event = { id = [event] days = 30 random = 90 } }
                #50 = { planet_event = { id = [event] days = 30 random = 90 } }
            }
            break = yes
        }
    }
}

 

Do note that I have the items in the random_list commented out because I'm currently still working on it. But it'll trigger one of those events after 30 days, give or take 90 days.

 

If you wanted you could set up your gatekeeper so it calls two or more other planet events instead of just one.

 

As for the species question.... I don't know what exactly you are trying to do, so its hard to give helpful advise.

Link to comment

Hmm okay so I just want to do something simple for me because I'm not too experienced with it.

 

Currently I have 

on_monthly_pulse = {
    events = {
        planetrape.1
    }
}

 

but the planetrape.1 has triggers in order to fire. but I'm not seeing anything come up on each month. If I type "event planetrape.1" in, the event fires.

 

 

 

Could you also clarify what 300=0 is? How does it find sexycolony.1 and .2?

   random_events = {
        300 = 0

        #### Colony Events & Chains
        #1 = sexycolony.1 #Invasive Tentacles
        #1 = sexycolony.2 #Xeno Zoo Breakout
    }

 

Thank you for all your help.

 

The species thing I used

 

create_species = {

      traits = random

}

create_pop = {

       species = last_created

}

 

to spawn a pop and now I want to spawn another pop of that species but I dont want to use last_create again because I'll have multiple species created and they need to be certain ones.

Link to comment

Calling an event using on_monthly_pulse is different than normal.

 

The way I have it set up (note this is for on_annual_pulse which is still the same setup) is it calls an event: This event acts as a gatekeeper for other events:

 

event = {
    id = interstellar_exchange.1
    hide_window = yes
    is_triggered_only = yes
    
    immediate = {
        every_country = {
            limit = { is_ai = no }
            random_list = {
                50 = { country_event = { id = interstellar_exchange.2 } }
                30 = { country_event = { id = military_affairs.1 } }
                20 = { country_event = { id = robotsex.1 } }
            }
        }
    }
}

 

Notice the every_country action there. Without that nothing is going to happen because those on_pulse triggers have no natural targets. Something else super important to keep in mind as well is if you use this method you need to replace OWNER with THIS. Its... a bit wonky. lol.

Link to comment

I'm not that experienced with coding lol thank you for helping me out. So is the gate keeper like a placeholder?

 

Does this look right?

 

on_monthly_pulse = {
    event = {
        id = project_pasiphae_placeholder
        hide_window = yes
        is_triggered_only = yes
    
        immediate = {
        every_country = {
            limit = { is_ai = no }
                country_event = { id = planetrape.1 }
            }
        }
    }
}

 

 

planetrape.1 is the event i want to happen when the triggers are met (they are in the planetrape.1 event) and I took out the random thing because I only have the one event so far.

Link to comment

No. The gatekeeper is an event that calls another event. I'd say its commonly used in instances when you want variation or some degree of randomization.

 

And I don't think your code there will work.

 

just do:

 

on_monthly_pulse = {

   every_country = {

     event = planetrape.1

   }

}

 

If all you want to do is call that event every month. It'll check planetrape.1's triggers. And in planetrape.1's triggers I'd have is_ai = no.

Link to comment

Hm, so its not working. Noob question, do they need to be in my main stellaris in program files folder? or is it fine in the documents paradox stellaris mods folder?

 

EDIT: The ai = no is in the triggers, and if I type the event in, it work but only if I select the planet.

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use