i changed both scripts nowfor the decal it's this script
Code:
--[[ sub-model for use in all models to place (cutout) decals on them, texture can have a alpha channel for a cutout decal but it's not a must if sequence is expandet so all squadrons can use all decals]]--define_model('decal', {info = {bounding_radius = 1,materials = {'decal'}},static = function(lod)end,dynamic = function(lod) selector1() -- requests "random" number from selector functionset_material('decal', .7,.7,.7, 0.99, .3,.3,.3,5) -- creates semi-transparent material to cut out alpha channel, has to be 0use_material('decal') if select1 < 26 then texture('sub_models/decals/decal_a.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) -- calls the texture for the decal, else if select1 < 51 thentexture('sub_models/decals/decal_b.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) -- if sequence could be expandet to 1000!(limited by "select1or" function) different decals, but 10 will be ok i guess

else if select1 < 76 thentexture('sub_models/decals/decal_c.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) -- when adding a additional one, divide 1000 through no. of total decals else if select1 < 101 thentexture('sub_models/decals/decal_d.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) -- feel free to exchange the existing ones with your own style else if select1 < 126 then texture('sub_models/decals/decal_e.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) -- accepts any quadratical sized texture, recommendet are 128x128, 256x256else if select1 < 151 thentexture('sub_models/decals/decal_f.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 176 then texture('sub_models/decals/decal_g.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 201 then texture('sub_models/decals/decal_h.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 226 thentexture('sub_models/decals/decal_i.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 251 thentexture('sub_models/decals/decal_j.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 276 thentexture('sub_models/decals/decal_a.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 301 thentexture('sub_models/decals/decal_b.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 326 thentexture('sub_models/decals/decal_c.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 351 then texture('sub_models/decals/decal_d.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 376 thentexture('sub_models/decals/decal_e.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 401 thentexture('sub_models/decals/decal_f.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 426 thentexture('sub_models/decals/decal_g.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 451 thentexture('sub_models/decals/decal_h.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 476 thentexture('sub_models/decals/decal_i.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 501 thentexture('sub_models/decals/decal_j.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 526 thentexture('sub_models/decals/decal_a.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 551 thentexture('sub_models/decals/decal_b.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 576 thentexture('sub_models/decals/decal_c.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 601 thentexture('sub_models/decals/decal_d.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 626 thentexture('sub_models/decals/decal_e.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 651 thentexture('sub_models/decals/decal_f.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 676 thentexture('sub_models/decals/decal_g.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 701 thentexture('sub_models/decals/decal_h.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 726 thentexture('sub_models/decals/decal_i.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 751 then texture('sub_models/decals/decal_j.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 776 thentexture('sub_models/decals/decal_a.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 801 thentexture('sub_models/decals/decal_b.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 826 thentexture('sub_models/decals/decal_c.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 851 then texture('sub_models/decals/decal_d.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 876 then texture('sub_models/decals/decal_e.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 901 thentexture('sub_models/decals/decal_f.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 926 thentexture('sub_models/decals/decal_g.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 951 thentexture('sub_models/decals/decal_h.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 976 thentexture('sub_models/decals/decal_i.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) elseif select1 > 975 thentexture('sub_models/decals/decal_j.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) end end end end end endendendendendendendendendendendendendendendendendendendendendendendendendendendendendendendendendendend zbias(100,v(0,0,0),v(0,0,0))quad(v(0,0,0), v(0,1,0), v(0,1,1), v(0,0,1)) -- creates a quadratic shape 1m x 1m for the decalzbias(0)end})function decal(set,v_pos,v_u,v_v)if set == 1 thenselector1() if select1 < 26 then texture('sub_models/decals/decal_a.png', v_pos, v_u, v_v) else if select1 < 51 thentexture('sub_models/decals/decal_b.png', v_pos, v_u, v_v) else if select1 < 76 thentexture('sub_models/decals/decal_c.png', v_pos, v_u, v_v) else if select1 < 101 thentexture('sub_models/decals/decal_d.png', v_pos, v_u, v_v) else if select1 < 126 then texture('sub_models/decals/decal_e.png', v_pos, v_u, v_v)else if select1 < 151 thentexture('sub_models/decals/decal_f.png', v_pos, v_u, v_v) else if select1 < 176 then texture('sub_models/decals/decal_g.png', v_pos, v_u, v_v) else if select1 < 201 then texture('sub_models/decals/decal_h.png', v_pos, v_u, v_v) else if select1 < 226 thentexture('sub_models/decals/decal_i.png', v_pos, v_u, v_v) else if select1 < 251 thentexture('sub_models/decals/decal_j.png', v_pos, v_u, v_v) else if select1 < 276 thentexture('sub_models/decals/decal_a.png', v_pos, v_u, v_v) else if select1 < 301 thentexture('sub_models/decals/decal_b.png', v_pos, v_u, v_v) else if select1 < 326 thentexture('sub_models/decals/decal_c.png', v_pos, v_u, v_v) else if select1 < 351 then texture('sub_models/decals/decal_d.png', v_pos, v_u, v_v) else if select1 < 376 thentexture('sub_models/decals/decal_e.png', v_pos, v_u, v_v) else if select1 < 401 thentexture('sub_models/decals/decal_f.png', v_pos, v_u, v_v) else if select1 < 426 thentexture('sub_models/decals/decal_g.png', v_pos, v_u, v_v) else if select1 < 451 thentexture('sub_models/decals/decal_h.png', v_pos, v_u, v_v) else if select1 < 476 thentexture('sub_models/decals/decal_i.png', v_pos, v_u, v_v) else if select1 < 501 thentexture('sub_models/decals/decal_j.png', v_pos, v_u, v_v) else if select1 < 526 thentexture('sub_models/decals/decal_a.png', v_pos, v_u, v_v) else if select1 < 551 thentexture('sub_models/decals/decal_b.png', v_pos, v_u, v_v) else if select1 < 576 thentexture('sub_models/decals/decal_c.png', v_pos, v_u, v_v) else if select1 < 601 thentexture('sub_models/decals/decal_d.png', v_pos, v_u, v_v) else if select1 < 626 thentexture('sub_models/decals/decal_e.png', v_pos, v_u, v_v) else if select1 < 651 thentexture('sub_models/decals/decal_f.png', v_pos, v_u, v_v) else if select1 < 676 thentexture('sub_models/decals/decal_g.png', v_pos, v_u, v_v) else if select1 < 701 thentexture('sub_models/decals/decal_h.png', v_pos, v_u, v_v) else if select1 < 726 thentexture('sub_models/decals/decal_i.png', v_pos, v_u, v_v) else if select1 < 751 then texture('sub_models/decals/decal_j.png', v_pos, v_u, v_v) else if select1 < 776 thentexture('sub_models/decals/decal_a.png', v_pos, v_u, v_v) else if select1 < 801 thentexture('sub_models/decals/decal_b.png', v_pos, v_u, v_v) else if select1 < 826 thentexture('sub_models/decals/decal_c.png', v_pos, v_u, v_v) else if select1 < 851 then texture('sub_models/decals/decal_d.png', v_pos, v_u, v_v) else if select1 < 876 then texture('sub_models/decals/decal_e.png', v_pos, v_u, v_v) else if select1 < 901 thentexture('sub_models/decals/decal_f.png', v_pos, v_u, v_v) else if select1 < 926 thentexture('sub_models/decals/decal_g.png', v_pos, v_u, v_v) else if select1 < 951 thentexture('sub_models/decals/decal_h.png', v_pos, v_u, v_v) else if select1 < 976 thentexture('sub_models/decals/decal_i.png', v_pos, v_u, v_v) elseif select1 > 975 thentexture('sub_models/decals/decal_j.png', v_pos, v_u, v_v) end end end end end endendendendendendendendendendendendendendendendendendendendendendendendendendendendendendendendendendendendend
the function needs some argumentsdecal(set,v_pos,v_u,v_v)the idea behind is to make it more flexible,let's say one likes to add a new set of decals and even perhaps a own routine to select them, thats why i added the "set" to the arguments.v_pos,v_u,v_v, is only ment if one likes to implement the function to a scripted model, but unfortunatly you have to pass all arguments to call the function now(still that is all ment to be called from the dynamic section)that would be thendecal(1,v(0,0,0),v(0,0,0),v(0,0,0))if you call the function for as texture for a .objmaterial i left up to the modeler to assign a own one.this one would replace the squad sign or affiliation
Code:
define_model('squad_color', {info = { bounding_radius = 1,materials = {'squad'},},static = function(lod) use_material('squad')end,dynamic = function(lod) selector1()if select1 < 201 then set_material('squad', .5,0,0,.99,.6,.6,.6,30) elseif select1 < 401 then set_material('squad', .45,.35,.01,.99,.6,.6,.6,30)else if select1 < 601 thenset_material('squad', 0,.15,.7,.99,.6,.6,.6,30) else if select1 < 801 thenset_material('squad', .06,.35,0,.99,.6,.6,.6,30)elseif select1 > 800 thenset_material('squad', .2,0,.35,.99,.6,.6,.6,30)endendendendendend})define_model('squadsign_1', {info = { bounding_radius = 1,materials = {'squad'},},static = function(lod)use_material('squad')texture('squad_1.png', v(0,0,0), v(0,0,-1), v(0,-1,0))zbias(100,v(0,0,0),v(0,0,0))quad(v(0,0,0), v(0,1,0), v(0,1,1), v(0,0,1))zbias(0)end,dynamic = function(lod)selector1()if select1 < 201 then set_material('squad', .5,0,0,.99,.2,.2,.2,10) elseif select1 < 401 then set_material('squad', .45,.35,.01,.99,.2,.2,.2,10)else if select1 < 601 thenset_material('squad', 0,.15,.7,.99,.2,.2,.2,10) else if select1 < 801 thenset_material('squad', .06,.35,0,.99,.2,.2,.2,10)elseif select1 > 800 thenset_material('squad', .2,0,.35,.99,.2,.2,.2,10)endendendendendend })define_model('imp_sign_1', {info = { bounding_radius = 1, materials = {'mat'},},static = function(lod)set_material('mat',.7,.68,.65,.99,.2,.2,.2,10)end,dynamic = function(lod)selector1()if select1 < 201 then texture('sub_models/squadsign/impsign_0.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) elseif select1 < 401 then texture('sub_models/squadsign/impsign_1.png', v(0,0,0), v(0,0,-1), v(0,-1,0))else if select1 < 601 then texture('sub_models/squadsign/impsign_2.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else if select1 < 801 then texture('sub_models/squadsign/impsign_3.png', v(0,0,0), v(0,0,-1), v(0,-1,0))elseif select1 > 800 then texture('sub_models/squadsign/impsign_4.png', v(0,0,0), v(0,0,-1), v(0,-1,0))endendendendenduse_material('mat')zbias(100,v(0,0,0),v(0,0,0))quad(v(0,0,0), v(0,1,0), v(0,1,1), v(0,0,1))zbias(0)end})function imp_sign(set,v_pos,v_u,v_v)-- preset, because i need time to update my modelslocal set = 1local v_pos = v(0,0,0)local v_u = v(-1,0,0)local v_v = v(0,-1,0)if set == 1 thenselector1()if select1 < 201 then texture('sub_models/squadsign/impsign_0.png', v_pos, v_u, v_v) elseif select1 < 401 then texture('sub_models/squadsign/impsign_1.png', v_pos, v_u, v_v)else if select1 < 601 then texture('sub_models/squadsign/impsign_2.png', v_pos, v_u, v_v)else if select1 < 801 then texture('sub_models/squadsign/impsign_3.png', v_pos, v_u, v_v)elseif select1 > 800 then texture('sub_models/squadsign/impsign_4.png', v_pos, v_u, v_v)endendendendendendendfunction fed_sign(set,v_pos,v_u,v_v)-- preset, because i need time to update my modelslocal set = 1local v_pos = v(0,0,0)local v_u = v(-1,0,0)local v_v = v(0,-1,0)if set == 1 thenselector1()if select1 < 201 thenset_material('squad', .5,0,0,.99,.2,.2,.2,10) elseif select1 < 401 thenset_material('squad', .45,.35,.01,.99,.2,.2,.2,10) else if select1 < 601 then set_material('squad', 0,.15,.7,.99,.2,.2,.2,10)else if select1 < 801 then set_material('squad', .06,.35,0,.99,.2,.2,.2,10)elseif select1 > 800 thenset_material('squad', .2,0,.35,.99,.2,.2,.2,10)endendendendendendtexture('sub_models/squadsign/squad_1.png', v_pos, v_u, v_v)use_material('squad')end
it's will be called like the decal function now and needs to get some information from you

that's again set,v_pos,v_u,v_vi.e.imp_sign(1,v(0,0,0),(0,0,-1),v(0,-1,0))if one would like to use it in a scripted model using a quad sized 1x1actually this is overridden by me because i need some time to update my existing models.but if one likes to use the new script allready, i can only recommend to use it in the above shown way.i guess i will have to update all models to use the function, then i will remove the old model from the script.fortunatly not many except myself used it until now.still i could explain how to place a pre-modeled decal, the system behind is useful for any transformation you like to do into a script.this upgraded function allows you to make small texture animations for the decals.
