Player Hands Handler
The Player Hands Handler loads and animates the first-person hand model. Helpers select a hand entity, play its animation and optionally attach the camera to a model socket; human, diving and deep-sea model helpers supply stock entity paths.
Contents
Before you start
- Open the map script inside your own mod. Keep its generated includes,
cScrMap : iScrMapclass and callback structure. See Add your first script if you have not edited a map script yet. - Add the helper include shown below alongside the script’s other includes.
- Read the stock example before copying its calls: named entities, voice subjects, materials and callbacks must belong to the map or resources you are using.
Follow the stock example
#include "helpers/helper_modules.hps"
PlayerHands_SetHandModel_Human
In maps/_e3/_e3_01_01/_e3_01_01.hps, SOMA calls PlayerHands_SetHandModel_Human as follows.
PlayerHands_SetHandModel_Human();
This is an excerpt from that stock script; its referenced names and variables belong to that script.
PlayerHands_PlayAnimation
In maps/chapter02/02_05_theta_inside/02_05_theta_inside.hps, SOMA calls PlayerHands_PlayAnimation as follows.
PlayerHands_PlayAnimation(sAnim, false, true, 1.0f);
| Parameter | Value in this stock call |
|---|---|
asAnim |
sAnim
|
abLoop |
false
|
abFullScaleModel |
true
|
afFadeTime |
1.0f
|
This is an excerpt from that stock script; its referenced names and variables belong to that script.
PlayerHands_AttachCameraToSocket
In maps/chapter03/03_02_omicron_inside/03_02_omicron_inside.hps, SOMA calls PlayerHands_AttachCameraToSocket as follows.
PlayerHands_AttachCameraToSocket("Socket_Camera", 1.0f, "", true,true,1.0f);
| Parameter | Value in this stock call |
|---|---|
asBoneName |
"Socket_Camera"
|
afFadeTime |
1.0f
|
asFadeOverCallback |
""
|
abDisablePlayer |
true
|
abAutoDetach |
true
|
afDetachTime |
1.0f
|
This is an excerpt from that stock script; its referenced names and variables belong to that script.
Check your change
Save the script and restart the map in development mode with F5. If the script fails, open F1 and use Show Error List or Show HPL Log. See the development loop for the launch and debugging steps.