Page 1 of 1
How to immobilize units?
Posted: Tue Apr 23, 2019 9:47 pm
by Kossatx
Hi, anyone can help me about how to immobilize units in one map position? For example, if I wat to immobilize a french Infantry unit in Paris... how can I do it?
Re: How to immobilize units?
Posted: Tue Apr 23, 2019 10:25 pm
by Robotron
Open game_supply.lua
Look for the function called:
function SetUnitMovePenalty(unit)
Insert the following at the end of the function
Code: Select all
local paris = game:GetHex(82, 30)
if paris.alliance.id == 1
and paris.unit ~= nil
and unit.hex ~= nil
and unit.hex.x == 82
and unit.hex.y == 30
and unit.prototype.name == "infantry"
and unit.hp >= 50 then
unit.mp = 0
end
This will reduce any Entente infantry's movement value to 0 as long as it occupies Paris and its unit strength is at least 5.
Re: How to immobilize units?
Posted: Wed Apr 24, 2019 8:30 am
by Kossatx
Thanks for your help Robotron, and thanks very much for your great POTZBLITZ mod. I enjoy a lot playing with it, Slitherine should publish it and allow you to mod hard coded scripts too!!!!

Re: How to immobilize units?
Posted: Fri Apr 26, 2019 3:34 pm
by Kossatx
This order to immobilize units affects to units not deployed in the beginning turn? If Paris is empty but in turn 10 an infantry unit is deployed in Paris, it will be immobilized?
Re: How to immobilize units?
Posted: Fri Apr 26, 2019 4:05 pm
by Robotron
Paris must be under Entente control and an Entente (French or British) infantry must be deployed at Paris with at least unit strength 5 for that infantry at Paris to be immobilized.
Is the solution I posted not working correctly or do you need something else?
Re: How to immobilize units?
Posted: Fri Apr 26, 2019 4:14 pm
by Kossatx
Yes, it works, but I don't know if this solution only works with the initial deployment in turn 1, or it works all the game.
Re: How to immobilize units?
Posted: Fri Apr 26, 2019 4:20 pm
by Robotron
It will work for the whole game since no time limit was defined in the function.
Re: How to immobilize units?
Posted: Fri Apr 26, 2019 4:28 pm
by Kossatx
Great, thanks Robotron!