Hi guys,
It's the first time I'm trying to make a mod. Spent yesterday with some trial and error, which was fun but what I want isn't happening yet so I hope you have some tips.
What I want to do is a little series of events where when an admiral reaches level 5 in a military republic, he or she can become a sort of Julius Ceasar. So you get a little window when the admiral reaches level 5 saying this very experienced and popular admiral could be trouble. I'm already running into trouble with this bit and haven't started the next part. Next I want that when the admiral enters the capital system there is a chance he/she will try to take over (cross the Rubicon/land on the capital planet) maybe you can stop this with some influence or else your government form will change into a military dictatorship with the erstwhile admiral as leader of the empire.
Just for some character to add to your empire, with a few more of these events for other government types/empire traits I hope to add a bit more flavor to your empire. Also it's fun to try to mod something .
That's the plan at least.
On to the code:
I've got an on-action:
Actual events:
Of course also a bit of not-finished flavor text but that's not important yet I guess (it's in the zipped attached mod).
Most of this code is just copy & paste and modified a bit, so there could be glaring mistakes. I'm not sure I fully understand scope. Are there any guides for that, I couldn't find any.
In any case when I use the console with: "mod_extra_events.2" I get the following error in the error.log [
[12:13:39][effect_impl.cpp:143]: Script Error: Invalid context switch[from], file: events/extra_events_1.txt line: 41, Scope:
type=country
id=0
random={ 791423972 791423972 }
]
Now I guess because the event then is a country scope, not a leader scope? But if I use "skills 1" to level up an admiral to 5 nothing happens either. (that why now it's got "has_level > 3" before I had "has_level = 5" but well there was no difference and it's an easy change).
Does anyone know how to make this happen? Do you need more information from me? Thanks for taking a look!
It's the first time I'm trying to make a mod. Spent yesterday with some trial and error, which was fun but what I want isn't happening yet so I hope you have some tips.
What I want to do is a little series of events where when an admiral reaches level 5 in a military republic, he or she can become a sort of Julius Ceasar. So you get a little window when the admiral reaches level 5 saying this very experienced and popular admiral could be trouble. I'm already running into trouble with this bit and haven't started the next part. Next I want that when the admiral enters the capital system there is a chance he/she will try to take over (cross the Rubicon/land on the capital planet) maybe you can stop this with some influence or else your government form will change into a military dictatorship with the erstwhile admiral as leader of the empire.
Just for some character to add to your empire, with a few more of these events for other government types/empire traits I hope to add a bit more flavor to your empire. Also it's fun to try to mod something .
That's the plan at least.
On to the code:
I've got an on-action:
Code:
on_leader_level_up = {
events = {
mod_extra_events.2 #gatekeeper for various events
}
}
Actual events:
Code:
namespace = mod_extra_events
country_event = {
id = mod_extra_events.1
title = "mod_extra_events.1.name"
desc = "mod_extra_events.1.desc"
picture = GFX_evt_federation_fleet
location = ROOT
is_triggered_only = yes
trigger = {
is_country_type = default
has_government = military_republic
hidden:fromfrom = { #hidden:fromfrom?
leader = {
has_leader_flag = ambitious_admiral
}
}
}
immediate = {
fromfrom = {
leader = { save_event_target_as = officer }
solar_system = { save_event_target_as = system }
}
}
option = {
name = "mod_extra_events.1.name.a"
#start event chain
}
}
country_event = {
id = mod_extra_events.2
hide_window = yes
is_triggered_only = yes
immediate = {
from = { #error! [[12:13:39][effect_impl.cpp:143]: Script Error: Invalid context switch[from], file: events/extra_events_1.txt line: 41, Scope:
#type=country
#id=0
#random={ 791423972 791423972 }]
# fromfrom also errror
if = {
limit = {
leader_class = admiral
has_level > 3
}
set_leader_flag = ambitious_admiral
owner = { country_event = { id = mod_extra_events.1} }
}
}
}
}
Of course also a bit of not-finished flavor text but that's not important yet I guess (it's in the zipped attached mod).
Most of this code is just copy & paste and modified a bit, so there could be glaring mistakes. I'm not sure I fully understand scope. Are there any guides for that, I couldn't find any.
In any case when I use the console with: "mod_extra_events.2" I get the following error in the error.log [
[12:13:39][effect_impl.cpp:143]: Script Error: Invalid context switch[from], file: events/extra_events_1.txt line: 41, Scope:
type=country
id=0
random={ 791423972 791423972 }
]
Now I guess because the event then is a country scope, not a leader scope? But if I use "skills 1" to level up an admiral to 5 nothing happens either. (that why now it's got "has_level > 3" before I had "has_level = 5" but well there was no difference and it's an easy change).
Does anyone know how to make this happen? Do you need more information from me? Thanks for taking a look!