Player Class Reference

Class providing access to the player character. More...

List of all members.

Read-Only Variables

Vector position
 Holds the current position of the player's actor.
Vector2 screenPosition
 Holds the current screen position of the player's actor.
int viewPoint
 Holds the current player viewpoint: 0=1st person, 1=3rd person, 2=isometric, 3=fixed camera.
string weapon
 Holds the name of the currently equipped weapon.
string animation
 Holds the name of the current player animation.

Low Level Methods

string GetName ()
 Get the name of the player.
void SetWeapon (int slot)
 Set the player's weapon to the slot number specified.
void SetWeapon (string weapon)
 Set the player's weapon to the specified weapon.
bool SetWeaponMatFromFlip (string flipbook, int actorMaterialIndex, int flipbookImageIndex, int r, int g, int b)
 Replace the current player weapon's material with index actorMaterialIndex by the texture with index flipbookImageIndex of the specified FlipBook entity.
void ChangeWeaponMaterial (string section)
 Change the material on the player's current weapon actor according to the specified section of material.ini.
void SetUseItem (string item)
 Set the specified item to be the current Use Item.
void ClearUseItem (string item)
 Remove the specified Use Item.
bool HasAttribute (string attribute)
 Check if the player has the specified attribute.
void SetAttribute (string attribute, int amount)
 Set the value of the player's attribute to the specified amount.
int GetAttribute (string attribute)
 Get the amount of the specified attribute.
void ModifyAttribute (string attribute, int amount)
 Modify the amount of the specified attribute.
void AddAttribute (string attribute)
 Give the player the specified attribute.
void AddAttribute (string attribute, int low, int high)
 Give the player the specified attribute.
void SetAttributeValueLimits (string attribute, int low, int high)
 Set the low and high value limits of the specified attribute.
int GetAttributeLowLimit (string attribute)
 Return the low limit of the player's attribute.
int GetAttributeHighLimit (string attribute)
 Return the high limit of the player's attribute.
void PowerUp (string attribute, int amount, bool setMaxAmount)
 Increase the upper limit of the specified attribute by the given amount.
int GetPowerUpLevel (string attribute)
 Get the PowerUp level of the specified attribute.
void SaveAttributes (string filename)
 Saves the current player attributes to a text file of the specified name.
void SetMouseControlled (bool enable)
 Define whether the player can be controlled with the mouse or not.
void AttachBlendActor (string slave)
 Attach the specified entity to the player's actor.
void DetachBlendActor (string slave)
 Detach the specified entity from the player.
void AttachAccessory (string slave)
 Attach the specified accessory to the player.
void DetachAccessory (string slave)
 Detach the specified accessory from the player.
void Render (bool enable)
 Controls the rendering and collision detection of the player actor.
void MatchEntityAngles (string szEntityName)
 Rotate the pawn's actor to match the angles of the specified entity.
void ChangeMaterial (string materialSection)
 Change the material on the player's actor according to the specified section of material.ini.
void SetLighting (float fillR, float fillG, float fillB, float ambientR, float ambientG, float ambientB, bool ambientLightFromFloor)
 Set the FillColor and AmbientColor of the player's actor.
void SetAlpha (float alpha)
 Set the transparency of the pawn's actor.
float GetAlpha ()
 Get the transparency of the pawn's actor.
void SetScale (float scale)
 Set the scale of the player's actor to scale.
void SetScale (float x, float y, float z)
 Set the scale of the player's actor to the given values.
void SetPosition (Vector position)
 Move the player to the specified position.
void SetPosition (float x, float y, float z)
 Move the player to the specified position.
Vector GetPosition ()
 Returns the current player position.
void SetRotation (Vector rotation)
 Set the rotation of the player to (x, y, z).
void SetRotation (float x, float y, float z)
 Set the rotation of the player to (x, y, z).
Vector GetRotation ()
 Returns the current player rotation.
void Move (Vector distance)
 Move the player by the specified distance.
void Move (float x, float y, float z)
 Move the player by the specified distance.
void Rotate (Vector rotation)
 Rotate the player.
void Rotate (float x, float y, float z)
 Rotate the player.
Vector2 GetScreenPosition ()
 Get the x and y coordinates of the player actor on the screen.
string GetGroundTexture ()
 Get the name of the texture beneath the player.
void SetIcon (string icon)
 Set the name of the player's icon image.
string GetIcon ()
 Get the name of the player's icon image.
void Speak (string textSection, string sound, float textScrollSpeed, float textDisplayTime)
 Show a text string and optionally play a sound at the player's position during a conversation. If not in a conversation, just play back the specified sound file.
void PlaySound (string filename)
 Play the WAV file filename once using the default audible range.
void PlaySound (string filename, float distance)
 Play the WAV file filename once.

Detailed Description

Class providing access to the player character.


Member Function Documentation

string Player::GetName ( )

Get the name of the player.

Returns:
String holding the name of the player.
void Player::SetWeapon ( int  slot)

Set the player's weapon to the slot number specified.

Parameters:
slotinteger value specifying the weapon slot number (0 - 39).
Returns:
Nothing.
void Player::SetWeapon ( string  weapon)

Set the player's weapon to the specified weapon.

Parameters:
weaponString holding the name of the weapon to switch to.
Returns:
Nothing.
bool Player::SetWeaponMatFromFlip ( string  flipbook,
int  actorMaterialIndex,
int  flipbookImageIndex,
int  r,
int  g,
int  b 
)

Replace the current player weapon's material with index actorMaterialIndex by the texture with index flipbookImageIndex of the specified FlipBook entity.

Parameters:
flipbookString holding the name of a Flipbook entity.
actorMaterialIndexinteger value specifying the index of the actor material to change.
flipbookImageIndexinteger value specifying the index of the image to use.
rSpecifies the red color value of the image.
gSpecifies the green color value of the image.
bSpecifies the blue color value of the image.
Returns:
  • true on success.
  • false if the method failed.
void Player::ChangeWeaponMaterial ( string  section)

Change the material on the player's current weapon actor according to the specified section of material.ini.

Parameters:
sectionString holding the name of a section in the material.ini file.
Returns:
Nothing.
void Player::SetUseItem ( string  item)

Set the specified item to be the current Use Item.

Parameters:
itemString holding the name of the item to set as Use Item.
Returns:
Nothing.
void Player::ClearUseItem ( string  item)

Remove the specified Use Item.

Parameters:
itemString holding the name of the Use Item to remove.
Returns:
Nothing.
bool Player::HasAttribute ( string  attribute)

Check if the player has the specified attribute.

Parameters:
attributeString holding the name of the player's attribute to check for.
Returns:
  • true if player has the attribute.
  • flase if the player does not have the attribute.
void Player::SetAttribute ( string  attribute,
int  amount 
)

Set the value of the player's attribute to the specified amount.

Parameters:
attributeString holding the name of the player's attribute to change.
amountinteger value determining the new value of the specified attribute.
Returns:
Nothing.
int Player::GetAttribute ( string  attribute)

Get the amount of the specified attribute.

Parameters:
attributeString holding the name of the player's attribute.
Returns:
value of the specified attribute.
void Player::ModifyAttribute ( string  attribute,
int  amount 
)

Modify the amount of the specified attribute.

Parameters:
attributeString holding the name of the player's attribute to change.
amountinteger value determining the amount the specified attribute will be modified by.
Returns:
Nothing.
void Player::AddAttribute ( string  attribute)

Give the player the specified attribute.

Initialize the attribute to 0 and set the low and high value limits to 0 and 100, respectively.

Parameters:
attributeString holding the name of the player's attribute to create.
Returns:
Nothing.
void Player::AddAttribute ( string  attribute,
int  low,
int  high 
)

Give the player the specified attribute.

Initialize the attribute to 0 and set the low and high value limits to 0 and 100, respectively.

Parameters:
attributeString holding the name of the player's attribute to create.
lowinteger value determining the low value limit of the new attribute.
highinteger value determining the high value limit of the new attribute.
Returns:
Nothing.
void Player::SetAttributeValueLimits ( string  attribute,
int  low,
int  high 
)

Set the low and high value limits of the specified attribute.

Parameters:
attributeString holding the name of the player's attribute to modify.
lowinteger value determining the new low value limit of the attribute.
highinteger value determining the new high value limit of the attribute.
Returns:
Nothing.
int Player::GetAttributeLowLimit ( string  attribute)

Return the low limit of the player's attribute.

Parameters:
attributeString holding the name of the player's attribute to check.
Returns:
the low limit of the specified attribute.
int Player::GetAttributeHighLimit ( string  attribute)

Return the high limit of the player's attribute.

Parameters:
attributeString holding the name of the player's attribute to check.
Returns:
the high limit of the specified attribute.
void Player::PowerUp ( string  attribute,
int  amount,
bool  setMaxAmount 
)

Increase the upper limit of the specified attribute by the given amount.

Parameters:
attributeString holding the name of the player's attribute to modify.
amountinteger value determining the amount by which to increase the high value limit of the attribute.
setMaxAmount
  • true to set the attribute to its new high value limit.
  • false to leave the attribute at its current value.
Returns:
Nothing.
int Player::GetPowerUpLevel ( string  attribute)

Get the PowerUp level of the specified attribute.

The PowerUp level is equal to the number of times the attribute's upper limit was increased by the PowerUp method or the ModifyAttribute entity.

Parameters:
attributeString holding the name of the player's attribute to check.
Returns:
the PowerUp level of the specified attribtue.
void Player::SaveAttributes ( string  filename)

Saves the current player attributes to a text file of the specified name.

Parameters:
filenameString holding the name of the file to write to.
Returns:
Nothing.
void Player::SetMouseControlled ( bool  enable)

Define whether the player can be controlled with the mouse or not.

Parameters:
enable
  • true to control the player by mouse movement.
  • false to turn off mouse control.
Returns:
Nothing.
void Player::AttachBlendActor ( string  slave)

Attach the specified entity to the player's actor.

The attached actor will use the same animation as the player and thus must have the same skeleton.

Parameters:
slaveString holding the name of the entity to attach.
Returns:
Nothing.
void Player::DetachBlendActor ( string  slave)

Detach the specified entity from the player.

Parameters:
slaveString holding the name of the attached entity.
Returns:
Nothing.
void Player::AttachAccessory ( string  slave)

Attach the specified accessory to the player.

The attached actor will use the same animation as the player and thus must have the same skeleton.

Parameters:
slaveString holding the name of the accessory to attach as defined in the pawn.ini file.
Returns:
Nothing.
void Player::DetachAccessory ( string  slave)

Detach the specified accessory from the player.

Parameters:
slaveString holding the name of the attached accessory as defined in the pawn.ini file.
Returns:
Nothing.
void Player::Render ( bool  enable)

Controls the rendering and collision detection of the player actor.

Parameters:
enable
  • true to make the player actor visible and enable collision detection.
  • false to hide the player actor and stop collision detection.
Returns:
Nothing.
void Player::MatchEntityAngles ( string  szEntityName)

Rotate the pawn's actor to match the angles of the specified entity.

Parameters:
szEntityNameString holding the name of the entity.
Returns:
Nothing.
void Player::ChangeMaterial ( string  materialSection)

Change the material on the player's actor according to the specified section of material.ini.

Parameters:
materialSectionString holding the name of a section in the material.ini file.
Returns:
Nothing.
void Player::SetLighting ( float  fillR,
float  fillG,
float  fillB,
float  ambientR,
float  ambientG,
float  ambientB,
bool  ambientLightFromFloor 
)

Set the FillColor and AmbientColor of the player's actor.

Parameters:
fillRSpecifies the new red color value of the entity's actor.
fillGSpecifies the new green color value of the entity's actor.
fillBSpecifies the new blue color value of the entity's actor.
ambientRSpecifies the new red ambient color value of the entity's actor.
ambientGSpecifies the new green ambient color value of the entity's actor.
ambientBSpecifies the new blue ambient color value of the entity's actor.
ambientLightFromFloor
  • true to use floor lighting values for ambient color.
  • false to use given ambient RGB values.
Returns:
Nothing.
void Player::SetAlpha ( float  alpha)

Set the transparency of the pawn's actor.

Parameters:
alphafloat value specifying the transparency of the actor with 0 being fully transparent and 255 being fully opaque.
Returns:
Nothing.
float Player::GetAlpha ( )

Get the transparency of the pawn's actor.

Returns:
float value specifying the transparency of the actor with 0 being fully transparent and 255 being fully opaque.
void Player::SetScale ( float  scale)

Set the scale of the player's actor to scale.

Parameters:
scalefloat value specifying the scale of the actor in x, y and z direction.
Returns:
Nothing.
void Player::SetScale ( float  x,
float  y,
float  z 
)

Set the scale of the player's actor to the given values.

Parameters:
xfloat value specifying the scale of the actor in x direction.
yfloat value specifying the scale of the actor in y direction.
zfloat value specifying the scale of the actor in z direction.
Returns:
Nothing.
void Player::SetPosition ( Vector  position)

Move the player to the specified position.

Parameters:
positionvector specifying the x, y and z position.
Returns:
Nothing.
void Player::SetPosition ( float  x,
float  y,
float  z 
)

Move the player to the specified position.

Parameters:
xfloat value specifying the x position.
yfloat value specifying the y position.
zfloat value specifying the z position.
Returns:
Nothing.
void Player::SetRotation ( Vector  rotation)

Set the rotation of the player to (x, y, z).

Parameters:
rotationvector specifying the x, y, z rotation (in degrees).
Returns:
Nothing.
void Player::SetRotation ( float  x,
float  y,
float  z 
)

Set the rotation of the player to (x, y, z).

Parameters:
xfloat value specifying the x rotation (in degrees).
yfloat value specifying the y rotation (in degrees).
zfloat value specifying the z rotation (in degrees).
Returns:
Nothing.
void Player::Move ( Vector  distance)

Move the player by the specified distance.

Parameters:
distancevector specifying the distance to move.
Returns:
Nothing
void Player::Move ( float  x,
float  y,
float  z 
)

Move the player by the specified distance.

Parameters:
xfloat value specifying the distance to move in x direction.
yfloat value specifying the distance to move in y direction.
zfloat value specifying the distance to move in z direction.
Returns:
Nothing
void Player::Rotate ( Vector  rotation)

Rotate the player.

Parameters:
rotationvector specifying the amount to rotate around the x, y and z axes
Returns:
Nothing.
void Player::Rotate ( float  x,
float  y,
float  z 
)

Rotate the player.

Parameters:
xfloat value specifying the amount to rotate around the x axis (in degrees).
yfloat value specifying the amount to rotate around the y axis (in degrees).
zfloat value specifying the amount to rotate around the z axis (in degrees).
Returns:
Nothing.
string Player::GetGroundTexture ( )

Get the name of the texture beneath the player.

Returns:
the name of the texture beneath the player.
void Player::SetIcon ( string  icon)

Set the name of the player's icon image.

Parameters:
iconString holding the name of the CEGUI image used as the player's icon.
Returns:
Nothing.
string Player::GetIcon ( )

Get the name of the player's icon image.

Returns:
the name of the player's icon image.
void Player::Speak ( string  textSection,
string  sound,
float  textScrollSpeed,
float  textDisplayTime 
)

Show a text string and optionally play a sound at the player's position during a conversation. If not in a conversation, just play back the specified sound file.

Note:
Sync points for the camera are automatically inserted after each Speak command. When pressing the space bar to skip the text display and/or the audio playback also the camera will fast-forward its movements till the next sync point is reached.
Parameters:
textSectionString holding the name of a section in the conversation text file.
soundString holding the name of the sound file (WAV, OGG, MP3) in the dubbing directory to play (optional).
textScrollSpeedfloat value specifying the speed at which the individual letters of the text will be diplayed (optional).
textDisplayTimefloat value specifying the amount of time (in seconds) the text will be shown once it is completely displayed (optional).
Returns:
Nothing.
void Player::PlaySound ( string  filename)

Play the WAV file filename once using the default audible range.

Parameters:
filenameString holding the name of the WAV file to play. The .wav extension must be included in the name.
Returns:
Nothing.
void Player::PlaySound ( string  filename,
float  distance 
)

Play the WAV file filename once.

Parameters:
filenameString holding the name of the WAV file to play. The .wav extension must be included in the name.
distanceSpecifies the audible radius of the sound.
Returns:
Nothing.