CreateMarker: Difference between revisions
Jump to navigation
Jump to search
Line 30: | Line 30: | ||
''Example 1:'' This example creates a marker at the player's position when they type !createmarker in the chat box. | ''Example 1:'' This example creates a marker at the player's position when they type !createmarker in the chat box. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
addEventHandler ( " | addEventHandler ( "onPlayerConsole", getRootElement(), "onPlayerConsole" ) | ||
function | function onPlayerConsole ( text ) | ||
-- Grab the command | |||
command = gettok ( text, 1, 32 ) | |||
--If the player types createmarker in the console | |||
if ( command == "console" ) then | |||
x, y, z = getPlayerPosition ( source ) --Assign player x,y,z position to x,y,z varibles | x, y, z = getPlayerPosition ( source ) --Assign player x,y,z position to x,y,z varibles | ||
createMarker ( x, y, z, 0, "checkpoint", 255, 0, 0, 255 ) --Create a marker at the x,y,z varible values | createMarker ( x, y, z, 0, "checkpoint", 255, 0, 0, 255 ) --Create a marker at the x,y,z varible values |
Revision as of 12:27, 1 June 2006
This function creates a marker and returns a handle to the created marker. If it fails, it will return false.
A marker is a 3D model in the world that can highlight a particular point or area, often used to instruct players where to go to perform actions such as entering buildings.
See also createCheckpoint.
Syntax
marker createMarker ( float x, float y, float z, [string type, int size, int r, int g, int b, int a] )
Required Arguments
- 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.
- type: The visual type of the marker to be created. Possible values:
- "checkpoint": Checkpoint (Note: Currently z position is always ground-level. Only remains visible to a certain height.)
- "ring": Ring (doughnut-shaped)
- "cylinder": Cylinder (Note: Currently z position is always ground-level.)
- "arrow": Animated arrow pointing down
- "corona": A glowing area
- size: The diameter of the marker to be created, in meters.
- r: An integer number representing the amount of red to use in the colouring of the marker (0 - 255).
- g: An integer number representing the amount of green to use in the colouring of the marker (0 - 255).
- b: An integer number representing the amount of blue to use in the colouring of the marker (0 - 255).
- a: An integer number representing the amount of alpha to use in the colouring of the marker (0 - 255).
Example
Example 1: This example creates a marker at the player's position when they type !createmarker in the chat box.
addEventHandler ( "onPlayerConsole", getRootElement(), "onPlayerConsole" ) function onPlayerConsole ( text ) -- Grab the command command = gettok ( text, 1, 32 ) --If the player types createmarker in the console if ( command == "console" ) then x, y, z = getPlayerPosition ( source ) --Assign player x,y,z position to x,y,z varibles createMarker ( x, y, z, 0, "checkpoint", 255, 0, 0, 255 ) --Create a marker at the x,y,z varible values outputChatBox ( "You got a red marker", source ) end end
Example 2: Create a marker at the coordinates 0, 0, 20:
createMarker ( 0, 0, 20 )
See Also
- createMarker
- getMarkerColor
- getMarkerCount
- getMarkerIcon
- getMarkerSize
- getMarkerTarget
- getMarkerType
- setMarkerColor
- setMarkerIcon
- setMarkerSize
- setMarkerTarget
- setMarkerType
- isElementWithinMarker
NEEDS CHECKING
- Syntax error example.
- Is type optional?
- Wouldn't corona be better as sphere or ball?
- Arrow has an extreme bounce... it needs to be definable.
- Cylinder and checkpoint are forced to the ground. Can cylinder be fixed? I know cp is glitchy.
- Detection radius is huge for all... can this be optional or adjusted to be smaller?
- Marker disregards alpha setting
- Corona (glow balls) dont show under black color 0, 0, 0