How to immobilize units?

A forum to discuss custom scenarios, campaigns and modding in general.

Moderators: Slitherine Core, The Lordz

Post Reply
Kossatx
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 134
Joined: Wed Nov 27, 2013 3:27 pm

How to immobilize units?

Post by Kossatx » Tue Apr 23, 2019 9:47 pm

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?

Robotron
Lieutenant Colonel - Panther D
Lieutenant Colonel - Panther D
Posts: 1232
Joined: Tue Nov 23, 2010 3:35 pm

Re: How to immobilize units?

Post by Robotron » Tue Apr 23, 2019 10:25 pm

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.
Slitherine's Commander the Great War on steroids: POTZBLITZ mod!
http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610

Kossatx
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 134
Joined: Wed Nov 27, 2013 3:27 pm

Re: How to immobilize units?

Post by Kossatx » Wed Apr 24, 2019 8:30 am

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!!!! :D

Kossatx
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 134
Joined: Wed Nov 27, 2013 3:27 pm

Re: How to immobilize units?

Post by Kossatx » Fri Apr 26, 2019 3:34 pm

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?

Robotron
Lieutenant Colonel - Panther D
Lieutenant Colonel - Panther D
Posts: 1232
Joined: Tue Nov 23, 2010 3:35 pm

Re: How to immobilize units?

Post by Robotron » Fri Apr 26, 2019 4:05 pm

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?
Slitherine's Commander the Great War on steroids: POTZBLITZ mod!
http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610

Kossatx
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 134
Joined: Wed Nov 27, 2013 3:27 pm

Re: How to immobilize units?

Post by Kossatx » Fri Apr 26, 2019 4:14 pm

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.

Robotron
Lieutenant Colonel - Panther D
Lieutenant Colonel - Panther D
Posts: 1232
Joined: Tue Nov 23, 2010 3:35 pm

Re: How to immobilize units?

Post by Robotron » Fri Apr 26, 2019 4:20 pm

It will work for the whole game since no time limit was defined in the function.
Slitherine's Commander the Great War on steroids: POTZBLITZ mod!
http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610

Kossatx
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 134
Joined: Wed Nov 27, 2013 3:27 pm

Re: How to immobilize units?

Post by Kossatx » Fri Apr 26, 2019 4:28 pm

Great, thanks Robotron!

Post Reply

Return to “Commander the Great War : Mods & Scenario Design”