Skyline Lua API  Version 1.0 RC1
Lua Script Reference for Skyline Game Engine.
fpsSystem Class Reference

#include <LUA_API_FpsSystem.h>

Public Member Functions

void setHasAmmo (int entity_ID, int state)
 Set the FPS Systems hasAmmo value. This value is used to notify the system that a weapon has ammo or not. More...
 
void playReloadSound (int entity_ID)
 Play the current weapons reload sound. More...
 
int getMaxClips (string wKey)
 Returns the max clip value for the weapon passed in the arg wKey. More...
 
int getMaxAmmo (string wKey)
 Returns the max Ammo value for the weapon passed in the arg wKey. More...
 
void setWeapon (int entityID, string wKey)
 Set the Game Systems main weapon to the type passed in the arg. More...
 
String getWeapon (int entityID)
 Returns the weapon key of the Game Systems current weapon. More...
 
void setKO (int entityID, int state)
 Sets the player KO status. More...
 
void setPosition (int entityID, float x, float y, float z)
 Sets the player position . More...
 
void setPositionString (int entityID, String xyz)
 Sets the player position . More...
 
void damagePlayer (int entityID, float damageAmt)
 Triggers player damage event in the fps player micro script where the arg damageAmt is passed through . More...
 
void setAsPlayer (int entityID, int state)
 Sets the character as the active player. More...
 

Detailed Description

This area covers FPS Action related functions. .
Use as fpsSystem.function()

For more information on how these functions can be used please visit the User Manual - http://www.chi-ad.com/Skyline/SDN/

Member Function Documentation

void fpsSystem::damagePlayer ( int  entityID,
float  damageAmt 
)

Triggers player damage event in the fps player micro script where the arg damageAmt is passed through .

Parameters
entityID: The EntityID with the attached FPS System action
float: The amount of damage to apply to the player

Sets the players position including character controller. Used when spawning after KO.

Here is a Small Example of how to use this function:

if(hitID==playerID) then fpsSystem.damagePlayer(objID, 10.0); end
int fpsSystem::getMaxAmmo ( string  wKey)

Returns the max Ammo value for the weapon passed in the arg wKey.

Parameters
wKey: The string weapon key to access the weapon database
Returns
int : the maxClips value of the weapon.

Get the weapons maximum number of rounds the weapon uses, One clip would contain this amount of rounds. The weapon to check
is specified in the arg wKey.

Here is a Small Example of how to use this function:

 
int fpsSystem::getMaxClips ( string  wKey)

Returns the max clip value for the weapon passed in the arg wKey.

Parameters
wKey: The string weapon key to access the weapon database
Returns
int : the maxClips value of the weapon.

Get the weapons maximum number of clips the player can carry when using this weapon. The weapon to check
is specified in the arg wKey.

Here is a Small Example of how to use this function:

 
String fpsSystem::getWeapon ( int  entityID)

Returns the weapon key of the Game Systems current weapon.

Parameters
entityID: The EntityID with the attached FPS System action
Returns
String : The weapon data key.

Get the weapons maximum number of rounds the weapon uses, One clip would contain this amount of rounds. The weapon to check
is specified in the arg wKey.

Here is a Small Example of how to use this function:

 
void fpsSystem::playReloadSound ( int  entity_ID)

Play the current weapons reload sound.

Parameters
entityID: The EntityID with the attached FPS System action

This command informs the FPS Sytem to play the current weapons reload sound. These sounds are set on a per weapon basis
from within the weapon editor.

Here is a Small Example of how to use this function:

function onKeyDown( key )
    if(key=="r" or key =="R") then
        if(clips>0) then
            clips = clips-1;
            ammo = ammo + maxAmmo;
            cegui.setText("Ammo","Ammo: "..ammo);
            fpsSystem.setHasAmmo(obj,1); -- wenow have some more ammo so tell the FPS System that its ok to shoot again.
            fpsSystem.playReloadSound(obj); -- informs the FPS System to play the current reload sound.
        end
        cegui.setText("Clips","Clips: "..clips);
    end
end
void fpsSystem::setAsPlayer ( int  entityID,
int  state 
)

Sets the character as the active player.

Parameters
entityID: The EntityID with the attached FPS System action
state: The int state to set the Fps player system to 0 = false and 1 = true.

Setting this command to true will enable this objects mnovement and system features. Only one player can be set to true
Here is a Small Example of how to use this function:

    fpsSystem.setAsPlayer(obj,1);
void fpsSystem::setHasAmmo ( int  entity_ID,
int  state 
)

Set the FPS Systems hasAmmo value. This value is used to notify the system that a weapon has ammo or not.

Parameters
entityID: The EntityID with the attached FPS System action
state: The int state to set the hasAmmo value to. 1=true or 0=false for no ammo

This setting is used to inform the FPS System of the current state of ammo when working from an external lua script/micro script. By setting the FPS Syetm hasAmmo value to either true or false will control how the weapon fires. A value of false(0) will
disable the weapon from firing as it has zero ammo available.

Here is a Small Example of how to use this function:

if(ammo>0) then
    ammo = ammo-1;
else
    --must have 0 ammo, so tell the system to behave accordingly
    fpsSystem.setHasAmmo(objID, 0);
end
void fpsSystem::setKO ( int  entityID,
int  state 
)

Sets the player KO status.

Parameters
entityID: The EntityID with the attached FPS System action
state: The int state to set the Fps player system to.

by setting the player status to KO true, no weapons will fire. Set this from your health managing function.

Here is a Small Example of how to use this function:

 
void fpsSystem::setPosition ( int  entityID,
float  x,
float  y,
float  z 
)

Sets the player position .

Parameters
entityID: The EntityID with the attached FPS System action
x: The x position .
y: The y position .
z: The z position .

Sets the players position including character controller. Used when re-spawning after KO. NOTE: Must have a player controller action for this to work.

Here is a Small Example of how to use this function:

    fpsSystem.setPosition(obj, 10, 20, 12);
void fpsSystem::setPositionString ( int  entityID,
String  xyz 
)

Sets the player position .

Parameters
entityID: The EntityID with the attached FPS System action
String: The position xyz formated in a string.

Sets the players position including character controller. Used when re-spawning after KO.

Here is a Small Example of how to use this function:

    fpsSystem.setPositionString(obj, "10 20 12");
void fpsSystem::setWeapon ( int  entityID,
string  wKey 
)

Set the Game Systems main weapon to the type passed in the arg.

Parameters
entityID: The EntityID with the attached FPS System action
wKey: The string weapon key to access the specified weapon database

Set the Game Systems main weapon to the type passed in the arg. This will over ride any weapon set from the editor.

Here is a Small Example of how to use this function:

 

The documentation for this class was generated from the following file: