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

junjun16

Corporal
11 Badges
Apr 7, 2020
29
0
  • Stellaris
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Stellaris - Path to Destruction bundle
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Stellaris: Federations
  • Stellaris: Synthetic Dawn
I am trying to make mod to change the galactic community forming mechanism.
I am confused about the script

In galactic_community_events.txt:

# Proposal to form the Galactic Community (HIDDEN)
Code:
# Proposal to form the Galactic Community (HIDDEN)
event = {
    id = galcom.1
    hide_window = yes

    is_triggered_only = yes

is_triggered_only = yes mean this event suppose to be triggered by another one .
However, I can't find which one did this.

According to the modding wiki, if nothing trigger this one, it will be never polled.
Do you know that is the mechanism here?
 

junjun16

Corporal
11 Badges
Apr 7, 2020
29
0
  • Stellaris
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Stellaris - Path to Destruction bundle
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Stellaris: Federations
  • Stellaris: Synthetic Dawn
Stellaris\common\on_actions\
Thanks.
I found the galcom.1 id there.
Does it mean galcom.1 will be triggered yearly no matter what?
There suppose a condition to control the trigger somewhere like there should be enough contacts built.

At first, I think it is in galactic_community_events.txt in trigger part:

Code:
trigger = {
        NOR = {
            has_global_flag = galactic_community_founded
            has_global_flag = galcom_founding_begun
        }
        has_global_flag = galcom_invitation_begun
[INDENT]...[/INDENT]

So I added a global bool (galcom_invitation_begun) to control which didn''t work. I tried this event in console which showed that the event condition was not met.

So I assume there should be some control mechanism before run the on action galcom.1?
 

Ryika

Field Marshal
52 Badges
Apr 16, 2018
2.813
8.356
No, the on_action means galcom.1 will trigger yearly, no matter what. It's essentially just an event hook that connects the engine with the script system.

Which means, the event is called, and then the trigger conditions within the event are checked, and if the conditions are met (or if there are no conditions), then it will execute the event. If not, then it will do nothing.

The default trigger condition for this event is made up by these elements:

Code:
       NOR = {
           has_global_flag = galactic_community_founded
           has_global_flag = galcom_founding_begun
       }
Both of those flags are added to the global scope by other events in the same file, so you can search for them.

They're essentially there to tell the event that the founding is already in process, or that it was already successful.

Code:
       count_country = { # minimum 3 countries
           limit = {
               is_country_type = default
               is_homicidal = no
           }
           count >= 3
       }
...at least 3 normal countries must exist on the map.

Code:
       any_playable_country = {
           perc_communications_with_playable >= 0.7
           is_homicidal = no
           is_gestalt = no
       }
...one of these countries must have communications with at least 70% of all other players, but they're not allowed to be homicidal (a flag for Fanatical Purifiers, etc), or Gestalts (Robots and Hive Minds).

Only if all conditions are met, will the event trigger.

If you try to trigger it in the console, it should show you which conditions aren't met.
 

junjun16

Corporal
11 Badges
Apr 7, 2020
29
0
  • Stellaris
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Stellaris - Path to Destruction bundle
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Stellaris: Federations
  • Stellaris: Synthetic Dawn
No, the on_action means galcom.1 will trigger yearly, no matter what. It's essentially just an event hook that connects the engine with the script system.

Which means, the event is called, and then the trigger conditions within the event are checked, and if the conditions are met (or if there are no conditions), then it will execute the event. If not, then it will do nothing.

The default trigger condition for this event is made up by these elements:

Code:
       NOR = {
           has_global_flag = galactic_community_founded
           has_global_flag = galcom_founding_begun
       }
Both of those flags are added to the global scope by other events in the same file, so you can search for them.

They're essentially there to tell the event that the founding is already in process, or that it was already successful.

Code:
       count_country = { # minimum 3 countries
           limit = {
               is_country_type = default
               is_homicidal = no
           }
           count >= 3
       }
...at least 3 normal countries must exist on the map.

Code:
       any_playable_country = {
           perc_communications_with_playable >= 0.7
           is_homicidal = no
           is_gestalt = no
       }
...one of these countries must have communications with at least 70% of all other players, but they're not allowed to be homicidal (a flag for Fanatical Purifiers, etc), or Gestalts (Robots and Hive Minds).

Only if all conditions are met, will the event trigger.

If you try to trigger it in the console, it should show you which conditions aren't met.


Thanks!
May I call a global event from a country_event option?
I check the modding wiki which provided the country_event trigger something like:

Code:
event = {
trigger = {... }
immediate={
random_planet = {
    planet_event = { id = my_planet_event.1 }
}
}}

Can I also do it in a similar way to trigger a global event in an option?
I can't find the a grammar to show that, so I mimic the way and give it like:
Code:
option = {
        name = galcom.2.a
        custom_tooltip = galcom_2_aye
        hidden_effect = {
            set_global_flag = galcom_invitation_begun
            event = { id = galcom.1 days = 30 } 
        }
...
}

So I call event like this "event = { id = galcom.1 days = 30 } " .
It doesn't seem to work.

BTW, do you have a better place to learn how to mod?
I spent quite a bit of time to figure out the mechanism and grammar as many things are not given on wiki.

Thanks!
 

Ryika

Field Marshal
52 Badges
Apr 16, 2018
2.813
8.356
May I call a global event from a country_event option?
That's an... interesting problem that I've never actually run into.

Some quick testing shows that you can, but not with:
Code:
event = { id = galcom.1 days = 30 }

Instead, you have to use the wrapper of the scope that you're in, so a country in this case:
Code:
country_event = { id = galcom.1 days = 30 }
As far as I can tell, the event will then automatically switch to the global scope because it's an event, not a country_event.

Keep in mind that this very basic testing, there may be problems with this implementations that aren't obvious to me at first glance.

As for learning how to mod... I think most people do it by looking at the game code, or at mods that do similar things to what they're trying to achieve. There is no good, advanced documentation that I'm aware of outside of the wiki that I'm aware of.

To figure out why a particular event doesn't work, you should generally look at the logs:
Documents\Paradox Interactive\Stellaris\logs

error.log for the most part. The game will tell you where things go wrong, and after a few mess-ups you'll generally understand what you have to fix for any given error message.


Other than that, the Stellaris Modding Den Discord Server seems to be the only place where many modders are active, and a lot of prominent people use it, so maybe that's an option to learn more directly from the experience of others. Can't say for sure though, as I've never used it.

The code isn't that complicated though. You should be able to wrap your head around it just by experimenting, and asking for help when you don't manage to make progress.
 

junjun16

Corporal
11 Badges
Apr 7, 2020
29
0
  • Stellaris
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Stellaris - Path to Destruction bundle
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Stellaris: Federations
  • Stellaris: Synthetic Dawn
That's an... interesting problem that I've never actually run into.

Some quick testing shows that you can, but not with:
Code:
event = { id = galcom.1 days = 30 }

Instead, you have to use the wrapper of the scope that you're in, so a country in this case:
Code:
country_event = { id = galcom.1 days = 30 }
As far as I can tell, the event will then automatically switch to the global scope because it's an event, not a country_event.

Keep in mind that this very basic testing, there may be problems with this implementations that aren't obvious to me at first glance.

As for learning how to mod... I think most people do it by looking at the game code, or at mods that do similar things to what they're trying to achieve. There is no good, advanced documentation that I'm aware of outside of the wiki that I'm aware of.

To figure out why a particular event doesn't work, you should generally look at the logs:
Documents\Paradox Interactive\Stellaris\logs

error.log for the most part. The game will tell you where things go wrong, and after a few mess-ups you'll generally understand what you have to fix for any given error message.


Other than that, the Stellaris Modding Den Discord Server seems to be the only place where many modders are active, and a lot of prominent people use it, so maybe that's an option to learn more directly from the experience of others. Can't say for sure though, as I've never used it.

The code isn't that complicated though. You should be able to wrap your head around it just by experimenting, and asking for help when you don't manage to make progress.
Cool! Thanks!
Can I check their code somewhere?
Is their code open source?

I am curious about the mod loading mechanism. During my trial, it seems that the I can't overwrite vanilla event already in the game such as galcom.1.
Because they always trigger with condition as original one instead my new version.
A even more confusing thing is that when I use console to trigger this event:
Code:
event  galcom.1
It list the condition of my version.
It seems that game triggered event and the console called event with same id are from different versions!!?

However, if I change 00_on_actions.txt and put in my mod. It is effective.
on_yearly_plus trigger event, I can change the trigger from yearly to monthly there.

Their coding suppose to deal with mod txt consistently. Have no idea what is the underlying mechanism.
 

Ryika

Field Marshal
52 Badges
Apr 16, 2018
2.813
8.356
Cool! Thanks!
Can I check their code somewhere?
Is their code open source?
You mean that of other mods? Yeah, just subscribe to them on the Steam Workshop.

Once they've finished downloading, they will be in:
Steam\steamapps\workshop\content\281990\<Some Mod ID>

They may be packaged as zip, so you might have to unpack them first, but the code itself is plain text, and structured like the game files.

I am curious about the mod loading mechanism. During my trial, it seems that the I can't overwrite vanilla event already in the game such as galcom.1.
Because they always trigger with condition as original one instead my new version.
A even more confusing thing is that when I use console to trigger this event:
Code:
event  galcom.1
It list the condition of my version.
It seems that game triggered event and the console called event with same id are from different versions!!?
Did you put the event in a new file?

If so, overriding events is based on file names, and events are First In Only Served, so your file needs to be loaded before the actual game files.

That's usually achieved by adding a ! at the front of your file, so something like !_galcom_events should work.

More information here.

If that's not the problem, then I'm not sure what's going on. The game should either override the entire event, or nothing at all. It might be the case that there's a coding error in your edited file, so make sure to have a look at the logs if you didn't already.[/QUOTE]
 

junjun16

Corporal
11 Badges
Apr 7, 2020
29
0
  • Stellaris
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Stellaris - Path to Destruction bundle
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Stellaris: Federations
  • Stellaris: Synthetic Dawn
Thanks.
For code, I perhaps would like to take a look at engine level for the inconsistent event version issue as I mentioned ( console version vs auto-triggered version) .
But I don't think they will release that part as anyway it is still commercial software.