ok, that was quite a piece of work, therefore it's cool (imo)you can now call the adverts to display with two functions (like promised)one can be called in the static part of a model
Code:
single_advert('advert_model_name', position, vector_right, vector_up, scale, zbias_level)
and displays simply a static advert, i.e. to label a factory building, the "zbias_level" means a integer value to lift the advert proper from the surface beyond, that's far better rather a presetted zbias.the other displays a changing advert, based on a seed you give (don't expect to much, we have actually "only" 19 different adverts to display)
Code:
multi_advert(gen_seed, position, vector_right, vector_up, scale, zbias_level)
gen_seed means any number and sets the difference between called adverts, while with little difference expect little difference, e.g. 1 is followed by 2, even when the adverts get generated by gametime + gen_seed.the cool thing is you don't have to mess a lot with code, the functions are similar to a model to call and the list of adverts to use in the function is easy to update.
Code:
-- list of adverts to use for multi_advert function, higher instances increase the chancelocal all_adverts = {'coolvar_1','ad_acme_0','ad_acme_1','ad_acme_2','ad_pioneer_0','ad_sirius_0','ad_sirius_1','ad_sirius_2','vegaline_1','banner_1','carousel','hal','momcorp','navy','soylent','tyrell_1','tyrell_2','ameisirennen','ameisirennen','ameisirennen','testscr_0','testscr_0','testscr_0',}multi_advert = function(index,v_pos,v_right,v_up,scale,n_zbias)local seed = 1 + indexlocal freq_1 = math.floor(get_time('MINUTES')*3) -- here you can speed up or slow down the changing rate-- setting up table contentsadv_name = {}table.insert (adv_name, all_adverts[math.ceil(math.fmod(index,#all_adverts))])-- exchange contents randomlyfor i = 1,#adv_name do math.randomseed(freq_1+seed)table.insert (adv_name, i, all_adverts[math.random(1,#all_adverts)])table.remove (adv_name)advert_name = adv_nameend-- get it displayedz_level = 0 + n_zbiascall_model(advert_name,v_pos,v_right,v_up,scale)endsingle_advert = function(name,v_pos,v_right,v_up,scale,n_zbias)z_level = 0 + n_zbias call_model(name,v_pos,v_right,v_up,scale)end
to get all working fine (help...) i changed the stations.lua script and moved it to ".../models/stations", and created a textures folder for the stations, to have them accsessable even when one removes i.e. my disabled city or any ship (actually only the eagle which can't be removed, but to be 101% safe).[/hr]anyway, i packed all into a zip to make it work for youagain, note that "spacestations.lua" has moved to "...data/models/stations" and you will have to remove the existing "spacestations.lua" to make it work.submodels_new_adverts_function_and_spacestation_example_1.zip[/hr]btw, marcel it's easy now to make from the station_splash texture a advert which will be displayed then randomly with the others.further i would recommend to make a sub_model from your screens if you use them repeatingly, it doesn't have to be place under "sub_models" (but can), you can use also the models or stations folder (where i placed the stations script now), if you decide for the stations folder, name the i.e. "tv_screen.lua" then "0_tv_screen.lua" to make sure it gets handled in front of any other following models.just as a idea