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

kaiki

Callsign Knight
63 Badges
May 11, 2011
24
9
  • Europa Universalis IV: Conquest of Paradise
  • Pillars of Eternity
  • Stellaris - Path to Destruction bundle
  • Rome Gold
  • Europa Universalis: Rome
  • Europa Universalis IV: Res Publica
  • Heir to the Throne
  • Hearts of Iron III
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Art of War
  • Crusader Kings II
  • Europa Universalis III Complete
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sword of Islam
  • Darkest Hour
  • Europa Universalis III
  • Divine Wind
  • Shadowrun Returns
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Crusader Kings II: Monks and Mystics
  • BATTLETECH
  • Surviving Mars
  • Crusader Kings III
  • Age of Wonders III
  • Crusader Kings II: Jade Dragon
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Surviving Mars: Digital Deluxe Edition
  • BATTLETECH - Digital Deluxe Edition
  • Stellaris: Distant Stars
  • Tyranny: Archon Edition
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Cadet
  • Stellaris
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Way of Life
  • Mount & Blade: Warband
  • Europa Universalis IV: El Dorado
  • 500k Club
  • Rome: Vae Victis
  • Supreme Ruler 2020
  • Europa Universalis III Complete
  • Europa Universalis III Complete
Hello,

I'm trying to create a custom sponsor, I've gotten most of it figured out but I don't know how to increase the research per sol.

If anyone has an idea I'd appreciate it.
 
Hello,

I'm trying to create a custom sponsor, I've gotten most of it figured out but I don't know how to increase the research per sol.

If anyone has an idea I'd appreciate it.

It is a separate line item that is not part of the mission sponsor.

Modify Gameplay.SponsorResearch +######. Example: Modify Gameplay.SponsorResearch +19900 to a base of 100 results in 20000 base sponsor research per Sol.
 
Posted this to the steam forum, but here it is for anyone else who is like me and new to modding.

1. Open up the editor for your sponsor mod and select the "New Item" menu. Then select "Game Value"

2. Change the "Category" dropdown to the "Research" selection.

3. Change the "ID" dropdown to "SponsorResearch"

4. Change either the "Percent" or "Amount" modifiers to get what you want in the final "Modified Amount" box.
 
It is a separate line item that is not part of the mission sponsor.

Modify Gameplay.SponsorResearch +######. Example: Modify Gameplay.SponsorResearch +19900 to a base of 100 results in 20000 base sponsor research per Sol.

Posted this to the steam forum, but here it is for anyone else who is like me and new to modding.

1. Open up the editor for your sponsor mod and select the "New Item" menu. Then select "Game Value"

2. Change the "Category" dropdown to the "Research" selection.

3. Change the "ID" dropdown to "SponsorResearch"

4. Change either the "Percent" or "Amount" modifiers to get what you want in the final "Modified Amount" box.

I have found that using this system DOES work BUT it will modify ALL Sponsor's as long as the mod is loaded (I found this out when trying to creat my own Corp but had another mod loaded and every game would have 20K spon res AND then 400 from my mod. Has anyone figured out How to do this as it is done and supplied in the sample mod Idiocracy?

I believe it is the CreateLableModifier Lua function but I can't seem to figure out how to get it to work properly.

CreateLabelModifier
Create a modifer for a label property.
A label property modifier looks up all objects within a label and modifies one of their properties.
The modification can add an absolute value amount and a relative value percent (0-100). Both can be positive and negative.
You can create multiple modifiers for the same property of a label, but they all must have unique IDs (even between different mods).
The final value of a property is calculated using the formula: original * (100 + total_percent) + total_amount.

void CreateLabelModifier(string id, string label, string property, int amount, int percent)

string id
unique modification identifier.

string label
city label. e.g all buildings are listed in labels with their template_name and build menu category.

string property
property of that label/class.

int amount
amount to be added to the property value (default=0).

int percent
percent change of that value (default=0).
 
Last edited:
I've got it working with my mod, it's this line:
In the "function (self, city)" box:

Code:
CreateLabelModifier("yoursponsornameSponsor", "Consts", "SponsorResearch", 0, 400)
end,

Yoursponsorname = the name of your new sponsor,

Second number = amount of research per sol.

Enjoy!
 
I've got it working with my mod, it's this line:
In the "function (self, city)" box:

Code:
CreateLabelModifier("yoursponsornameSponsor", "Consts", "SponsorResearch", 0, 400)
end,

Yoursponsorname = the name of your new sponsor,

Second number = amount of research per sol.

Enjoy!

A few pointers:

  • It doesn't have to be yoursponsornameSponsor. The identifier can be anything as long as it's unique (i.e. doesn't share a name with another CreateLabelModifier)
  • The second number is the percentage modifier, not the amount modifier. However, given that the default value for sponsor research is 100, the effect would be the same (100 + 400 = 500; 100 + (100 * 4) = 500). Also note what the documentation says: "The final value of a property is calculated using the formula: original * (100 + total_percent) + total_amount." So if you want 400 research per sol, the code required would be
    Code:
    CreateLabelModifier("uniqueID", "Consts", "SponsorResearch", 300, 0)
    or
    Code:
    CreateLabelModifier("uniqueID", "Consts", "SponsorResearch", 0, 300)
    A good idea is to test the values with GameValues in the mod editor because it tells you what the eventual value will be (but be sure to delete those GameValues afterwards).
  • end, should not be there because it's added automatically to the generated Lua file.
  • The changes made here will not be reflected in tooltips because Game Apply is executed only at game start.
 
A few pointers:

  • It doesn't have to be yoursponsornameSponsor. The identifier can be anything as long as it's unique (i.e. doesn't share a name with another CreateLabelModifier)
  • The second number is the percentage modifier, not the amount modifier. However, given that the default value for sponsor research is 100, the effect would be the same (100 + 400 = 500; 100 + (100 * 4) = 500). Also note what the documentation says: "The final value of a property is calculated using the formula: original * (100 + total_percent) + total_amount." So if you want 400 research per sol, the code required would be
    Code:
    CreateLabelModifier("uniqueID", "Consts", "SponsorResearch", 300, 0)
    or
    Code:
    CreateLabelModifier("uniqueID", "Consts", "SponsorResearch", 0, 300)
    A good idea is to test the values with GameValues in the mod editor because it tells you what the eventual value will be (but be sure to delete those GameValues afterwards).
  • end, should not be there because it's added automatically to the generated Lua file.
  • The changes made here will not be reflected in tooltips because Game Apply is executed only at game start.

I have tried multiple variations of this and I can't seem to be getting it to work and I don't know why I've been using unique ID the same taglines and everything and it just won't modify the research.
 
If you are like me and copy pasted from the Idiocracy sample mod then it is because of a typo in "CreateLabelModifier" (They have it spelled "CreateLabelModifer)
It took me face palming ages for me to discover that mistake even after discovering that it didn't work right in the sample mod.
 
If you are like me and copy pasted from the Idiocracy sample mod then it is because of a typo in "CreateLabelModifier" (They have it spelled "CreateLabelModifer)
It took me face palming ages for me to discover that mistake even after discovering that it didn't work right in the sample mod.

This THIS is my problem. BUT no longer!

if I could give you a cookie sir you would have it!
 
CreateLabelModifier
Create a modifer for a label property.
A label property modifier looks up all objects within a label and modifies one of their properties.
The modification can add an absolute value amount and a relative value percent (0-100). Both can be positive and negative.
You can create multiple modifiers for the same property of a label, but they all must have unique IDs (even between different mods).
The final value of a property is calculated using the formula: original * (100 + total_percent) + total_amount.

void CreateLabelModifier(string id, string label, string property, int amount, int percent)

This solved one of my problems (I never did figure out how to dynamically calculate the label in the tool text and have it include this value, something that one would want to do if other mods globally edit the sponsorships, but finally my Sponsor is working more-or-less correctly!

What I want to know, is where you found this excellent documentation? I've been churning through the modding docs that shipped with the ModTools, and I can't find anything like this in there.
 
This solved one of my problems (I never did figure out how to dynamically calculate the label in the tool text and have it include this value, something that one would want to do if other mods globally edit the sponsorships, but finally my Sponsor is working more-or-less correctly!

What I want to know, is where you found this excellent documentation? I've been churning through the modding docs that shipped with the ModTools, and I can't find anything like this in there.

Its in those docs i followed a link from the main page that pops up every time you start the mod editor. I'll edit this with mor info later. On ma cell
 
Its in those docs i followed a link from the main page that pops up every time you start the mod editor. I'll edit this with mor info later. On ma cell

Thanks to your pointing me in the right direction, I was able to find it!

The navigation to it is non-obvious (at least to me); after doing a grep of the whole docs directory, I was able to locate it in the LuaFunctionDoc_Gameplay.md.html file, and then figured out a set of links that took me there from the top-level index.html.
 
Another issue is the Research per Sol: <research(0)> text. <research(0)> is a hardcoded solution where the parameter, in this case 0, is the amount you want to be shown in the description. But this value will not update if you have mods with global modifications active.

Does anyone know about the variable that holds the final SponsorResearch value?
 
Wouldn't matter. The reason you have to hard-code it is because none of the stuff that change it applies until after you have selected your landing site.

For a CustomSponsor, you're right!

This should show the final modified research value, but it won't show modification that happens through code.
Code:
Research per Sol: <research(SponsorResearch)>
Like with the following LabelModifier in the 'game_apply' function:
Code:
CreateLabelModifier("MyResearchBoost", "Consts", "SponsorResearch", 400, 0)
It will however update if you have active mods with GameValue items that modifies SponsorResearch...

Original sponsors doesn't have hard-coded values. They do not alter values through code but like this:
Code:
PlaceObj('MissionSponsor',  {
    ...
    PlaceObj('TechEffect_ModifyLabel', {
        'Label',"Consts",
        'Prop',"SponsorResearch",
        'Amount',200,
    })
})
Haemimont says that the mod tools will at some point be updated so we can add items like TechEffect's to our CustomSponsor's and such.

Until then, a hardcoded value seems to be the best option.
 
Also nothing keeps you from doing something like this in a regular text editor:
Code:
PlaceObj('ModItemMissionSponsor', {
    'name', "SpaceX",
    'display_name', T{801235285272, --[[ModItemMissionSponsor SpaceX display_name]] "SpaceX"},
    'challenge_mod', 40,
    'funding', 8000,
    'cargo', 70000,
    'initial_rockets', 3,
    ...
}, {
    PlaceObj('TechEffect_ModifyLabel', {
        'Label', "Consts",
        'Prop', "SponsorResearch",
        'Amount', 1000,
    }),
    PlaceObj('TechEffect_ModifyLabel', {
        'Label', "Consts",
        'Prop', "FoodPerRocketPassenger",
        'Percent', 100,
    }),
})

This will make your MissionSponsor a tree-view in the mod editor. Allowing you to change the TechEffect_ModifyLabel parameters. For new TechEffect's you'd have to add them manually to the lua file. But the editor seem to support it already!
 
Welp that was an incredibly useful example thanks, I must have gotten the syntax wrong when I messed with that originally. I wish the logs gave more useful debugging info. And yeah with that there doesn't seem to be any more reason to hard-code the values.