Rod 3D Script Functions

This document contains a complete list of all of the scripting functions available in Rod 3D.


Camera Functions

Camera control is split into 2 areas, target and position.

Both target and position have a number of options which are set totally seperately. Any position option can work with any target (so you can mix and match).

When you are done don't forget to call SC_ReleaseCamera to return the camera back to game control!

void SC_ReleaseCamera()
Releases the camera and sets it back to default behaviour so the player can get on with the game, call this when you are done moving the camera around.
void SC_SetCameraUpVector( int x, int y, int z)
Sets the camera up vector.  In basic terms this determines which way up the camera is.  Be sure to read the Coordinates section above.
void SC_SetCameraTarget_Object( int ObjectId)
Sets the camera target so that it always looks at the specified object regardless of where you position your camera.
void SC_SetCameraTarget_Coords( int x, int y, int z)
Sets the camera target so that it always looks at the specified coordinates.
void SC_SetCameraPos_AboveTarget()
Sets the camera position above the camera target (suggested up vector: of 0, 0, -1).
void SC_SetCameraPos_FollowTarget( int dist, int angle, int HeightOffset)
Sets the camera position so that it follows the target wherever the target goes.
void SC_SetCameraPos_Coords( int x, int y, int z)
Fixes the camera position at the specified coordinates.


Tile Functions

void SC_SetMapTile( int TileLocationX, int TileLocationZ, int tile)
Change a tile on the map to the specified tile.


Object Functions

Examples of objects are monsters, trees and even the player. These functions allow objects to be altered or created using script.

void SC_BindObjectToWaypoint( int ObjectId, int WaypointId)
Bind the specified object to the specified waypoint.
int SC_GetObjectTypeNumber( string &name)
Returns the object type number for an object type name.
int SC_GetPlayerObjectId()
Gets the player object ID (single player only).
void SC_SetObjectCoords( int ObjectId, int x, int z, bool centre)
Sets and object's location on the map using 2D coordinates.
void SC_SetObjectAngle( int ObjectId, int angle)
Sets an object's direction angle where 256 represents a full circle and 64 is a right angle.
void SC_SetObjectIndestructible( int ObjectId, int value)
Make and object godly, or not.
int SC_GetObjectIndestructible( int ObjectId)
Get an Object's godly status.
void SC_SetObjectNoTarget( int ObjectId, int value)
Prevents or permits an object to be shot at.
int SC_GetObjectNoTarget( int ObjectId)
Gets an object's no target status.
void SC_SetObjectNoAttack( int ObjectId, int value)
Prevents or permits an object to shoot at other objects.
int SC_GetObjectNoAttack( int ObjectId)
Gets an object's no attack status.
void SC_SetObjectActive( int ObjectId, int value)
Sets an object's active state.
int SC_GetObjectActive( int ObjectId)
Gets an object's active status.
void SC_SetObjectHits( int ObjectId, int value)
Sets and objects hit points (health).
int SC_GetObjectHits( int ObjectId)
Gets the number of hit points (health) of an object.
void SC_SetObjectHidden( int ObjectId, int value)
Sets an object's hidden status.
int SC_GetObjectHidden( int ObjectId)
Get's an object's hidden status.
int SC_AddGameObject( int ObjectTypeNumber, float PosX, float PosZ, int angle)
Add's a new game object to the map.
void SC_SetObjectMaxSpeed( int ObjectId, int value)
Sets the max and current speed of an object.
int SC_GetObjectMaxSpeed( int ObjectId)
Gets the max speed of an object.


Sprite Functions

A basic definition of a sprite is a flat animated masked bitmap that sits on the floor. It is no collision detection and can't be destroyed. Sprites are generally used for wrekage after an object is destroyed.

Unlike other elements (such as objects) sprites are identified by filename and not description.

int SC_GetSpriteTypeNumber( string &filename)
Gets a sprite type number from the specified filename.
int SC_AddSprite( int SpriteTypeNumber, int x, int z, int angle, bool centre)
Adds a sprite to the map.
void SC_DeleteSprite( int SpriteId)
Deletes the specified sprite from the map.


Weapon Functions

int SC_GetWeaponRange( int WeaponNumber)
Gets the range of the specified weapon type.
int SC_GetWeaponTypeNumber( string &name)
Gets the weapon type  number for the specified weapon name.


Projectile Functions

void SC_SpawnProjectile( int ProjectileTypeNumber, int x, int y, int z, float SwivelAngle, float TiltAngle, int range, int OwnerObjectId)
Spawns a projectile.
int SC_GetProjectileTypeNumber( string &name)
Gets a projectile type number from a projectile name.
void SC_GetProjectileTypeName( string &name, int number)
Gets a projectile type's name from a projectile number.


Power Up Functions

void SC_AddPowerUp( int PowerUpNumber, int x, int z)
Adds a power up to the map.
int SC_GetPowerUpNumber( string &PowerUpName)
Gets a power up type number for the specified power up name.


Item Functions

void SC_GiveItem( string &name, int count)
Gives or takes items from the player.
int SC_GetItemCount( string &name)
Gets the number of items that the player has for the specified item type.


GUI Functions

void SC_MessageBox( string &MessageText)
Displays a message box on the screen that requires a button to be pressed to dismiss the message.
void SC_GameMessage( string &MessageText)
Displays a message across the centre of the screen playing the standard "beep beep" sound.
void SC_GameMessageSound( int SoundNumber, string &MessageText)
Displays a message across the centre of the screen and plays the specified sound number.
void SC_ConsoleMessage( string &MessageText)
Displays a message in the console.
int SC_StringInputBox( string &str, int MaxLen, string &caption)
Displays a string input dialog box.
int SC_ConfirmBox( string &caption)
Displays a yes/no box and returns the user's choice.
int SC_CreateToolbar( int ToolbarNumber, string &title, int x, int y, int docked, int LocalOnly)
Creates a toolbar on the game screen.
void SC_DestroyToolbar( int ToolbarNumber, int LocalOnly)
Destroys the specified toolbar.
void SC_AddToolbarButton( int ToolbarNumber, string &caption, string &ImageFilename, string &TriggerText, int LocalOnly)
Adds a button or seperator to an existing toolbar which was created using SC_CreateToolbar.


Audio Functions

void SC_PlaySound( int SoundNumber)
Plays the specified sound number.
int SC_GetSoundNumber( string &EffectName)
Gets a sound number from a sound effect filename.
void SC_PlayDirectionalNumber( int SoundNumber, int x, int z, string &InstanceId)
Plays the specified sound from the specified 2D coordinates.
void SC_PlayMusic( string &MusicFilename)
Plays the specified music file.
void SC_MusicSeekToStart()
Restarts the current game music from the start.
void SC_StopMusic()
Stops any music that is currently playing.
void SC_TogglePauseMusic()
Pauses or resumes the game music.


Other Functions

void SC_EndLevel()
Ends the current level and resumes to the next.
void SC_ApplyDamageToArea( int CentreX, int CentreY, int CentreZ, int radius, int damage, int OwnerObjectId)
Appliy damage to a given 3D cube area.
int SC_Rand( int value)
Generates a random number.


Events

Events a predefined functions which are called/triggered automatically by the game. You can use events to trigger your own script by creating your own event functions.

void OnUpdateIDs()
Use this event to store ID numbers for sounds, objects, weapons, projectiles etc in the game script.
void OnMapStart_Global()
This event is fired whenever a new map is started (for game script).
void OnMapStart()
This event fires whenever a new map is started (for map scripts).
void OnPlayerOverTile_?( int TileLocationX, TileLocationZ)
This event is fired whenever the player walks over the specified tile type numer.
void OnObjectTypeRemoved( int ObjectType, int PosX, int PosY, int PosZ, int angle, int MidPosX, int MidPosY, int MidPosZ)
This event is fired whenever an object is removed.
void OnObjectTypeDie( int ObjectType, int ObjectId, int PosX, int PosY, int PosZ)
This event is fired whenever and object is killed.
void OnObjectDie_?()
This event fires when a specific object is killed.
void OnFireWeapon( int WeaponNumber, int OriginX, int OriginY, int OriginZ, int SwivelAngle, int TiltAngle, int OwnerObjectId)
This event is fired whenever a weapon is fired.
void OnWaypointReached_?(int ObjectId)
This event is fired when an object reaches the specified waypoint.
void OnProjectileHit( int ProjectileTypeNumber, int PosX, int PosY, int PosZ, int angle, int OwnerObjectId)
This event fires whenever a projectile hits an object or solid terrain.


Copyright 2008 to 2009 by James Bunting
www.jbplay.com/games/rod3d/

This page was automatically generated by James' Script Docs Generator