1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Sukritact's Events and Decisions

Discussion in 'Civ5 - Modpacks' started by sukritact, Jun 22, 2014.

  1. sukritact

    sukritact Artist and Modder

    Joined:
    Sep 21, 2010
    Messages:
    2,826
    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







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









    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.
     
    Asterix Rage, spilo and SLGray like this.
  2. sukritact

    sukritact Artist and Modder

    Joined:
    Sep 21, 2010
    Messages:
    2,826
    Location:
    Bangkok
    For Modders:




    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)
     
  3. JFD

    JFD Kathigitarkh

    Joined:
    Oct 19, 2010
    Messages:
    9,107
    Location:
    The Kingdom of New Zealand
  4. bane_

    bane_ Howardianism High-Priest

    Joined:
    Nov 27, 2013
    Messages:
    1,559
    Great mechanic! When is the planned launching?
     
  5. sukritact

    sukritact Artist and Modder

    Joined:
    Sep 21, 2010
    Messages:
    2,826
    Location:
    Bangkok
    I'm debating between when I finish the AI system (ATM they just enact them as soon as they can), or when I finish decisions for all the civs.
     
  6. bane_

    bane_ Howardianism High-Priest

    Joined:
    Nov 27, 2013
    Messages:
    1,559
    Very interesting. If you need testers I'm more than willing to spend a whole lot of hours playing with this. :lol:
     
  7. COF

    COF Emperor

    Joined:
    Dec 30, 2013
    Messages:
    1,521
    Location:
    Bosnia and Herzegovina
    This is absolutely amazing! Can't wait. Hopefully this is a success so people put it into their mods.
     
  8. Pouakai

    Pouakai It belongs in a museum. Moderator

    Joined:
    Jun 16, 2010
    Messages:
    7,151
    Location:
    Aotearoa
    All of the More Civs civs are hopefully going to contain support for it upon release at the very least
     
  9. Rob (R8XFT)

    Rob (R8XFT) Ancient Briton Super Moderator

    Joined:
    Aug 11, 2002
    Messages:
    10,803
    Location:
    Leeds (UK)
  10. dilophosaur

    dilophosaur Prince

    Joined:
    Dec 9, 2013
    Messages:
    507
    Cool mod! Cannot stand waiting for it :)
     
  11. AW Arcaeca

    AW Arcaeca Deus Vult

    Joined:
    Mar 10, 2013
    Messages:
    2,958
    Gender:
    Male
    Location:
    Operation Padlock ground zero
    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. :)
     
  12. Crixler

    Crixler Yay, less blurry!

    Joined:
    May 14, 2014
    Messages:
    98
    This has just become my most anticipated mod (well, tied with JFD's Cultural Diversity, actually).
     
  13. TPangolin

    TPangolin Just the worst person

    Joined:
    May 23, 2013
    Messages:
    4,022
    Location:
    Sydney, Australia
    Amazing. CL will endeavour to have compatibility.
     
  14. Wodhann

    Wodhann South American Norse God

    Joined:
    Feb 27, 2014
    Messages:
    1,507
    Adds a whole new dynamic to the game. Really good, elegant idea.
     
  15. albie_123

    albie_123 Modding In Secret

    Joined:
    Mar 12, 2010
    Messages:
    1,380
    Location:
    Sydney, NSW
    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?
     
  16. bane_

    bane_ Howardianism High-Priest

    Joined:
    Nov 27, 2013
    Messages:
    1,559
    Now all we need is slave trading mechanic and I'll never have a free weekend again.
     
  17. albie_123

    albie_123 Modding In Secret

    Joined:
    Mar 12, 2010
    Messages:
    1,380
    Location:
    Sydney, NSW
    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?
     
  18. JFD

    JFD Kathigitarkh

    Joined:
    Oct 19, 2010
    Messages:
    9,107
    Location:
    The Kingdom of New Zealand
    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.
     
  19. sukritact

    sukritact Artist and Modder

    Joined:
    Sep 21, 2010
    Messages:
    2,826
    Location:
    Bangkok
    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

    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.
     
  20. Bobert13

    Bobert13 Prince

    Joined:
    Feb 25, 2013
    Messages:
    345
    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.
     

Share This Page