LUA Unit type

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

Moderator: Panzer Corps 2 Moderators

Post Reply
cicciopastic
Administrative Corporal - SdKfz 232 8Rad
Administrative Corporal - SdKfz 232 8Rad
Posts: 173
Joined: Mon Oct 26, 2015 9:01 pm

LUA Unit type

Post by cicciopastic »

how do i identify a unit kind (e.g. Infantry or CapitalShip). I tried a lot and i thought something as the following condition (with or without quotes), but is not working

if unit.type.kind == "Infantry" then
unit.max_strength = 15
end

Is anybody able to help me plz?
Last edited by cicciopastic on Fri Apr 02, 2021 4:15 pm, edited 1 time in total.
cicciopastic
Administrative Corporal - SdKfz 232 8Rad
Administrative Corporal - SdKfz 232 8Rad
Posts: 173
Joined: Mon Oct 26, 2015 9:01 pm

Re: LUA Unit type

Post by cicciopastic »

i got it! unit kind is a numeric value with infantry code equal to 0 so the correct script is

if unit.type.kind == 0 then
unit.max_strength = 15
end
Post Reply

Return to “Panzer Corps 2 Scenario Design”