Meteor 2 Scripting Functions
Spline
int createSplineNode(vector2 pos)
Create a spline node.
int node = createSplineNode(getPos(PLAYER_OBJECT));
void deleteSplineNode(int nodeID)
Delete a spline node.
deleteSplineNode(1);
vector2 getSplineNodePos(int nodeID)
Get the position of a spline node.
print(getSplineNodePos(1));
void setSplineNodePos(int nodeID, vector2 pos)
set the position of a spline node.
setSplineNodePos(1, getPos(PLAYER_OBJECT));
int createSplineSegment(string splineType, float width, float sideWidth, int startNodeID, int endNodeID, float tension=0)
Create a spline segment.
int segment = createSplineSegment("Road", -1, -1, 1, 2, 0.5f);
int segment = createSplineSegment("Road", 250, 20, 1, 2, 0.8f);
int segment = createSplineSegment("Railway (single)", -1, -1, 1, 2, 0.5f);
If width or sideWidth is negative, the value will be randomised.
Tension is between -1 and 1 inclusive.
void deleteSplineSegment(int segmentID)
Delete a spline segment.
deleteSplineSegment(1);
int getSplineSegmentStartNode(int segmentID)
Get the start node of a spline segment.
print(getSplineSegmentStartNode(1));
int getSplineSegmentEndNode(int segmentID)
Get the end node of a spline segment.
print(getSplineSegmentEndNode(1));
float getSplineSegmentWidth(int segmentID)
Get the width of a spline segment.
print(getSplineSegmentWidth(1));
void setSplineSegmentWidth(int segmentID, float width)
Set the width of a spline segment.
setSplineSegmentWidth(1, 100);
setSplineSegmentWidth(1, -1);
If width is negative, it will be randomised.
float getSplineSegmentSideWidth(int segmentID)
Get the side width of a spline segment.
print(getSplineSegmentSideWidth(1));
void setSplineSegmentSideWidth(int segmentID, float sideWidth)
Set the side width of a spline segment.
setSplineSegmentSideWidth(1, 10);
setSplineSegmentSideWidth(1, -1);
If sideWidth is negative, it will be randomised.
float getSplineSegmentTension(int segmentID)
Get the tension of a spline segment.
print(getSplineSegmentTension(1));
void setSplineSegmentTension(int segmentID, float tension)
Set the tension of a spline segment.
setSplineSegmentTension(1, 0.5);
setSplineSegmentTension(1, 0);
Tension is limited to between -1 and 0.8 inclusive.
string getSplineSegmentSplineType(int segmentID)
Get the type of a spline segment.
print(getSplineSegmentSplineType(1));
void setSplineSegmentSplineType(int segmentID, string splineType)
Set the type of a spline segment.
setSplineSegmentSplineType(1, "River");
int getSplineSegmentTerrainType(int segmentID)
Get the terrain type of a spline segment.
print(getSplineSegmentTerrainType(1));
Valid terrain type values:
- TPT_LAND
- TPT_SOLID
- TPT_WATER
- TPT_OPEN
- TPT_CLOSED
- TPT_LOW_WALL
void setSplineSegmentTerrainType(int segmentID, int terrainType)
Set the terrain type of a spline segment.
setSplineSegmentTerrainType(1, TPT_WATER);
Valid terrain type values:
- TPT_LAND
- TPT_SOLID
- TPT_WATER
- TPT_OPEN
- TPT_CLOSED
- TPT_LOW_WALL
bool bindToSpline(int objectID, int nodeID, vector2 offset=vector2(0,0), bool reverse=false)
Bind an object to a spline.
bindToSpline(1, 2);
bindToSpline(1, 2, vector2(50, 0));
bindToSpline(1, 5, vector2(0, 0), true);
Index