• 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.
GreenMarine said:
Anyone have a link to console commands? How do I fire off an event for a specific province from the console?
Do a search for a thread of cheat codes in the GD forum. I think I saw it on page 3 or 4 earlier today and it has a post from Havard that gives the console commands to cause an event to fire. I forget it right at present, but if you find it then perhaps you'd be so kind as to copy it into this thread for future reference.

I guess we'll need a scripting FAQ thread at some point that is stickied at the top of the forum. I'll lift a bunch of stuff out of here when I do it (unless some kind soul beats me to it).
 
MrT said:
Do a search for a thread of cheat codes in the GD forum. I think I saw it on page 3 or 4 earlier today and it has a post from Havard that gives the console commands to cause an event to fire. I forget it right at present, but if you find it then perhaps you'd be so kind as to copy it into this thread for future reference.

This one?
 
GreenMarine said:
Anyone have a link to console commands? How do I fire off an event for a specific province from the console?
Select the province first (by clicking on it).

F12

provevent ####

For character event, select a character first (by clicking on his portrait)

charevent ####

Note that trying to fire a Charevent without selectioning a character, or a province event without selecting a province, will cause a CTD.

Cheers,

Cat
 
MrT said:
I guess we'll need a scripting FAQ thread at some point that is stickied at the top of the forum. I'll lift a bunch of stuff out of here when I do it (unless some kind soul beats me to it).
MrT, I am currenty updating the event_effect.txt file, and plan to do some events bible like Havard did for EU2.

No need to duplicate the effort :)

Cat
 
Cat Lord said:
MrT, I am currenty updating the event_effect.txt file, and plan to do some events bible like Havard did for EU2.

No need to duplicate the effort :)

Cat
Cool, that are good news! :)
Thanks a lot for your great input since now.
 
One more event scripting question! ;)
Concernig to the modifiers of this "An offspring finishes his education(Midas touched)":
Code:
mean_time_to_happen = {
		months = 50

		modifier = {
			condition = { type = father_trait value = detached_priest }
			factor = 1.6
		}
		modifier = {
			condition = { type = father_trait value = martial_cleric }
			factor = 1.2
		}
		modifier = {
			condition = { type = father_trait value = scholarly_theologian }
			factor = 0.8
		}
		modifier = {
			condition = { type = father_trait value = mastermind_theologian }
			factor = 0.6
		}
		modifier = {
			condition = { type = father_trait value = misguided_warrior }
			factor = 1.6
		}
		modifier = {
			condition = { type = father_trait value = tough_soldier }
			factor = 1.2
		}
		modifier = {
			condition = { type = father_trait value = knowledged_tactician }
			factor = 0.8
		}
		modifier = {
			condition = { type = father_trait value = brilliant_strategist }
			factor = 0.6
		}
		modifier = {
			condition = { type = father_trait value = naive_wirepuller }
			factor = 1.6
		}
		modifier = {
			condition = { type = father_trait value = flamboyant_schemer }
			factor = 1.2
		}
		modifier = {
			condition = { type = father_trait value = intricate_webweaver }
			factor = 0.8
		}
		modifier = {
			condition = { type = father_trait value = illusive_shadow }
			factor = 0.6
		}
		modifier = {
			condition = { type = father_trait value = amateurish_pettifogger }
			factor = 1.6
		}
		modifier = {
			condition = { type = father_trait value = proven_dealbreaker }
			factor = 1.2
		}
		modifier = {
			condition = { type = father_trait value = charismatic_negotiator }
			factor = 0.8
		}
		modifier = {
			condition = { type = father_trait value = grey_eminence }
			factor = 0.6
		}
		modifier = {
			condition = { type = father_trait value = hole_in_the_pocket }
			factor = 1.6
		}
		modifier = {
			condition = { type = father_trait value = proven_accountant }
			factor = 1.2
		}
		modifier = {
			condition = { type = father_trait value = fortune_builder }
			factor = 0.8
		}
		modifier = {
			condition = { type = father_trait value = midas_touched }
			factor = 0.6
		}		
	}

	action_a = {
		effect = { type = remove_trait value = court_education }
		effect = { type = add_trait value = midas_touched }
		effect = { type = set_to_realm_religion }
	}
Why is there a malus on MTTH, if father have the trait "Midas Touched"?
And the other modifiers confusing me too. Why a higher bonus on MTTH on deteached priest than on martial cleric and so on???
 
Wilhelm II. said:
One more event scripting question! ;)
Concernig to the modifiers of this "An offspring finishes his education(Midas touched)":

Why is there a malus on MTTH, if father have the trait "Midas Touched"?
And the other modifiers confusing me too. Why a higher bonus on MTTH on deteached priest than on martial cleric and so on???

If the father is Midas Touched, a decrease to the MTTH for Midas Touched relative to the other education types makes it more likely that the offspring is Midas Touched. Remember, MTTH is Mean Time To Happen; the larger it is, the longer it takes, on average, so increasing MTTH isn't a "bonus".
 
richvh said:
If the father is Midas Touched, a decrease to the MTTH for Midas Touched relative to the other education types makes it more likely that the offspring is Midas Touched. Remember, MTTH is Mean Time To Happen; the larger it is, the longer it takes, on average, so increasing MTTH isn't a "bonus".
Ok thanks...so in this case is a bonus a malus! :eek:
Now i understand those modifiers.
 
Wilhelm II. said:
Ok thanks...so in this case is a bonus a malus! :eek:
Now i understand those modifiers.
Depending of the effect, factor are either a bonus or a malus.

If the effect is an overall "positive" thing for the character, factor < 1 are a bonus, and factor > 1 are a malus.

If the effect is an overall "negative" thing for the character, factor < 1 are a malus, and factor > 1 are a bonus.

Cat
 
scripting tutorial

A little scripting tutorial
Code:
#######################################
# An offspring finishes his education #
#######################################
# become naive puppet master
#######################################
Everything after a # is a comment, inserted so someone looking at the code has a better idea what's going on.
Code:
character_event = {
	id = 8451025						# replaces event 1025
Every event has a unique ID.
Code:
	picture = "event_education"
This picture will be displayed in the event message box
Code:
	trigger = {
There has to be a way to trigger an event. Unless the event is triggered directly by another event, the trigger has to be included in the event code.
Code:
		condition = { 
			type = trait 
			value = court_education 
		}
The first trigger is the character trait court_education. If the character does not have this trait, this event will not fire.
Code:
		condition = { 
			type = gender 
			value = male 
		}
The second trigger is the character's gender. If the character is female, this event will not fire.
Code:
		condition = { 
			type = age 
			value = 15 
		}
The third trigger is the character's age. If the character is under 15, this event will not fire.
Code:
	}
Ok, that last brace closes the trigger clause. If we've passed all the trigger, we continue.
Code:
	mean_time_to_happen = {
		months = 40
Mean time to happen (or MTTH) is how long, on average, this event will take to fire. The lower it is, the more likely it is to happen, and the sooner it is likely to happen.
Code:
		modifier = {
			condition = { 
				type = father_trait 
				value = naive_wirepuller 
			}
			factor = 0.5
		}
We can modify the MTTH based on various factors. In this case, does the character's father have the naive_wirepuller trait? If yes, we lower MTTH: the character is likely to take after his father.
Code:
		modifier = {
			condition = { 
				type = father_trait 
				value = flamboyant_schemer 
			}
			factor = 0.7
		}
		modifier = {
			condition = { 
				type = father_trait 
				value = intricate_webweaver 
			}
			factor = .8
		}
		modifier = {
			condition = { 
				type = father_trait 
				value = illusive_shadow 
			}
			factor = .9
		}
Likewise, if the father is a better spy, the character is less likely to be a mere naive wirepuller. The MTTH is decreased less, but having a spy father still gives some bias toward all the spy degrees.
Code:
		modifier = {
			condition = {
				type = not
				value = {
					type = intrigue
					value = 2
				}
			}
			factor = .75
		}
		modifier = {
			condition = {
				type = not
				value = {
					type = intrigue
					value = 4
				}
			}
			factor = .8
		}
If the character has a low intrigue score, he is more likely to get a worse spy degree. Note that if his intrigue score is under 2, it is also under 4, so the factor for intrigue under 2 is .75*.8, or .6
Code:
		modifier = {
			condition = {
				type = intrigue
				value = 6
			}
			factor = 1.2
		}
		modifier = {
			condition = {
				type = intrigue
				value = 8
			}
			factor = 1.2
		}
Likewise, if he has a high intrigue stat, he is less likely to be a mere naive puppetmaster. Again, intrigue over 8 is also over 6, so the factor for intrigue over 8 is 1.2*1.2, or 1.44.
Code:
		modifier = {
			condition = {
				type = father_trait
				value = trusting
			}
			factor = .6
		}
		modifier = {
			condition = {
				type = father_trait
				value = suspicious
			}
			factor = 1.4
		}
		modifier = {
			condition = {
				type = father_trait
				value = honest
			}
			factor = .6
		}
		modifier = {
			condition = {
				type = father_trait
				value = deceitful
			}
			factor = 1.4
		}
Finally, the father's personality has some influence on the son's performance. I've coded this so that honesty and trust biases toward naive puppetmaster and away from illusive shadow, but it's arguable that deceit and suspicion should bias toward all spy education levels and honesty/trust away from them, possibly weighting more on the higher education levels.
Code:
	}
We are now done with the mean time to happen.
Code:
	action_a = {
Events can have up to four action buttons, labelled action_a through action_d. If there is only one action, it can be immidiate (yes, that is the correct spelling for event scripting. For this event, the first (and only) button has the following effects:
Code:
		effect = { 
			type = remove_trait 
			value = court_education 
		}
Education is done, remove the court_education trait
Code:
		effect = { type = add_trait value = naive_wirepuller }
and add the naive_wirepuller trait (= naive puppetmaster.)
Code:
		effect = { type = set_to_realm_religion }
Finally, set the character's religion to that of the realm (that of the character's highest level liege, or that of his immediate liege? I'm not sure here.)
Code:
	}
We're done with the button effects
Code:
}
And with the event.

(MrT, feel free to pull this post out and sticky it if you think it will help people.)
 
Last edited:
has_improvement is broken (as of 1.02),
Code:
condition = {
  type = has_improvement
  value = { improvement = no }
}
always returns true,
Code:
condition = {
  type = has_improvement
  value = { improvement = yes }
}
works properly, so if you want to test for the lack of an improvement, test for its presence then invert the result with type = not, like this:
Code:
condition = {
  type = not
  value = {
    type = has_improvement
    value = { improvement = yes }
  }
}
 
Last edited:
richvh said:
(MrT, feel free to pull this post out and sticky it if you think it will help people.)
Done.

And sticked with the rest of this thread. :)

Cat
 
Using ai_chance in CK 1.02

ai_chance in 1.02 is a bit strange. After extensive testing, it appears that it uses a 10 point range with a -1 offset. An ai_chance of 0 for action_a will give it a 10 percent chance of happening. Each point added to the ai_chance of action_a will give it an additional 10 percent chance of happening. For each point in ai_chance in subsequent actions, there is a 10 percent chance of that action happening. Once the total of previous actions reaches 9, there is no chance of any subsequent actions occuring.

For instance, if you want to have two actions, with an equal chance that the AI will choose either, use this template:
Code:
  action_a = {
    ai_chance = 4
    effect = { }
  }
  action_b = {
    ai_chance = 5
    effect = { }
  }
For four actions with equal chances, use this template:
Code:
  action_a = {
    ai_chance = 1.5
    effect = { }
  }
  action_b = {
    ai_chance = 2.5
    effect = { }
  }
  action_c = {
    ai_chance = 2.5
    effect = { }
  }
  action_d = {
    ai_chance = 2.5
    effect = { }
  }
[edit - removed random, which isn't used with ai_chance]
 
Last edited:
When you use boolean checks in conditions, the AND and OR checks are normally followed by another condition statement, like so:

Code:
              condition = {
                 type = or
                 condition = { type = is_independent }
                 condition = { type = is_vassal }
              }

The NOT check, however, must be followed by a value statement:

Code:
              condition = {
                 type = not
                 value = { type = has_vassal }
              }

No idea why it's this way, but using condition with NOT will give you an error.
 
Cat Lord said:
Also, province event cannot fire character event, and vice-versa.

Cat

Are you sure that you can fire a province event from a province event, because CK doesn't like the trigger statement in this kind of choice at all.

Code:
action_b = { 	#Tell him to ply his trade elsewhere!
		ai_chance = 50
		effect = { type = ruler_prestige value = -20 }
		effect = { type = noble_loyalty value = 0.1 }
		effect = { type = noble_power value = 0.2 }
		effect = { type = peasant_power value = -0.2 }
		effect = { type = peasant_loyalty value = -0.1 }
		effect = { type = trigger for = random_neighbor value = 20800 }}

M
 
You can't trigger a province event from a province event. You have to use spread syntax "from"/"to" for a province to have an effect on its neighbor :)

Cat
 
So it has to be a province_x_province event to use a trigger...

Here is what I was hoping to accomplish with the way I have it coded: You are presented with a choice, the latter of which rejects a service and the service is then offered to a neighbor instead. Does a province_x_province event allow this functionality?

M
 
Bismarck said:
So it has to be a province_x_province event to use a trigger...

Here is what I was hoping to accomplish with the way I have it coded: You are presented with a choice, the latter of which rejects a service and the service is then offered to a neighbor instead. Does a province_x_province event allow this functionality?

M
Probably.

Start a new thread about the event you want to code, and we will have a look at it. :)

Cat