事件模组制作

本页面讲述的内容长期有效
自由之民讨论 | 贡献2020年9月8日 (二) 19:20的版本 (文本替换 - 替换“Category:Modding”为“Category:模组制作”)

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

Positions. List of possible animations.

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.