Advertisement
Metalhead33

M2TW Model Generator

Jun 7th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.23 KB | None | 0 0
  1. function tablelength(T)
  2.   local count = 0
  3.   for _ in pairs(T) do count = count + 1 end
  4.   return count
  5. end
  6.  
  7. global_model = "unit_models/_Units/EN_Lmail_Hmail/textures/EN_Lmail_Hmail_"
  8. global_model_normal = "unit_models/_Units/EN_Lmail_Hmail/textures/EN_Lmail_Hmail_normal.texture"
  9. global_sprite = "_ug1_Pavise_Crossbowmen_sprite.spr"
  10. global_attachment = "unit_models/AttachmentSets/Final European CB Gun_"
  11.  
  12. function generate_unit(faction)
  13.     local strings = {}
  14.     local temp_string
  15.     strings[1] = string.len(faction) .." " .. faction .."\n"
  16.     temp_string = global_model .. faction ..".texture"
  17.     strings[2] = string.len(temp_string) .." " .. temp_string .."\n"
  18.     strings[3] = string.len(global_model_normal) .. " " .. global_model_normal .. "\n"
  19.     temp_string ="unit_sprites/" .. faction ..global_sprite
  20.     strings[4] = string.len(temp_string) .." " .. temp_string .."\n"
  21.     temp_string =""
  22.     for key in pairs(strings) do
  23.         temp_string = temp_string .. strings[key]
  24.     end
  25.     return temp_string
  26. end
  27.  
  28. function generate_unit2(faction)
  29.     local strings = {}
  30.     local temp_string
  31.     strings[1] = string.len(faction) .." " .. faction .."\n"
  32.     temp_string =global_attachment .. faction .."_diff.texture"
  33.     strings[2] = string.len(temp_string) .." " .. temp_string .."\n"
  34.     temp_string =global_attachment .. faction .."_norm.texture"
  35.     strings[3] = string.len(temp_string) .." " .. temp_string .." 0\n"
  36.     temp_string =""
  37.     for key in pairs(strings) do
  38.         temp_string = temp_string .. strings[key]
  39.     end
  40.     return temp_string
  41. end
  42.  
  43. function generate_units1(factions)
  44.     local temp_string = tablelength(factions) .."\n"
  45.     for key in pairs(factions) do
  46.         temp_string = temp_string .. generate_unit(factions[key])
  47.     end
  48.     return temp_string
  49. end
  50. function generate_units2(factions)
  51.     local temp_string = tablelength(factions) .."\n"
  52.     for key in pairs(factions) do
  53.         temp_string = temp_string .. generate_unit2(factions[key])
  54.     end
  55.     return temp_string
  56. end
  57.  
  58. factiones = {"england","france","hre","spain","venice","sicily","milan","scotland","denmark","portugal","poland","hungary","slave","papal_states"}
  59. print(generate_units1(factiones) .. generate_units2(factiones) )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement