• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

Add improvement from Lua

krisztiantobias

Chieftain
Joined
Feb 15, 2025
Messages
7
I have this Civ6 Scout mod, which is great, but it would be lovely to use Sailor Cat's Watchtower Improvement mod and put down a watchtower if the user click the lookout button.
I can place goody huts from lua, but that's it, the others don't work:
Code:
ImprovementBuilder.CanHaveImprovement(localStartingPlot, IMPROVEMENT_SAILOR_WATCHTOWER, Game.GetLocalPlayer()) -- returns true
ImprovementBuilder.CanHaveImprovement(localStartingPlot, IMPROVEMENT_GOODY_HUT, -1) -- returns true

WorldBuilder.MapManager():SetImprovementType(localStartingPlot, IMPROVEMENT_GOODY_HUT, -1) -- works
WorldBuilder.MapManager():SetImprovementType(localStartingPlot, IMPROVEMENT_SAILOR_WATCHTOWER, -1) -- does not work
WorldBuilder.MapManager():SetImprovementType(localStartingPlot, IMPROVEMENT_FARM, 0) -- does not work
ImprovementBuilder.SetImprovementType(localStartingPlot, IMPROVEMENT_SAILOR_WATCHTOWER, Game.GetLocalPlayer()) -- does not work
ImprovementBuilder.SetImprovementType(localStartingPlot, IMPROVEMENT_FARM, Game.GetLocalPlayer()) -- does not work
Is there a limitation here or what? With ImprovementBuilder I can see the smoke animation for improvements, but that's it, it does not put off the improvement itself.

The deletion also works just fine:
Code:
WorldBuilder.MapManager():SetImprovementType(PlacedWatchtowers[i], -1, -1);
 
Back
Top Bottom