Unit Functions Lua Help?

DEathgod65

Chieftain
Joined
Jul 26, 2013
Messages
71
Location
Singapore
I'm trying to edit the Unit Functions Lua in RED WWII to let me give custom unit names to each specific class of unit in the different nations

An example:

Spoiler :

end
if ( unitType == GE_BF110 ) then
local name = {"Zerstörergeschwader 1 'Wespe'", "Zerstörergeschwader 2", "Zerstörergeschwader 26 'Horst Wessel'", "Zerstörergeschwader 52", "Zerstörergeschwader 76", "Zerstörergeschwader 141", "Zerstörergeschwader 101"
,"Zerstörergeschwader 142 'Horst Wessel'", "Zerstörergeschwader 143", "Zerstörergeschwader 144"}
if (num <= # name) then
str = name[num]
unit:SetName(str)
else
str = "Zerstörergeschwader " .. num
unit:SetName(str)
end
end

if ( unitType == GE_BF110_F4 ) then
str = "Nachtjagdgeschwader " .. num
unit:SetName(str)
end

if ( unitType == GE_JU87 ) then
local name = {"Sturzkampfgeschwader 1", "Sturzkampfgeschwader 2 'Immelmann'", "Sturzkampfgeschwader 3", "Sturzkampfgeschwader 5", "Sturzkampfgeschwader 51", "Sturzkampfgeschwader 76", "Sturzkampfgeschwader 77"
,"Sturzkampfgeschwader 101", "Sturzkampfgeschwader 102", "Sturzkampfgeschwader 151", "Sturzkampfgeschwader 160", "Sturzkampfgeschwader 162 'Immelmann'", "Sturzkampfgeschwader 163", "Sturzkampfgeschwader 165"
,"Sturzkampfgeschwader 167", "Sturzkampfgeschwader 168"}
if (num <= # name) then
str = name[num]
unit:SetName(str)
else
str = "Sturzkampfgeschwader " .. num
unit:SetName(str)
end
end


However, when implemented, the game still classifies all the units under the same naming category, my first StG squadron would be Sturzkampfgeschwader 3 rather than StG 1 due to the first 2 squadrons i have being He-111 squadrons.

Is there anyway to separate all the planes, similar to how the naval units are named?
 
Difficult, as changing the numeration may affect other parts of the code, you'll have to use CountUnitType (unitType) in your code to get the number of that type of unit (naming is based on number of a "class")
 
Top Bottom