Jump to content

Getting LOD from world model XML node


Solstice.

Recommended Posts

I'm loading XML nodes from a .map file to load maps into a server. I'm trying to add removeWorldObject nodes but for some buildings the LOD element is still there. I tried to use setOcclusionsEnabled but it's not working. Is there a way to find a work around? I was thinking of using getLowLODElement but I'm not sure how to get the world element from the model ID.

I tried using the LOD_MAP from the scripting extension but it doesn't seem to work either.

for k, value in ipairs( result3 ) do 
removeWorldModel( value.model, value.radius, value.x, value.y, value.z ) 
removeWorldModel( LOD_MAP[ tonumber(value.model) ], value.radius, value.x, value.y, value.z ) 
end 

Link to comment
I'm not sure if I understand, what is the real problem? you don't have the LOD model of the building you removed or it's not removing it?

I don't have the LOD model of the buildings I'm trying to remove.

I copied the LOD_MAP table from mapEditorScriptingExtension_s. On instance the element model of the object I'm trying to remove is 5408 (the nightclub in singleplayer) but that model isn't in there, as with the gas station in Idlewood.

I was thinking of trying to use getLowLODElement but I'm not sure how to acquire the parent element I'm removing that the LOD is attached to.

Link to comment

I added a loop to try and get the LOD and it doesn't get a LOD.

                    local result3 = exports.sql:query_assoc( "SELECT * FROM remove_objects WHERE mapID = " .. data.mapID .. " ORDER BY objectID ASC" ) 
                    if result3 then 
                        for k, value in ipairs( result3 ) do 
                            removeWorldModel( value.model, value.radius, value.x, value.y, value.z ) 
                            --outputChatBox( LOD_MAP[ tonumber(value.model) ) 
                            --removeWorldModel( LOD_MAP[ tonumber(value.model) ], value.radius, value.x, value.y, value.z ) 
                            for _, objs in ipairs( getElementsByType( "removeWorldObject" ) ) do 
                                if getElementModel( objs ) == value.model then 
                                    local LOD = getLowLODElement( objs ) 
                                    if LOD then 
                                        outputServerLog("bitch") 
                                        local LODID = getElementModel( LOD ) 
                                        removeWorldModel( LODID, value.radius, value.x, value.y, value.z ) 
                                    end 
                                end 
                            end 
                        end 
                    end 

ef80dbf2dd73ec581540fe473227a497.png

Link to comment
You could just as well go and collect the LOD model ids from the map editor and also store it under another database column or XML attribute

The benefit of the script is being able to just load a .map file with a command instead of having to plow through the XML adding the LODs manually.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...