Multiple Units Per Tile

thecrazyscot

Spiffy
Joined
Dec 27, 2012
Messages
2,460
So I found an intriguing setting within GlobalParameters.xml.
Code:
<Row Name="PLOT_UNIT_LIMIT" Value="1" />
I tried changing it to 2 and then tested it:
upt.PNG

It looks like it's a global parameter which applies to all unit types. So changing it to "2" permitted 2 of each type of unit to stack.

BUT, there's a problem. Currently, when units run into each other they "swap" if they both have movement points, otherwise the move is illegal. Well, the same thing happens here. Even though the unit limit has been increased, moving into another unit causes them to automatically swap...UNLESS the target unit has no movement points left or insufficient movement points left to swap into the moving unit's tile.

So, basically, you can increase the number of units, but every time you move you'll have all your units swapping places until they run out of movement points. I'm guessing that behavior is hardcoded, but don't know for sure.
 
These variables alone are limited in usage because there are other checks in the game. Like you can't build/buy new units if city center already has unit occupied.
 
so In conclusion can I use it for above 1? or its gonna make problems with the movement units?
 
so In conclusion can I use it for above 1? or its gonna make problems with the movement units?
I have the units swap sometimes, but not always, when both have movement points so haven't figured out what difference is yet. As posted above as long as first unit can't move, they will always stack. Also if second unit has just enough to reach first, if you click one hex beyond when moving they won't swap. If you pay attention to when you move units, won't be to annoying, also I like being able to buy more than one unit at a time.
 
anyone wants to make a mod about stacking?

I had just made the changes in game files to test but pretty much all you need is:

Code:
UPDATE GlobalParameters SET Value=2 WHERE Name='PLOT_UNIT_LIMIT';

UPDATE Units SET Stackable = 1;

p.s. it's early here, so if I have the code wrong for updates a column please someone correct, thanks.
 
Alright so it really bothered me in my last 2 games where
1) I went for a religious victory but couldn't get near their cities because my non combat couldn't go on any other civs tiles that had combat or non combat unit
2) Same for when I was doing a war game and another civs (Who I was not at war with... But damn well soon was!) religious units were blocking my combat units from moving into those squares.

Is there any chance that while doing this mod that you've came across any commands which would let you have a similar thing with your own combat and non combat, but with other civs that you're not at war with??

I really don't know how people do religious games when the AI sometimes spawns 40 warriors and slingers around their cities!
 
So I'm totally new at modding, and I'm getting the hang of .xml alright, but having the .sql with all the coding scraes me! ;p

How would I do the line of code in an .sql document to change stackable default to 1.

Base file - 01_GameplaySchema.sq
Base line - "Stackable" BOOLEAN NOT NULL CHECK (Stackable IN (0,1)) DEFAULT 0,

Is it UPDATE Stackable SET Default=1; ??

Default is coming out blue, and I'm not sure if it should be caps or not?? Also do I not need to link the line to the 01_GameplaySchema file like I would do with .xml?
 
But I don't understand why this is this!!
UPDATE Units SET Stackable = 1;

It's not coming from the Units file?? Does it not need to be told where to find the file like .xml?

And so you obviously don'e need to set default because, you're just setting the value, and there's only 1 value per line in the sql?
 
Found a solution to swapping problem.
In Civ6Common.lua around line 147 , under:
Spoiler :
-- Check that unit isn't already in the plot (essentially canceling the move),
-- otherwise the operation will complete, and while no move is made, the next
-- unit will auto seltect.

Changed:
Code:
UnitManager.RequestOperation(kUnit, UnitOperationTypes.SWAP_UNITS, tParameters);
to
Code:
UnitManager.RequestOperation(kUnit, UnitOperationTypes.MOVE_TO, tParameters);
and no more swapping.
 
Top Bottom