This class provides control for certain level objects. See the documentation of the LevelController entity on how to place a level controller in your level. More...
Read-Only Variables | |
int | DifficultyLevel |
This is a read-only variable which contains the difficulty level of the level. Easy is 1, Medium is 2 and Hard is 3. | |
string | EntityName |
This is a read-only variable which contains the szEntityName of the LevelController entity. | |
float | player_X |
Returns the current X coordinate of the player. | |
float | player_Y |
Returns the current Y coordinate of the player. | |
float | player_Z |
Returns the current Z coordinate of the player. | |
int | key_pressed |
Returns the key code of the key being pressed. Deprecated, use Input.KeyDown() instead. | |
bool | lbutton_pressed |
Returns the state of the left mouse button. Deprecated, use Input.IsMouseButtonDown() instead. | |
bool | rbutton_pressed |
Returns the state of the right mouse button. Deprecated, use Input.IsMouseButtonDown() instead. | |
bool | mbutton_pressed |
Returns the state of the middle mouse button. Deprecated, use Input.IsMouseButtonDown() instead. |
Writable Variables | |
float | time |
A variable that contains the amount of time, in seconds, that has elapsed since scripting for this controller started. Used to keep track of the current time. | |
float | ThinkTime |
The amount of time, in seconds, that must elapse before the current order will be executed again. This is used to limit the number of times per second that the LevelController is run. By setting self.ThinkTime = 0.1; the LevelController will be run 10 times per second. This variable must be reset each time the LevelController is run. | |
string | think |
A write-only variable that is set to the name of the order that is to be executed the next time the LevelController is run. Used to change the 'think' order of the LevelController. |
Low Level Methods | |
void | Console (bool flag) |
Set whether information about this LevelController's script is displayed on the screen. | |
void | debug (var variable) |
Output the contents of variable to the console window for this LevelController, assuming the console is active. | |
void | SetPlatformTargetTime (string platform, float keyTime) |
Trigger the specified MovingPlatform entity and set the model's target time to keyTime. | |
float | GetPlatformTargetTime (string platform) |
Get the target time of the platform's animation which was set by SetPlatformTargetTime. | |
float | GetPlatformCurrentTime (string platform) |
Get the current animation time of the model associated with the specified MovingPlatform entity. | |
bool | PlatformCollision (string platform) |
Perform collision detection for the specified MovingPlatform entity. | |
void | SetPlatformSpeed (string platform, float speed) |
Set the animation speed of the platform to speed. | |
void | SetPlatformToTargetTime (string platform, float keyTime) |
Trigger the platform and set the model animation to the target time keyTime. | |
float | PlatformDistance (string platform, string szEntityName, bool ignoreY=false) |
Return the distance between the platform's center and the specified entity. | |
void | SetDoorTargetTime (string door, float keyTime) |
Trigger the specified Door entity and set the model's target time to keyTime. | |
float | GetDoorTargetTime (string door) |
Get the target time of the door's animation which was set by SetDoorTargetTime. | |
float | GetDoorCurrentTime (string door) |
Get the current animation time of the model associated with the specified Door entity. | |
bool | DoorCollision (string door) |
Perform collision detection for the specified Door entity. | |
void | SetDoorSpeed (string door, float speed) |
Set the animation speed of the door to speed. | |
void | SetDoorToTargetTime (string door, float keyTime) |
Trigger the door and set the model animation to the target time keyTime. | |
float | DoorDistance (string door, string szEntityName, bool ignoreY=false) |
Return the distance between the door's center and the specified entity. | |
void | ShowWallDecal (string decal) |
Show the specified WallDecal entity. | |
void | HideWallDecal (string decal) |
Hide the specified WallDecal entity. | |
void | SetWallDecalBitmap (string decal, int imageID) |
If the WallDecal Style is set to 5, this method will display the specified image. | |
void | Start3DAudioSource (string AudioSource3D) |
Turn on the specified AudioSource3D entity. | |
void | Stop3DAudioSource (string AudioSource3D) |
Turn off the specified AudioSource3D entity. | |
bool | Get3DAudioSourceState (string AudioSource3D) |
Get the state of the specified AudioSource3D entity as a boolean value. | |
void | ActivateTrigger (string trigger) |
Activate the Trigger entity called trigger as if it was activated by a pawn or the player. | |
void | SetEventState (string eventTrigger, bool state) |
Set the state of the named trigger to state. | |
bool | GetEventState (string eventTrigger) |
Return the state of the event trigger named event. | |
void | SetFlag (int flagID, bool state) |
Set the state of the pawn flag flagID to state. | |
bool | GetFlag (int flagID) |
Get the state of the pawn flag flagID. | |
void | PlaySound (string filename, float x, float y, float z) |
Play the WAV file filename once at the specified position using the default audible range. | |
void | PlaySound (string filename, float x, float y, float z, float distance) |
Play the WAV file filename once at the specified position. | |
void | SetAttribute (string attribute, int amount, string szEntityName="Player") |
Set the value of the attribute attribute of the entity szEntityName to amount. | |
int | GetAttribute (string attribute, string szEntityName="Player") |
Get the amount of the attribute attribute of the entity szEntityName. | |
void | ModifyAttribute (string attribute, int amount, string szEntityName="Player") |
Modify the amount of the attribute attribute of the entity szEntityName by amount. | |
void | AddAttribute (string attribute, string szEntityName="Player") |
Give the entity szEntityName the attribute attribute, initialize it to 0 and set the low and high value limits to 0 and 100, respectively. | |
void | AddAttribute (string attribute, int low=0, int high=100, string szEntityName="Player") |
Give the entity szEntityName the attribute attribute, initialize it to 0 and set the low and high value limits. | |
void | SetAttributeValueLimits (string attribute, int low, int high, string szEntityName="Player") |
Set the low and high value limits of the attribute attribute of the entity szEntityName. | |
void | SetFixedCameraPosition (float x, float y, float z) |
Set the position of the currently active FixedCamera to (x, y, z). | |
void | SetFixedCameraRotation (float angleX, float angleY, float angleZ) |
Set the rotation of the currently active FixedCamera to (angleX, angleY, angleZ). | |
void | SetFixedCameraFOV (float fov) |
Set the field of view of the currently active FixedCamera. | |
void | MoveFixedCamera (float offsetX, float offsetY, float offsetZ) |
Move the currently active FixedCamera. | |
void | RotateFixedCamera (float angleX, float angleY, float angleZ) |
Rotate the currently active FixedCamera. | |
void | SetPlayerWeapon (int weaponSlot) |
Set the player's weapon to the slot number specified. | |
void | SetUseItem (string item) |
Set the specified item to be the current Use Item. | |
void | ClearUseItem (string item) |
Remove the specified Use Item. | |
void | ShowText (int textID, string szEntityName, string animation, string text, string font, string sound, int x, int y, string align, float alpha) |
Display the given text attached to an entity (Pawn, Attribute, StaticEntityproxy) or the player. | |
void | RemoveText (int textID) |
Remove the text object with the ID textID displayed by the ShowText or ShowTextDelay method. | |
bool | IsKeyDown (int key) |
Check if the specified key is pressed. | |
string | StringCopy (string text) |
Transfer the contents of the given string variable into another string variable. | |
string | LeftCopy (string text, int numChars) |
Get the first numChars characters from the given string. | |
string | RightCopy (string text, int numChars) |
Get the last numChars characters from the given string. | |
int | random (int lower, int upper) |
Get a random integer number in the range of low to high. | |
int | Integer (float value) |
Get the integer portion of the given value. | |
float | sin (float value) |
Get the sine of the given value. | |
float | cos (float value) |
Get the cosine of the given value. | |
float | tan (float value) |
Get the tangent of the given value. | |
float | asin (float value) |
Get the arc sine of the given value. | |
float | acos (float value) |
Get the arc cosine of the given value. | |
float | atan (float value) |
Get the arc tangent of the given value. |
This class provides control for certain level objects. See the documentation of the LevelController entity on how to place a level controller in your level.
void LevelController::Console | ( | bool | flag | ) |
Set whether information about this LevelController's script is displayed on the screen.
This includes any error messages generated at runtime.
flag |
|
void LevelController::debug | ( | var | variable | ) |
Output the contents of variable to the console window for this LevelController, assuming the console is active.
Used to debug scripts that are not working correctly.
variable | Specifies any variable from the script and can be of any type (i.e. string, float, int or bool). |
void LevelController::SetPlatformTargetTime | ( | string | platform, |
float | keyTime | ||
) |
Trigger the specified MovingPlatform entity and set the model's target time to keyTime.
platform | String holding the name of the MovingPlatform entity. |
keyTime | float value specifying the targeted animation time. |
float LevelController::GetPlatformTargetTime | ( | string | platform | ) |
Get the target time of the platform's animation which was set by SetPlatformTargetTime.
platform | String holding the name of the MovingPlatform entity. |
float LevelController::GetPlatformCurrentTime | ( | string | platform | ) |
Get the current animation time of the model associated with the specified MovingPlatform entity.
platform | String holding the name of the MovingPlatform entity. |
bool LevelController::PlatformCollision | ( | string | platform | ) |
Perform collision detection for the specified MovingPlatform entity.
platform | String holding the name of the MovingPlatform entity. |
void LevelController::SetPlatformSpeed | ( | string | platform, |
float | speed | ||
) |
Set the animation speed of the platform to speed.
platform | String holding the name of the MovingPlatform entity. |
speed | float value specifying the animation speed. |
void LevelController::SetPlatformToTargetTime | ( | string | platform, |
float | keyTime | ||
) |
Trigger the platform and set the model animation to the target time keyTime.
platform | String holding the name of the MovingPlatform entity. |
keyTime | float value specifying the targeted animation time. |
float LevelController::PlatformDistance | ( | string | platform, |
string | szEntityName, | ||
bool | ignoreY = false |
||
) |
Return the distance between the platform's center and the specified entity.
platform | String holding the name of the MovingPlatform entity. |
szEntityName | String holding the name of the entity. To specify the player use "Player", for the camera use "Camera". |
ignoreY |
|
void LevelController::SetDoorTargetTime | ( | string | door, |
float | keyTime | ||
) |
Trigger the specified Door entity and set the model's target time to keyTime.
door | String holding the name of the Door entity. |
keyTime | float value specifying the targeted animation time. |
float LevelController::GetDoorTargetTime | ( | string | door | ) |
Get the target time of the door's animation which was set by SetDoorTargetTime.
door | String holding the name of the Door entity. |
float LevelController::GetDoorCurrentTime | ( | string | door | ) |
Get the current animation time of the model associated with the specified Door entity.
door | String holding the name of the Door entity. |
bool LevelController::DoorCollision | ( | string | door | ) |
Perform collision detection for the specified Door entity.
door | String holding the name of the Door entity. |
void LevelController::SetDoorSpeed | ( | string | door, |
float | speed | ||
) |
Set the animation speed of the door to speed.
door | String holding the name of the Door entity. |
speed | float value specifying the animation speed. |
void LevelController::SetDoorToTargetTime | ( | string | door, |
float | keyTime | ||
) |
Trigger the door and set the model animation to the target time keyTime.
door | String holding the name of the Door entity. |
keyTime | float value specifying the targeted animation time. |
float LevelController::DoorDistance | ( | string | door, |
string | szEntityName, | ||
bool | ignoreY = false |
||
) |
Return the distance between the door's center and the specified entity.
door | String holding the name of the Door entity. |
szEntityName | String holding the name of the entity. To specify the player use "Player", for the camera use "Camera". |
ignoreY |
|
void LevelController::ShowWallDecal | ( | string | decal | ) |
Show the specified WallDecal entity.
decal | String holding the name of the WallDecal entity. |
void LevelController::HideWallDecal | ( | string | decal | ) |
Hide the specified WallDecal entity.
decal | String holding the name of the WallDecal entity. |
void LevelController::SetWallDecalBitmap | ( | string | decal, |
int | imageID | ||
) |
If the WallDecal Style is set to 5, this method will display the specified image.
The images must be named as if they were of the animated style (see FlipBook entity).
decal | String holding the name of the WallDecal entity. |
imageID | integer value specifying the image to display. |
void LevelController::Start3DAudioSource | ( | string | AudioSource3D | ) |
Turn on the specified AudioSource3D entity.
AudioSource3D | String holding the name of the AudioSource3D entity. |
void LevelController::Stop3DAudioSource | ( | string | AudioSource3D | ) |
Turn off the specified AudioSource3D entity.
AudioSource3D | String holding the name of the AudioSource3D entity. |
bool LevelController::Get3DAudioSourceState | ( | string | AudioSource3D | ) |
Get the state of the specified AudioSource3D entity as a boolean value.
AudioSource3D | String holding the name of the AudioSource3D entity. |
void LevelController::ActivateTrigger | ( | string | trigger | ) |
Activate the Trigger entity called trigger as if it was activated by a pawn or the player.
trigger | String holding the name of the Trigger entity to activate. |
void LevelController::SetEventState | ( | string | eventTrigger, |
bool | state | ||
) |
Set the state of the named trigger to state.
If the trigger does not exist it will be created.
eventTrigger | String holding the name of an event trigger. |
state | boolean value specifying the new state of the event trigger. |
bool LevelController::GetEventState | ( | string | eventTrigger | ) |
Return the state of the event trigger named event.
eventTrigger | String holding the name of the event trigger. |
void LevelController::SetFlag | ( | int | flagID, |
bool | state | ||
) |
Set the state of the pawn flag flagID to state.
Pawn flags are shared among all pawns.
flagID | integer value (0 - 499) identifying the pawn flag to be set. |
state | boolean value specifying the new state of the pawn flag. |
bool LevelController::GetFlag | ( | int | flagID | ) |
Get the state of the pawn flag flagID.
Pawn flags are shared among all pawns.
flagID | integer value (0 - 499) identifying the pawn flag. |
void LevelController::PlaySound | ( | string | filename, |
float | x, | ||
float | y, | ||
float | z | ||
) |
Play the WAV file filename once at the specified position using the default audible range.
filename | String holding the name of the WAV file to play. The .wav extension must be included in the name. |
x | float value specifying the x position. |
y | float value specifying the y position. |
z | float value specifying the z position. |
void LevelController::PlaySound | ( | string | filename, |
float | x, | ||
float | y, | ||
float | z, | ||
float | distance | ||
) |
Play the WAV file filename once at the specified position.
filename | String holding the name of the WAV file to play. The .wav extension must be included in the name. |
x | float value specifying the x position. |
y | float value specifying the y position. |
z | float value specifying the z position. |
distance | Specifies the audible radius of the sound. |
void LevelController::SetAttribute | ( | string | attribute, |
int | amount, | ||
string | szEntityName = "Player" |
||
) |
Set the value of the attribute attribute of the entity szEntityName to amount.
szEntityName may specify a Pawn, a StaticEntityProxy or the player ("Player").
attribute | String holding the name of the attribute to change. |
amount | integer value determining the new value of the specified attribute. |
szEntityName | String holding the name of the entity owning the attribute. |
int LevelController::GetAttribute | ( | string | attribute, |
string | szEntityName = "Player" |
||
) |
Get the amount of the attribute attribute of the entity szEntityName.
szEntityName may specify a Pawn, a StaticEntityProxy or the player ("Player").
attribute | String holding the name of the attribute. |
szEntityName | String holding the name of the entity owning the attribute. |
void LevelController::ModifyAttribute | ( | string | attribute, |
int | amount, | ||
string | szEntityName = "Player" |
||
) |
Modify the amount of the attribute attribute of the entity szEntityName by amount.
szEntityName may specify a Pawn, a StaticEntityProxy or the player ("Player").
attribute | String holding the name of the attribute to change. |
amount | integer value determining the amount the specified attribute will be modified by. |
szEntityName | String holding the name of the entity owning the attribute. |
void LevelController::AddAttribute | ( | string | attribute, |
string | szEntityName = "Player" |
||
) |
Give the entity szEntityName the attribute attribute, initialize it to 0 and set the low and high value limits to 0 and 100, respectively.
szEntityName may specify a Pawn, a StaticEntityProxy or the player ("Player").
attribute | String holding the name of the attribute to create. |
szEntityName | String holding the name of the entity owning the attribute. |
void LevelController::AddAttribute | ( | string | attribute, |
int | low = 0 , |
||
int | high = 100 , |
||
string | szEntityName = "Player" |
||
) |
Give the entity szEntityName the attribute attribute, initialize it to 0 and set the low and high value limits.
szEntityName may specify a Pawn, a StaticEntityProxy or the player ("Player").
attribute | String holding the name of the attribute to create. |
low | integer value determining the low value limit of the new attribute. |
high | integer value determining the high value limit of the new attribute. |
szEntityName | String holding the name of the entity owning the attribute. |
void LevelController::SetAttributeValueLimits | ( | string | attribute, |
int | low, | ||
int | high, | ||
string | szEntityName = "Player" |
||
) |
Set the low and high value limits of the attribute attribute of the entity szEntityName.
szEntityName may specify a Pawn, a StaticEntityProxy or the player ("Player").
attribute | String holding the name of the attribute to modify. |
low | integer value determining the new low value limit of the attribute. |
high | integer value determining the new high value limit of the attribute. |
szEntityName | String holding the name of the entity owning the attribute. |
void LevelController::SetFixedCameraPosition | ( | float | x, |
float | y, | ||
float | z | ||
) |
Set the position of the currently active FixedCamera to (x, y, z).
x | float value specifying the x position. |
y | float value specifying the y position. |
z | float value specifying the z position. |
void LevelController::SetFixedCameraRotation | ( | float | angleX, |
float | angleY, | ||
float | angleZ | ||
) |
Set the rotation of the currently active FixedCamera to (angleX, angleY, angleZ).
angleX | float value specifying the new rotation around the x-axis (in degrees). |
angleY | float value specifying the new rotation around the y-axis (in degrees). |
angleZ | float value specifying the new rotation around the z-axis (in degrees). |
void LevelController::SetFixedCameraFOV | ( | float | fov | ) |
Set the field of view of the currently active FixedCamera.
fov | Field of view in radians. |
void LevelController::MoveFixedCamera | ( | float | offsetX, |
float | offsetY, | ||
float | offsetZ | ||
) |
Move the currently active FixedCamera.
offsetX | float value specifying the distance to move in x-direction. |
offsetY | float value specifying the distance to move in y-direction. |
offsetZ | float value specifying the distance to move in z-direction. |
void LevelController::RotateFixedCamera | ( | float | angleX, |
float | angleY, | ||
float | angleZ | ||
) |
Rotate the currently active FixedCamera.
angleX | float value specifying the angle to rotate around the x-axis (in degrees). |
angleY | float value specifying the angle to rotate around the y-axis (in degrees). |
angleZ | float value specifying the angle to rotate around the z-axis (in degrees). |
void LevelController::SetPlayerWeapon | ( | int | weaponSlot | ) |
Set the player's weapon to the slot number specified.
weaponSlot | integer value specifying the weapon slot number (0 - 39). |
void LevelController::SetUseItem | ( | string | item | ) |
Set the specified item to be the current Use Item.
item | String holding the name of the item to set as Use Item. |
void LevelController::ClearUseItem | ( | string | item | ) |
Remove the specified Use Item.
item | String holding the name of the Use Item to remove. |
void LevelController::ShowText | ( | int | textID, |
string | szEntityName, | ||
string | animation, | ||
string | text, | ||
string | font, | ||
string | sound, | ||
int | x, | ||
int | y, | ||
string | align, | ||
float | alpha | ||
) |
Display the given text attached to an entity (Pawn, Attribute, StaticEntityproxy) or the player.
The text will move along with the entity keeping its the relative position.
textID | integer value used to identify this text object (0 - 19). |
szEntityName | String holding the name of the entity to attach the text to ("Player" to specify the player). Use an empty string ("") for absolute screen coordinates. |
animation | String holding the name of the animation the entity/player will play while the text is shown. If left empty ("") the previously active animation will continue. |
text | String holding the text to display. |
font | String specifying the font to use. |
sound | String holding the name of a WAV file to play once while the text is displayed. (not implemented) |
x | integer value defining the relative or absolute x-position to draw the text on the screen. |
y | integer value defining the relative or absolute y-position to draw the text on the screen. |
align | String defining the alignment of the text relative to the origin of the entity/player ("left", "right", "center"). |
alpha | float value specifying the transparency of the text with 0 being fully transparent and 255 being fully opaque. |
void LevelController::RemoveText | ( | int | textID | ) |
Remove the text object with the ID textID displayed by the ShowText or ShowTextDelay method.
textID | integer value used to identify a text object (0 - 19). |
bool LevelController::IsKeyDown | ( | int | key | ) |
Check if the specified key is pressed.
key | integer value specifying the key to check. |
string LevelController::StringCopy | ( | string | text | ) |
Transfer the contents of the given string variable into another string variable.
text | String to copy. |
string LevelController::LeftCopy | ( | string | text, |
int | numChars | ||
) |
Get the first numChars characters from the given string.
text | String to copy. |
numChars | Specifies the number of characters to copy. |
string LevelController::RightCopy | ( | string | text, |
int | numChars | ||
) |
Get the last numChars characters from the given string.
text | String to copy. |
numChars | Specifies the number of characters to copy. |
int LevelController::random | ( | int | lower, |
int | upper | ||
) |
Get a random integer number in the range of low to high.
lower | Specifies the lower limit of the random number. |
upper | Specifies the upper limit of the random number. |
int LevelController::Integer | ( | float | value | ) |
Get the integer portion of the given value.
value | float value that is to be converted to an integer. |
float LevelController::sin | ( | float | value | ) |
Get the sine of the given value.
value | float value to calculate the sine of (in radians). |
float LevelController::cos | ( | float | value | ) |
Get the cosine of the given value.
value | float value to calculate the cosine of (in radians). |
float LevelController::tan | ( | float | value | ) |
Get the tangent of the given value.
value | float value to calculate the tangent of (in radians). |
float LevelController::asin | ( | float | value | ) |
Get the arc sine of the given value.
value | float value to calculate the arc sine of. |
float LevelController::acos | ( | float | value | ) |
Get the arc cosine of the given value.
value | float value to calculate the arc cosine of. |
float LevelController::atan | ( | float | value | ) |
Get the arc tangent of the given value.
value | float value to calculate the arc tangent of. |