davidlallen
Deity
I have an interesting problem with a promotion to make units run out of gas. It seems the standard game engine will hang, if a stack of units is in motion and suddenly one has a *negative* number of move points. This may not seem like a problem, but I cannot think of any easy workaround.
Here is how you can see the problem.
1. Take a completely vanilla game, no mods or extensions.
2. Copy units/civ4promotioninfos.xml to customassets, and modify one of the promotions (maybe "Guerilla I"). Change the one line:
<iMovesChange>-4</iMovesChange>
Let's call this the Promotion of Immobility, it's a catchy name. In my mod, it represents "Out Of Gasoline".
3. Start the game. Any map, etc.
4. In World Builder, give yourself two units in the same plot.
5. In the game, double click the two units to make a stack, and give them a move order to a distant destination.
6. Advance one turn so the two units are "in motion"
7. In WB, select one of the units and give it your Promotion of Immobility
8. In the game, mouse over *do not click* the stack. You can see that the unit has negative movement points available.
8. Click on your stack. The game freezes.
Now, if you had a unit with a movement of exactly one, and you gave it an iMovesChange of -1, then the unit would have zero movement points. In this case the behavior is still probably wrong, but at least it doesn't hang. The game computes the number of turns to reach the destination the same as before, but the stack doesn't move. If the destination was 5 turns away, it stays at 5 turns forever.
What I wanted to do, is have one Promotion of Immobility that could be attached to any unit. I am using -4 because a gunship has movement of 4, so when I attach the promotion to any unit it will have movement of zero or less and be immobile. Depending on which other promotions the unit may have, its movement could normally be 1,2,3,4. I really don't want to have four immobility promotions and then have to pick out the right one. There is some chance that I may accidentally choose too low a value and the unit could still move slowly, or I may accidentally choose too high a value and run into the hanging problem.
Can anybody suggest a "safer" way to achieve immobility?
Here is how you can see the problem.
1. Take a completely vanilla game, no mods or extensions.
2. Copy units/civ4promotioninfos.xml to customassets, and modify one of the promotions (maybe "Guerilla I"). Change the one line:
<iMovesChange>-4</iMovesChange>
Let's call this the Promotion of Immobility, it's a catchy name. In my mod, it represents "Out Of Gasoline".
3. Start the game. Any map, etc.
4. In World Builder, give yourself two units in the same plot.
5. In the game, double click the two units to make a stack, and give them a move order to a distant destination.
6. Advance one turn so the two units are "in motion"
7. In WB, select one of the units and give it your Promotion of Immobility
8. In the game, mouse over *do not click* the stack. You can see that the unit has negative movement points available.
8. Click on your stack. The game freezes.
Now, if you had a unit with a movement of exactly one, and you gave it an iMovesChange of -1, then the unit would have zero movement points. In this case the behavior is still probably wrong, but at least it doesn't hang. The game computes the number of turns to reach the destination the same as before, but the stack doesn't move. If the destination was 5 turns away, it stays at 5 turns forever.
What I wanted to do, is have one Promotion of Immobility that could be attached to any unit. I am using -4 because a gunship has movement of 4, so when I attach the promotion to any unit it will have movement of zero or less and be immobile. Depending on which other promotions the unit may have, its movement could normally be 1,2,3,4. I really don't want to have four immobility promotions and then have to pick out the right one. There is some chance that I may accidentally choose too low a value and the unit could still move slowly, or I may accidentally choose too high a value and run into the hanging problem.
Can anybody suggest a "safer" way to achieve immobility?