Sukritact's Events and Decisions

sukritact

Artist and Modder
Joined
Sep 21, 2010
Messages
2,931
Location
Bangkok


Heavily inspired by the mechanics of the same names in Europa Universalis IV; Events and Decisions is a mod and framework that hopes to inject a bit more historical flavor into the game, and to allow other mod creators to do the same. Events and Decisions is supported by the majority of modded civs and custom mechanics.

Download | Wikia







Decisions are a set of choices a nation can make if certain conditions are met. Each decision has consequences, which can be both positive and negative. A nation never has to take a decision it is always at the players discretion whether to accept a decision or not. Some decisions are nation specific, some are religion specific and some are more generic.

The mod introduces an "Enact Decisions Panel" accessible through the Diplocorner drop-down. Decisions themselves are created/defined almost entirely via Lua (with XML/SQL for text and for certain effects via dummy buildings and policies), thus almost anything that can be done or detected via Lua, can be triggered or required by Decisions. The system is also modular, other mods can come in and introduce, remove or modify any existing decisions!

Spoiler :





Currently, the mod does introduce a few other things into the game; many Decisions require Magistrates, a new resource, to be enacted. A number of Magistrates will be provided at the start of the game via the Palace, and more can be gained by constructing the Judicial Court, a new National Wonder.

As it stands, there are a number of Generic Decisions available to anyone, and 2 Religious Decisions that are designed to change depending on your civ's majority religion at the time (compatible with Tomatekh's mods). Each Firaxis civilization also has 2 Civ Specific Decisions, modded civilizations must have their Civ Specific Decisions supplied by their modder.

For a list of Civilization Specific Decisions, see here (Graciously completed by iBurst).









Events occur throughout the course of play. There are a whole range of events in the game, which can result in positive, negative and mixed outcomes for a player's country. They take the form of a pop-up notification on the player's screen, which may present a player with a choice, or may simply inform the player of the consequences and require they acknowledge the event has occurred.

There is also an Events system, also inspired by EU4 (and partly by Civ 4). With random events enabled an Event will occasionally occur. Events can also be scheduled to occur at a certain time; be triggered by other Events or Decisions.

Spoiler :
And much like the Decisions system, the Events system is also modular; allowing other mods to add their own Events. I highly suggest checking out More Civ's Civilizations, Patria Grande, Tomatekh's Civs and JFD's Civilisations, as many of them have Decisions and/or Events support.





My thanks to JFD for graciously providing events to incorporate into the base mod, to JanBoruta for his excellent artwork, to them both as well as Pouakai and Viregel for help with Decision and Event ideas; and to them all once again for help in playing testing the mod in it's earlier stages and providing feedback.
 
For Modders:




This tool is designed for use with Google Chrome. It appears to work on Internet Explorer, but will not function in Firefox.

The Event Creator is a tool designed to make to process of creating Events a bit less tedious, the Creator allows you to visually script the more repetitive and common parts of an event. Simpler events can be created entirely in the Creator. More unique or complex features will still require you to do a bit of manual tweaking, and lua knowledge is still highly recommended, but this will undoubtedly speed up and simplify the process.

The leftmost column is your palette, this is where you adjust settings and grab modules to add. The center column is your canvas, drag and drop modules here, finally the rightmost column is your code output.

LINK




Spoiler :

Decisions: Tutorial | Generator
Random Events: Tutorial | Generator

I haven't updated the tutorials very regularly unfortunately; so if something seems amiss, please leave a comment (either here, or in the doc)
The generators will help generate the framework for your decision, simply modify the variables and run them (I suggest Repl.it or the Lua Demo)
 
Cool mod! Cannot stand waiting for it :)
 
I think it's a great idea, but how hard is it to make new decisions for modded civs (like you did with Tuscany)? Can you give an example of what kind of coding is needed to make a new decision? Because I'd totally love to incorporate compatibility for this into my mods, as long as it's within my capability. :)
 
This has just become my most anticipated mod (well, tied with JFD's Cultural Diversity, actually).
 
Amazing. CL will endeavour to have compatibility.
 
This is extremely exciting. I can see this completely revolutionizing scenarios - imagine how complex and detailed we can make historical scenarios now! Victoria II in Civilization V, anyone?
 
I just realised that this could be used as a way to introduce player-initiated country forming (in the form of city flipping) when certain conditions are met on a scenario map, ala EU / Vicky.

Change my previous extremely exciting to extremely extremely exciting. Think it's about time to start work on a 19th Century scenario.

EDIT: Quick question: Are newly available decisions notified to the player, and are decisions made by AI's notified to the player as well?
 
I just realised that this could be used as a way to introduce player-initiated country forming (in the form of city flipping) when certain conditions are met on a scenario map, ala EU / Vicky.

Change my previous extremely exciting to extremely extremely exciting. Think it's about time to start work on a 19th Century scenario.

EDIT: Quick question: Are newly available decisions notified to the player, and are decisions made by AI's notified to the player as well?

A notification is sent when you adopt a decision (Sukritact needs to give it more flavour though ;) ), but I don't think for when the AI does.
 
I think it's a great idea, but how hard is it to make new decisions for modded civs (like you did with Tuscany)? Can you give an example of what kind of coding is needed to make a new decision? Because I'd totally love to incorporate compatibility for this into my mods, as long as it's within my capability. :)

JFD has mentioned he found it relatively intuitive. It does assume that you are familiar with Lua however.

Here's an example:

Code:
--------------------------------------------------------------------------------------------------------------------------
-- Ottomans: Adopt the Devshirme System
--------------------------------------------------------------------------------------------------------------------------

local Decisions_OttomanDevshirme = {}
	Decisions_OttomanDevshirme.Name = "TXT_KEY_DECISIONS_OTTOMANDEVSHIRME"
	Decisions_OttomanDevshirme.Desc = "TXT_KEY_DECISIONS_OTTOMANDEVSHIRME_DESC"
	HookDecisionCivilizationIcon(Decisions_OttomanDevshirme, "CIVILIZATION_OTTOMAN")
	Decisions_OttomanDevshirme.CanFunc = (
	function(pPlayer)
		if pPlayer:GetCivilizationType() ~= GameInfoTypes.CIVILIZATION_OTTOMAN then return false, false end
		if load(pPlayer, "Decisions_OttomanDevshirme") == true then
			Decisions_OttomanDevshirme.Desc = Locale.ConvertTextKey("TXT_KEY_DECISIONS_OTTOMANDEVSHIRME_ENACTED_DESC")
			return false, false, true
		end
		
		local iCost = math.ceil(pPlayer:GetNumCities() * iMod * 150)
		Decisions_OttomanDevshirme.Desc = Locale.ConvertTextKey("TXT_KEY_DECISIONS_OTTOMANDEVSHIRME_DESC", iCost)
		
		if (pPlayer:GetGold() < iCost) then return true, false end
		if (pPlayer:GetCapitalCity() == nil) then return true, false end
		if not(Teams[pPlayer:GetTeam()]:IsHasTech(GameInfoTypes.TECH_GUNPOWDER)) then return true, false end
		if (Teams[pPlayer:GetTeam()]:IsHasTech(GameInfoTypes.TECH_RIFLING)) then return true, false end
		if (pPlayer:GetNumResourceAvailable(iMagistrate, false) < 2) then return true, false end
		return true, true
	end
	)
	
	Decisions_OttomanDevshirme.DoFunc = (
	function(pPlayer)
		local iCost = math.ceil(pPlayer:GetNumCities() * iMod * 100)
		pPlayer:ChangeGold(-iCost)
		pPlayer:ChangeNumResourceTotal(iMagistrate, -2)
		for pCity in pPlayer:Cities() do
			InitUnitFromCity(pCity, GameInfoTypes.UNIT_OTTOMAN_JANISSARY, 1)
		end
		save(pPlayer, "Decisions_OttomanDevshirme", true)
	end
	)
	
tDecisions.Decisions_OttomanDevshirme = Decisions_OttomanDevshirme

Basically a decision is a Lua table, which you supply a name, a description, a "CanFunc" and a "DoFunc" to. There will also be a number of global entries and functions that I will ask people not alter (adding a decision basically amounts to including an extra Lua file in an ever increasingly long line of includes).
A more detailed tutorial, but I warn that you go through this at your own risk, everything is subject to alteration until release: LINK

EDIT: Quick question: Are newly available decisions notified to the player, and are decisions made by AI's notified to the player as well?
In addition to what is stated above, there's also a notification when a Decision become available; though there will be a 1 turn delay between it becoming available and the notification.
 
Just curious here. Wouldn't it be possible to set up an Lua event and then just have authors adding new Decisions use a listener with the Add function? That would allow plug and play functionality and would avoid having to alter the core file to add new includes.
 
Top Bottom