Public Member Functions | ||||
bool | IsValid () | |||
check if the object is valid | ||||
ParaCharacter (CBaseObject *pObj) | ||||
void | SetSpeedScale (float fSpeedScale) | |||
the default value of speed scale is 1.0f, which will use the character's default speed. | ||||
float | GetSpeedScale () | |||
void | FallDown () | |||
if the biped is in air, it will fall down. | ||||
void | SetSizeScale (float fScale) | |||
the default value of size scale is 1.0f, which will use the character's default size. | ||||
float | GetSizeScale () | |||
void | SetFocus () | |||
ask the camera to follow this character.The camera will be immediately focused on this character without translation. | ||||
void | AddAction2 (int nAction, const object ¶m) | |||
add an action symbol, and let the character state manager determine which states it should go to. | ||||
void | AddAction (int nAction) | |||
bool | WalkingOrRunning () | |||
return true if character uses walk as the default moving animation.otherwise it uses running. | ||||
bool | IsCustomModel () | |||
check whether this character is customizable. | ||||
void | ResetBaseModel (ParaAssetObject assetCharBaseModel) | |||
Reset base model. | ||||
void | SetSkin (int nIndex) | |||
set the replaceable skin according to the skin database. | ||||
int | GetSkin () | |||
return the current skin index. | ||||
void | LoadStoredModel (int nModelSetID) | |||
Load a stored model in data base by the model set ID. | ||||
void | PlayAnimation (int nAnimID) | |||
play a specified animation. | ||||
void | PlayAnimation_ (const char *sAnim) | |||
int | GetAnimID () | |||
get the current animation ID of the character. | ||||
const char * | GetAnimFileName () | |||
get the current animation's filename. | ||||
void | EnableAnimIDMap (bool bEnable) | |||
set whether the m_mapAnimIDs will be used. | ||||
bool | IsAnimIDMapEnabled () | |||
get whether the m_mapAnimIDs will be used.Disabled by default | ||||
bool | AddAnimIDMap (int nFromID, int nToID) | |||
get whether the m_mapAnimIDs will be used.Disabled by default animation ID mapping is a mapping from one animation ID to another ID. | ||||
void | ClearAllAnimIDMap () | |||
remove all mapping. | ||||
bool | HasMountPoint (int nMountPointID) | |||
whether the character has a mount point at the given ID. | ||||
bool | IsMounted () | |||
whether the object is mounted on another object. | ||||
void | MountOn_ (const char *sTarget) | |||
mount the current object on another object. | ||||
void | MountOn (ParaObject &target) | |||
the target must contain at least one mount point. | ||||
void | SetBodyParams (int skinColor, int faceType, int hairColor, int hairStyle, int facialHair) | |||
Set the character body parameters. | ||||
int | GetBodyParams (int type) | |||
Get the character body parameters. | ||||
void | SetDisplayOptions (int bShowUnderwear, int bShowEars, int bShowHair) | |||
Set the display options for the character. | ||||
bool | GetDisplayOptions (int type) | |||
Get the display option parameters. | ||||
void | SetCharacterSlot (int nSlotID, int nItemID) | |||
set the model ID of a specified character slot. | ||||
int | GetCharacterSlotItemID (int nSlotID) | |||
Get the model ID of a specified character slot. | ||||
void | LoadFromFile (const char *filename) | |||
load all settings of the model to file. | ||||
void | SaveToFile (const char *filename) | |||
save all settings of the model to file. | ||||
void | RefreshModel () | |||
update the entire model from its characters settings, such as body parameters and equipments. | ||||
void | UseAIModule (const char *sAIType) | |||
use a specified AI object. | ||||
void | AssignAIController (const char *sAICtrlerName, const char *sParam1) | |||
assign a new controller to the current AI object. | ||||
bool | IsAIControllerEnabled (const char *sAICtrlerName) | |||
whether a certain controller is enabled. | ||||
ParaMovieCtrler | GetMovieController () | |||
get the movie controller. | ||||
ParaSeqCtrler | GetSeqController () | |||
get the sequence controller. | ||||
ParaFaceTrackingCtrler | GetFaceTrackingController () | |||
get the face tracking controller. | ||||
void | CastEffect (int nEffectID) | |||
cast a magic effect by the effect ID. | ||||
void | CastEffect2 (int nEffectID, const char *sTarget) | |||
cast a magic effect by the effect ID. | ||||
void | AddAttachment (ParaAssetObject ModelAsset, int nAttachmentID) | |||
| ||||
void | RemoveAttachment (int nAttachmentID) | |||
the model to be detached. | ||||
void | Stop () | |||
stop the biped if it is moving. | ||||
void | MoveTo (float x, float y, float z) | |||
move (using the current style i.e. | ||||
double | GetCartoonFaceComponent (int nComponentID, int SubType) | |||
get the cartoon face associated with this object. | ||||
void | SetCartoonFaceComponent (int nComponentID, int SubType, double value) | |||
see GetCartoonFaceComponent() | ||||
bool | IsSupportCartoonFace () | |||
check whether the associated cartoon model supports cartoon face. | ||||
int | GetGender () | |||
get the character gender. | ||||
int | GetRaceID () | |||
get the character race ID according to CharRacesDB table | ||||
Public Attributes | ||||
CBipedObject * | m_pCharacter |
void ParaScripting::ParaCharacter::FallDown | ( | ) |
if the biped is in air, it will fall down.
In case a biped is put to stop and the terrain below it changes. one should manually call this function to let the biped fall down. Internally it just set the vertical speed to a small value
void ParaScripting::ParaCharacter::SetSizeScale | ( | float | fScale | ) |
the default value of size scale is 1.0f, which will use the character's default size.
increasing this value will enlarge the character as well as its physical radius.
void ParaScripting::ParaCharacter::AddAction2 | ( | int | nAction, | |
const object & | param | |||
) |
add an action symbol, and let the character state manager determine which states it should go to.
this function will not perform any concrete actions on the biped objects.
nAction,: | please see script/ide/action_table.lua for a list of valid values. | |
param,: | the param specifying more details about the action. This value default to nil if nAct is S_ACTIONKEY, then this is const ActionKey* if nAct is S_WALK_POINT, then this is nil or 1, specifying whether to use angle. |
bool ParaScripting::ParaCharacter::WalkingOrRunning | ( | ) |
return true if character uses walk as the default moving animation.otherwise it uses running.
void ParaScripting::ParaCharacter::ResetBaseModel | ( | ParaAssetObject | assetCharBaseModel | ) |
Reset base model.
Base model is the frame model, to which other sub-models like weapons and clothing are attached. NOTE: the current version will delete the entire model instance, so that any sub-models attached to this model will be deleted and that the default appearance of the base model will show up, if one does not update its equipment after this call.
assetCharBaseModel,: | It is the new base model asset;it should be a valid ParaX model asset. |
void ParaScripting::ParaCharacter::SetSkin | ( | int | nIndex | ) |
set the replaceable skin according to the skin database.
this only applies to non-customizable characters.if the index exceeds, it will use the default one. the default skin is at index 0.
nIndex,: | the skin index. |
int ParaScripting::ParaCharacter::GetSkin | ( | ) |
return the current skin index.
the default skin is at index 0.
void ParaScripting::ParaCharacter::LoadStoredModel | ( | int | nModelSetID | ) |
Load a stored model in data base by the model set ID.
A stored model usually contain the attachments and equipments, but not the base model. This function is only valid when the base model has already been set.
nModelSetID,: | the ID of the model set in the database. Some ID may be reserved for user-specified model |
void ParaScripting::ParaCharacter::PlayAnimation | ( | int | nAnimID | ) |
play a specified animation.
int ParaScripting::ParaCharacter::GetAnimID | ( | ) |
get the current animation ID of the character.
Usually 0-46 is for normal animation like idle and walking; 0-1000 are reserved for internally animation. 1000-2000 are game specific; 2000 plus are automatically generated. One should call GetAnimFileName() for id above 2000.
const char * ParaScripting::ParaCharacter::GetAnimFileName | ( | ) |
get the current animation's filename.
If it is an internal animation, it will return nil. If it is from bone animation provider, it returns the file name from which the animation is loaded.
void ParaScripting::ParaCharacter::EnableAnimIDMap | ( | bool | bEnable | ) |
set whether the m_mapAnimIDs will be used.
Disabled by default
bool ParaScripting::ParaCharacter::AddAnimIDMap | ( | int | nFromID, | |
int | nToID | |||
) |
get whether the m_mapAnimIDs will be used.Disabled by default animation ID mapping is a mapping from one animation ID to another ID.
This mapping is usually not used (empty). However, it is used when we can want to secretly replace animation used by this animation instance, by adding a ID to ID map. e.g. we can replace female walk animation ID with an external female walk animation ID.
nFromID,: | ||
nToID,: | if it is negative, the mapping nFromID is removed. |
void ParaScripting::ParaCharacter::ClearAllAnimIDMap | ( | ) |
remove all mapping.
bool ParaScripting::ParaCharacter::HasMountPoint | ( | int | nMountPointID | ) |
whether the character has a mount point at the given ID.
Such characters are usually cars, horses, planes, etc.
nMountPointID,: | this is usually 0. |
bool ParaScripting::ParaCharacter::IsMounted | ( | ) |
whether the object is mounted on another object.
void ParaScripting::ParaCharacter::MountOn_ | ( | const char * | sTarget | ) |
mount the current object on another object.
sTarget,: | the name of the global target object on which the current character is mounted on. |
void ParaScripting::ParaCharacter::MountOn | ( | ParaObject & | target | ) |
the target must contain at least one mount point.
if there are multiple mount point, it will mount to the closet one.
target,: | the name of the target object on which the current character is mounted on. |
void ParaScripting::ParaCharacter::SetBodyParams | ( | int | skinColor, | |
int | faceType, | |||
int | hairColor, | |||
int | hairStyle, | |||
int | facialHair | |||
) |
Set the character body parameters.
Need to call RefreshModel() after finished with the settings. All body parameters are integer ranging from 0 to maxType, where maxType is the maximum number of types of of a certain body parameter. For each body parameter, one can specify -1 to retain its current value. This is useful, when the caller only wants to change one or several of the body parameters. The default body parameters is (0,0,0,0,0).
int ParaScripting::ParaCharacter::GetBodyParams | ( | int | type | ) |
Get the character body parameters.
@ param type: the body parameter type of the character BP_SKINCOLOR =0, BP_FACETYPE = 1, BP_HAIRCOLOR = 2, BP_HAIRSTYLE = 3, BP_FACIALHAIR = 4
void ParaScripting::ParaCharacter::SetDisplayOptions | ( | int | bShowUnderwear, | |
int | bShowEars, | |||
int | bShowHair | |||
) |
Set the display options for the character.
in case of boolean input: 1 stands for true; 0 stands for false, -1 stands for retaining its current value. Need to call RefreshModel() after finished with the settings.
bool ParaScripting::ParaCharacter::GetDisplayOptions | ( | int | type | ) |
Get the display option parameters.
@ param type: the display option parameter of the character DO_SHOWUNDERWEAR =0, DO_SHOWEARS = 1, DO_SHOWHAIR = 2
void ParaScripting::ParaCharacter::SetCharacterSlot | ( | int | nSlotID, | |
int | nItemID | |||
) |
set the model ID of a specified character slot.
Need to call RefreshModel() after finished with the settings.
nSlotID,: | the ID of the slot to be set for the character. Normally there are 16 slots on the character. CS_HEAD =0, CS_NECK = 1, CS_SHOULDER = 2, CS_BOOTS = 3, CS_BELT = 4, CS_SHIRT = 5, CS_PANTS = 6, CS_CHEST = 7, CS_BRACERS = 8, CS_GLOVES = 9, CS_HAND_RIGHT = 10, CS_HAND_LEFT = 11, CS_CAPE = 12, CS_TABARD = 13, | |
nItemID,: | the ID of the item to be put into the character slot. The default value for all slots is 0. One may empty a certain slots by setting its nItemID to 0. |
int ParaScripting::ParaCharacter::GetCharacterSlotItemID | ( | int | nSlotID | ) |
Get the model ID of a specified character slot.
nSlotID,: | the ID of the slot to be set for the character. Normally there are 16 slots on the character. |
void ParaScripting::ParaCharacter::LoadFromFile | ( | const char * | filename | ) |
load all settings of the model to file.
Need to call RefreshModel() after loading.
void ParaScripting::ParaCharacter::SaveToFile | ( | const char * | filename | ) |
save all settings of the model to file.
void ParaScripting::ParaCharacter::RefreshModel | ( | ) |
update the entire model from its characters settings, such as body parameters and equipments.
This will rebuild the composed character texture.
refresh equipment
refresh base model
void ParaScripting::ParaCharacter::UseAIModule | ( | const char * | sAIType | ) |
use a specified AI object.
sAIType,: | valid AI object is: "NPC"|""|"NULL" "" is the same as "NPC" "NULL" means no AI module. |
void ParaScripting::ParaCharacter::AssignAIController | ( | const char * | sAICtrlerName, | |
const char * | sParam1 | |||
) |
assign a new controller to the current AI object.
if there is no AI object, we will create a default one to use.
sAICtrlerName:valid | AI controller name is: "sequence"|"movie"|"face"|"follow"|"avoid" | |
sParam1,: | this format of this parameter is dependent on the sAICtrlerName. see below: |
sAICtrlerName = "follow": follow another named biped: sParam1 = "" | "sName" | "sName radius angle" : "" to disable following, or follow a biped called sName.
sAICtrlerName = "movie": enable a movie controller. sParam1 = ""|"true"|"false": "" or "true" to enable a movie, or "false" to disable it. e.g. Char:AssignAIController("movie", "true");Char:AssignAIController("movie", "false"); use GetMovieController() to get the controller
sAICtrlerName = "sequence": enable a sequence controller. sParam1 = ""|"true"|"false": "" or "true" to enable a sequence, or "false" to disable it. e.g. Char:AssignAIController("sequence", "true");Char:AssignAIController("sequence", "false"); use GetSeqController() to get the controller
if there is no AI object, we will create a default one to use
bool ParaScripting::ParaCharacter::IsAIControllerEnabled | ( | const char * | sAICtrlerName | ) |
whether a certain controller is enabled.
sAICtrlerName,: | "sequence"|"movie"|"face"|"follow"|"avoid" see also AssignAIController(); |
if there is no AI object, return false
ParaMovieCtrler ParaScripting::ParaCharacter::GetMovieController | ( | ) |
get the movie controller.
the movie controller will be created if it does not exist.
if there is no AI object, we will create a default one to use
ParaSeqCtrler ParaScripting::ParaCharacter::GetSeqController | ( | ) |
get the sequence controller.
the sequence controller will be created if it does not exist.
if there is no AI object, we will create a default one to use
ParaFaceTrackingCtrler ParaScripting::ParaCharacter::GetFaceTrackingController | ( | ) |
get the face tracking controller.
the sequence controller will be created if it does not exist.
if there is no AI object, we will create a default one to use
void ParaScripting::ParaCharacter::CastEffect | ( | int | nEffectID | ) |
cast a magic effect by the effect ID.
nEffectID,: | effect ID in the effect database if effect id is negative, the effect will be removed from the object. |
void ParaScripting::ParaCharacter::CastEffect2 | ( | int | nEffectID, | |
const char * | sTarget | |||
) |
cast a magic effect by the effect ID.
nEffectID,: | effect ID in the effect database if effect id is negative, the effect will be removed from the object. | |
sTarget,: | target of the effect, if there is any. it can either to the name of the target object, or an attachment ID on the current character. in case it is an attachment ID. It should be in the following format. <d> d is the attachment ID. For customizable characters, some IDs are: 0 ATT_ID_SHIELD, 1 ATT_ID_HAND_RIGHT, 2 ATT_ID_HAND_LEFT, -- default value 5 ATT_ID_SHOULDER_RIGHT, 6 ATT_ID_SHOULDER_LEFT, 11 ATT_ID_HEAD, e.g. char:CastEffect(1, "NPC0"); -- fire missile 1 at NPC0. char:CastEffect(2, "<2>"); -- attach the effect 2 to the current character's hand. |
void ParaScripting::ParaCharacter::AddAttachment | ( | ParaAssetObject | ModelAsset, | |
int | nAttachmentID | |||
) |
ModelAsset | the model to be attached. |
This can be both ParaX model or static mesh model.
nAttachmentID | to which part of the character, the effect model is attached. 0 ATT_ID_SHIELD, 1 ATT_ID_HAND_RIGHT, 2 ATT_ID_HAND_LEFT, -- default value 5 ATT_ID_SHOULDER_RIGHT, 6 ATT_ID_SHOULDER_LEFT, 11 ATT_ID_HEAD, | |
nSlotID | the slot id of the effect. default value is -1. if there is already an effect with the same ID it will be replaced with this new one. |
void ParaScripting::ParaCharacter::RemoveAttachment | ( | int | nAttachmentID | ) |
void ParaScripting::ParaCharacter::Stop | ( | ) |
stop the biped if it is moving.
void ParaScripting::ParaCharacter::MoveTo | ( | float | x, | |
float | y, | |||
float | z | |||
) |
move (using the current style i.e.
walk or run) to a position relative to the current position.
double ParaScripting::ParaCharacter::GetCartoonFaceComponent | ( | int | nComponentID, | |
int | SubType | |||
) |
get the cartoon face associated with this object.
nComponentID,: | one of the following value. cartoon face slots on the face of the character enum CartoonFaceSlots { CFS_FACE = 0, CFS_WRINKLE = 1, CFS_EYE = 2, CFS_EYEBROW = 3, CFS_MOUTH = 4, CFS_NOSE = 5, CFS_MARKS = 6, |
SubType,: |
|
void ParaScripting::ParaCharacter::SetCartoonFaceComponent | ( | int | nComponentID, | |
int | SubType, | |||
double | value | |||
) |
bool ParaScripting::ParaCharacter::IsSupportCartoonFace | ( | ) |
check whether the associated cartoon model supports cartoon face.
int ParaScripting::ParaCharacter::GetGender | ( | ) |
get the character gender.
int ParaScripting::ParaCharacter::GetRaceID | ( | ) |
get the character race ID according to CharRacesDB table