except "rom_rome" is a faction key not a region key![]()
except "rom_rome" is a faction key not a region key![]()
Magnar Plays Magnar Mod: https://www.youtube.com/playlist?lis...r7s7EZQXeu3yaC
Magnar Tutorials: https://www.youtube.com/channel/UCtd..._n1Y7DrBtVK-1A
My Youtube Channel: https://www.youtube.com/channel/UCtd4sdZYB_n1Y7DrBtVK-1A
thanks,
local settlement_name = context:garrison_residence():region():settlement():name()
local region = context:garrison_residence():region():name()
"settlement:"..region..":"settlement_name
but, SETTLEMENT_SCRIPT_INTERFACE not contain name(), how get it?
thanks,
local settlement_name = context:garrison_residence():region():settlement():name()
local region = context:garrison_residence():region():name()
"settlement:"..region..":"settlement_name
but, SETTLEMENT_SCRIPT_INTERFACE not contain name(), how get it?
Sorry, don't understand your question. There is only one settlement per region so you only need the region name.
~ Too soon old, too late smart ~
sorry for my english, command :
scripting.game_interface:grant_unit("settlement:rom_scythia_scythia:gelonus","Mer_Ibe_Noble_Fighters")
i want get region and settlement name from event(settlement selected) and command :
scripting.game_interface:grant_unit("settlement:"..region..":"..settlement..,"Mer_Ibe_Noble_Fighters")
region = context:garrison_residence():region():name(), but settlement = ???
local function OnGrantUnits(context)
local var1 =
TCS_Log_Update(var1)
local owning_faction = context:garrison_residence():faction():name()
if owning_faction == "rom_roxolani" then
scripting.game_interface:grant_unit(var1,"Mer_Ibe_Noble_Fighters")
end
end
i dont get a settlement names for my variable(
hmm, in wrath of sparta campaign settlement_id = "settlement:"+region key, in rome campaign "settlement:"+region key":"+settlement name. Anyone could find a settlement_id ?
@Seregavg, I fully share your frustration because I have been trying to make those game_interface add/grant unit commands work for 3 hours until now. I have been trying to RE it to understand which parameters formats are requested (the "settlement:" prefix for example), which fields must be used (region names don't work, settlement ids from ESF don't work, combinations don't work), which parameters must be adapted from Attila's documentation (the only one which is available on the web and containing the function interfaces) but i'm still in a black hole.
__________
I'm disappointed because this community is good, many modders are even helpful but as soon as anyone wants to push on the "advanced customizations" pedal, then the effort becomes exponential. Actually not even exponential because you don't have any way to estimate how long it will take to get to a final statement, be it red or green. The effort becomes huge and totally unpredictable. I don't want to make assumptions about the real backstage reasons that make this happen but it happens because the available documentation is poor.
I don't have a whole Tbyte of code samples from CA or from top-tier modders and I must rebuild the wheel everytime I face an undocumented or scarcely documented function. This is not progress.
What I also know is that you can't fully rely on forums because the skilled "community" able to provide advanced answers is a dozen of persons, maybe less, with their jobs and life.
I'm humbly working to try out something that the community of players might enjoy but it's a lost battle. It takes too much time, too many "black box" experimentations and after 1 script and 4 mods with low/very low popularity, my bright side pushes me to improve my newbie performances but my dark side, the pragmatical one, suggests me to focus on something that makes a better use of my time than reverse-engineering badly documented functions as a precondition for every creative development.
This is why I warmly ask some enlighted modders, possibly close to CA, to take this post as a "constructive" complaint (actually it's pure frustration by now) and to support with more vitality the creation proposal of a programming reference manual. Considering the small amount of modders that have time/skills to script and the low frequency at which new discoveries are achieved, I would elaborate something if i was in charge to decide.
Don't take this as a "please open all interfaces" post. I can presume there are reasons behind, that involve corporate strategies. Take it as a "guys, limit reached, we should proactively share some more details now or our modders' wives will ask for divorce. Massively.".
Prime
totally agree with you,
local function OnGrantUnits(context)
if context:garrison_residence():settlement_interface():region():owning_faction():name() == "rom_roxolani" then
scripting.game_interface:grant_unit("settlement:rom_scythia_scythia:gelonus","Mer_Ibe_Noble_Fighters")
end
end
scripting.AddEventCallBack("FactionTurnStart", OnGrantUnits)
is work, but
scripting.game_interface:grant_unit("settlement:???????????????settlement_id?????????","Mer_Ibe_Noble_Fighters")
in rome campaign does not want.
and where to find information - it is not clear
Hey guys,
I would like to add some money to the faction if its treasury was more than a fixed amount or subtract some money if its treasury was less than a fixed amount.
Adding money way has works, it looks like this:
But I was not able to get it to work with scripting.game_interface:treasury_mod(current_faction, -250)Code:local function AddMoney(context) local current_faction = context.string; local treasury_count = context:faction():treasury(); if treasury_count <= 500 then scripting.game_interface:treasury_mod(current_faction, 250); end end scripting.AddEventCallBack("FactionTurnStart", AddMoney)
So I turned to other methods.
Has someone any experiences with the losing_money function and its parameters?
I've tried to written this but it didn't work.Code:local function SubtractMoney(context) local current_faction = context.string; local treasury_count = context:faction():treasury(); if treasury_count >= 20000 then -- Here I wanna subtract the faction's money when it more than 20000. scripting.game_interface:losing_money(current_faction, 3000); end end scripting.AddEventCallBack("FactionTurnStart", SubtractMoney)
And the set_tax_disabled function doesn't work either.
Code:local function SubtractMoney(context) local current_faction = context.string; local treasury_count = context:faction():treasury(); if treasury_count >= 20000 then scripting.game_interface:set_tax_disabled(current_faction); end end scripting.AddEventCallBack("FactionTurnStart", SubtractMoney)
Is there a way to subtract a faction's treatury?
Thanks in advance!
Hey so I've replaced a number of vanilla traits with new ethnic traits for my upcoming mod. So now the Roman characters can get traits that describe them as an Illyrian-Roman or an Italo-Roman, etc. I set the chance to 100 and the value to 1 for each trait. I want every Roman general to have 1 of these traits. Below is the code I'm using at the moment, and its working for the most part. The traits work, and appear, but the code doesn't know how to limit them. So when I spawn a new general he ends up with 2-3 of them. My commanders are Iberian, Brito, and Dacian-Romans at the same time haha. The last piece of the code needed is a way stop that and ensure that the general only receives 1 of them.
char_is_general(context:character()) and context:character():faction():name() == "emp_antony" or context:character():faction():name() == "emp_lepidus" or context:character():faction():name() == "emp_octavian" or context:character():faction():name() == "emp_pompey" and context:character():model():campaign_name("main_emperor") and context:character():number_of_traits() <1
Avatar courtesy of Joar.