GRW ScriptHook 0.11.0
Plugin API for Ghost Recon Wildlands
Loading...
Searching...
No Matches
scripthook.h
Go to the documentation of this file.
1
4#ifndef GRW_SCRIPTHOOK_H
5#define GRW_SCRIPTHOOK_H
6
7#include <stdint.h>
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
16
17#define SH_API_VERSION 1
18
19#ifdef SH_BUILD
20#define SH_API __declspec(dllexport)
21#else
22#define SH_API
23#endif
24
26typedef struct { float x, y, z; } ShVec3;
27
29
33
57
61 SH_UI_DRONE = 0x0001,
63 SH_UI_VEHICLE = 0x0004,
64 SH_UI_PAUSE = 0x0008,
65 SH_UI_LOADOUT = 0x0010,
66 SH_UI_MAP = 0x0020,
67 SH_UI_SKILLS = 0x0040,
70 SH_UI_LOADING = 0x0200,
72 SH_UI_POPUP = 0x0800
73};
74SH_API uint32_t ShGetUiState(void);
75SH_API int ShInDrone(void);
77SH_API int ShInMap(void);
79
83
106
111
115#define SH_STREAM_RADIUS 1500.0f
116
121
125typedef struct {
126 uint64_t entity;
127 uint64_t node;
128 uint64_t root;
129} ShPlayer;
130
131typedef int (*ShLastError_t)(void);
132typedef const char *(*ShErrorString_t)(int err);
133typedef int (*ShGetVersion_t)(void);
134typedef int (*ShGetPlayer_t)(ShPlayer *out);
135typedef int (*ShTeleportPlayer_t)(const ShVec3 *pos,
136 const ShVec3 *orient);
137typedef int (*ShWalkToRoot_t)(uint64_t entity, uint64_t *outRoot);
138typedef int (*ShGetPlayerPosition_t)(ShVec3 *out);
139typedef void (*ShInvalidate_t)(void);
140
144
148SH_API const char *ShErrorString(int err);
151
155
173 const ShVec3 *orient);
174
182 const ShVec3 *orient,
183 float hopMetres, int delayMs);
184
189
194
198SH_API int ShPlaceEntity(uint64_t entity, const ShVec3 *pos,
199 const ShVec3 *orient);
200
204SH_API int ShPlaceEntityRot(uint64_t entity, const ShVec3 *pos,
205 float yaw, float pitch, float roll);
206
210SH_API int ShGetEntityTransform(uint64_t entity, ShVec3 *pos,
211 float *yaw, float *pitch,
212 float *roll);
213
217SH_API int ShQueueTransform(uint64_t entity, const ShVec3 *pos,
218 float yaw, float pitch, float roll);
235
239#define SH_FIND_UNNAMED 0x1
240
241typedef struct {
242 uint64_t entity;
244 float distance;
245 int kind;
246 uint32_t maxHealth;
247 char name[32];
248} ShEntity;
249
253SH_API int ShFindEntities(int kind, float radius, uint32_t flags,
254 ShEntity *out, int max);
255
257SH_API int ShGetEntityKind(uint64_t entity);
259SH_API const char *ShKindName(int kind);
260
264typedef struct {
265 uint64_t component;
266 uint64_t dataBlock;
267 uint32_t classHash;
268 char name[32];
270
274SH_API int ShGetComponents(uint64_t entity, ShComponent *out,
275 int max);
276
278SH_API uint64_t ShFindComponent(uint64_t entity,
279 uint32_t classHash);
280
285
292SH_API int ShQueueCall(uint64_t fn, uint64_t a0, uint64_t a1,
293 uint64_t a2, uint64_t a3);
294
298SH_API int ShQueueCallF(uint64_t fn, uint64_t a0, uint64_t a1,
299 float f2, float f3, float f4);
300SH_API int ShQueueResult(uint64_t *outRet);
301
306
307typedef struct {
308 uint32_t id;
309 const char *name;
310} ShVehicle;
311
316SH_API const ShVehicle *ShVehicleAt(int index);
317SH_API const char *ShVehicleName(uint32_t vehicleId);
318
325SH_API uint64_t ShSpawnVehicle(uint32_t vehicleId,
326 const ShVec3 *pos);
328
332SH_API int ShReadBytes(uint64_t addr, void *out, uint32_t len);
333SH_API uint64_t ShReadU64(uint64_t addr, int *ok);
334SH_API float ShReadF32(uint64_t addr, int *ok);
335
338typedef void (*ShFrameFn_t)(void *user);
341
346
353SH_API int ShSetLightningFrequency(int enable, float value);
354
359
361SH_API int ShExplosionShield(const ShVec3 *at, float radius);
362
364SH_API int ShSetEntityPhysics(uint64_t entity, int on);
366SH_API int ShAttachEntity(uint64_t child, uint64_t parent,
367 const ShVec3 *offset);
368SH_API int ShDetachEntity(uint64_t child);
369
374
375typedef struct {
376 uint64_t id;
377 int kind;
379
383SH_API const ShNpcArchetype *ShNpcAt(int index);
384
389SH_API uint64_t ShSpawnNpc(uint64_t archetypeId, const ShVec3 *pos);
390
394SH_API int ShDespawn(uint64_t entity);
395
399
401SH_API int ShWalkToRoot(uint64_t entity, uint64_t *outRoot);
404
409
416typedef struct {
420 uint32_t hits;
421 uint64_t descriptor;
422 uint64_t collector;
423 uint8_t raw[32];
424
428 uint64_t projectile;
429 uint32_t projHits;
430 uint64_t hitObject;
431 float hitDist;
432} ShRay;
433
439
446SH_API void ShRayFilter(const ShVec3 *from, float radius,
447 float minLength);
449SH_API void ShRayFilterPlayer(float radius, float minLength);
450
454SH_API void ShRayLog(int mode);
455SH_API uint32_t ShRayCount(void);
457SH_API int ShGetRays(ShRay *out, int max);
458
471
473SH_API int ShQueryRays(const ShRayQuery *q, ShRay *out, int max);
474
479
483typedef struct {
484 uint64_t entity;
485 uint64_t root;
486 int kind;
487 uint32_t id;
490 float distance;
491 uint64_t shooter;
493 uint64_t projectile;
494 int index;
495} ShHit;
496
500typedef void (*ShHitFn)(const ShHit *hit, void *user);
501
505
510#define SH_EVT_MINE_ONLY 0x1
511#define SH_EVT_NO_SELF 0x2
512
514SH_API int ShOnHit(ShHitFn fn, void *user, int flags);
517
519SH_API uint32_t ShHitCount(void);
520SH_API int ShGetHits(ShHit *out, int max);
521
525typedef struct {
526 uint64_t shooter;
527 int kind;
531 float yaw;
532 float pitch;
533 float range;
534 uint64_t projectile;
535} ShShot;
536
537typedef void (*ShFireFn)(const ShShot *shot, void *user);
538
540SH_API int ShOnFire(ShFireFn fn, void *user, int flags);
542SH_API uint32_t ShShotCount(void);
543SH_API int ShGetShots(ShShot *out, int max);
544
549
553SH_API int ShSetVisible(uint64_t entity, uint64_t node,
554 int visible, int persist);
555SH_API int ShEntityNodeCount(uint64_t entity);
556
560SH_API int ShGetEntityNodes(uint64_t entity, uint64_t *out,
561 int max);
565SH_API int ShGetHeadNodes(uint64_t entity, uint64_t *out,
566 int max);
567
572
573typedef void (*ShMenuFn)(uint32_t menu, uint32_t item, int value,
574 void *user);
575
577SH_API uint32_t ShMenuCreate(const char *title);
578SH_API uint32_t ShMenuSub(uint32_t parent, const char *label);
579SH_API int ShMenuAction(uint32_t menu, const char *label,
580 ShMenuFn fn, void *user);
581SH_API int ShMenuToggle(uint32_t menu, const char *label,
582 int initial, ShMenuFn fn, void *user);
583SH_API int ShMenuNumber(uint32_t menu, const char *label,
584 float initial, float lo, float hi,
585 float step, ShMenuFn fn, void *user);
587SH_API int ShMenuList(uint32_t menu, const char *label,
588 const char **opts, int n, int initial,
589 ShMenuFn fn, void *user);
592SH_API int ShMenuClear(uint32_t menu);
594SH_API int ShMenuDestroy(uint32_t menu);
596SH_API int ShMenuStatus(uint32_t menu, const char *text);
597SH_API void ShMenuSetKey(int vk);
599SH_API void ShMenuOpen(int open);
600
605
606enum {
611};
612
614SH_API uint32_t ShHudCreate(const char *name, int anchor,
615 int priority);
617SH_API int ShHudSet(uint32_t hud, const char *text);
618SH_API int ShHudColour(uint32_t hud, uint32_t rgb);
619SH_API int ShHudShow(uint32_t hud, int visible);
620SH_API void ShHudDestroy(uint32_t hud);
621
626
639
643SH_API uint64_t ShCameraCalls(void);
644SH_API uint64_t ShCameraWrites(void);
645
649
655
659
666
668
672
676
678SH_API int ShGetVelocity(uint64_t entity, ShVec3 *out);
679SH_API int ShSetVelocity(uint64_t entity, const ShVec3 *v);
680SH_API int ShAddVelocity(uint64_t entity, const ShVec3 *v);
681
683SH_API int ShGetAngularVelocity(uint64_t entity, ShVec3 *out);
684SH_API int ShSetAngularVelocity(uint64_t entity, const ShVec3 *v);
685SH_API int ShAddAngularVelocity(uint64_t entity, const ShVec3 *v);
686
690SH_API int ShShove(uint64_t entity, const ShVec3 *dir,
691 float strength, const ShVec3 *atWorldPos);
692
696SH_API int ShCanMove(uint64_t entity);
697
699
703
704SH_API uint64_t ShHavokWorld(void);
705SH_API uint32_t ShGetBodyId(uint64_t entity);
706SH_API int ShHavokScan(int *bodies, int *owners, int *mapped);
707
709
713
714#define SH_INPUT_KEYS 0x01
715#define SH_INPUT_MOVE 0x02
716#define SH_INPUT_FIRE 0x04
717#define SH_INPUT_AIM 0x08
718#define SH_INPUT_LOOK 0x10
719
721SH_API int ShBlockInput(uint32_t mask);
722SH_API uint32_t ShBlockedInput(void);
723
725
731
735
738
743
745SH_API int ShCrashReport(char *buf, int len);
746
752
754
757
760
764SH_API int ShSetCamera(const ShVec3 *pos);
765SH_API int ShCameraOrbit(float back, float up);
766
770SH_API int ShCameraFree(const ShVec3 *pos, float yaw, float pitch);
771SH_API int ShCameraAngles(float *yaw, float *pitch);
773
777SH_API void ShCameraReleaseFields(uint32_t fields);
778SH_API uint32_t ShCameraOwned(void);
779
784SH_API int ShCameraFirstPerson(float forward, float up);
785
792
796#define SH_CAM_POS 0x01
797#define SH_CAM_ROT 0x02
798#define SH_CAM_FOV 0x04
799#define SH_CAM_SKEW 0x08
800#define SH_CAM_MODE 0x10
801
802typedef struct {
803 uint32_t apply;
805 float yaw, pitch, roll;
806 float fov;
807 float skewX, skewY;
808 int mode;
810
813
817SH_API int ShCameraMatrix(int index, float *out16);
818
822
831SH_API int ShGetGameStateName(char *buf, int len);
832
833typedef int (*ShGetGameState_t)(void);
834typedef int (*ShIsInGame_t)(void);
835
839
842SH_API int ShGroundHeight(float x, float y, float *outZ);
846SH_API int ShGroundHeightFrom(float x, float y, float nearZ,
847 float *outZ);
848SH_API int ShTeleportPlayerToGround(float x, float y,
849 float clearance);
850
855
859SH_API int ShGetHealthPlayer(uint32_t *cur, uint32_t *max);
860SH_API int ShSetHealthPlayer(uint32_t value);
862
866SH_API int ShDamagePlayer(uint32_t amount);
871
875SH_API int ShGetHealthEntity(uint64_t entity, uint32_t *cur,
876 uint32_t *max);
877SH_API int ShSetHealthEntity(uint64_t entity, uint32_t value);
878SH_API int ShSetGodModeEntity(uint64_t entity, int on);
879
883SH_API int ShStatRead(uint64_t stat, uint32_t *out);
884SH_API int ShStatWrite(uint64_t stat, uint32_t value);
885
887#define SH_RES_FOOD 0
888#define SH_RES_GASOLINE 1
889#define SH_RES_MEDICINE 2
890#define SH_RES_COMMS 3
891SH_API int ShGetResource(int which, uint32_t *out);
892SH_API int ShSetResource(int which, uint32_t value);
893SH_API int ShSetAllResources(uint32_t value);
894
896SH_API int ShGetSkillPoints(uint32_t *out);
897SH_API int ShSetSkillPoints(uint32_t value);
898
902SH_API int ShSetVisibility(float factor);
903SH_API int ShGetVisibility(float *out);
904
906SH_API int ShGetAmmo(int slot, uint32_t *out);
907SH_API int ShSetAmmo(int slot, uint32_t value);
908
913
925SH_API int ShSetWeather(int type);
927SH_API int ShSetWeatherBlend(int type, float seconds);
930SH_API int ShGetWeather(int *out);
931
935SH_API int ShSetTime(float hours);
936SH_API int ShGetTime(float *out);
937
941SH_API int ShSetTimeSpeed(float multiplier);
942SH_API int ShGetTimeSpeed(float *out);
943
948
952typedef struct {
953 uint32_t nameHash;
954 int index;
955 uint64_t fn;
956} ShMethod;
957
959SH_API int ShReflectMethod(uint64_t obj, uint32_t nameHash,
960 uint64_t *outFn);
962SH_API int ShReflectMethods(uint64_t obj, ShMethod *out, int max);
964SH_API uint32_t ShReflectClassHash(uint64_t obj);
965
969SH_API int ShReflectCall(uint64_t obj, uint32_t nameHash,
970 uint64_t a1, uint64_t a2, uint64_t a3,
971 uint64_t *outRet);
972
974#define SH_HASH_ENTER 0x78B1EF6Au
975#define SH_HASH_EXIT 0x343B2B30u
976#define SH_HASH_INIT 0x66464B4Au
977#define SH_HASH_SHUTDOWN 0x6CD4BC94u
978#define SH_HASH_GAMEOVER 0xCA671D0Au
979
983SH_API int ShSceneEnter(uint64_t obj);
984SH_API int ShSceneExit(uint64_t obj);
985
987SH_API uint64_t ShGameFlow(void);
988
992#define SH_FLOW_GAMEOVER_SCENE 9
993#define SH_FLOW_ALT_SCENE 11
994SH_API uint64_t ShGameFlowObject(int slot);
995
997SH_API uint64_t ShHybridMenu(void);
998
1003
1008
1013SH_API void ShUiEnable(int on);
1017SH_API int ShUiSetDefaultFont(const char *guid);
1018SH_API int ShUiSetDefaultImage(const char *guid);
1020SH_API int ShUiGen(void);
1023SH_API uint64_t ShSceneHandle(void);
1024
1026SH_API uint32_t ShUiPanel(float x, float y, float w, float h,
1027 uint32_t rgb, float alpha);
1029SH_API uint32_t ShUiLabel(uint32_t panel, float x, float y, float w,
1030 float h, const char *text, uint32_t rgb);
1032SH_API uint32_t ShUiImage(uint32_t panel, float x, float y, float w,
1033 float h, uint32_t rgb, float alpha);
1034
1035SH_API int ShUiSetText(uint32_t id, const char *text);
1036SH_API int ShUiSetPos(uint32_t id, float x, float y);
1037SH_API int ShUiSetSize(uint32_t id, float w, float h);
1038SH_API int ShUiSetColour(uint32_t id, uint32_t rgb);
1039SH_API int ShUiSetAlpha(uint32_t id, float alpha);
1041SH_API int ShUiShow(uint32_t id, int visible);
1043SH_API int ShUiDestroy(uint32_t id);
1044
1048#define SH_PT_FLOAT 1
1049#define SH_PT_BOOL 2
1050#define SH_PT_UINT 3
1051#define SH_PT_VEC2 4
1052#define SH_PT_VEC3 5
1053#define SH_PT_STRING 6
1054
1055#define SH_P_POSITION 0x01
1056#define SH_P_ROTATION3 0x02
1057#define SH_P_ROTATION 0x03
1058#define SH_P_COLOUR 0x05
1059#define SH_P_ALPHA 0x06
1060#define SH_P_VISIBLE 0x07
1061#define SH_P_SCALE 0x35
1062#define SH_P_TEXT 0x08
1063#define SH_P_AUTOSIZE 0x09
1064#define SH_P_STYLE 0x0A
1065#define SH_P_FONTSIZE 0x0C
1066#define SH_P_LINEGAP 0x0E
1067#define SH_P_SIZE 0x0F
1068#define SH_P_IMAGE 0x2A
1069#define SH_P_UV0 0x38
1070#define SH_P_UV1 0x39
1071#define SH_P_CONTSIZE 0x3E
1072
1075#define SH_W_CONTAINER 1
1076#define SH_W_LABEL 2
1077#define SH_W_IMAGE 3
1078#define SH_W_PANEL 4
1079
1083SH_API uint32_t ShUiCreate(uint32_t parent, int cls, float x, float y,
1084 float w, float h);
1085
1087SH_API int ShUiPropType(uint32_t id, uint32_t prop);
1088SH_API int ShUiSetF(uint32_t id, uint32_t prop, float v);
1089SH_API int ShUiSetU(uint32_t id, uint32_t prop, uint32_t v);
1090SH_API int ShUiSetV(uint32_t id, uint32_t prop, const float *v, int n);
1091SH_API int ShUiSetS(uint32_t id, uint32_t prop, const char *utf8);
1092SH_API int ShUiGetF(uint32_t id, uint32_t prop, float *out);
1093SH_API int ShUiGetU(uint32_t id, uint32_t prop, uint32_t *out);
1094SH_API int ShUiGetV(uint32_t id, uint32_t prop, float *out, int n);
1095SH_API int ShUiGetS(uint32_t id, uint32_t prop, char *out, int n);
1097SH_API int ShUiSetAutoSize(uint32_t id, int autoW, int autoH);
1100SH_API int ShUiMeasure(uint32_t id, float *w, float *h);
1101
1104SH_API uint32_t ShUiTextureCreate(int w, int h, const uint8_t *rgba,
1105 int stride);
1107SH_API int ShUiImageSet(uint32_t id, uint32_t texture);
1110SH_API int ShUiPropAt(int i, char *cls, int n, uint32_t *prop,
1111 int *type);
1112
1116SH_API uint32_t ShUiSceneCreate(const char *name, int order);
1117SH_API int ShUiSceneSetOrder(uint32_t scene, int order);
1118SH_API int ShUiSceneShow(uint32_t scene, int visible);
1120SH_API int ShUiSceneDestroy(uint32_t scene);
1122SH_API uint32_t ShUiCreateIn(uint32_t scene, uint32_t parent, int cls,
1123 float x, float y, float w, float h);
1126SH_API int ShUiSetReset(uint32_t scene,
1127 void (*fn)(uint32_t scene, void *user),
1128 void *user);
1135SH_API int ShUiCommitAsync(void (*done)(int ok, void *user),
1136 void *user);
1137
1140SH_API int ShUiReparent(uint32_t id, uint32_t parent, int index);
1141SH_API int ShUiChildCount(uint32_t id);
1142SH_API uint32_t ShUiChildAt(uint32_t id, int index);
1143
1147#define SH_UI_EV_DOWN 1
1148#define SH_UI_EV_UP 2
1149#define SH_UI_EV_MOVE 3
1150typedef struct { int type; int key; int x; int y; } ShUiEvent;
1151typedef int (*ShUiInputFn)(uint32_t scene, const ShUiEvent *e,
1152 void *user);
1153SH_API int ShUiSetInput(uint32_t scene, ShUiInputFn fn, void *user);
1154SH_API int ShUiFocus(uint32_t scene, int take);
1155SH_API uint32_t ShUiFocused(void);
1157SH_API int ShBlockKey(int vk, int on);
1160
1163#define SH_SCENE_DRONE "HUD_Drone"
1164#define SH_SCENE_BINOCULAR "HUD_Binocular"
1165#define SH_SCENE_VEHICLE "HUD_Vehicle"
1166#define SH_SCENE_PAUSE "Menu_TabbedPage"
1167#define SH_SCENE_LOADOUT "MENU_LoadoutV2"
1168#define SH_SCENE_MAP "MENU_Map_Cursor"
1169#define SH_SCENE_SKILLS "MENU_Skills"
1170#define SH_SCENE_COMWHEEL "HUD_ComWheel"
1171#define SH_SCENE_GAMEOVER "MENU_GameOver"
1172#define SH_SCENE_LOADING "MENU_LoadingScreen"
1173#define SH_SCENE_CINEMATIC "HUD_Cinematic"
1175SH_API int ShGameSceneActive(const char *name);
1177SH_API int ShGameScenes(char *buf, int n);
1178
1183
1186
1190SH_API uint64_t ShGameSceneAt(int i);
1191SH_API int ShGameSceneName(uint64_t scene, char *buf, int n);
1192
1194SH_API uint64_t ShSceneRoot(uint64_t scene);
1195
1197SH_API int ShWidgetChildCount(uint64_t widget);
1198SH_API uint64_t ShWidgetChildAt(uint64_t widget, int i);
1199
1201SH_API int ShWidgetClass(uint64_t widget, char *out, int n);
1202
1205SH_API int ShWidgetPropType(uint64_t widget, uint32_t prop);
1206SH_API int ShWidgetGetF(uint64_t widget, uint32_t prop, float *out);
1207SH_API int ShWidgetGetU(uint64_t widget, uint32_t prop,
1208 uint32_t *out);
1209SH_API int ShWidgetGetV(uint64_t widget, uint32_t prop, float *out,
1210 int n);
1211SH_API int ShWidgetGetS(uint64_t widget, uint32_t prop, char *out,
1212 int n);
1213
1216SH_API uint64_t ShUiHandle(uint32_t id);
1217
1221
1222typedef int (*ShGetHealthPlayer_t)(uint32_t *, uint32_t *);
1223typedef int (*ShSetHealthPlayer_t)(uint32_t);
1224typedef int (*ShSetGodModePlayer_t)(int);
1225typedef int (*ShPhysicsReady_t)(void);
1226typedef int (*ShGroundHeight_t)(float, float, float *);
1227typedef int (*ShTeleportPlayerToGround_t)(float, float, float);
1228
1230
1231#ifdef __cplusplus
1232}
1233#endif
1234
1235#endif
SH_API int ShCameraReady(void)
SH_API int ShCameraApply(const ShCameraOverride *o)
Reapplied every frame until ShCameraRelease.
SH_API int ShCameraHookInstall(void)
Redirect the selector thunk.
SH_API int ShCameraMatrix(int index, float *out16)
The nine derived matrices at camera+0x420, view and projection and their inverses.
SH_API uint32_t ShCameraOwned(void)
SH_API int ShGetHeadPosition(ShVec3 *out)
The head in world space, from the bone named Head.
SH_API int ShHeadBone(void)
SH_API int ShSetCamera(const ShVec3 *pos)
The engine rebuilds the camera every frame, so an override is reapplied until it is released.
SH_API int ShCameraAngles(float *yaw, float *pitch)
SH_API int ShCameraOrbit(float back, float up)
SH_API int ShCameraFree(const ShVec3 *pos, float yaw, float pitch)
Free camera.
SH_API uint64_t ShCameraCalls(void)
SH_API void ShCameraRelease(void)
SH_API int ShCameraBlurOff(void)
SH_API uint64_t ShCameraWrites(void)
SH_API int ShCameraFirstPerson(float forward, float up)
First person: the eye tracks the head bone every frame and eases onto the aim ray during ADS,...
SH_API int ShSetCameraBlur(int on)
The close range body blur, a hidden proximity fade the menu's DoF settings leave running.
SH_API int ShGetCamera(ShCamera *out)
Where the camera is, and how it is pointed.
SH_API void ShCameraReleaseFields(uint32_t fields)
Ownership is per field, so plugins compose.
SH_API int ShOffHit(ShHitFn fn)
Remove one receiver, or all of them when fn is NULL.
void(*) ShFireFn(const ShShot *shot, void *user)
Definition scripthook.h:537
void(*) ShHitFn(const ShHit *hit, void *user)
Receivers run on a worker thread the API owns, so any API call is safe from inside one.
Definition scripthook.h:500
SH_API int ShOffFire(ShFireFn fn)
SH_API uint32_t ShShotCount(void)
SH_API int ShHitHookInstall(void)
Install the hook.
SH_API uint32_t ShHitCount(void)
A ring, for callers that would rather poll.
SH_API int ShHitHookReady(void)
SH_API int ShGetShots(ShShot *out, int max)
SH_API int ShGetHits(ShHit *out, int max)
SH_API int ShOnFire(ShFireFn fn, void *user, int flags)
Register a receiver for shots, up to eight.
SH_API int ShOnHit(ShHitFn fn, void *user, int flags)
Register a receiver, up to eight.
#define SH_API
Definition scripthook.h:22
int(*) ShPhysicsReady_t(void)
Definition scripthook.h:1225
int(*) ShSetHealthPlayer_t(uint32_t)
Definition scripthook.h:1223
SH_API int ShLastError(void)
The last error for the calling context.
int(*) ShTeleportPlayerToGround_t(float, float, float)
Definition scripthook.h:1227
SH_API const char * ShErrorString(int err)
The readable name of an error code.
int(*) ShGetHealthPlayer_t(uint32_t *, uint32_t *)
Definition scripthook.h:1222
ShError
Every int function returns 1 on success, 0 on failure, and on failure ShLastError carries one of thes...
Definition scripthook.h:87
int(*) ShGroundHeight_t(float, float, float *)
Definition scripthook.h:1226
int(*) ShSetGodModePlayer_t(int)
Definition scripthook.h:1224
SH_API int ShGetVersion(void)
SH_API_VERSION, for compatibility checks.
@ SH_ERR_NO_GROUND
Definition scripthook.h:98
@ SH_ERR_NOT_STREAMED
Definition scripthook.h:100
@ SH_OK
Definition scripthook.h:88
@ SH_ERR_UI_NOT_READY
in game, scene not up yet
Definition scripthook.h:102
@ SH_ERR_CONTROLLER
Definition scripthook.h:101
@ SH_ERR_NO_POSITION
Definition scripthook.h:91
@ SH_ERR_NO_ROOT
Definition scripthook.h:93
@ SH_ERR_UI_PROP
no such property on the class
Definition scripthook.h:103
@ SH_ERR_NOT_IN_GAME
Definition scripthook.h:99
@ SH_ERR_HOOK_FAILED
Definition scripthook.h:96
@ SH_ERR_NO_CANDIDATE
Definition scripthook.h:92
@ SH_ERR_NOT_ENTITY
Definition scripthook.h:95
@ SH_ERR_UI_ASSET
font or texture not loaded
Definition scripthook.h:104
@ SH_ERR_UNWRITABLE
Definition scripthook.h:94
@ SH_ERR_NO_GLOBAL
Definition scripthook.h:90
@ SH_ERR_BAD_ARG
Definition scripthook.h:89
@ SH_ERR_NO_PHYSICS
Definition scripthook.h:97
SH_API int ShCrashCount(void)
How many crashes have been caught this session.
SH_API int ShCrashReport(char *buf, int len)
The first report of the session, as text.
SH_API int ShCrashHealed(void)
How many were resumed on the engine's own null path, which the player never sees.
SH_API int ShCrashFreezeOn(void)
SH_API int ShSetCrashFreeze(int on)
Freeze parks the faulting thread instead of dying, for a live post mortem.
SH_API int ShGetGodMode(void)
SH_API int ShTriggerLightning(void)
One lightning strike, queued in the weather system.
SH_API int ShSetGhostMode(int on)
SH_API int ShAttachEntity(uint64_t child, uint64_t parent, const ShVec3 *offset)
The child follows the parent at an offset.
SH_API int ShExplosionShield(const ShVec3 *at, float radius)
A sphere explosions ignore.
SH_API float ShGetWetness(void)
The live ground wetness.
SH_API int ShDetachEntity(uint64_t child)
SH_API int ShSetLightningFrequency(int enable, float value)
Override the lightning rate, or 0 to hand it back.
SH_API int ShSetGodMode(int on)
The player's own god and ghost bytes.
SH_API int ShSetEntityPhysics(uint64_t entity, int on)
Physics bodies on or off for one entity.
SH_API int ShQueueCallF(uint64_t fn, uint64_t a0, uint64_t a1, float f2, float f3, float f4)
Args three to five as floats, which the ABI passes in xmm2, xmm3 and the stack rather than the int re...
SH_API int ShQueueResult(uint64_t *outRet)
SH_API int ShQueueCall(uint64_t fn, uint64_t a0, uint64_t a1, uint64_t a2, uint64_t a3)
Run an engine call on the GAME THREAD.
SH_API uint64_t ShFindComponent(uint64_t entity, uint32_t classHash)
The component of a given class, or 0.
SH_API int ShGetComponents(uint64_t entity, ShComponent *out, int max)
Fills out with the entity's components, returning how many were written.
SH_API int ShPlaceEntity(uint64_t entity, const ShVec3 *pos, const ShVec3 *orient)
Place any entity through the engine's set transform.
SH_API int ShGetEntityKind(uint64_t entity)
Kind of one entity.
SH_API int ShGetEntityTransform(uint64_t entity, ShVec3 *pos, float *yaw, float *pitch, float *roll)
Its inverse: where a thing is and how it is turned, so a caller can rotate relative to that.
SH_API int ShPlaceEntityRot(uint64_t entity, const ShVec3 *pos, float yaw, float pitch, float roll)
Full orientation in radians, which ShPlaceEntity cannot express: roll puts a car on its roof.
SH_API int ShFindEntities(int kind, float radius, uint32_t flags, ShEntity *out, int max)
Fills out with entities within radius of the player, nearest first.
SH_API int ShQueueTransform(uint64_t entity, const ShVec3 *pos, float yaw, float pitch, float roll)
Applied on the frame path rather than right now.
ShEntityKind
Entity kinds, from the engine's own net identity component.
Definition scripthook.h:222
SH_API const char * ShKindName(int kind)
The readable name of a kind.
@ SH_KIND_TURRET
Definition scripthook.h:229
@ SH_KIND_NPC
Definition scripthook.h:225
@ SH_KIND_DOOR
Definition scripthook.h:231
@ SH_KIND_OTHER
Definition scripthook.h:233
@ SH_KIND_PLAYER
Definition scripthook.h:224
@ SH_KIND_LOOTCHEST
Definition scripthook.h:232
@ SH_KIND_DRONE
Definition scripthook.h:227
@ SH_KIND_MINE
Definition scripthook.h:230
@ SH_KIND_ANY
Definition scripthook.h:223
@ SH_KIND_VEHICLE
Definition scripthook.h:226
@ SH_KIND_TEAMMATE
Definition scripthook.h:228
SH_API int ShGroundHeightFrom(float x, float y, float nearZ, float *outZ)
Probe from a given height, for stacked geometry like bridges and caves.
SH_API int ShPhysicsReady(void)
Predicate only, never installs anything.
SH_API int ShTeleportPlayerToGround(float x, float y, float clearance)
SH_API int ShGroundHeight(float x, float y, float *outZ)
SH_API uint32_t ShGetBodyId(uint64_t entity)
SH_API int ShHavokScan(int *bodies, int *owners, int *mapped)
SH_API uint64_t ShHavokWorld(void)
SH_API int ShHudSet(uint32_t hud, const char *text)
Text may hold newlines.
SH_API uint32_t ShHudCreate(const char *name, int anchor, int priority)
Register a line.
SH_API void ShHudDestroy(uint32_t hud)
SH_API int ShHudColour(uint32_t hud, uint32_t rgb)
SH_API int ShHudShow(uint32_t hud, int visible)
@ SH_HUD_TOPRIGHT
Definition scripthook.h:608
@ SH_HUD_BOTTOMRIGHT
Definition scripthook.h:610
@ SH_HUD_BOTTOMLEFT
Definition scripthook.h:609
@ SH_HUD_TOPLEFT
Definition scripthook.h:607
SH_API int ShBlockInput(uint32_t mask)
Alt, Tab, Esc, F4 and Win always get through.
SH_API uint32_t ShBlockedInput(void)
SH_API void ShMenuSetKey(int vk)
SH_API int ShMenuIsOpen(void)
SH_API uint32_t ShMenuCreate(const char *title)
A top level entry for your plugin.
SH_API void ShMenuOpen(int open)
SH_API int ShMenuToggle(uint32_t menu, const char *label, int initial, ShMenuFn fn, void *user)
void(*) ShMenuFn(uint32_t menu, uint32_t item, int value, void *user)
Definition scripthook.h:573
SH_API int ShMenuAction(uint32_t menu, const char *label, ShMenuFn fn, void *user)
SH_API int ShMenuClear(uint32_t menu)
Drop a menu's items, keeping the row, so a plugin can rebuild its own menu without stacking duplicate...
SH_API uint32_t ShMenuSub(uint32_t parent, const char *label)
SH_API int ShMenuStatus(uint32_t menu, const char *text)
The line under the items.
SH_API int ShMenuList(uint32_t menu, const char *label, const char **opts, int n, int initial, ShMenuFn fn, void *user)
opts must outlive the menu.
SH_API int ShMenuNumber(uint32_t menu, const char *label, float initial, float lo, float hi, float step, ShMenuFn fn, void *user)
SH_API int ShMenuDestroy(uint32_t menu)
Remove the row and its subtree.
SH_API int ShSetAngularVelocity(uint64_t entity, const ShVec3 *v)
SH_API int ShAddAngularVelocity(uint64_t entity, const ShVec3 *v)
SH_API int ShGetAngularVelocity(uint64_t entity, ShVec3 *out)
Radians a second about each world axis.
SH_API int ShAddVelocity(uint64_t entity, const ShVec3 *v)
SH_API int ShCanMove(uint64_t entity)
True when velocity moves this entity.
SH_API int ShSetVelocity(uint64_t entity, const ShVec3 *v)
SH_API int ShShove(uint64_t entity, const ShVec3 *dir, float strength, const ShVec3 *atWorldPos)
A push at a world point, shoving and spinning like a hit on a corner.
SH_API int ShGetVelocity(uint64_t entity, ShVec3 *out)
Pass an entity, never a body id: an entity owns several bodies and these calls write every one of the...
SH_API const ShNpcArchetype * ShNpcAt(int index)
SH_API uint64_t ShSpawnNpc(uint64_t archetypeId, const ShVec3 *pos)
Spawn an NPC and return its ENTITY, or 0 on failure.
SH_API int ShNpcCount(void)
The archetype registry, read once per session on first use.
SH_API int ShDespawn(uint64_t entity)
Retire a spawned entity, NPC or vehicle, through the spawn manager.
int(*) ShGetPlayerPosition_t(ShVec3 *out)
Definition scripthook.h:138
int(*) ShLastError_t(void)
Definition scripthook.h:131
int(*) ShGetVersion_t(void)
Definition scripthook.h:133
SH_API int ShTeleportPlayer(const ShVec3 *pos, const ShVec3 *orient)
Teleport the player, at any range.
SH_API int ShIsInVehicle(void)
True while riding a vehicle, read from the entity link in the parent chain.
SH_API int ShGetPlayer(ShPlayer *out)
The local player.
SH_API int ShGetCameraEyePosition(ShVec3 *out)
Where the player global says the view sits, about 1.9m behind and 1.6m above the body in third person...
SH_API int ShGetPlayerPosition(ShVec3 *out)
The soldier's own position, from its matrix.
int(*) ShTeleportPlayer_t(const ShVec3 *pos, const ShVec3 *orient)
Definition scripthook.h:135
SH_API void ShInvalidate(void)
Drop the cached player, so the next call re-resolves.
SH_API int ShWalkToRoot(uint64_t entity, uint64_t *outRoot)
Walk an entity's parent chain to its root.
int(*) ShGetPlayer_t(ShPlayer *out)
Definition scripthook.h:134
int(*) ShWalkToRoot_t(uint64_t entity, uint64_t *outRoot)
Definition scripthook.h:137
void(*) ShInvalidate_t(void)
Definition scripthook.h:139
SH_API int ShTeleportPlayerHops(const ShVec3 *pos, const ShVec3 *orient, float hopMetres, int delayMs)
Teleport in hops rather than one jump, for when a single long move misbehaves.
SH_API int ShGetRays(ShRay *out, int max)
Fills out with the most recent rays, newest first.
SH_API void ShRayLog(int mode)
Recording is off by default: it costs a copy on every cast, and the engine casts a great many per fra...
ShRayMode
Definition scripthook.h:434
SH_API void ShRayFilterPlayer(float radius, float minLength)
Track the player instead.
SH_API int ShQueryRays(const ShRayQuery *q, ShRay *out, int max)
Newest first, only the rays matching the query.
SH_API void ShRayFilter(const ShVec3 *from, float radius, float minLength)
The engine casts about 100k rays a second, so an unfiltered ring holds only a few milliseconds.
SH_API uint32_t ShRayCount(void)
@ SH_RAY_OFF
Definition scripthook.h:435
@ SH_RAY_ALL
everything, tens of thousands a second
Definition scripthook.h:436
@ SH_RAY_DIRECTED
skip the straight down ground probes
Definition scripthook.h:437
SH_API uint32_t ShReflectClassHash(uint64_t obj)
The class hash, through the descriptor getter.
SH_API uint64_t ShGameFlowObject(int slot)
SH_API uint64_t ShHybridMenu(void)
The HybridMenu, the shell every menu page lives in.
SH_API int ShSceneExit(uint64_t obj)
SH_API int ShSceneEnter(uint64_t obj)
A scene is any reflected object with Enter and Exit.
SH_API uint64_t ShGameFlow(void)
The GR_GameFlow machine, identity checked.
SH_API int ShReflectCall(uint64_t obj, uint32_t nameHash, uint64_t a1, uint64_t a2, uint64_t a3, uint64_t *outRet)
Call a method by name on the game thread and wait.
SH_API int ShReflectMethods(uint64_t obj, ShMethod *out, int max)
Every method of the object's class, in table order.
SH_API int ShReflectMethod(uint64_t obj, uint32_t nameHash, uint64_t *outFn)
The function behind a method name, 0 when absent.
SH_API int ShTriggerGameOver(int reason)
The real thing: death, card and checkpoint reload.
SH_API int ShInMap(void)
SH_API int ShIsInGame(void)
Stays true while paused: the world is loaded and every read keeps working, so callers keep their stat...
int(*) ShIsInGame_t(void)
Definition scripthook.h:834
SH_API int ShGetGameStateName(char *buf, int len)
SH_API uint32_t ShGetUiState(void)
SH_API int ShInLoadout(void)
ShGameState
Definition scripthook.h:34
SH_API int ShGetGameState(void)
Game flow state.
SH_API int ShInBinocular(void)
ShUiState
What the game's UI is showing, from the scenes it drew last frame.
Definition scripthook.h:60
int(*) ShGetGameState_t(void)
Definition scripthook.h:833
SH_API int ShInDrone(void)
SH_API int ShInPauseMenu(void)
The game flow stays in Playing while paused, so this is read off the camera: the pause menu renders t...
@ SH_STATE_CINEMATIC
Definition scripthook.h:55
@ SH_STATE_DRONE
Live play with the engine driving its own camera.
Definition scripthook.h:53
@ SH_STATE_BINOCULAR
Definition scripthook.h:54
@ SH_STATE_UNKNOWN
Definition scripthook.h:35
@ SH_STATE_MENU
Definition scripthook.h:36
@ SH_STATE_LOBBY
Definition scripthook.h:38
@ SH_STATE_RELOADING
Definition scripthook.h:40
@ SH_STATE_PAUSED
In game with the pause menu, loadout, map or skills up.
Definition scripthook.h:44
@ SH_STATE_INGAME
Definition scripthook.h:39
@ SH_STATE_LOADING
Definition scripthook.h:37
@ SH_STATE_GAMEOVER
The game over screen is drawn.
Definition scripthook.h:46
@ SH_UI_SKILLS
Definition scripthook.h:67
@ SH_UI_BINOCULAR
Definition scripthook.h:62
@ SH_UI_CINEMATIC
Definition scripthook.h:71
@ SH_UI_PAUSE
the pause menu (tabs)
Definition scripthook.h:64
@ SH_UI_GAMEOVER
Definition scripthook.h:69
@ SH_UI_MAP
Definition scripthook.h:66
@ SH_UI_COMWHEEL
Definition scripthook.h:68
@ SH_UI_POPUP
a modal popup
Definition scripthook.h:72
@ SH_UI_LOADING
Definition scripthook.h:70
@ SH_UI_VEHICLE
vehicle HUD
Definition scripthook.h:63
@ SH_UI_DRONE
flying the drone
Definition scripthook.h:61
@ SH_UI_LOADOUT
Definition scripthook.h:65
SH_API int ShGetResource(int which, uint32_t *out)
SH_API int ShSetGodModeEntity(uint64_t entity, int on)
SH_API void ShInvalidateHealth(void)
SH_API int ShGetVisibility(float *out)
SH_API int ShSetVisibility(float factor)
Visibility to enemies.
SH_API int ShSetSkillPoints(uint32_t value)
SH_API int ShSetResource(int which, uint32_t value)
SH_API int ShStatWrite(uint64_t stat, uint32_t value)
SH_API int ShKillPlayer(void)
SH_API int ShSetGodModePlayer(int on)
SH_API int ShSetCannotDiePlayer(int on)
Floors at the downed state instead of dying.
SH_API int ShSetHealthEntity(uint64_t entity, uint32_t value)
SH_API int ShGetHealthEntity(uint64_t entity, uint32_t *cur, uint32_t *max)
Entity targeted variants.
SH_API int ShStatRead(uint64_t stat, uint32_t *out)
Protected ints, the general stat storage: four bit planes and an XOR key.
SH_API int ShSetAllResources(uint32_t value)
SH_API int ShDamagePlayer(uint32_t amount)
Damage through the engine's own path, so death runs its real sequence.
SH_API int ShGetAmmo(int slot, uint32_t *out)
Ammo by weapon slot: 0 primary, 1 second, 2 sidearm.
SH_API int ShSetHealthPlayer(uint32_t value)
SH_API int ShGetHealthPlayer(uint32_t *cur, uint32_t *max)
Health, local player.
SH_API int ShSetAmmo(int slot, uint32_t value)
SH_API int ShGetSkillPoints(uint32_t *out)
Skill points, a plain int rather than a protected one.
SH_API int ShUiChildCount(uint32_t id)
SH_API int ShUiSetF(uint32_t id, uint32_t prop, float v)
SH_API int ShBlockKey(int vk, int on)
One virtual key hidden from the game until released.
SH_API uint32_t ShUiPanel(float x, float y, float w, float h, uint32_t rgb, float alpha)
A container with a translucent quad behind it.
SH_API int ShUiReady(void)
1 once the world is up; poll before building.
SH_API int ShUiSetU(uint32_t id, uint32_t prop, uint32_t v)
SH_API uint64_t ShSceneHandle(void)
The phoenix::Scene handle that hosts every ShUi widget, built and driven by the DLL itself; 0 until i...
SH_API int ShGameSceneActive(const char *name)
1 when a scene of that name was drawn last frame.
SH_API int ShUiSceneShow(uint32_t scene, int visible)
SH_API int ShUiSceneDestroy(uint32_t scene)
Every widget of the scene, then the scene.
SH_API uint32_t ShUiCreate(uint32_t parent, int cls, float x, float y, float w, float h)
Any widget under any container (0 = the scene root), at any depth.
SH_API int ShGameScenes(char *buf, int n)
Comma separated names drawn last frame; the count.
SH_API int ShUiImageSet(uint32_t id, uint32_t texture)
Shows a texture on an image widget or panel plate.
SH_API int ShUiSetText(uint32_t id, const char *text)
SH_API int ShUiSetColour(uint32_t id, uint32_t rgb)
SH_API int ShUiCommit(void)
SH_API int ShUiShow(uint32_t id, int visible)
Hiding a panel hides its children too.
SH_API int ShUiSetS(uint32_t id, uint32_t prop, const char *utf8)
SH_API int ShUiSceneSetOrder(uint32_t scene, int order)
SH_API int ShUiSetSize(uint32_t id, float w, float h)
SH_API int ShUiSetAutoSize(uint32_t id, int autoW, int autoH)
Label size follows its text on the axes set to 1.
SH_API uint32_t ShUiLabel(uint32_t panel, float x, float y, float w, float h, const char *text, uint32_t rgb)
A line of text in the HUD font.
SH_API int ShUiMeasure(uint32_t id, float *w, float *h)
The label's laid out box: its text bounds once an axis is automatic, otherwise the size that was set.
SH_API int ShUiGetS(uint32_t id, uint32_t prop, char *out, int n)
SH_API int ShUiGetF(uint32_t id, uint32_t prop, float *out)
SH_API int ShUiSetV(uint32_t id, uint32_t prop, const float *v, int n)
SH_API int ShUiFocus(uint32_t scene, int take)
SH_API uint32_t ShUiImage(uint32_t panel, float x, float y, float w, float h, uint32_t rgb, float alpha)
A tinted quad, for bars and highlights.
SH_API void ShUiEnable(int on)
Kill switch, on by default.
SH_API int ShUiGetU(uint32_t id, uint32_t prop, uint32_t *out)
SH_API int ShUiCommitAsync(void(*done)(int ok, void *user), void *user)
Commit from a worker; done(ok, user) when it landed.
SH_API int ShCaptureKeys(int on)
Every key but the escapes hidden, focus uses this.
SH_API uint32_t ShUiCreateIn(uint32_t scene, uint32_t parent, int cls, float x, float y, float w, float h)
A widget in a scene; parent 0 is that scene's root.
SH_API int ShUiSetDefaultImage(const char *guid)
SH_API int ShUiPropType(uint32_t id, uint32_t prop)
0 when the widget's class has no such property.
SH_API int ShUiGen(void)
Changes when the scene reloads; older ids are dead.
SH_API int ShUiDestroy(uint32_t id)
Detaches the widget and its children from the tree.
SH_API uint32_t ShUiSceneCreate(const char *name, int order)
Scenes: layers of your own.
int(*) ShUiInputFn(uint32_t scene, const ShUiEvent *e, void *user)
Definition scripthook.h:1151
SH_API int ShUiSetReset(uint32_t scene, void(*fn)(uint32_t scene, void *user), void *user)
After a world reload, once the scene is back: the old widgets are gone, rebuild inside.
SH_API uint32_t ShUiChildAt(uint32_t id, int index)
SH_API int ShUiSetDefaultFont(const char *guid)
Font and plate texture for new widgets, by asset GUID ("873fe53f-3b90-db4d-9887-d3cc6edeaba9",...
SH_API int ShUiSetInput(uint32_t scene, ShUiInputFn fn, void *user)
SH_API int ShUiSetAlpha(uint32_t id, float alpha)
SH_API int ShUiGetV(uint32_t id, uint32_t prop, float *out, int n)
SH_API int ShUiSetPos(uint32_t id, float x, float y)
SH_API int ShUiAbort(void)
SH_API uint32_t ShUiTextureCreate(int w, int h, const uint8_t *rgba, int stride)
RGBA8 pixels to an engine texture, stride in bytes.
SH_API int ShUiPropCount(void)
The resolved property records: class, id, type.
SH_API uint32_t ShUiFocused(void)
SH_API int ShUiBegin(void)
Edits between Begin and Commit run as one job.
SH_API int ShUiPropAt(int i, char *cls, int n, uint32_t *prop, int *type)
SH_API int ShUiReparent(uint32_t id, uint32_t parent, int index)
Tree: move a widget under another container of the same scene at a sibling index (draw order); list c...
SH_API uint64_t ShSpawnVehicle(uint32_t vehicleId, const ShVec3 *pos)
Spawn a vehicle and return its ENTITY, or 0 on failure.
SH_API int ShVehicleCount(void)
The catalogue, named one spawn at a time by eye.
SH_API float ShReadF32(uint64_t addr, int *ok)
void(*) ShFrameFn_t(void *user)
A per frame hook on the game thread.
Definition scripthook.h:338
SH_API int ShReadBytes(uint64_t addr, void *out, uint32_t len)
Guarded reads, for anything walking engine memory.
SH_API void ShSpawnInvalidate(void)
SH_API int ShRegisterFrameCallback(ShFrameFn_t fn, void *user)
SH_API uint64_t ShReadU64(uint64_t addr, int *ok)
SH_API void ShUnregisterFrameCallback(ShFrameFn_t fn)
SH_API const char * ShVehicleName(uint32_t vehicleId)
SH_API const ShVehicle * ShVehicleAt(int index)
SH_API int ShEntityNodeCount(uint64_t entity)
SH_API int ShSetVisible(uint64_t entity, uint64_t node, int visible, int persist)
node 0 means the whole entity.
SH_API int ShGetHeadNodes(uint64_t entity, uint64_t *out, int max)
The group appears the first time the player aims, so 0 is normal until then.
SH_API int ShGetEntityNodes(uint64_t entity, uint64_t *out, int max)
Enumerate parts, so a caller can hide any subset.
SH_API int ShGetTimeSpeed(float *out)
SH_API int ShSetTime(float hours)
Time of day in hours past midnight, 0 to 24.
SH_API int ShGetWeather(int *out)
SH_API int ShReleaseWeather(void)
Hand the weather back to the ambient system.
SH_API int ShSetTimeSpeed(float multiplier)
Clock rate.
SH_API int ShSetWeather(int type)
ShWeather
Weather type, blended by the engine over its default ten seconds.
Definition scripthook.h:917
SH_API int ShSetWeatherBlend(int type, float seconds)
The same, blended over seconds.
SH_API int ShGetTime(float *out)
@ SH_WEATHER_RAIN_LIGHT
Definition scripthook.h:922
@ SH_WEATHER_CLOUDS_HEAVY
Definition scripthook.h:920
@ SH_WEATHER_RAIN_HEAVY
Definition scripthook.h:923
@ SH_WEATHER_CLOUDS_LIGHT
Definition scripthook.h:919
@ SH_WEATHER_FOG
Definition scripthook.h:921
@ SH_WEATHER_SUNNY
Definition scripthook.h:918
SH_API int ShGameSceneName(uint64_t scene, char *buf, int n)
SH_API uint64_t ShSceneRoot(uint64_t scene)
The root widget of any scene, ours or the game's.
SH_API uint64_t ShGameSceneAt(int i)
SH_API int ShWidgetPropType(uint64_t widget, uint32_t prop)
Any property the class has, by the same ids the SH_P_ defines carry.
SH_API int ShGameSceneCount(void)
Read only.
SH_API uint64_t ShUiHandle(uint32_t id)
The handle behind one of our own ids, so a widget made with ShUiCreate reads back the same way.
SH_API int ShWidgetGetU(uint64_t widget, uint32_t prop, uint32_t *out)
SH_API uint64_t ShWidgetChildAt(uint64_t widget, int i)
SH_API int ShWidgetGetS(uint64_t widget, uint32_t prop, char *out, int n)
SH_API int ShWidgetGetF(uint64_t widget, uint32_t prop, float *out)
SH_API int ShWidgetGetV(uint64_t widget, uint32_t prop, float *out, int n)
SH_API int ShWidgetClass(uint64_t widget, char *out, int n)
The class name, "LabelWidget" and the like.
SH_API int ShWidgetChildCount(uint64_t widget)
Children in the engine's own draw order.
SH_API int ShSetCrashIntercept(int on)
Watch faults first and resume ones with a null path.
SH_API int ShCrashInterceptOn(void)
Definition scripthook.h:802
float pitch
Definition scripthook.h:805
float skewY
Definition scripthook.h:807
uint32_t apply
Definition scripthook.h:803
int mode
Definition scripthook.h:808
float yaw
Definition scripthook.h:805
float skewX
Definition scripthook.h:807
ShVec3 pos
Definition scripthook.h:804
float roll
Definition scripthook.h:805
float fov
Definition scripthook.h:806
Rows of the pose matrix: right, forward, up, then position.
Definition scripthook.h:630
ShVec3 forward
Definition scripthook.h:633
uint64_t camera
Definition scripthook.h:637
ShVec3 right
Definition scripthook.h:632
ShVec3 pos
Definition scripthook.h:631
ShVec3 up
Definition scripthook.h:634
float fov
Definition scripthook.h:635
int mode
Definition scripthook.h:636
Components.
Definition scripthook.h:264
uint32_t classHash
Definition scripthook.h:267
uint64_t component
Definition scripthook.h:265
char name[32]
set when the class is known
Definition scripthook.h:268
uint64_t dataBlock
shared definition, at +0x20
Definition scripthook.h:266
Definition scripthook.h:241
uint32_t maxHealth
Definition scripthook.h:246
int kind
Definition scripthook.h:245
uint64_t entity
Definition scripthook.h:242
float distance
Definition scripthook.h:244
char name[32]
Definition scripthook.h:247
ShVec3 pos
Definition scripthook.h:243
Bullets often strike a child part, so root is resolved for you and is the one worth acting on.
Definition scripthook.h:483
uint64_t shooter
who fired it, 0 if unknown
Definition scripthook.h:491
ShVec3 pos
impact point
Definition scripthook.h:488
uint64_t entity
validated against its own id
Definition scripthook.h:484
int kind
kind of root, an ShEntityKind
Definition scripthook.h:486
uint32_t id
entity+0x138
Definition scripthook.h:487
float distance
along the bullet's flight
Definition scripthook.h:490
int byPlayer
the local player fired it
Definition scripthook.h:492
int index
record index in the list
Definition scripthook.h:494
uint64_t projectile
Definition scripthook.h:493
uint64_t root
top of the parent chain
Definition scripthook.h:485
ShVec3 normal
surface normal
Definition scripthook.h:489
An object is [vtable, methodTable, ...]; the table is 32 byte entries of crc32(name),...
Definition scripthook.h:952
uint64_t fn
Definition scripthook.h:955
uint32_t nameHash
Definition scripthook.h:953
int index
Definition scripthook.h:954
Definition scripthook.h:375
int kind
1 = spawnable NPC, 10 = none
Definition scripthook.h:377
uint64_t id
archetype id, stable across sessions
Definition scripthook.h:376
root is the top of the parent chain, and the only position that survives a direct write.
Definition scripthook.h:125
uint64_t node
Definition scripthook.h:127
uint64_t root
Definition scripthook.h:128
uint64_t entity
Definition scripthook.h:126
A query over the recorded rays.
Definition scripthook.h:462
ShVec3 from
origin must be close to this
Definition scripthook.h:466
float fromRadius
0 disables the origin test
Definition scripthook.h:467
ShVec3 through
trace must pass near this point
Definition scripthook.h:468
int hitsOnly
only traces that hit something
Definition scripthook.h:465
float minLength
trace at least this long
Definition scripthook.h:463
float maxLength
0 means no upper bound
Definition scripthook.h:464
float throughRadius
0 disables the through test
Definition scripthook.h:469
dir is a full length vector, so origin + dir is the end of the trace rather than a unit direction.
Definition scripthook.h:416
uint64_t collector
Definition scripthook.h:422
ShVec3 hitPos
first record, when hits > 0
Definition scripthook.h:419
uint64_t projectile
Bullets cast with the descriptor at projectile+0x1D0, so the projectile and its hits are reachable.
Definition scripthook.h:428
ShVec3 origin
Definition scripthook.h:417
ShVec3 dir
Definition scripthook.h:418
uint32_t projHits
count at projectile+0xA6A
Definition scripthook.h:429
uint64_t hitObject
first hit record, at +0x38
Definition scripthook.h:430
float hitDist
first hit record, at +0x48
Definition scripthook.h:431
uint32_t hits
collector count
Definition scripthook.h:420
uint64_t descriptor
Definition scripthook.h:421
uint8_t raw[32]
collector head, for layout work
Definition scripthook.h:423
A shot, reported on the projectile's first step.
Definition scripthook.h:525
float pitch
degrees, positive is up
Definition scripthook.h:532
int byPlayer
the local player fired it
Definition scripthook.h:528
uint64_t shooter
entity that fired, or 0
Definition scripthook.h:526
ShVec3 dir
unit vector of travel
Definition scripthook.h:530
ShVec3 origin
muzzle, where the bullet began
Definition scripthook.h:529
uint64_t projectile
Definition scripthook.h:534
int kind
kind of shooter
Definition scripthook.h:527
float yaw
degrees, 0 along +X
Definition scripthook.h:531
float range
the weapon's max range
Definition scripthook.h:533
Definition scripthook.h:1150
int x
Definition scripthook.h:1150
int y
Definition scripthook.h:1150
int key
Definition scripthook.h:1150
int type
Definition scripthook.h:1150
Metres.
Definition scripthook.h:26
float z
Definition scripthook.h:26
float x
Definition scripthook.h:26
float y
Definition scripthook.h:26
Definition scripthook.h:307
const char * name
Definition scripthook.h:309
uint32_t id
Definition scripthook.h:308