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

Cniht

Sergeant
56 Badges
Jun 15, 2004
89
26
  • BATTLETECH
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Conclave
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Crusader Kings II: Reapers Due
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Monks and Mystics
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Pre-order
  • Stellaris: Synthetic Dawn
  • Crusader Kings II: Jade Dragon
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • BATTLETECH: Flashpoint
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Stellaris: Ancient Relics
  • Stellaris: Necroids
  • Europa Universalis III: Chronicles
  • Crusader Kings II
  • 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: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Darkest Hour
  • Deus Vult
  • Europa Universalis III
  • Hearts of Iron II: Armageddon
  • Divine Wind
  • Europa Universalis IV
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Heir to the Throne
  • March of the Eagles
  • Semper Fi
  • Sengoku
  • War of the Roses
Ok guys I'm needing a little help with determining what the code means with the factor modifiers and other thing. I'll post a few examples. I'm trying to tweak a few problems I see with some of the chracter trait developments and potentially add new ones.

Example.

#
# An offspring finishes his/her education
# He/she became a midas_touched
#
character_event = {
id = 1036
picture = "event_education"
trigger = {
condition = { type = gender value = male }
condition = { type = age value = 15 }
condition = { type = trait value = court_education }
}
mean_time_to_happen = {
months = 50
modifier = {
condition = { type = not value = { type = diplomacy value = 5 } }
factor = 1.05
}
modifier = {
condition = { type = diplomacy value = 8 }
factor = 0.95
}
modifier = {
condition = { type = not value = { type = intrigue value = 5 } }
factor = 1.05

*****************************************************
Questions:

Do you have to achieve every trigger to get the event to fire or just one?
(I'm kind of thinking just one as I have a king who is 23 and just lost his martial education but want to make sure)

On the condition values, when such is triggered, is that factor modifier an added thing? Or is it a multiple? And what are we looking for as an end result to 'get' the trait or 'not get' the trait?


Months= <-----I'm assuming this means CK checks this specific firing every x ammount of months.

Id=1036 <--------------Are there finite numbers of these, do they have any special relation if there are not. Can we add more, or would that cause very bad things to happen. What importance if any does this valiue have.

*********************************************
MODDING Buildings.

royal_post =
{
cost = { gold = 100 prestige = 0 piety = 0 }
construction_time = 12

lasting_effects =
{
demesne = 0.2
percentage_score = { gold = 0.95 }
# periodic_score = { gold = -1 }
}
additional_return_on_investment = 0.06 #demesne bonus

**********************************
Cost I understand, I'm running into problems with a few commands.
Demesne = .2 <---------------is this a multiplier or an added modifier? (sometimes i think one sometimes i think the other.)

Can I add the demesne modifier to other buildings? When done if i can, will it report the modifier correctly in the gui, or does it need something added which I am unable to do without decompiling things?


percentage_score = { gold = .95} <---------------This is clearly a multiple modifier, and that's part of the confusion from above.

periodic_score = {gold = -1} <---------------No clue would love an explination. Although from the # at the first of the line i'm thinking it is commented out.

Additional_return_on_investment = .06 <------is this where it was changed to a .8 bonus from a .2 as it was previously for the appearance of it working 'backward' and how can you specify what 'additional return on investment' will modify. or does it always modify the value of the modifier which isn't in brackets?
 
Do you have to achieve every trigger to get the event to fire or just one?
I believe that there is an implicit AND between the conditions, however you can add an AND or an OR condition if you want to be sure.

In this case you want an AND, because you don't want the event to trigger for boys (age less than 15) with a martial education, or for little girls with a court education.

On the condition values, when such is triggered, is that factor modifier an added thing? Or is it a multiple? And what are we looking for as an end result to 'get' the trait or 'not get' the trait?

The factors are factors that you apply to the MTTH (your month/day/year value). A low (<1) factor will mean that the event triggers more often and sooner.

Months= <-----I'm assuming this means CK checks this specific firing every x ammount of months.

Nope, the months command is part of the mean_time_to_happen (MTTH) command. In your event it will happen on average every 50 months (to everyone who satisfies the conditions). How often the conition is checked and what chance it then has to fire depends on your computers specs (So on an min spec computer it may give a 12% per half year chance, but on a super-computer have a 1/15% chance per day).

Id=1036 <--------------Are there finite numbers of these, do they have any special relation if there are not. Can we add more, or would that cause very bad things to happen. What importance if any does this valiue have.

Id's must be unique, no two events can have the same id. There is a finite number (but its quite big), and so there are plenty of extra's for people to play with.

Can I add the demesne modifier to other buildings? When done if i can, will it report the modifier correctly in the gui, or does it need something added which I am unable to do without decompiling things?

Most changes should be viewable in the GUI if you just change them. There are some exceptions (like the Additional_return_on_investment, which is only for the AI - see below).

periodic_score = {gold = -1} <---------------No clue would love an explination. Although from the # at the first of the line i'm thinking it is commented out.

yep, I belive that the brewary's effects are like this (but uncommented).
Anything that happens to the right of a # is just a comment.

Additional_return_on_investment = .06 <------is this where it was changed to a .8 bonus from a .2 as it was previously for the appearance of it working 'backward' and how can you specify what 'additional return on investment' will modify. or does it always modify the value of the modifier which isn't in brackets?

This is a special function that allows the AI to decide that the build is better than it looks. For example a road will help the spread of technology (in the technology spread events), but since you don't want to duplicate that information here the Additional_return_on_investment is just a way of telling the AI that this build is good for some hidden reason (it has no effect on players).
 
This is better off in the event scripting sub forum - so...would some kind mod move it there, please.

Thanks.
 
I wrote a post going through one of my modded education events line by line, explaining what was happening. You can find that post in the "Event scripting tricks and traps" sticky in the Event Scripting forum - I believe it is post 26, top of the second page of posts.
 
Sonny said:
This is better off in the event scripting sub forum - so...would some kind mod move it there, please.

Thanks.
*moved*
 
Cniht said:
Questions:

Do you have to achieve every trigger to get the event to fire or just one?
(I'm kind of thinking just one as I have a king who is 23 and just lost his martial education but want to make sure)
As Fawr says, they are implicitly ANDed together. The instances where you see an AND in the code is where it is convenient for us to put it there to make things easier to read (usually when nested).

On the condition values, when such is triggered, is that factor modifier an added thing? Or is it a multiple? And what are we looking for as an end result to 'get' the trait or 'not get' the trait?
All applicable factors (ones whose conditions are satisfied) are multiplied to the base mtth value to determine the net effective mtth for the event. A factor of 1 makes no change (mtth * 1 = mtth), a factor less than 1 will make the mtth value lower and and factor greater than 1 will make it higher.

If you use condition = { type = diplomacy value = 5 } then this will return as true if the dimplomacy value is 5 or higher. If it's a character event then it's the character's diplomacy value that is looked at, but if it's a province or a p_x_p event then it's the realm diplomacy value that is used. In a p_x_p or province evnet you could still check just the ruler's diplomacy value (or, perhaps, the chancellor's value if you prefer) via the use of the new csc tools.

If you use condition = { type = not value = { type = diplomacy value = 5 } } then this will return as true if the diplomacy value is less than (but not equal to) 5. Again, the value being checked depends on the type of event as per the above example.

In general, if a condition is specifying a value to check against then it will return true if it is equal to or greater than the value. Using NOT will flip this to return true if it is less than the value.

Months= <-----I'm assuming this means CK checks this specific firing every x ammount of months.
As Fawr says, this is a vule used to determine the approximate average length of time that would be expected to elapse for this event to fire for repeated checks. He is incorrect with regards to the frequency that the event is checked since it is in no way related to the computer's specs.

Id=1036 <--------------Are there finite numbers of these, do they have any special relation if there are not. Can we add more, or would that cause very bad things to happen. What importance if any does this valiue have.
As Fawr says, this number must be unique to every event. I will add further that Paradox has reserved the event ID range 0001 through 9999 for internal use so I would very strongly advise you not to script an event in that ID range even if the ID is currently unused. Future DEMs will continue to add many "official" Paradox events and those of us who are scripting them will never use an ID higher than 9999 but we could use any available ID below that. I don't recall whether there's an uper limit to the ID range but I'd suggest sticking to an ID that's less than a mililion. That would give you 990000 events to script before you run out of IDs (and if you have that many events your computer will slow to a crawl anyway ;)).

Cost I understand, I'm running into problems with a few commands.
Demesne = .2 <---------------is this a multiplier or an added modifier? (sometimes i think one sometimes i think the other.)
For this particular command it is additive and is used to determine at what point the efficiency penalty kicks in. The effect is that this structure will eliminate the first 20% of the efficiency penalty - allowing the province to suffer no loss of income if you're 2 provinces over your limit. (Note that this would only be true for this province. If you have otehr provinces that don't have the this structure then they will suffer the normal efficiency penalty.)

Can I add the demesne modifier to other buildings? When done if i can, will it report the modifier correctly in the gui, or does it need something added which I am unable to do without decompiling things?
Yes, this will work just as it currently does for RP and GP. Note that the GUI feedback is somewhat limited on this function and is really most easily seen if you have a very large demesne and then check the province's income dropdown and comare the reported demesne efficiency penalty to the expected one (it doesn't get a separate line of its own and is simply subtracted from the DEP before it is reported).

percentage_score = { gold = .95} <---------------This is clearly a multiple modifier, and that's part of the confusion from above.
That's the cost to have the building in the province. It will reduce your monthly income from that province by 0.95 (all income modifiers of this type are multiplied together in a province so if you have several structures with this type of maintenence cost then they are multiplied, not added, to determine the net effect. Example: having 2 buildings with 0.9 results in a total of 0.81 modifier, not 0.8).

periodic_score = {gold = -1} <---------------No clue would love an explination. Although from the # at the first of the line i'm thinking it is commented out.
Yes. Commented out. In the original alpha version of the code (long before release) all buildings had set value amounts. Many of these were later changed to percentage modifiers but the original lines were left in place in case we wanted to revert to set amounts later. I never got around to going back and removing them later but I'll probably take some time to go through the file and remove these lines before 1.04 is released.

Additional_return_on_investment = .06 <------is this where it was changed to a .8 bonus from a .2 as it was previously for the appearance of it working 'backward' and how can you specify what 'additional return on investment' will modify. or does it always modify the value of the modifier which isn't in brackets?
This is a recent addition (1.03) and is, as Fawr says, a "hidden" value that has no effect on the building. The sole function of this modifier is to instruct the AI as to what priority to assign to the construction of improvements. The AI's code uses the expected return on investement and thus any building that doesn't have one would never get built. I have added ROI modifiers to the majority of buildings so the AI will now build them, and the sequence that it does this in is determined using these modified values (ROI modifier is additive by percentage).

Some modders might want to tweak these values if they feel that I have assigned them inappropriately, although I feel that they are failry well balanced. Remember that some structures have hidden or non-cash-producing functions (particularly with regards to the research and spread of advances) and have thus been tweaked to encourage the AI to build them. The same is true of several other structures (PJ, RP, GP) which have less tangeable direct benefits but should be a priority for the AI.