[BNW] Help creating Great General garrison unique ability and city-dependent food unique ability

ExothermicSpartan

Chieftain
Joined
May 22, 2018
Messages
3
I'm currently working on my first mod: a new civilization from an online RPG. So far I've been reading through Kael's amazing modding guide and watched a few tutorials on YouTube, and I believe that I have a basic understanding of editing .xml files to edit certain things in game (changing production costs/combat strength/required techs/resources.

However, I don't know where to start with creating the following two abilities:
1) Unique Building ability: "+4 Culture if a Great General is garrisoned in this city."

2) Civilization Ability: "-1 Food in all Puppets and in all Cities other than the Capital and +1 Food in the Capital for each City or Puppet in the empire"

Any advice on how to achieve these?
 
It would require a combination of lua scripting and (as the easiest method to implement the effects) dummy buildings. You could get close to the food effects via xml only but there would be corner cases such as a capital being captured that would probably not be handled by xml-only methods -- and these xml methods would requre dummy buildings.
 
@LeeS Thank you... I'm starting to think that this particular ability is far beyond my modding skill level. Maybe I can come back to this later, but I've got to at least get an ability working for now... what about restricting a civilization from adopting a specific Social Policy tree? I'm thinking about completely blocking off Liberty for my civilization to offset their other abilities and to tie in with them being oppressors... any thoughts on how to implement that?
 
It can be done but it requires lua. The lua file would have to be set-up in modbuddy as what is called an InGameUIAddin -- see post #3 of this thread whoward69's what ModBuddy setting for what file types tutorial

The lua code within the file would be fairly straightforward
Code:
-- PlayerCannotSelectLiberty
-- Author: LeeS
--------------------------------------------------------------

local iYourCiv = GameInfoTypes.CIVILIZATION_SOMETHING

function PlayerCannotSelectLiberty(iPlayer, iPolicyBranch)
	if (iPolicyBranch == GameInfoTypes.POLICY_BRANCH_LIBERTY) then
		local pPlayer = Players[iPlayer]
		if pPlayer:GetCivilizationType() == iYourCiv then
			return false
		end
	end
	return true
end
GameEvents.PlayerCanAdoptPolicyBranch.Add(PlayerCannotSelectLiberty)

print("PlayerCannotSelectLiberty lua loaded to the end")
You need to make an lua file in modbuddy, drop that code into the file, and set-up the file as shown in William Howard's tutorial that I linked to. You also need to change this line
Code:
local iYourCiv = GameInfoTypes.CIVILIZATION_SOMETHING
so that CIVILIZATION_SOMETHING matches to what you have used as your civilization's xml-name in table <Civilizations>.

--------------------------------

Just bear in mind that locking off an early-game policy-branch like that might cause issues regarding having enough culture to adopt a policy but no policies available to adopt and/or cause the AI to do even dumber stuff than usual when your civ is running as an AI. Altho not having anything to select for a policy-adoption will most likely never be a real problem, but it is something to think about.
 
Back
Top Bottom