You are not logged in.    Login    New User    Forum Home    Search

JBPLAY  \  Meteor 2  \  Editing  \  Meteor Scripting Example Map

Back to Threads

Viewing Thread: Meteor Scripting Example Map


James Bunting
Joined: 17 September 2003
Posts: 1308
22 January 2005 00:12 (UK time)

Sorry to people who have tried to email me, I have been out of the loop for a while.

Anyway JohnWE has made an example script map that demonstrates the use of many of the scripting commands.

This map can be download from the Meteor 2 Maps page at <a target="_blank" href=""></a>.

You need to login to create posts in this thread.

Zable Fahr

Joined: 04 November 2004
Posts: 74
24 January 2005 02:06 (UK time)

I tried out the map, and kudos to JohnWE for it. It's pretty helpful, and honestly, I didn't even know you could enable/disable triggers before trying out the map :-)

What I think would be cool is for the two sectors all the way on the bottom that makes the tractor faster/slower is to make the effects cumulative; i.e. each time the sector is triggered, the tractor speeds up or slows down by a certain amount.

Here's the new faster trigger, which shows how to use the SC_GetObjectMaxSpeed function as well as using two commands in one line:

void faster() {
SC_ConsoleMessage("Yay Faster!";);

// Set the new speed to 1 + the current speed
SC_SetObjectMaxSpeed(11, SC_GetObjectMaxSpeed(11) + 1);

SC_SetSectorTriggerEnabled(36,1);//re-enable the trigger

Here's the new slower trigger, which uses a local variable to temporarily store the value of SC_GetObjectMaxSpeed. It also shows how to use an if statement for decision making. In this case, it makes sure that the tractor's max speed doesn't go below 5:

void slower() {
int currentSpeed;

SC_ConsoleMessage("Yay Slower!";);

// Retrieve the current speed
currentSpeed = SC_GetObjectMaxSpeed(11);

if (currentSpeed <= 5) { // If speed is 5 or less
SC_SetObjectMaxSpeed(11, 5); // reset it to 5
} else { // If speed is greater than 5
SC_SetObjectMaxSpeed(11, currentSpeed - 1); // decrease it
SC_SetSectorTriggerEnabled(37,1);//re-enable the trigger

These two show just how powerful the scripting engine can be.

Edit: Whoa... forum posting gets rid of whitespace and tabs in your posts..

Edited: 24 January 2005 02:09

You need to login to create posts in this thread.

Forums system (C) 1999-2023 by James Bunting.

Terms of Use