Ulixes
Prince
- Joined
- May 2, 2010
- Messages
- 312
Hi everybody.
After a break I'm returning to civ modding and I had an idea.
I would like to make some Beliefs excluding each other:
if you adopt Belief "X", you cannot adopt Belief "Y" and Belief "Z".
Now, I'm a newbie in Lua so I apologize if what I did seems naive or if it is entirely wrong.
I need an advice on how to complete the code or, at least, to know if it is far beyond my abilities or not.
In SQL, I created a 'MutuallyExclusiveGroup' entry in the 'Beliefs' table:
Than, I tried to build this Lua code (using Whoward's GameEvents.ReligionCanHaveBelief.Add(OnReligionCanHaveBelief))
Please,
After a break I'm returning to civ modding and I had an idea.
I would like to make some Beliefs excluding each other:
if you adopt Belief "X", you cannot adopt Belief "Y" and Belief "Z".
Now, I'm a newbie in Lua so I apologize if what I did seems naive or if it is entirely wrong.
I need an advice on how to complete the code or, at least, to know if it is far beyond my abilities or not.
In SQL, I created a 'MutuallyExclusiveGroup' entry in the 'Beliefs' table:
ALTER TABLE Beliefs ADD MutuallyExclusiveGroup INTEGER DEFAULT -1;
Than, I tried to build this Lua code (using Whoward's GameEvents.ReligionCanHaveBelief.Add(OnReligionCanHaveBelief))
GameEvents.ReligionCanHaveBelief.Add(
function(iPlayer, iReligion, iBelief)
local MutuallyExclusiveGroup = GameInfo.Beliefs[BeliefType].MutuallyExclusiveGroup
local eReligion = player:GetReligionCreatedByPlayer()
--if player founded a religion
if eReligion ~= -1 then
return false -- the player has no religion founded
end
if MutuallyExclusiveGroup ~= -1
--if the value is -1 the belief can always be adopted.
return true
end
--if the value is greater than -1
if MutuallyExclusiveGroup > -1
--if you have adopted a belief, all the others with the same number will be unavalaible. How do I do that?????
end
end
end)
Please,
