Auto-translated
you can try to fast-forward 1 week and see if it works at the beginning of the second week?
New here? I'm Roha — want a quick tour?
you can try to fast-forward 1 week and see if it works at the beginning of the second week?
maybe there's something in the console? I don't know, a similar script works perfectly in my map.
It would be better if you shared the map, so I can take a look. It's really hard to understand without it.
for build = TOWN_BUILDING_DWELLING_1, TOWN_BUILDING_DWELLING_7 do
SetTownBuildingLimitLevel('houseInferno', build, 0)
end
function CaptureTown(p_owner, n_owner, hero, object)
for build = TOWN_BUILDING_DWELLING_1, TOWN_BUILDING_DWELLING_7 do
SetTownBuildingLimitLevel(object, build, 2)
for i = 1, 2 do
UpgradeTownBuilding(object, build)
end
end
local week = GetDate(WEEK)
SetObjectDwellingCreatures(object, 16, 35 * week)
SetObjectDwellingCreatures(object, 18, 34 * week)
SetObjectDwellingCreatures(object, 20, 18 * week)
SetObjectDwellingCreatures(object, 22, 10 * week)
SetObjectDwellingCreatures(object, 24, 7 * week)
SetObjectDwellingCreatures(object, 26, 4 * week)
SetObjectDwellingCreatures(object, 28, 2 * week)
end
Trigger(OBJECT_CAPTURE_TRIGGER, 'houseInferno', 'CaptureTown')
No, I made a mistake here. Although the function works, the AI still detects the increase. I think this is because the owner is a neutral player. Therefore, I see only one way to fix it: remove all buildings initially and build them upon capturing the town:for build = TOWN_BUILDING_DWELLING_1, TOWN_BUILDING_DWELLING_7 do
SetTownBuildingLimitLevel('houseInferno', build, 0)
end
function CaptureTown(p_owner, n_owner, hero, object)
for build = TOWN_BUILDING_DWELLING_1, TOWN_BUILDING_DWELLING_7 do
SetTownBuildingLimitLevel(object, build, 2)
for i = 1, 2 do
UpgradeTownBuilding(object, build)
end
end
local week = GetDate(WEEK)
SetObjectDwellingCreatures(object, 16, 35 * week)
SetObjectDwellingCreatures(object, 18, 34 * week)
SetObjectDwellingCreatures(object, 20, 18 * week)
SetObjectDwellingCreatures(object, 22, 10 * week)
SetObjectDwellingCreatures(object, 24, 7 * week)
SetObjectDwellingCreatures(object, 26, 4 * week)
SetObjectDwellingCreatures(object, 28, 2 * week)
end
Trigger(OBJECT_CAPTURE_TRIGGER, 'houseInferno', 'CaptureTown')
Yeah, and do I need to change anything in this code? I still don't understand a lot of things here.
No, I was wrong here. The function works, but the AI still takes advantage of the increase. I think this is because the owner is a neutral player. Therefore, I see only one way – to remove all buildings initially and build them upon capturing the town:for build = TOWN_BUILDING_DWELLING_1, TOWN_BUILDING_DWELLING_7 do
SetTownBuildingLimitLevel('houseInferno', build, 0)
end
function CaptureTown(p_owner, n_owner, hero, object)
for build = TOWN_BUILDING_DWELLING_1, TOWN_BUILDING_DWELLING_7 do
SetTownBuildingLimitLevel(object, build, 2)
for i = 1, 2 do
UpgradeTownBuilding(object, build)
end
end
local week = GetDate(WEEK)
SetObjectDwellingCreatures(object, 16, 35 * week)
SetObjectDwellingCreatures(object, 18, 34 * week)
SetObjectDwellingCreatures(object, 20, 18 * week)
SetObjectDwellingCreatures(object, 22, 10 * week)
SetObjectDwellingCreatures(object, 24, 7 * week)
SetObjectDwellingCreatures(object, 26, 4 * week)
SetObjectDwellingCreatures(object, 28, 2 * week)
end
Trigger(OBJECT_CAPTURE_TRIGGER, 'houseInferno', 'CaptureTown')
I don’t even know, everything works fine for me, I tested this code on your map... maybe you forgot to remove all the buildings that provide growth in the city in the editor?