Barbarian camps won't spawn Barbarians!

Murphy613

Prince
Joined
Nov 18, 2012
Messages
483
I gave a unit the ability to build barbarian camps, which he can do, but they don't spawn barbarians. What do I need to change to do this?
Also, how do I let my units build outside of my borders, and how do I make the game stop giving me this unit instead of a worker on advanced starts?

Edit - Maybe Barbarians can't spawn in a civ's borders?
 
I figured out how to make them stop replacing workers - set <AdvancedStartCost> to -1 so they never show up on advanced starts. But the issues still stand.
 
Just found a table in Improvements: <OutsideBorders>. I update the barbarian camps to <OutsideBorders>true</OutsideBorders>. Maybe now it will work.
Edit - It builds outside of borders but the Barbs still dont spawn.
 
Barbarian camps are created by the DLL and units then spawn from those. The DLL code doesn't scan the map for camps as it remembers the ones it has placed, so if you use a unit/lua to add an encampment that's all you get - just the encampment, as the DLL has no knowledge of it (although there is a method to tell the DLL about the camp it is not available to Lua).

So, if you want the camp you manually added to then spawn units you will have to track where you added camps (and also when those camps are cleared) and spawn units manually from those camps (with all the associated persisted data to remember when the last unit was spawned and how many units have been spawned - the spawn rate decreases over the life time of the camp in the core game)
 
Barbarian camps are created by the DLL and units then spawn from those. The DLL code doesn't scan the map for camps as it remembers the ones it has placed, so if you use a unit/lua to add an encampment that's all you get - just the encampment, as the DLL has no knowledge of it (although there is a method to tell the DLL about the camp it is not available to Lua).

So, if you want the camp you manually added to then spawn units you will have to track where you added camps (and also when those camps are cleared) and spawn units manually from those camps (with all the associated persisted data to remember when the last unit was spawned and how many units have been spawned - the spawn rate decreases over the life time of the camp in the core game)

Yikes. I'm just gonna give the unit the Foreign Lands promotion instead. (It's the division of the Iranian Revolutionary Guard that trains terrorists and insurgents.)
 
Barbarian camps are created by the DLL and units then spawn from those. The DLL code doesn't scan the map for camps as it remembers the ones it has placed, so if you use a unit/lua to add an encampment that's all you get - just the encampment, as the DLL has no knowledge of it (although there is a method to tell the DLL about the camp it is not available to Lua).

That just doesn't strike me as good design. Why not just scan the map every turn, if a plot has a camp on it then check to see if it has a turn counter (for spawning units) and assign it one if it doesn't?
 
That just doesn't strike me as good design.

Are you surprised?

Given that you can only add a barb camp via CvPlot::SetImprovementType() why not just change that to call the required method in CvBarbarians.

Now, if they'd gone for a truly OO approach (this is C++ after all) the (overridden) constructor for Barb Camps could have handled it all - like I said elsewhere, it would appear that good C programmers can write C in any language :rolleyes:
 
Back
Top Bottom