SetWaterVertexPosition: Difference between revisions
Jump to navigation
Jump to search
(New page: __NOTOC__ {{Client function}} Sets the world position of a corner point of a water area. ''Be careful with this function. San Andreas is very picky about the positioning of water vertices...) |
No edit summary |
||
(11 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{ | {{Server client function}} | ||
Sets the world position of a corner point of a water area. | Sets the world position of a corner point of a water area. | ||
{{Note|X and Y positions will be changed to an even integer. i.e. -2, 0, 2, 4 etc.}} | |||
==Syntax== | |||
<syntaxhighlight lang="lua">bool setWaterVertexPosition ( water theWater, int vertexIndex, int x, int y, float z )</syntaxhighlight> | |||
{{OOP||[[water]]:setVertexPosition||getWaterVertexPosition}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
Line 16: | Line 18: | ||
===Returns=== | ===Returns=== | ||
Returns ''true'' if successful, ''false'' otherwise. | Returns ''true'' if successful, ''false'' otherwise. | ||
==Example== | |||
<section name="Server" class="server" show="true"> | |||
This example creates a water whose vertices 2 and 4 go up and down when someone uses the '/water' command. | |||
<syntaxhighlight lang="lua"> | |||
waterSquare = createWater (1418, -625, 91.8, 1436, -625, 91.8, 1418, -613, 91.8, 1436, -613, 91.8) | |||
local waterVertices = false | |||
function waterUp () | |||
if waterVertices == false then | |||
setWaterVertexPosition (waterSquare, 2, 1436, -625, 94.8) | |||
setWaterVertexPosition (waterSquare, 4, 1436, -613, 94.8) | |||
waterVertices = true | |||
else | |||
setWaterVertexPosition (waterSquare, 2, 1436, -625, 91.8) | |||
setWaterVertexPosition (waterSquare, 4, 1436, -613, 91.8) | |||
waterVertices = false | |||
end | |||
end | |||
addCommandHandler("water", waterUp) | |||
</syntaxhighlight> | |||
</section> | |||
==See Also== | ==See Also== | ||
{{ | {{Water functions}} |
Latest revision as of 16:58, 11 May 2017
Sets the world position of a corner point of a water area.
Syntax
bool setWaterVertexPosition ( water theWater, int vertexIndex, int x, int y, float z )
OOP Syntax Help! I don't understand this!
- Method: water:setVertexPosition(...)
- Counterpart: getWaterVertexPosition
Required Arguments
- theWater: the water element of which to change a vertex.
- vertexIndex: the index of the vertex to move. Values range from 1 to 4 for water quads, and 1 to 3 for triangles.
- x: the X coordinate to set for the vertex.
- y: the Y coordinate to set for the vertex.
- z: the Z coordinate to set for the vertex.
Returns
Returns true if successful, false otherwise.
Example
Click to collapse [-]
ServerThis example creates a water whose vertices 2 and 4 go up and down when someone uses the '/water' command.
waterSquare = createWater (1418, -625, 91.8, 1436, -625, 91.8, 1418, -613, 91.8, 1436, -613, 91.8) local waterVertices = false function waterUp () if waterVertices == false then setWaterVertexPosition (waterSquare, 2, 1436, -625, 94.8) setWaterVertexPosition (waterSquare, 4, 1436, -613, 94.8) waterVertices = true else setWaterVertexPosition (waterSquare, 2, 1436, -625, 91.8) setWaterVertexPosition (waterSquare, 4, 1436, -613, 91.8) waterVertices = false end end addCommandHandler("water", waterUp)
See Also
- createWater
- getWaterColor
- getWaterVertexPosition
- getWaveHeight
- resetWaterColor
- resetWaterLevel
- setWaterColor
- setWaterLevel
- setWaterVertexPosition
- setWaveHeight