• 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
Not sure if it's a bug or not (used to work fine before 1.2), but i have been wasting 2 days on this without any solution. My pirate script is broken, but everything works fine, at least as far as the error logs are concerned. What happen is that my pirates never go home. Their station is alive and well, but they "forgot" how to return to it. Old code look for a system with a planet with "target_event:pirate_home", work fine as long as it point to a planet. Everything breaks when that event target is set on a ship, namely the pirate station (ie when it create a new fleet from it). There is just no code that allow a fleet to locate a ship, only systems and planets. So my fleets look for a planet home but don't find it because it's a space station... Just can't find a workaround and i tried for 2 days. The easiest fix would be to change that target to a planet but can't seem to figure out how to convert a ship location to the planet it is in orbit around...

Anybody has any idea?

Edit: Can't do anything for that smiley.
 
Are you setting the pirate_home target in the same event you're calling?

Event targets are not global, they exist in the event itself only and must be declared before they are called.

Look at \events\pirate_events.txt event pirate.1. In the immediate, it first sets pirate_home by this:
Code:
                random_system_planet = {
                    limit = { is_asteroid = yes }
                    save_event_target_as = pirate_home
That creates the pirate_home target in that event only, so that follow-up actions inside the same event to create the fleet can work.

If you're creating a new event and want to find the existing pirate home system, look at the event pirate.2 instead. This locks down the pirates' home system as such:
Code:
        random_owned_ship = {
            limit = { is_ship_size = pirate_station }
            save_event_target_as = pirate_home
Since the event is run for is_country_type = pirate it will thus set the event target pirate_home to the same system the pirate_station is already in.
 
Are you setting the pirate_home target in the same event you're calling? Look at \events\pirate_events.txt event pirate.1

In the immediate, it first sets pirate_home by this:
Code:
                random_system_planet = {
                    limit = { is_asteroid = yes }
                    save_event_target_as = pirate_home
That creates the pirate_home target in that event only, so that followup events for the fleet can work.

If you're creating a new event and want to find the existing pirate home system, look at the event pirate.2 instead. This locks down the home system as such:
Code:
        random_owned_ship = {
            limit = { is_ship_size = pirate_station }
            save_event_target_as = pirate_home
Since the event is run for is_country_type = pirate it will thus set the event target pirate_home to the same system the pirate_station is already in.

Nah, my problem is i changed the pirate event heavily and no longer build the fleet along the station; all fleets are built in pirate.2 where the pirate_home is set on the station itself. It used to work fine, or at least i never noticed the bug before. But i think i found a workaround; using a planet flag when creating the station so the script only has to look for a system with both the owned station and the planet flag (not sure if the flag remain after the pirates are destroyed so i check for both) .
 
Yeah, that will work, as long as you have only one pirate nation so the event doesn't get confused.

Looking for a owned ship should point to the correct pirate nation. My problem right now is to combine the looking for that planet with a flag and the owned ship check. Seem the scopes were never meant to be used along so i'm struggling to find how to check for both before assigning the pirate home.
 
here where i'm currently stuck :

Code:
        random_system = {
            limit = {
                any_planet = { has_planet_flag = pirate_hideout }
                any_ship_in_system = { 
                    is_ship_size = pirate_station
                }
            }   
            random_system_planet = {
               limit = { 
                    has_planet_flag = pirate_hideout
                }
                save_event_target_as = pirate_home
            }   
        }

Only thing missing is checking the ownership of said station (or else that pirate fleet will likely return to the wrong pirate station). Can't find anything that would allow this, but it's the only thing missing for my script to work so i'm unwilling to give it up.
 
It seem the game is hell bent on preventing my script from working. Fleets can't use a ship as a home, and can't transfer the event target to the planet bellow the pirate station. It's as if all the game code was meant to not allow it, no combination of code i could think of has worked so far. I'm sure it's a bug, fleets used the pirate station as a home before and it worked just fine, but now it doesn't and it's not due to the changes i made (as far as i can tell). Damn, i'm so close to get it right but i'm wasting time looking for an elusive piece of code that may not even exist...