Graphics::createCheckpoint: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
Creates a checkpoint. Returns the handle of the checkpoint.<br><br>Parameters:<br>* type - The type of checkpoint to create. See below for a list of checkpoint types.<br>* pos1 - The position of the checkpoint.<br>* pos2 - The position of the next checkpoint to point to.<br>* radius - The radius of the checkpoint.<br>* color - The color of the checkpoint.<br>* reserved - Special parameter, see below for details. Usually set to 0 in the scripts.<br><br>Checkpoint types:<br>0-4---------Cylinder: 1 arrow, 2 arrow, 3 arrows, CycleArrow, Checker<br>5-9---------Cylinder: 1 arrow, 2 arrow, 3 arrows, CycleArrow, Checker<br>10-14-------Ring: 1 arrow, 2 arrow, 3 arrows, CycleArrow, Checker<br>15-19-------1 arrow, 2 arrow, 3 arrows, CycleArrow, Checker      <br>20-24-------Cylinder: 1 arrow, 2 arrow, 3 arrows, CycleArrow, Checker <br>25-29-------Cylinder: 1 arrow, 2 arrow, 3 arrows, CycleArrow, Checker   <br>30-34-------Cylinder: 1 arrow, 2 arrow, 3 arrows, CycleArrow, Checker <br>35-38-------Ring: Airplane Up, Left, Right, UpsideDown<br>39----------?<br>40----------Ring: just a ring<br>41----------?<br>42-44-------Cylinder w/ number (uses 'reserved' parameter)<br>45-47-------Cylinder no arrow or number<br><br>If using type 42-44, reserved sets number / number and shape to display<br><br>0-99------------Just numbers (0-99)<br>100-109-----------------Arrow (0-9)<br>110-119------------Two arrows (0-9)<br>120-129----------Three arrows (0-9)<br>130-139----------------Circle (0-9)<br>140-149------------CycleArrow (0-9)<br>150-159----------------Circle (0-9)<br>160-169----Circle  w/ pointer (0-9)<br>170-179-------Perforated ring (0-9)<br>180-189----------------Sphere (0-9)
{{ClientsideJsFunction}}
{{JSContainer|
 
__TOC__
 
Creates a checkpoint in the game world, returning a handle to reference it. Checkpoints are customizable markers often used for navigation, objectives, or area marking.
 
=== Checkpoint Types ===
Each `type` value corresponds to different checkpoint styles:
- **0-4, 5-9, 20-24, 25-29, 30-34**: Cylinder types with 1 to 3 arrows, CycleArrow, Checker.
- **10-14, 15-19**: Ring styles with various arrow options.
- **35-38**: Airplane Ring types for specific directions.
- **40**: Simple ring.
- **42-44**: Numbered cylinders using the `reserved` parameter for customization.
 
=== Reserved Parameter ===
For `type` values 42-44, `reserved` controls the displayed number and style, allowing further customization:
- **0-99**: Number display.
- **100-179**: Arrow or CycleArrow display.
- **180-189**: Sphere.
 
==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">mp.game.graphics.createCheckpoint(type, posX1, posY1, posZ1, posX2, posY2, posZ2, radius, colorR, colorG, colorB, alpha, reserved);</syntaxhighlight>
<syntaxhighlight lang="javascript">
mp.game.graphics.createCheckpoint(type, posX1, posY1, posZ1, posX2, posY2, posZ2, radius, colorR, colorG, colorB, alpha, reserved);
</syntaxhighlight>
 
=== Required Arguments ===
=== Required Arguments ===
*'''type:''' int
* '''type:''' int - Type of checkpoint to create.
*'''posX1:''' float
* '''posX1, posY1, posZ1:''' float - Coordinates of the checkpoint position.
*'''posY1:''' float
* '''posX2, posY2, posZ2:''' float - Coordinates pointing to the next checkpoint.
*'''posZ1:''' float
* '''radius:''' float - Radius of the checkpoint.
*'''posX2:''' float
* '''colorR, colorG, colorB:''' int - RGB color values.
*'''posY2:''' float
* '''alpha:''' int - Transparency level (0-255).
*'''posZ2:''' float
* '''reserved:''' int - Used for numbered checkpoints (42-44).
*'''radius:''' float
 
*'''colorR:''' int
*'''colorG:''' int
*'''colorB:''' int
*'''alpha:''' int
*'''reserved:''' int
===Return value===
===Return value===
*'''int'''
* '''int''' - Handle to the created checkpoint.
 
==Example==
==Example==
This example creates a white ring checkpoint for an airplane marker at a specified position.


This example creates a ring checkpoint with white color.
<syntaxhighlight lang="javascript">
const type = 35; // Airplane ring
const position1 = { x: -115, y: -848, z: 36 };
const position2 = { x: -115, y: -848, z: 39 };
const radius = 1.0;
const color = { r: 255, g: 255, b: 255, a: 150 };
const reserved = 0;


<syntaxhighlight lang="javascript">
mp.game.graphics.createCheckpoint(type, position1.x, position1.y, position1.z, position2.x, position2.y, position2.z, radius, color.r, color.g, color.b, color.a, reserved);
mp.game.graphics.createCheckpoint(35, -115, -848, 36, -115, -848, 39, 1, 255, 255, 255, 150,0);
// Vector3 doesn't work
</syntaxhighlight>
</syntaxhighlight>
 
}}
==See also==
==See also==
{{Graphics_s_function_c}}
{{Graphics_s_function_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]

Latest revision as of 11:47, 5 November 2024

Client-Side
Function

 JavaScript



JavaScript Syntax


Creates a checkpoint in the game world, returning a handle to reference it. Checkpoints are customizable markers often used for navigation, objectives, or area marking.

Checkpoint Types

Each `type` value corresponds to different checkpoint styles: - **0-4, 5-9, 20-24, 25-29, 30-34**: Cylinder types with 1 to 3 arrows, CycleArrow, Checker. - **10-14, 15-19**: Ring styles with various arrow options. - **35-38**: Airplane Ring types for specific directions. - **40**: Simple ring. - **42-44**: Numbered cylinders using the `reserved` parameter for customization.

Reserved Parameter

For `type` values 42-44, `reserved` controls the displayed number and style, allowing further customization: - **0-99**: Number display. - **100-179**: Arrow or CycleArrow display. - **180-189**: Sphere.

Syntax

mp.game.graphics.createCheckpoint(type, posX1, posY1, posZ1, posX2, posY2, posZ2, radius, colorR, colorG, colorB, alpha, reserved);

Required Arguments

  • type: int - Type of checkpoint to create.
  • posX1, posY1, posZ1: float - Coordinates of the checkpoint position.
  • posX2, posY2, posZ2: float - Coordinates pointing to the next checkpoint.
  • radius: float - Radius of the checkpoint.
  • colorR, colorG, colorB: int - RGB color values.
  • alpha: int - Transparency level (0-255).
  • reserved: int - Used for numbered checkpoints (42-44).

Return value

  • int - Handle to the created checkpoint.

Example

This example creates a white ring checkpoint for an airplane marker at a specified position.

const type = 35; // Airplane ring
const position1 = { x: -115, y: -848, z: 36 };
const position2 = { x: -115, y: -848, z: 39 };
const radius = 1.0;
const color = { r: 255, g: 255, b: 255, a: 150 };
const reserved = 0;

mp.game.graphics.createCheckpoint(type, position1.x, position1.y, position1.z, position2.x, position2.y, position2.z, radius, color.r, color.g, color.b, color.a, reserved);


See also