Events modding

本页面讲述的内容长期有效
咯咯炀讨论 | 贡献2020年9月14日 (一) 19:36的版本 (创建页面,内容为“{{version|Timeless}}{{需要翻译}} Events are the meat of every well-rounded mod; smaller and larger bits of story that can happen to a player during the campaign.…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

Events are the meat of every well-rounded mod; smaller and larger bits of story that can happen to a player during the campaign. In order to mod new ones in, you should start with an empty txt file in the events directory below your mod's root folder.

Structure

The overall structure is similar to that of a CK2 event, with some tweaks to the syntax and a whole lot of extra features, many of them optional. The barest possible event is laid out here, and each element is described individually in a later section.

example.1 = {
	desc = example.1.desc
	
	option = {
		name = example.1.a
	}
}

There you go! Add this to your mod, trigger it from the in-game console, and you have got yourself a working event! Everything else is optional, but necessary to really flesh out the events.

ID and namespace

The ID uniquely identifies your event.

Flags

These are top-level variables that determine your event's kind and appearance. They have a limited set of values.

Flag Meaning Possible values
type The kind of event. It determines what sort of scope the root is (WHY WOULD ONE ADD THIS FLAG?). * character_event
  • none (when an event doesn't use the root scope at all)
hidden Set this to true, and the event will not be shown at all; it will happen in the background. Useful for doing maintenance events that are not immediately relevant to the player. true, false

Isn't there one for pausing too?

Portraits

In Crusader Kings III, portraits are now in 3D, and can now be animated as well! What follows is a list of the different portrait positions, as well as a list of animations for them.

Portrait Positions

Portrait Positions
Portrait Position Description
left_portrait Shown on the left side of the event scene.
right_portrait Shown on the right side of the event scene.
lower_left_portrait Shown on the lower left part of the event scene.
lower_center_portrait Shown on the lower center part of the event scene.
lower_right_portrait Shown on the lower right part of the event scene.

Here is an example of all of the portrait positions in use at the same time, along with a screenshot:

example_event.1001 = {
	left_portrait = {
		character = ROOT # Whoever this is scoped to will show up in this event window position, exhibiting the chosen animation. 
		animation = fear # Take note that characters with SOME genetic traits (for example, gigantism, dwarfism) that change their character models have different animations, and if you assign one of THOSE animations to a character that does not have that model, crashes may occur.
	}
	right_portrait = {
		character = ROOT
		animation = scheme
	}
	lower_left_portrait = {
		character = ROOT
	}
	lower_center_portrait = {
		character = ROOT
	}
	lower_right_portrait = {
		character = ROOT
	}
}

Animations

Animation
animation = happiness
animation = dismissal
animation = prison_dungeon
animation = admiration
animation = disgust
animation = schadenfreude
animation = stress
animation = personality_compassionate
animation = pain
animation = ecstasy
animation = fear
animation = rage
animation = anger
animation = flirtation_left
animation = shame
animation = boredom
animation = shock
animation = worry
animation = scheme
animation = personality_bold
animation = flirtation
animation = personality_callous
animation = personality_irrational
animation = personality_content
animation = disbelief
animation = personality_cynical
animation = personality_rational
animation = personality_dishonorable
animation = idle
animation = paranoia
animation = personality_vengeful
animation = disapproval
animation = sick
animation = beg
animation = personality_zealous
animation = newborn
animation = love
animation = sadness
animation = personality_honorable
animation = personality_forgiving
animation = personality_greedy
animation = personality_coward
animation = severelyinjured
animation = severelywounded
animation = war_attacker
animation = war_defender
animation = war_over_win
animation = grief

Themes

A list of implemented themes.

override_background, override_icon, override_sound, override_environment

Trigger

This is an additional requirement for an event to work.

on_trigger_fail

Runs when the trigger fails.

Description

Explain how a description can be composed of multiple strings; with stuff like first_valid, and all the alternatives.

Immediate

This is a block of effect script: it will be ran immediately as your event is triggered, before the title, description, portraits, are even evaluated let alone rendered. This block is useful for setting variables and saving scopes to use in your text or for portraits; or for functional effects that you want to happen without the player having any control over it.

"has happened" tooltip.

Options

Name is required.

After

This is a block of effect script that runs after the event has ran its course and an option has been chosen.

Widgets

What types of widgets are there, with screenshots for each of what they look like.

Strategy

Triggering the event

Should probably become its own page.

Techniques and design patterns

Pinging events, message events.

Other fancy ideas.