How to immobilize units?

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

Moderators: Slitherine Core, The Lordz

Post Reply
Kossatx
Sergeant - 7.5 cm FK 16 nA
Sergeant - 7.5 cm FK 16 nA
Posts: 241
Joined: Wed Nov 27, 2013 3:27 pm

How to immobilize units?

Post 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?
Robotron
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2151
Joined: Tue Nov 23, 2010 3:35 pm

Re: How to immobilize units?

Post 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.
Image
Slitherine's Commander the Great War - Director's Cut: POTZBLITZ mod!
FIND IT HERE: http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610
Kossatx
Sergeant - 7.5 cm FK 16 nA
Sergeant - 7.5 cm FK 16 nA
Posts: 241
Joined: Wed Nov 27, 2013 3:27 pm

Re: How to immobilize units?

Post 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!!!! :D
Kossatx
Sergeant - 7.5 cm FK 16 nA
Sergeant - 7.5 cm FK 16 nA
Posts: 241
Joined: Wed Nov 27, 2013 3:27 pm

Re: How to immobilize units?

Post 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?
Robotron
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2151
Joined: Tue Nov 23, 2010 3:35 pm

Re: How to immobilize units?

Post 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?
Image
Slitherine's Commander the Great War - Director's Cut: POTZBLITZ mod!
FIND IT HERE: http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610
Kossatx
Sergeant - 7.5 cm FK 16 nA
Sergeant - 7.5 cm FK 16 nA
Posts: 241
Joined: Wed Nov 27, 2013 3:27 pm

Re: How to immobilize units?

Post 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.
Robotron
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2151
Joined: Tue Nov 23, 2010 3:35 pm

Re: How to immobilize units?

Post by Robotron »

It will work for the whole game since no time limit was defined in the function.
Image
Slitherine's Commander the Great War - Director's Cut: POTZBLITZ mod!
FIND IT HERE: http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610
Kossatx
Sergeant - 7.5 cm FK 16 nA
Sergeant - 7.5 cm FK 16 nA
Posts: 241
Joined: Wed Nov 27, 2013 3:27 pm

Re: How to immobilize units?

Post by Kossatx »

Great, thanks Robotron!
Post Reply

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