[Help] Making a Civ start with a Belief?

Harkodos

Warlord
Joined
Feb 9, 2016
Messages
197
I'm currently in the process of programming a Civilization's UA where they are able to purchase Military Units with Faith at the beginning of the game. Pretty much it takes the Holy Warriors and Religious Fervor Beliefs and merges them into one. I tried to re-purpose an Lua code I've been using from a few of PHXHRC's mods to give the belief to the Civ in question, but it doesn't seem to work.

Here's the code in question:
Code:
function FosterBeliefOpener(player)
	print("Thanks to JFD for this script")
	for playerID, player in pairs(Players) do
		local player = Players[playerID];
		if player:GetCivilizationType() == GameInfoTypes["CIVILIZATION_AMERICA"] then
			if not player:HasBelief(GameInfoTypes["BELIEF_MADAME_FOSTER_UA"]) then
				--player:SetBelief(GameInfoTypes["BELIEF_ANCESTOR_WORSHIP"], true)
				player:SetNumFreeBeliefs(1)
				player:SetNumFreeBeliefs(0)
				player:SetHasBelief(GameInfoTypes["BELIEF_MADAME_FOSTER_UA"], true)	
			end
		end
	end 
end
Events.SequenceGameInitComplete.Add(FosterBeliefOpener)
It was perhaps naive of me to think that this code alone would be able to achieve the results I desired, but I just wanted to check and make sure.
 
That code looks like it was originally intended to give a dummy policy to a specfic civ as part of a 'UA'. Policies and Beliefs are different animals entirely within lua, as elsewhere. And the lua 'code-commands' are completely different.

Not sure if giving a Belief, Pantheon or Otherwise, when a civ does not yet have any cities will be a game-crasher.

There should be a couple threads here in SDK/LUA on giving Beliefs at game-start. I remember Craig Sutter had a thread on this sort of thing not so long ago.
 
Yeah, I just figured I'd try. Shot in the dark I suppose.

Anyways, thanks for the info, I'll check that out when able.
 
Back
Top Bottom