Help on introducing a new rule in Civ4

Joined
Oct 26, 2005
Messages
4,868
Location
Kansas City, MO
I would like to make a new mod for the game that caps the amount of units available to be on one tile. I want to set a rule in the code somewhere that allows only 10 units to be on any tile at any given time. So once 10 units are on a tile, zone of control takes place. Is there a way to do this that anyone is aware of? Where should I be looking?

I am thinking this will involve me actually applying a new value to tiles. But I could be wrong. Any advice on getting me rolling on this would be greatly appreciated.

Thanks.
 
King Flevance said:
I would like to make a new mod for the game that caps the amount of units available to be on one tile. I want to set a rule in the code somewhere that allows only 10 units to be on any tile at any given time. So once 10 units are on a tile, zone of control takes place. Is there a way to do this that anyone is aware of? Where should I be looking?

I am thinking this will involve me actually applying a new value to tiles. But I could be wrong. Any advice on getting me rolling on this would be greatly appreciated.

Thanks.

This would be an SDK change in the canMoveInto function to check and see how many units are already in the tile and return falce if it is over a certain number.

BTW, making the change to set the limit is easy, teaching the AI how to deal with it is not.
 
Also remember to ignore invisible units in the count, as it becomes an exploit where you can find out where invisible units are by how many units can move into the tile.
 
You also may have to be careful about cities - only 10 defenders in a city could lead to cities falling more easily in big games.
 
there already is a cap for units in a tile, its called: cats.
 
Also, how will new builds be handled in a city with 10 units already?

If a unit has a path through the tile, does it have to wait or will it go through the tile and continue?

What about cargo? Is it counted? If so makes fleets useless, as have two fully loaded carriers and there's 8 of 10 units with no battleships or subs. And you couldn't have two loaded transports in the same tile either.
 
Thanks for all the feedback. :D

As for invisible units, that is a good point, Dale. In concern to cities falling easier, I would have thought of two solutions for this.

1) Have a city tile be able to hold 20.
2) Train the AI to not only turtle inside thier cities but also in all adjacent tiles to the city. (90 units in 9 tiles.)

Or both, which would result in a max 100 units in a 3x3 tile box around every city. This would put an end to stack of doom making an invading force of 50 units be in 5 groups. (Alot harder to do multiple collateral damage to every unit coming in.) This would mostly fix some problems I have with AI invading armies being generally easy to collateral.

Also, how will new builds be handled in a city with 10 units already?
This one I do not know about yet. The only thing I can think of is to have it "pushed" to the nearest friendly tile available. Like when culture expands or open borders are cancelled.
If a unit has a path through the tile, does it have to wait or will it go through the tile and continue?
The unit already having a path that gets interrupted by zone of control I would like to have the path be negated. and the unit is active needing orders when the turn reaches you again.
What about cargo? Is it counted? If so makes fleets useless, as have two fully loaded carriers and there's 8 of 10 units with no battleships or subs. And you couldn't have two loaded transports in the same tile either.
This would make cargo ships be wisest to only have 1 per fleet. So, a full transport is 5/10 and a full carrier is 4/10. Then you have 5-6 other spaces to put in subs, battleships, destroyers and such. A carrier is a poor choice to guard a transport anyway so I see no problem with the inability to stack full sets of these as you actually could and still have rom for a battleship as well. Also, 1 tile (10 units) is a small fleet. A large fleet will consist of about 2-4 tiles. (15ish-40 units) So 1cargo unit per fleet is ideal in this idea.

Of course if I could, I would prefer to have any "cargo units" be assigned as "temperary invisible status" if I could. This would make sense as the carrier would be the same size whther it has planes on it or not. Same with a transport.
 
Kael said:
This would be an SDK change in the canMoveInto function to check and see how many units are already in the tile and return falce if it is over a certain number.

BTW, making the change to set the limit is easy, teaching the AI how to deal with it is not.
Woohoo! I finally found something that isnt simple modding and needs the SDK! :woohoo:

Ok, what all do I need to download to work with this? I only have Civ 4 with the 1.61 patch installed. If anyone could provide me with what I need (tools) to start this, I would be most grateful. (Keep it $ free if you can)
 
Have a look at the stickied thread in this forum, installing and compiling the SDK.

Good luck. :)

Dale

BTW, I looked it up, and cargo is already classed as non-active units and thus doesn't count towards group numbers. Only the transport unit does. However, they do count towards units on a tile. But the easiest thing to do to not count cargo is use an exclusion:

if(getTransportUnit() != NULL)
{
return;
}
 
I still think 20 units is not enough; my proposed change would be 10 units max on a tile (or a configurable value), but an unlimited number of units on a city tile. That way city's will not fall as easily as if they were restricted to x amount of defenders, and the attack still doesn't know what to expect.
 
Back
Top Bottom