Meteor 2 Scripting Functions
Spline
int createSplineNode(vector2 pos)
Create a spline node.

Example
// create node at player's position
int node = createSplineNode(getPos(PLAYER_OBJECT));

See also
deleteSplineNode

void deleteSplineNode(int nodeID)
Delete a spline node.

Example
// delete node ID 1
deleteSplineNode(1);

See also
createSplineNode

vector2 getSplineNodePos(int nodeID)
Get the position of a spline node.

Example
// output the position of spline node 1
print(getSplineNodePos(1));

See also
setSplineNodePos

void setSplineNodePos(int nodeID, vector2 pos)
set the position of a spline node.

Example
// move spline node 1 to the player's position
setSplineNodePos(1, getPos(PLAYER_OBJECT));

See also
getSplineNodePos

int createSplineSegment(string splineType, float width, float sideWidth, int startNodeID, int endNodeID, float tension=0)
Create a spline segment.

Example 1
// create randomly sized road segment between node 1 and 2
int segment = createSplineSegment("Road", -1, -1, 1, 2, 0.5f);

Example 2
// create set size road segment between node 1 and 2
int segment = createSplineSegment("Road", 250, 20, 1, 2, 0.8f);

Example 3
// create randomly sized railway segment between node 1 and 2
int segment = createSplineSegment("Railway (single)", -1, -1, 1, 2, 0.5f);

Comments
If width or sideWidth is negative, the value will be randomised.
Tension is between -1 and 1 inclusive.

See also
deleteSplineSegment

void deleteSplineSegment(int segmentID)
Delete a spline segment.

Example
// delete segment ID 1
deleteSplineSegment(1);

See also
createSplineSegment

int getSplineSegmentStartNode(int segmentID)
Get the start node of a spline segment.

Example
// output the start node of spline segment 1
print(getSplineSegmentStartNode(1));

See also
getSplineSegmentEndNode

int getSplineSegmentEndNode(int segmentID)
Get the end node of a spline segment.

Example
// output the end node of spline segment 1
print(getSplineSegmentEndNode(1));

See also
getSplineSegmentStartNode

float getSplineSegmentWidth(int segmentID)
Get the width of a spline segment.

Example
// output the width of spline segment 1
print(getSplineSegmentWidth(1));

See also
setSplineSegmentWidth getSplineSegmentSideWidth setSplineSegmentSideWidth

void setSplineSegmentWidth(int segmentID, float width)
Set the width of a spline segment.

Example 1
// set the width of spline segment 1
setSplineSegmentWidth(1, 100);

Example 2
// randomise the width of spline segment 1
setSplineSegmentWidth(1, -1);

Comments
If width is negative, it will be randomised.

See also
getSplineSegmentWidth getSplineSegmentSideWidth setSplineSegmentSideWidth

float getSplineSegmentSideWidth(int segmentID)
Get the side width of a spline segment.

Example
// output the side width of spline segment 1
print(getSplineSegmentSideWidth(1));

See also
getSplineSegmentWidth setSplineSegmentWidth setSplineSegmentSideWidth

void setSplineSegmentSideWidth(int segmentID, float sideWidth)
Set the side width of a spline segment.

Example 1
// set the side width of spline segment 1
setSplineSegmentSideWidth(1, 10);

Example 2
// randomise the side width of spline segment 1
setSplineSegmentSideWidth(1, -1);

Comments
If sideWidth is negative, it will be randomised.

See also
getSplineSegmentWidth setSplineSegmentWidth getSplineSegmentSideWidth

float getSplineSegmentTension(int segmentID)
Get the tension of a spline segment.

Example
// output the tension of spline segment 1
print(getSplineSegmentTension(1));

See also
setSplineSegmentTension

void setSplineSegmentTension(int segmentID, float tension)
Set the tension of a spline segment.

Example 1
// set the tension of spline segment 1
setSplineSegmentTension(1, 0.5);

Example 2
// reset the tension of spline segment 1
setSplineSegmentTension(1, 0);

Comments
Tension is limited to between -1 and 0.8 inclusive.

See also
getSplineSegmentTension

string getSplineSegmentSplineType(int segmentID)
Get the type of a spline segment.

Example
// output the type of spline segment 1
print(getSplineSegmentSplineType(1));

See also
setSplineSegmentSplineType

void setSplineSegmentSplineType(int segmentID, string splineType)
Set the type of a spline segment.

Example
// set the type of spline segment 1
setSplineSegmentSplineType(1, "River");

See also
getSplineSegmentSplineType

int getSplineSegmentTerrainType(int segmentID)
Get the terrain type of a spline segment.

Example
// output the terrain type of spline segment 1
print(getSplineSegmentTerrainType(1));

Comments
Valid terrain type values:
- TPT_LAND
- TPT_SOLID
- TPT_WATER
- TPT_OPEN
- TPT_CLOSED
- TPT_LOW_WALL

See also
setSplineSegmentTerrainType

void setSplineSegmentTerrainType(int segmentID, int terrainType)
Set the terrain type of a spline segment.

Example
// set the terrain type of spline segment 1
setSplineSegmentTerrainType(1, TPT_WATER);

Comments
Valid terrain type values:
- TPT_LAND
- TPT_SOLID
- TPT_WATER
- TPT_OPEN
- TPT_CLOSED
- TPT_LOW_WALL

See also
getSplineSegmentTerrainType

bool bindToSpline(int objectID, int nodeID, vector2 offset=vector2(0,0), bool reverse=false)
Bind an object to a spline.

Example 1
// make object 1 follow spline node 2
bindToSpline(1, 2);

Example 2
// make object 1 follow spline node 2 offset to the left
bindToSpline(1, 2, vector2(50, 0));

Example 3
// make object 1 follow spline node 5 in reverse
bindToSpline(1, 5, vector2(0, 0), true);


Index