No CanBuild (improvement) Hook?

bane_

Howardianism High-Priest
Joined
Nov 27, 2013
Messages
1,559
I'm trying to limit where you can build a special Improvement based on Lua commands, but I can't find a hook to it. :confused:

I was using XML just fine, but the AI started to do weird things and the only thing I can think of is limiting where you can build it with boolean returns on Lua.

I thought about using SetXY but I believe this method is too CPU consuming. Ideas?
 
Not as part of the standard DLL, but if you've using mine or the CP DLL you have

Code:
GameEvents.PlayerCanBuild.Add(function(iPlayer, iUnit, iX, iY, iBuild) return true end)
GameEvents.PlotCanImprove.Add(function(iX, iY, iImprovement) return true end)
 
Search for GameEvents in CustomModOptions.xml - they're all documented in there.

Alphabetical list of additional events as of v60

Spoiler :
Code:
AiOverrideChooseNextTech
AreaCanHaveAnyResource
CanDoCommand
CanHaveAnyUpgrade
CanHavePromotion
CanHaveUpgrade
CanLoadAt
CanMoveInto
CannotParadropFrom
CanParadropFrom
CanRebaseInCity
CanRebaseTo
CircumnavigatedGlobe
CityBoughtPlot
CityCanAcquirePlot
CityConnected
CityConnections
CityConstructed
CityCreated
CityPrepared
CitySoldBuilding
CityTrained
CustomMissionCompleted
CustomMissionCameraTime
CustomMissionDoStep
CustomMissionPossible
CustomMissionStart
CustomMissionSetActivity
CustomMissionTargetPlot
CustomMissionTimerInc
DeclareWar
GetDiploModifier
GetBombardRange
GetReligionToFound
GoodyHutCanNotReceive
GoodyHutCanResearch
GoodyHutTechResearched
GreatPersonExpended
IsAbleToDeclareWar
IsAbleToMakePeace
MakePeace
MinorAlliesChanged
MinorFriendsChanged
NaturalWonderDiscovered
NuclearDetonation
PantheonFounded
ParadropAt
PlaceResource
PlayerBuilding
PlayerBuilt
PlayerCanAdoptIdeology
PlayerCanAdoptTenet
PlayerCanBuild
PlayerCanDeclareWar
PlayerCanFoundPantheon
PlayerCanFoundReligion
PlayerCanHaveBelief
PlayerCanMakePeace
PlayerCanPropose
PlayerCanRaze
PlayerCanRemoveHeresy
PlayerCanSpreadReligion
PlayerGoldenAge
PlayerPlunderedTradeRoute
PlotCanImprove
RebaseTo
ReligionCanHaveBelief
ReligionEnhanced
ReligionFounded
ResolutionResult
TeamSetEra
TerraformingMap
TerraformingPlot
TileFeatureChanged
TileImprovementChanged
TileOwnershipChanged
TileRevealed
TileRouteChanged
UiDiploEvent
UnitCanHaveAnyUpgrade
UnitCanHaveGreatWork
UnitCanHaveName
UnitCanHavePromotion
UnitCanHaveUpgrade
UnitCaptureType
UnitCityFounded
UnitCreated
UnitPrekill
UnitPromoted
UnitUpgraded
 
One question, though. It has the 'See also' commentary. I don't plan on using the Pontoon Bridge mod, can't I just update the CustomModOptions via XML?

All of the events (and API extensions) can be enabled directly, the "See Also's" just serve as examples. The comment at the top of the file is more for the other features as they usually require some Lua or XML to support them.
 
Top Bottom