SetElementStreamable: Difference between revisions
Jump to navigation
Jump to search
(New page: {{Client function}} __NOTOC__ This function can be used to disable streaming for an element. This will make sure the element is not virtualized (streamed out from GTA) when the player mo...) |
(Fixed documentation) |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{Client function}} | {{Client function}} | ||
__NOTOC__ | __NOTOC__ | ||
This function can be used to disable streaming for an element. This will make sure the element is not virtualized (streamed out from GTA) when the player moves far away from it. | This function can be used to disable streaming for an element. This will make sure the element is not virtualized (streamed out from GTA) when the player moves far away from it. This function only works in elements with a physical representation in the world (entities), such as [[player|players]], [[ped|peds]], [[vehicle|vehicles]] and [[object|objects]]. | ||
''' | {{Tip|'''Always use this function with caution'''. Not doing so can cause the following problems: | ||
* There is a limit of elements that can be streamed in safely for every GTA entity type. If you bypass said limit by using this function, the client can experience problems of disappearing objects and unstability when trying to stream in new elements of that type. | |||
* In general, if you disable too many elements (of the same type or not) to stream out, GTA will always try to render them, so it can cause a noticeable FPS drop.}} | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool setElementStreamable ( element theElement, bool streamable ) | bool setElementStreamable ( element theElement, bool streamable ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{New feature/item|3.0141|1.4.0|6987|{{OOP||[[element]]:setStreamable|streamable|isElementStreamable}}}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theElement:''' The element you wish to set the streaming of | *'''theElement:''' The element you wish to set the streaming of | ||
*'''streamable:''' | *'''streamable:''' ''true'' if this element should stream in/out like normal, ''false'' if it should always be streamed in. | ||
===Returns=== | ===Returns=== | ||
Returns | Returns whether the element could be set to be streamable. | ||
==Example== | ==Example== | ||
This example creates an [[object]] at the center of the map which will always be streamed in when the resource which contains it starts. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
local function testNonStreamableObjects() | |||
local object = createObject ( 1097, 0, 0, 5 ) | |||
setElementStreamable ( object, false ) -- Make the object always be streamed in | |||
end | |||
addEventHandler ( "onClientResourceStart", resourceRoot, testNonStreamableObjects ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{ | {{Client_element_functions}} |
Latest revision as of 15:57, 13 August 2015
This function can be used to disable streaming for an element. This will make sure the element is not virtualized (streamed out from GTA) when the player moves far away from it. This function only works in elements with a physical representation in the world (entities), such as players, peds, vehicles and objects.
Tip: Always use this function with caution. Not doing so can cause the following problems:
|
Syntax
bool setElementStreamable ( element theElement, bool streamable )
OOP Syntax Help! I don't understand this!
- Method: element:setStreamable(...)
- Variable: .streamable
- Counterpart: isElementStreamable
Required Arguments
- theElement: The element you wish to set the streaming of
- streamable: true if this element should stream in/out like normal, false if it should always be streamed in.
Returns
Returns whether the element could be set to be streamable.
Example
This example creates an object at the center of the map which will always be streamed in when the resource which contains it starts.
local function testNonStreamableObjects() local object = createObject ( 1097, 0, 0, 5 ) setElementStreamable ( object, false ) -- Make the object always be streamed in end addEventHandler ( "onClientResourceStart", resourceRoot, testNonStreamableObjects )
See Also
- getElementBoneMatrix
- getElementBonePosition
- getElementBoneRotation
- getElementBoundingBox
- getElementDistanceFromCentreOfMassToBaseOfModel
- getElementLighting
- getElementRadius
- isElementCollidableWith
- isElementLocal
- isElementOnScreen
- isElementStreamable
- isElementStreamedIn
- isElementSyncer
- isElementWaitingForGroundToLoad
- setElementBoneMatrix
- setElementBonePosition
- setElementBoneRotation
- setElementCollidableWith
- setElementStreamable
- updateElementRpHAnim
- Shared
- attachElements
- createElement
- destroyElement
- detachElements
- getAttachedElements
- getElementAlpha
- getElementAttachedOffsets
- getElementAttachedTo
- getElementByIndex
- getElementByID
- getElementChild
- getElementChildren
- getElementChildrenCount
- getElementCollisionsEnabled
- getElementColShape
- getElementData
- getAllElementData
- hasElementData
- getElementDimension
- getElementHealth
- getElementID
- getElementInterior
- getElementMatrix
- getElementModel
- getElementParent
- getElementPosition
- getElementRotation
- getElementsByType
- getElementsWithinColShape
- getElementsWithinRange
- getElementType
- getElementVelocity
- getLowLODElement
- getRootElement
- isElement
- isElementAttached
- isElementCallPropagationEnabled
- isElementDoubleSided
- isElementFrozen
- isElementInWater
- isElementLowLOD
- isElementWithinColShape
- isElementWithinMarker
- setElementAlpha
- setElementAngularVelocity
- getElementAngularVelocity
- setElementAttachedOffsets
- setElementCallPropagationEnabled
- setElementCollisionsEnabled
- setElementData
- setElementDimension
- setElementDoubleSided
- setElementFrozen
- setElementHealth
- setElementID
- setElementInterior
- setElementModel
- setElementParent
- setElementPosition
- setElementRotation
- setElementVelocity
- setLowLODElement
- getPedContactElement
- getResourceDynamicElementRoot
- getResourceRootElement