Bean666 Posted June 8, 2016 Posted June 8, 2016 is there anyway scripted gates will be exempted from this script? because this script makes objects visible even far from distance, but it's messing up the scripted gates. or Exempt a certain Object ID? here is why: code: local objects = getElementsByType("object") for i, v in ipairs(objects) do local x,y,z = getElementPosition(v) local xr,yr,zr = getElementRotation(v) setLowLODElement(v,createObject ( getElementModel(v), x,y,z,xr,yr,zr,true ) ) end
Captain Cody Posted June 8, 2016 Posted June 8, 2016 You have to not include the object id example: if not (ID) then
Bean666 Posted June 8, 2016 Author Posted June 8, 2016 like this? EDIT: lol nope local objects = getElementsByType("object") for i, v in ipairs(objects) do local x,y,z = getElementPosition(v) local xr,yr,zr = getElementRotation(v) local ID = getElementModel (v) if not (ID) == 3113 then setLowLODElement(v,createObject ( getElementModel(v), x,y,z,xr,yr,zr,true ) ) end end
Captain Cody Posted June 8, 2016 Posted June 8, 2016 may work - - local objects = getElementsByType("object") for i, v in ipairs(objects) do if ID ~= 3113 then local x,y,z = getElementPosition(v) local xr,yr,zr = getElementRotation(v) local ID = getElementModel (v) setLowLODElement(v,createObject ( getElementModel(v), x,y,z,xr,yr,zr,true )) end end
Bean666 Posted June 8, 2016 Author Posted June 8, 2016 may work - - local objects = getElementsByType("object") for i, v in ipairs(objects) do if ID ~= 3113 then local x,y,z = getElementPosition(v) local xr,yr,zr = getElementRotation(v) local ID = getElementModel (v) setLowLODElement(v,createObject ( getElementModel(v), x,y,z,xr,yr,zr,true )) end end great i never thought of that idea of ~= , ~= means different right? and == means equal , anywy going to test it , hope it works! EDIT: It wasn't working in the beginning but i optimized the script and did this: i switched the local ID = getElementModel (v) on the top and it managed to fix it. local objects = getElementsByType("object") for i, v in ipairs(objects) do local ID = getElementModel (v) if ID ~= 3113 then local x,y,z = getElementPosition(v) local xr,yr,zr = getElementRotation(v) setLowLODElement(v,createObject ( getElementModel(v), x,y,z,xr,yr,zr,true )) end end
Anubhav Posted June 9, 2016 Posted June 9, 2016 may work - - local objects = getElementsByType("object") for i, v in ipairs(objects) do if ID ~= 3113 then local x,y,z = getElementPosition(v) local xr,yr,zr = getElementRotation(v) local ID = getElementModel (v) setLowLODElement(v,createObject ( getElementModel(v), x,y,z,xr,yr,zr,true )) end end great i never thought of that idea of ~= , ~= means different right? and == means equal , anywy going to test it , hope it works! EDIT: It wasn't working in the beginning but i optimized the script and did this: i switched the local ID = getElementModel (v) on the top and it managed to fix it. local objects = getElementsByType("object") for i, v in ipairs(objects) do local ID = getElementModel (v) if ID ~= 3113 then local x,y,z = getElementPosition(v) local xr,yr,zr = getElementRotation(v) setLowLODElement(v,createObject ( getElementModel(v), x,y,z,xr,yr,zr,true )) end end == means equal to ~= not equal to
Bean666 Posted June 10, 2016 Author Posted June 10, 2016 i already know that ^-^ and i could use more IDS right? is this right or wrong if i add more IDs? local objects = getElementsByType("object") for i, v in ipairs(objects) do local ID = getElementModel (v) if ID ~= 3113 or if ID ~= 980 then local x,y,z = getElementPosition(v) local xr,yr,zr = getElementRotation(v) setLowLODElement(v,createObject ( getElementModel(v), x,y,z,xr,yr,zr,true )) end end
Walid Posted June 10, 2016 Posted June 10, 2016 is this right or wrong if i add more IDs? use tables try sth like this, put my code after checking the object model. local id = {3113,980, --[[add more ids here]]} for i, v in pairs (id) do -- your code here -- if ID ~= v then etc.. end
Anubhav Posted June 10, 2016 Posted June 10, 2016 is this right or wrong if i add more IDs? use tables try sth like this, put my code after checking the object model. local id = {3113,980, --[[add more ids here]]} for i, v in pairs (id) do -- your code here -- if ID ~= v then etc.. end that will lag the server. looping for every id is not a good idea rather: local id = { [3113]=true, } if not v[id] then end
Discord Moderators AlexTMjugador Posted June 10, 2016 Discord Moderators Posted June 10, 2016 You can try moving the low LOD object too, instead of making your draw-distance script not work with scripted gates. Or even simpler: attach the low LOD object to the main object, like in the Wiki setLowLODElement example.
Captain Cody Posted June 10, 2016 Posted June 10, 2016 Looping through numbers won't lag a server. Any ways -- Do as alex said local objects = getElementsByType("object") for i, v in ipairs(objects) do local x,y,z = getElementPosition(v) local xr,yr,zr = getElementRotation(v) setLowLODElement(v,createObject ( getElementModel(v), x,y,z,xr,yr,zr,true ) local lowlod = getLowLODElement(v) attachElements(lowlod,v) ) end
Anubhav Posted June 10, 2016 Posted June 10, 2016 Looping through numbers won't lag a server. Any ways -- Do as alex said local objects = getElementsByType("object") for i, v in ipairs(objects) do local x,y,z = getElementPosition(v) local xr,yr,zr = getElementRotation(v) setLowLODElement(v,createObject ( getElementModel(v), x,y,z,xr,yr,zr,true ) local lowlod = getLowLODElement(v) attachElements(lowlod,v) ) end It will. When you loop through every object and then loop through a table again. Actually, it is not that optimized and won't matter much.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now