Jump to content

[HELP] removeWorldModel and dimensions


mono1

Recommended Posts

 

This script removes every single default map object (except the ones I need), the problem is that if affects every single dimension, is there a way to make removeWorldModel delete the objects only in dimension 54? I want to build a new map in that dimension while leaving the default map on dimension 0 intact. thanks in advance!

local ignoreObjects = { 
    [3990]=true, 
    [4131]=true, 
} 
  
for i=550,20000 do 
    if not ignoreObjects[i] then 
        removeWorldModel(i,10000,0,0,0)
    end 
end 
setOcclusionsEnabled(false) 

 

Link to comment

Dear mono1,

did you know that the concept of "dimensions" is invented by MTA to allow for multiple MTA object realms? Dimensions do not exist in GTA:SA. Interiors is the closest matching concept. But as you know MTA currently does not have any functions to make interior 54 look the same like interior 0 (sky, world, etc).

Thus your idea is not that easily possible in the way you suggested. What you can do instead is place your map into the sky (offset z+500) or create a map system that tracks dimension changes on the client-side and removes all world models only-if getElementDimension on the localPlayer is equal to 54.

If you need help implementing anything just ask. :)

- Martin

Edited by The_GTA
Link to comment
5 hours ago, The_GTA said:

did you know that the concept of "dimensions" is invented by MTA to allow for multiple MTA object realms? Dimensions do not exist in GTA:SA. Interiors is the closest matching concept. But as you know MTA currently does not have any functions to make interior 54 look the same like interior 0 (sky, world, etc).

Yes I'm aware, I tried using the Liberty City interior too but the rendering of objects with transparency is bugged among other things. The .map file works as intended and the new maps correctly appears in dimension 54, the problem is the default San Andreas map getting in the way, removeworldmodel does get rid of it but also affects dimension 0. If only there was a parameter for dimensions like it has for interiors...

5 hours ago, The_GTA said:

Thus your idea is not that easily possible in the way you suggested. What you can do instead is place your map into the sky (offset z+500)

I tried that approach too, but the map needs to use the out of bounds water for since it has lots of sea ports and islands (createwater doesn't works as it only raises the water level within the default map boundaries ).

5 hours ago, The_GTA said:

or create a map system that tracks dimension changes on the client-side and removes all world models only-if getElementDimension on the localPlayer is equal to 54.

If you need help implementing anything just ask. :)

That sounds like a potential solution, if you can help me with that I'd be really grateful!

Link to comment
7 hours ago, mono1 said:

That sounds like a potential solution, if you can help me with that I'd be really grateful!

Check out this code.

local last_dim = false;

local function remove_world_models()
    outputDebugString( "removing world models" );
    
    for n=550,19999,1 do
        removeWorldModel(n, 10000, 0, 0, 0);
    end
    
    setOcclusionsEnabled(false);
end

local function restore_world_models()
    outputDebugString( "restoring world models" );
    
    for n=550,19999,1 do
        restoreWorldModel(n, 10000, 0, 0, 0);
    end
    
    setOcclusionsEnabled(true);
end

addEventHandler("onClientRender", root,
    function()
        local cur_dim = getElementDimension(localPlayer);
        
        if not (last_dim == cur_dim) then
            if (cur_dim == 54) then
                remove_world_models();
            elseif (last_dim == 54) then
                restore_world_models();
            end
            
            last_dim = cur_dim;
        end
    end
);

You actually did give me quite the valuable idea for scene2res by the way. It seems reasonable to add a map type where all world models are removed, in a special dimension at least.

Link to comment
17 hours ago, The_GTA said:

Check out this code.

It works perfectly so far, thank you so much for your help! ☺️

17 hours ago, The_GTA said:

You actually did give me quite the valuable idea for scene2res by the way. It seems reasonable to add a map type where all world models are removed, in a special dimension at least.

I use scene2res a lot, that would be an useful feature for huge maps.

  • Like 1
Link to comment
  • 10 months later...

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...