RemoveWorldModel: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
m (Fix small precision)
(12 intermediate revisions by 7 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Server client function|New items}}
{{Server client function}}
{{Note box|There are two types of world objects Binary IPL (anything not in data/maps and in gta3.img) and data IPL (anything in data/maps) Binary IPL removal requires a stream out if you are deleting anything within 300 units (anything visible) you can just move the camera to do this. Data IPL are removed instantly and this is not required. Also LOD objects are not removed automatically so you need to remove them separately.}}
<!--
{{Note box|Pre r4844: There are two types of world objects: Binary IPL (anything not in data/maps and in gta3.img & gta_int.img) and Data IPL (anything in data/maps). Binary IPL removal requires a stream out if you are deleting anything within 300 units (anything visible) you can just move the camera to do this. Data IPL are removed instantly and this is not required. Be aware that LOD object models are not removed automatically with the model they are linked to, so you need to remove them separately.}}
-->
This function is used to remove a world object.
This function is used to remove a world object.
{{Tip|It is strongly advised that you use this server side rather than client side because it will just function infinitely better as you should not need to handle streaming it out/back in.}}
<!--
 
{{Tip|Pre r4844: It is strongly advised that you use this server side rather than client side because it will just function infinitely better as you should not need to handle streaming it out/back in.}}
-->
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">bool removeWorldModel ( int modelID, float radius, float x, float y, float z [, int interior = 0 ] )</syntaxhighlight>  
<syntaxhighlight lang="lua">bool removeWorldModel ( int modelID, float radius, float x, float y, float z [, int interior = -1 ] )</syntaxhighlight>  


===Required Arguments===  
===Required Arguments===  
Line 17: Line 20:
===Optional Arguments===  
===Optional Arguments===  
{{New items|3.0132|1.3.2|
{{New items|3.0132|1.3.2|
*'''interior:''' The interior ID to apply the removal to ( some objects in interior 13 show in all interiors so if you want to remove everything in interior 0 also remove everything in interior 13 )
*'''interior:''' The interior ID to apply the removal to. Some objects in interior 13 show in all interiors so if you want to remove everything in interior 0 also remove everything in interior 13. A value of -1 here will affect all interiors.}}
}}
 
===Returns===
===Returns===
Returns ''true'' if the [[object]] was removed, ''false'' if invalid arguments were passed.
Returns ''true'' if the world object was removed, ''false'' if invalid arguments were passed.


==Requirements==
==Requirements==
Line 29: Line 30:
This example will removes buildings on BigEar:
This example will removes buildings on BigEar:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
removeWorldModel(16617,1000,-300,1556,75) --lod
removeWorldModel(16617, 1000, -300, 1556, 75) --lod
removeWorldModel(16616,1000,-300,1556,75) --lod
removeWorldModel(16616, 1000, -300, 1556, 75) --lod
removeWorldModel(16615,1000,-300,1556,75) --lod
removeWorldModel(16615, 1000, -300, 1556, 75) --lod
removeWorldModel(16138,1000,-300,1556,75) -- model
removeWorldModel(16138, 1000, -300, 1556, 75) -- model
</syntaxhighlight>
</syntaxhighlight>


This example removes CJ house:
This example removes CJ house:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
for i=700,20000 do
for i = 700, 18630 do
     removeWorldModel(i,10,2494,-1696,17)
     removeWorldModel(i, 10, 2494, -1696, 17)
end
</syntaxhighlight>
 
This server script example removes all models, everywhere:
<syntaxhighlight lang="lua">
for i = 321, 18630 do
    removeWorldModel(i, 10000, 0, 0, 0)
end
end
setOcclusionsEnabled(false)  -- Also disable occlusions when removing certain models
setWaterLevel(-5000)        -- Also hide the default water as it will be full of holes
</syntaxhighlight>
</syntaxhighlight>


Line 45: Line 55:
{{ChangelogHeader}}
{{ChangelogHeader}}
{{ChangelogItem|1.3.1-9.04636|Added interior argument}}
{{ChangelogItem|1.3.1-9.04636|Added interior argument}}
{{ChangelogItem|1.3.1-9.04844|Everything streams out fine now.}}


==See Also==
==See Also==
{{Client_world_functions}}
{{Client_world_functions}}

Revision as of 21:51, 25 June 2024

This function is used to remove a world object.

Syntax

bool removeWorldModel ( int modelID, float radius, float x, float y, float z [, int interior = -1 ] )

Required Arguments

  • modelID: A whole integer specifying the GTASA object model ID.
  • radius: A floating point number representing the radius that will be eliminated.
  • x: A floating point number representing the X coordinate on the map.
  • y: A floating point number representing the Y coordinate on the map.
  • z: A floating point number representing the Z coordinate on the map.

Optional Arguments

  • interior: The interior ID to apply the removal to. Some objects in interior 13 show in all interiors so if you want to remove everything in interior 0 also remove everything in interior 13. A value of -1 here will affect all interiors.

Returns

Returns true if the world object was removed, false if invalid arguments were passed.

Requirements

Minimum server version 1.2.0-9.03618
Minimum client version 1.2.0-9.03618

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version server="1.2.0-9.03618" client="1.2.0-9.03618" />

Example

This example will removes buildings on BigEar:

removeWorldModel(16617, 1000, -300, 1556, 75) --lod
removeWorldModel(16616, 1000, -300, 1556, 75) --lod
removeWorldModel(16615, 1000, -300, 1556, 75) --lod
removeWorldModel(16138, 1000, -300, 1556, 75) -- model

This example removes CJ house:

for i = 700, 18630 do
    removeWorldModel(i, 10, 2494, -1696, 17)
end

This server script example removes all models, everywhere:

for i = 321, 18630 do
    removeWorldModel(i, 10000, 0, 0, 0)
end
setOcclusionsEnabled(false)  -- Also disable occlusions when removing certain models
setWaterLevel(-5000)         -- Also hide the default water as it will be full of holes

Changelog

Version Description
1.3.1-9.04636 Added interior argument
1.3.1-9.04844 Everything streams out fine now.

See Also