MoveObject: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 22: | Line 22: | ||
x, y, z = [[getPlayerPosition]] ( someguy ) | x, y, z = [[getPlayerPosition]] ( someguy ) | ||
someObject = [[createObject]] ( 1700, x + 5, y, z ) | someObject = [[createObject]] ( 1700, x + 5, y, z ) | ||
[[moveObject]] ( | [[moveObject]] ( someObject, 3000, x, y, z ) | ||
[[serverChat]] ( "Moving a bed towards someguy" ) | [[serverChat]] ( "Moving a bed towards someguy" ) | ||
else | else | ||
[[serverChat]] ( "Player someguy doesn't exist" ) | [[serverChat]] ( "Player someguy doesn't exist" ) | ||
end | end |
Revision as of 14:15, 30 March 2006
Description
This function will smoothly move an object from its current position/rotation to the given target position/rotation in the given time. If the function fails for some reason, it will return false.
Syntax
bool moveObject ( object, time, targetx, targety, targetz, targetrx, targetry, targetrz )
Required Arguments
- object: The object that will be moved.
- time: The time in milliseconds the object will arrive at the destination.
- targetx: The X value of the target position
- targety: The Y value of the target position
- targetz: The Z value of the target position
- targetrx: The X value of the target rotation
- targetry: The Y value of the target rotation
- targetrz: The Z value of the target rotation
Example
someguy = getPlayerFromNick ( "someguy" ) if ( someguy ) then x, y, z = getPlayerPosition ( someguy ) someObject = createObject ( 1700, x + 5, y, z ) moveObject ( someObject, 3000, x, y, z ) serverChat ( "Moving a bed towards someguy" ) else serverChat ( "Player someguy doesn't exist" ) end