---------------------------------------------------------------
PingPong.cs - Part of the object movement library by EvilCheese

V0.6 beta.

Allows the creation of a Ping-Pong movement path along which any
game object can travel.
---------------------------------------------------------------

Uses
----

Moveable platforms, lifts, sliding doors and any other repeat-path style movement uses.

Enabling:
---------

The script will need to be placed in your scripts directory.

Add the line:

exec("scripts/pingpong.cs");

to the bottom of your .mis file for your map, to enable the script.

make sure it is distributed as part of your map .vl2 file.


How do I make it work?
----------------------

A ping pong path consists of two items: An object (to move) and a destination marker (can be any object, but a generic marker is best).

Place the object to be moved at the start of the path, and give it a name (for this example, we will use "MovedObject")

Place the destination marker at the end of the desired path, and name it (we will use "MoveMarker").

To activate your movement path...
-----------------------------

To test it, we can activate the movement manually from the console, using the command:

PingPongInit( NameToID(MovedObject), NameToID(MoveMarker), 10000, 10, 5000);

This will cause the object to move backwards and forwards at an interval of 10000ms (10 seconds) updating 10 times per second. (the object will take 20 seconds to return to it's original position). The object will pause for 5000ms (5 seconds) at each end of it's path.

To hardcode it into your map:

Once you have it set up how you want, simply add the PingPongInit command to your .mis file at the end, after the objects are loaded.

NOTES:

Command Syntax:

PingPongInit( <Object>, <Marker>, <Half-time>, <fps>, <delay> );

<Object> = ID of object to move.
<Marker> = ID of destination marker.
<Half-time> = Time in ms for half the round-trip to be complete (1000 = 1 second).
<fps> = Number of times per second the object is refreshed, faster = smoother movement, but is more CPU intensive.
<Delay> = The time in ms that the object will wait at each end of it's path before returning.

WARNING:
--------

Setting <Half-Time> too low, or <fps> too high can result in the game locking up.

<Half-Time> of greater than 2000 and <fps> of less than 30 are safe.

Please save your map before testing.


Disclaimer
----------

This software is provided "as is" with no warranty, implied or otherwise. 

Use of this software is at the user's own risk, and EvilCheese accepts no responsibility for damage or loss of data caused by the use of this, or other scripts by the same author.

Contact
-------

ICQ:25248920

EMail:cheese@beaufort01.demon.co.uk

TMail:EvilCheese

----------------------------------------------
Scripts and contents copyright 2001 EvilCheese
----------------------------------------------