crimsontrojan
Chieftain
- Joined
- Aug 13, 2014
- Messages
- 6
[*]Short of it: Can someone help me set a policy prerequisite for improvements?
[*]What I've already done, and used as example:
Implementation for <PrereqPolicy> units/buildings/technologies:
[*]What I've tried:
GameEvents.PlayerCanBuild.Add(
GameEvents.PlayerCanImprove.Add(
I guess there's just not a GameEvents for improvements? But then how do technology prerequisites work for improvements?
[*]Backdoor into policy prereq through restriction of units:
I created a new unit that requires Exploration - Navigation School, the Adventurer. Among other things, he can build Feitorias and excavate archaeological digs.
+
I remove UNIT_WORKER from <Unit_Builds> for <BuildType>BUILD_FEITORIA.
=
Only Civs that have chosen Exploration can build the Feitoria.
However, there are game design choices for other policies where I want the worker to be able to build the policy's unique improvement.
I'd also prefer to not artificially restrict by technology or building.
Thanks if you can help or commiserate!
[*]What I've already done, and used as example:
Implementation for <PrereqPolicy> units/buildings/technologies:
Spoiler :
-- Insert SQL Rules Here
ALTER TABLE Buildings ADD COLUMN 'PrereqPolicy' TEXT DEFAULT NULL;
-- Lua Script1
--------------------------------------------------------------
GameEvents.PlayerCanConstruct.Add(
function(iPlayer, buildingTypeID)
local prereqPolicy = GameInfo.Buildings[buildingTypeID].PrereqPolicy
if prereqPolicy then
local player = Players[iPlayer]
local policyID = GameInfo.Policies[prereqPolicy].ID
if not player:HasPolicy(policyID) then
return false
end
end
return true
end)
ALTER TABLE Buildings ADD COLUMN 'PrereqPolicy' TEXT DEFAULT NULL;
-- Lua Script1
--------------------------------------------------------------
GameEvents.PlayerCanConstruct.Add(
function(iPlayer, buildingTypeID)
local prereqPolicy = GameInfo.Buildings[buildingTypeID].PrereqPolicy
if prereqPolicy then
local player = Players[iPlayer]
local policyID = GameInfo.Policies[prereqPolicy].ID
if not player:HasPolicy(policyID) then
return false
end
end
return true
end)
[*]What I've tried:
GameEvents.PlayerCanBuild.Add(
GameEvents.PlayerCanImprove.Add(
I guess there's just not a GameEvents for improvements? But then how do technology prerequisites work for improvements?
[*]Backdoor into policy prereq through restriction of units:
I created a new unit that requires Exploration - Navigation School, the Adventurer. Among other things, he can build Feitorias and excavate archaeological digs.
+
I remove UNIT_WORKER from <Unit_Builds> for <BuildType>BUILD_FEITORIA.
=
Only Civs that have chosen Exploration can build the Feitoria.
However, there are game design choices for other policies where I want the worker to be able to build the policy's unique improvement.
I'd also prefer to not artificially restrict by technology or building.
Thanks if you can help or commiserate!