Wasn't sure where to put this because it's not a script issue and I can't call it a bug either. It's one of those "does anyone know why?" threads
I put together a script to scale trees randomly. It adds variety without manually scaling. (script below for those curious but it's
not actually relevant).
When I test, everything works fine. Trees scale correctly etc. (see images). I come back to the editor, make any other changes and turn the tree scaling script off in code to keep the trees as they are. It all works perfectly.
However, if I close the editor and come back, without reapplying the script all trees are back to 100%. I thought to myself, to keep consistency I am going to have to save the tree size to file and reapply on map load for scene continuity. BUT... if I create the level after reapplying the scaler, the tree scales are permanently fixed in the standalone - in their scaled versions.
Thus it's not technically a "something is broken" issue because I can simply scale, compile and my trees are a fixed size w/o using a save/load in the standalone. But I am hellishly curious why the editor dumps the scale on map being reloaded on editor restart.
Pic 1 shows after scaling. Pic 2 shows after reloading the editor. All back to 100%. Odd.
-- when you are finished set this to 1 - make sure it is 0 for anything else
local done_here = 0
-- change to 1 to randomly scale any entity with this script attached - trees- bushes etc.
local scale_trees= 1
-- set to 1 to put all trees back to "normal" size (scale_trees must be 0 to do so)
local fix_trees = 0
-- use this to set smallest and largest tree size.
local min_tree = 25
local max_tree = 125
--- ********** NO NEED TO PROGRESS BEYOND THIS POINT - warranty void :)
function treescaler_init(e)
have_entity = 0
tree_array = {}
t_count = 0
end
function treescaler_main(e)
if have_entity == 0 and done_here == 0 then
tcount=table.count(tree_array)
-- do we have this tree already?
have_entity=table.search(tcount,tree_array,e) -- pass tcount so we don't do it twice
if have_entity==0 then
tree_array[tcount+1] = e
if fix_trees == 1 then
Scale(e,100)
end
if scale_trees == 1 then
Scale(e,math.random(min_tree,max_tree))
end
end -- if
end -- table populate
end -- function
-- ***************************************
function table.count(tbl)
local c=0
for k in pairs(tbl) do c=c+1 end
return c
end
-- ***************************************
function table.search(tbllen,tbl,tblval)
local z = 1
tblmatch = 0
for z=1, tbllen, 1 do
if tbl[z]==tblval then
tblmatch = 1
end
end
return tblmatch
end
AKA SisterMatic (Steam)
Development/ Gaming Rigs
Sys 1: i7-4770 (3.5)/16Gb/128 SSD/3Tb/970gtx/2 x 23, 1 x 27 LCD - Sys 2: i7/8Gb/670gtx/1.5Tb/1 x 23 LCD - Sys 3: Amd Quad/8Gb/645gtx/1Tb/30" LCD