setElementParent
Pair: getElementParent
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
This function is used for setting an element as the parent of another element.
This function does not change when an element will be destroyed - Elements are always destroyed when the resource that created them is stopped.
When an element is destroyed, its parent becomes the new parent of its children.
setElementParent only works if new parent is the root element, map root, or ancestor of map root
This function does not affect the child elements position. To attach elements use the function attachElements .
The client-side version of this function can only be used on client-created elements. It cannot be used to modify the parent of server side elements.
OOP Syntax Help! I don't understand this!
- Method:element:setParent(...)
- Variable: .parent
Syntax
bool setElementParent ( element theElement, element parent )Required Arguments
- theElement: The element that you wish to set the parent of.
- parent: The element you wish to be the parent of theElement .
Returns
- bool: value
Returns true if both elements are valid, false otherwise.
Code Examples
This example sets the parent of each spawnpoint to a dummy element:
dummyElem = createElement ( "spawngroup", "Group of spawn points" ) -- create a dummy elementlocal spawnpoints = getElementsByType ( "spawnpoint" ) -- get a table of spawn point elementsfor k,v in ipairs (spawnpoints) do -- loop through the table of spawn points setElementParent ( v, dummyElem ) -- set the dummy element as the parent of the spawn pointend-- all of the spawn points are now children of 'dummyElem'See Also
Element Functions
- addElementDataSubscriber
- attachElements
- clearElementVisibleTo
- cloneElement
- createElement
- destroyElement
- detachElements
- getAllElementData
- getAttachedElements
- getElementAlpha
- getElementAngularVelocity
- getElementAttachedOffsets
- getElementAttachedTo
- getElementBonePosition
- getElementBoneQuaternion
- getElementBoneRotation
- getElementBoundingBox
- getElementByID
- getElementByIndex
- getElementChild
- getElementChildren
- getElementChildrenCount
- getElementCollisionsEnabled
- getElementColShape
- getElementData
- getElementDimension
- getElementDistanceFromCentreOfMassToBaseOfModel
- getElementHealth
- getElementID
- getElementInterior
- getElementLighting
- getElementModel
- getElementParent
- getElementPosition
- getElementRadius
- getElementRotation
- getElementsByType
- getElementsWithinColShape
- getElementsWithinRange
- getElementSyncer
- getElementType
- getElementVelocity
- getElementZoneName
- getLowLODElement
- getRootElement
- hasElementData
- hasElementDataSubscriber
- isElement
- isElementAttached
- isElementCallPropagationEnabled
- isElementCollidableWith
- isElementDoubleSided
- isElementFrozen
- isElementInWater
- isElementLocal
- isElementLowLOD
- isElementOnFire
- isElementOnScreen
- isElementStreamable
- isElementStreamedIn
- isElementSyncer
- isElementVisibleTo
- isElementWaitingForGroundToLoad
- isElementWithinColShape
- isElementWithinMarker
- removeElementData
- removeElementDataSubscriber
- setElementAlpha
- setElementAngularVelocity
- setElementAttachedOffsets
- setElementBonePosition
- setElementBoneQuaternion
- setElementBoneRotation
- setElementCallPropagationEnabled
- setElementCollidableWith
- setElementCollisionsEnabled
- setElementData
- setElementDimension
- setElementDoubleSided
- setElementFrozen
- setElementHealth
- setElementID
- setElementInterior
- setElementLighting
- setElementModel
- setElementOnFire
- setElementParent
- setElementPosition
- setElementRotation
- setElementStreamable
- setElementSyncer
- setElementVelocity
- setElementVisibleTo
- setLowLODElement
- updateElementRpHAnim
Element Events
- onClientElementColShapeHit
- onClientElementColShapeLeave
- onClientElementDataChange
- onClientElementDestroy
- onClientElementDimensionChange
- onClientElementInteriorChange
- onClientElementModelChange
- onClientElementStreamIn
- onClientElementStreamOut
- onElementClicked
- onElementColShapeHit
- onElementColShapeLeave
- onElementDataChange
- onElementDestroy
- onElementDimensionChange
- onElementInteriorChange
- onElementModelChange
- onElementStartSync
- onElementStopSync