Skip to content

Latest commit

 

History

History
459 lines (423 loc) · 17.5 KB

SCRIPTING.md

File metadata and controls

459 lines (423 loc) · 17.5 KB

Scripting modules

parameters inside brackets are optional;

  • constants TR_I TR_I_DEMO TR_I_UB TR_II TR_II_DEMO TR_III TR_IV TR_IV_DEMO TR_V TR_UNKNOWN

    GAME_1 GAME_1_1 GAME_1_5 GAME_2 GAME_2_1 GAME_2_5 GAME_3 GAME_3_5 GAME_4 GAME_4_1 GAME_5

    GF_OP_PICTURE GF_OP_LISTSTART GF_OP_LISTEND GF_OP_STARTFMV GF_OP_STARTLEVEL GF_OP_STARTCINE GF_OP_LEVELCOMPLETE GF_OP_STARTDEMO GF_OP_JUMPTOSEQUENCE GF_OP_ENDSEQUENCE GF_OP_SETTRACK GF_OP_ENABLESUNSET GF_OP_LOADINGPIC GF_OP_DEADLYWATER GF_OP_REMOVEWEAPONS GF_OP_GAMECOMPLETE GF_OP_CUTANGLE GF_OP_NOFLOOR GF_OP_ADDTOINVENTORY GF_OP_LARASTARTANIM GF_OP_NUMSECRETS GF_OP_KILLTOCOMPLETE GF_OP_REMOVEAMMO

    ITEM_TYPE_SYSTEM ITEM_TYPE_SUPPLY ITEM_TYPE_QUEST

    ITEM_COMPASS ITEM_PASSPORT ITEM_LARAHOME ITEM_VIDEO ITEM_AUDIO ITEM_CONTROLS ITEM_LOAD ITEM_SAVE ITEM_MAP

    TR_FD_TRIGTYPE_TRIGGER TR_FD_TRIGTYPE_PAD TR_FD_TRIGTYPE_SWITCH TR_FD_TRIGTYPE_KEY TR_FD_TRIGTYPE_PICKUP TR_FD_TRIGTYPE_HEAVY TR_FD_TRIGTYPE_ANTIPAD TR_FD_TRIGTYPE_COMBAT TR_FD_TRIGTYPE_DUMMY TR_FD_TRIGTYPE_ANTITRIGGER TR_FD_TRIGTYPE_HEAVYSWITCH TR_FD_TRIGTYPE_HEAVYANTITRIGGER TR_FD_TRIGTYPE_MONKEY TR_FD_TRIGTYPE_SKELETON TR_FD_TRIGTYPE_TIGHTROPE TR_FD_TRIGTYPE_CRAWLDUCK TR_FD_TRIGTYPE_CLIMB

    TR_FD_TRIGFUNC_OBJECT TR_FD_TRIGFUNC_SET_CAMERA TR_FD_TRIGFUNC_UWCURRENT TR_FD_TRIGFUNC_FLIPMAP TR_FD_TRIGFUNC_FLIPON TR_FD_TRIGFUNC_FLIPOFF TR_FD_TRIGFUNC_SET_TARGET TR_FD_TRIGFUNC_ENDLEVEL TR_FD_TRIGFUNC_PLAYTRACK TR_FD_TRIGFUNC_FLIPEFFECT TR_FD_TRIGFUNC_SECRET TR_FD_TRIGFUNC_CLEARBODIES TR_FD_TRIGFUNC_FLYBY TR_FD_TRIGFUNC_CUTSCENE

    ENTITY_STATE_ENABLED ENTITY_STATE_ACTIVE ENTITY_STATE_VISIBLE ENTITY_STATE_COLLIDABLE ENTITY_STATE_DELETED

    ENTITY_TYPE_SPAWNED ENTITY_TYPE_GENERIC ENTITY_TYPE_INTERACTIVE ENTITY_TYPE_TRIGGER_ACTIVATOR ENTITY_TYPE_HEAVYTRIGGER_ACTIVATOR ENTITY_TYPE_PICKABLE ENTITY_TYPE_TRAVERSE ENTITY_TYPE_TRAVERSE_FLOOR ENTITY_TYPE_DYNAMIC ENTITY_TYPE_ACTOR

    ENTITY_CALLBACK_NONE ENTITY_CALLBACK_ACTIVATE ENTITY_CALLBACK_DEACTIVATE ENTITY_CALLBACK_COLLISION ENTITY_CALLBACK_STAND ENTITY_CALLBACK_HIT ENTITY_CALLBACK_ATTACK ENTITY_CALLBACK_SHOOT

    PARAM_HEALTH PARAM_AIR PARAM_STAMINA PARAM_WARMTH PARAM_HIT_DAMAGE PARAM_EXTRA1 PARAM_EXTRA2 PARAM_EXTRA3 PARAM_EXTRA4 PARAM_LASTINDEX

    ANIMATION_KEY_INIT ANIMATION_KEY_DEAD

    STATE_FUNCTIONS_LARA STATE_FUNCTIONS_BAT STATE_FUNCTIONS_WOLF STATE_FUNCTIONS_BEAR STATE_FUNCTIONS_RAPTOR STATE_FUNCTIONS_TREX STATE_FUNCTIONS_LARSON STATE_FUNCTIONS_PIERRE STATE_FUNCTIONS_LION STATE_FUNCTIONS_GORILLA STATE_FUNCTIONS_CROCODILE STATE_FUNCTIONS_RAT STATE_FUNCTIONS_CENTAUR STATE_FUNCTIONS_PUMA STATE_FUNCTIONS_WINGED_MUTANT STATE_FUNCTIONS_COWBOY STATE_FUNCTIONS_SKATEBOARDIST STATE_FUNCTIONS_MRT STATE_FUNCTIONS_TORSO_BOSS STATE_FUNCTIONS_NATLA

    ANIM_NORMAL_CONTROL ANIM_LOOP_LAST_FRAME ANIM_FRAME_LOCK ANIM_FRAME_REVERSE

    ANIM_TYPE_BASE ANIM_TYPE_WEAPON_LH ANIM_TYPE_WEAPON_RH ANIM_TYPE_WEAPON_TH ANIM_TYPE_MISK_1 ANIM_TYPE_MISK_2 ANIM_TYPE_MISK_3 ANIM_TYPE_MISK_4

    BODY_PART_BODY_LOW BODY_PART_BODY_UPPER BODY_PART_HEAD BODY_PART_LEFT_HAND_1 BODY_PART_LEFT_HAND_2 BODY_PART_LEFT_HAND_3 BODY_PART_RIGHT_HAND_1 BODY_PART_RIGHT_HAND_2 BODY_PART_RIGHT_HAND_3 BODY_PART_LEFT_LEG_1 BODY_PART_LEFT_LEG_2 BODY_PART_LEFT_LEG_3 BODY_PART_RIGHT_LEG_1 BODY_PART_RIGHT_LEG_2 BODY_PART_RIGHT_LEG_3 BODY_PART_TAIL

    ZONE_TYPE_ALL ZONE_TYPE_1 ZONE_TYPE_2 ZONE_TYPE_3 ZONE_TYPE_4 ZONE_TYPE_FLY

    MOVE_STATIC_POS MOVE_KINEMATIC MOVE_ON_FLOOR MOVE_WADE MOVE_QUICKSAND MOVE_ON_WATER MOVE_UNDERWATER MOVE_FREE_FALLING MOVE_CLIMBING MOVE_MONKEYSWING MOVE_WALLS_CLIMB MOVE_DOZY MOVE_FLY

    TRIGGER_OP_OR TRIGGER_OP_XOR TRIGGER_OP_AND_INV

    CHARACTER_STATE_DEAD CHARACTER_STATE_WEAPON

    TICK_IDLE TICK_STOPPED TICK_ACTIVE

    COLLISION_SHAPE_BOX COLLISION_SHAPE_BOX_BASE COLLISION_SHAPE_SPHERE COLLISION_SHAPE_TRIMESH COLLISION_SHAPE_TRIMESH_CONVEX COLLISION_SHAPE_SINGLE_BOX COLLISION_SHAPE_SINGLE_SPHERE

    COLLISION_NONE COLLISION_GROUP_ALL COLLISION_MASK_ALL COLLISION_GROUP_STATIC_ROOM COLLISION_GROUP_STATIC_OBLECT COLLISION_GROUP_KINEMATIC COLLISION_GROUP_TRIGGERS COLLISION_GROUP_CHARACTERS COLLISION_GROUP_VEHICLE COLLISION_GROUP_BULLETS COLLISION_GROUP_DYNAMICS COLLISION_GROUP_DYNAMICS_NI

    ENTITY_TRIGGERING_ACTIVATED ENTITY_TRIGGERING_DEACTIVATED ENTITY_TRIGGERING_NOT_READY

  • script

    • ls(dir_path, filter) - shows files and [dir's] in dir_path where item name corresponds to filter (chars, *, ?).
    • addFont(font_index, font_path, font_size) - creates font with given access index.
    • removeFont(font_index) - deletes font by given access index.
    • addFontStyle(index, R, G, B, A, shadow) - creates font style with given access index.
    • removeFontStyle(index) - deletes font style by given access index.
    • bindKey(action_id, key_id1, (key_id2)) - bind action and keyboard, joystick, mouse key.
    • getActionState(action_id) - .
    • getActionChange(action_id) - .
  • script_audio

    • playSound(sound_id, (entity_id)) - .
    • stopSound(sound_id, (entity_id)) - .
    • playStream(stream_id, (mask)) - .
  • script_character

    • characterCreate(entity_id) - .
    • setCharacterBones(entity_id, head_bone, torso_bone, l_hand_first, l_hand_last, r_hand_first, r_hand_last)) - .
    • setCharacterMoveSizes(entity_id, height, min_step_up_height, max_step_up_height, max_climb_height, fall_down_height) - .
    • setCharacterStateControlFunctions(entity_id, funcs_id) - .
    • setCharacterKeyAnim(entity_id, anim_type, anim_key_id) - .
    • setCharacterTarget(entity_id, (target_id)) - .
    • getCharacterTarget(entity_id) - .
    • setCharacterAIParams(entity_id, zone, zone_type) - .
    • setCharacterPathTarget(entity_id, target_id) - .
    • setCharacterParam(entity_id, param, value, (max_value)) - .
    • getCharacterParam(entity_id, param_id) - .
    • changeCharacterParam(entity_id, param_id, delta) - .
    • getCharacterCombatMode() - is weapons ready.
    • addCharacterHair(entity_id, hair_setup_table) - .
    • resetCharacterHair(entity_id) - .
    • setCharacterRagdollSetup(entity_id, ragdoll_setup_table) - .
    • setCharacterDefaultRagdoll(entity_id, anim, frame) - .
    • setCharacterRagdollActivity(entity_id, value) - .
    • setCharacterState(entity_id, state_id, value) - .
    • getCharacterState(entity_id, state_id) - .
    • setCharacterClimbPoint(entity_id, x, y, z) - for game saving.
    • getCharacterClimbPoint(entity_id) - .
    • getCharacterCurrentWeapon(entity_id) - .
    • setCharacterCurrentWeapon(entity_id, weapon_id) - .
  • script_entity

    • activateEntity(object_id, activator_id, trigger_mask, trigger_op, trigger_lock, trigger_timer) - .
    • deactivateEntity(object_id, activator_id) - .
    • noFixEntityCollision(entity_id, value) - .
    • noEntityMove(entity_id, value) - .
    • enableEntity(entity_id) - .
    • disableEntity(entity_id) - .
    • getEntitySectorFlags(entity_id) - .
    • getEntitySectorIndex(entity_id) - .
    • getEntitySectorMaterial(entity_id) - .
    • getEntityBoxID(entity_id, dx_sector, dy_sector) - .
    • `setEntityActivationOffset(entity_id, (dx, dy, dz), (max_delta)) - .
    • getEntityActivationOffset(entity_id) - return dx, dy, dz, max_delta - .
    • setEntityActivationDirection(entity_id, dx, dy, dx, (cos_max_delta_angle)) - .
    • getEntityActivationDirection(entity_id) - return dx, dy, dx, cos_max_delta_angle.
    • getEntityVector(entity_id1, entity_id2) - .
    • getEntityDistance(entity_id1, entity_id2) - .
    • getEntityDirDot(entity_id1, entity_id2) - .
    • getEntityRoom(entity_id) - .
    • getEntityPosition(entity_id) - return x, y, z, ax, ay, az.
    • getEntityAngles(entity_id) - return ax, ay, az.
    • getEntityScaling(entity_id) - .
    • setEntityPosition(entity_id, x, y, z, (fi_x, fi_y, fi_z)) - .
    • setEntityAngles(entity_id, fi_x, (fi_y, fi_z)) - .
    • setEntityScaling(entity_id, x_scaling, y_scaling, z_scaling) - .
    • moveEntityGlobal(entity_id, x, y, z) - .
    • moveEntityLocal(entity_id, dx, dy, dz) - .
    • moveEntityToSink(entity_id, sink_id) - .
    • moveEntityToEntity(moved_entity_id, target_entity_id, speed, (ignore_z)) - .
    • rotateEntity(entity_id, rot_x, (rot_y, rot_z)) - .
    • getEntitySpeed(entity_id) - .
    • getEntitySpeedLinear(entity_id) - .
    • setEntitySpeed(entity_id, speed_x, speed_y, speed_z) - .
    • setEntityLinearSpeed(entity_id, speed) - .
    • setEntityBodyPartFlag(entity_id, bone_id, body_part_flag) - .
    • addItem(entity_id, item_id, (items_count = pickup_count)) - .
    • removeItem(entity_id, item_id, items_count) - .
    • removeAllItems(entity_id) - .
    • getItemsCount(entity_id, item_id) - .
    • getItems(entity_id) - .
    • canTriggerEntity(entity_id1, entity_id2) - .
    • entityRotateToTriggerZ(entity_id1, entity_id2) - .
    • entityRotateToTrigger(entity_id1, entity_id2) - .
    • entityMoveToTriggerActivationPoint(entity_id1, entity_id2) - .
    • getEntityVisibility(entity_id) - .
    • setEntityVisibility(entity_id, value) - .
    • getEntityEnability(entity_id) - .
    • getEntityActivity(entity_id) - .
    • setEntityActivity(entity_id, value) - .
    • getEntityTriggerLayout(entity_id) - return mask, event, lock.
    • setEntityTriggerLayout(entity_id, layout) or (entity_id, mask, event, once) - .
    • setEntityLock(entity_id, value) - .
    • getEntityLock(entity_id) - .
    • setEntityEvent(entity_id, value) - .
    • getEntityEvent(entity_id) - .
    • setEntityMask(entity_id, value) - .
    • getEntityMask(entity_id) - .
    • setEntitySectorStatus(entity_id, value) - .
    • getEntitySectorStatus(entity_id) - .
    • setEntityOCB(entity_id, value) - .
    • getEntityOCB(entity_id) - .
    • setEntityFlags(entity_id, state_flags, type_flags, callback_flags) - .
    • getEntityFlags(entity_id) - return state_flags, type_flags, callback_flags.
    • setEntityTypeFlag(entity_id, type_flag, (value)) - .
    • getEntityTypeFlag(entity_id, (type_flag)) - .
    • setEntityStateFlag(entity_id, state_flag, (value)) - .
    • getEntityStateFlag(entity_id, (state_flag)) - .
    • setEntityCallbackFlag(entity_id, callback_flag, (value)) - .
    • getEntityCallbackFlag(entity_id, (callback_flag)) - .
    • setEntityTimer(entity_id, value) - .
    • getEntityTimer(entity_id) - .
    • setEntityMoveType(entity_id, value) - .
    • getEntityMoveType(entity_id) - .
    • setEntityRoomMove(entity_id, room_id, move_type, dir_flag) - heavy, for save / load.
    • setEntityCollision(entity_id, val) - .
    • setEntityBoneCollision(entity_id, bone_id, val) - .
    • setEntityGhostCollisionShape(entity_id, shape_index, min_x, min_y, min_z, max_x, max_y, max_z) - .
    • setEntityCollisionFlags(entity_id, collision_group, collision_shape, collision_mask) - .
    • setEntityCollisionGroupAndMask(entity_id, collision_group, collision_mask) - .
    • resetRigidBodies(entity_id) - .
    • createGhosts(entity_id) - .
    • getEntityGlobalMove(entity_id, dx, dy, dz) - .
    • getEntityCollisionFix(entity_id, filter) - return has_collision, x, y, z.
    • getEntityMoveCollisionFix(entity_id, filter, dx, dy, dz) - return has_collision, x, y, z.
    • getEntityRayTest(entity_id, filter, mx, my, mz, (dx, dy, dz)) - return has_collision, x, y, z.
    • getEntitySphereTest(entity_id, filter, r, mx, my, mz, (dx, dy, dz)) - return has_collision, x, y, z.
    • dropEntity(entity_id, time, (only_room)) - .
    • pushEntityBody(entity_id, body_number, h_force, v_force, reset_flag) - .
    • setEntityBodyMass(entity_id, body_number, (mass / each body mass)) - .
    • lockEntityBodyLinearFactor(entity_id, body_number, (vertical_factor)) - .
  • script_skeletal_model

    • setStateChangeRange(model_id, anim_num, state_id, dispatch_num, start_frame, end_frame, (next_anim, next_frame)) - .
    • getEntityModelID(entity_id, (anim_id)) - .
    • getEntityAnimState(entity_id, anim_type_id) - .
    • setEntityBaseAnimModel(entity_id, model_id) - .
    • setModelBodyPartFlag(model_id, bone_id, body_part_flag) - .
    • copyModelAnimations(model_dst_id, model_src_id) - .
    • setEntityAnimState(entity_id, anim_type_id, next_state, (is_heavy)) - .
    • getModelMeshCount(model_id) - .
    • getEntityMeshCount(entity_id) - .
    • setEntityMeshes(dest_entity_id, src_model_id) - .
    • setEntitySkinMeshes(dest_entity_id, src_model_id) - .
    • setModelMeshReplaceFlag(model_id, bone_num, flag) - .
    • setEntityAnimFlag(entity_id, anim_type_id, anim_flag) - .
    • setModelAnimReplaceFlag(model_id, bone_num, flag) - .
    • copyMeshFromModelToModel(model_id1, model_id2, bone_num1, bone_num2) - .
    • setEntityBoneVisibility(entity_id, bone_id, value) - .
    • setEntityAnim(entity_id, anim_type_id, anim_num, frame_number, (curr_anim, curr_frame)) - .
    • getEntityAnim(entity_id, anim_type_id) - .
    • entitySSAnimCopy(dest_id, src_id) - .
    • entitySSAnimEnsureExists(entity_id, anim_type_id, model_id) - .
    • entitySSAnimSetBoneMeshes(entity_id, bone_id, replace_id, slot_id) - .
    • entitySSAnimSetTarget(entity_id, targeted_bone, target_x, target_y, target_z, bone_dir_x, bone_dir_y, bone_dir_z) - .
    • entitySSAnimSetAxisMod(entity_id, bone_id, mod_x, mod_y, mod_z) - .
    • entitySSAnimSetTargetingLimit(entity_id, bone_id, q_x, q_y, q_z, q_w) - .
    • entitySSAnimSetCurrentRotation(entity_id, bone_id, q_x, q_y, q_z, q_w) - .
    • entitySSAnimSetCurrentRotation(entity_id, anim_type_id, enabled, anim_ext_flags) - .
    • entitySSAnimSetEnable(entity_id, anim_type_id, enabled) - .
    • entitySSAnimGetEnable(entity_id, anim_type_id) - .
  • script_world

    • setSectorFloorConfig(room_id, index_x, index_y, penetration_config, diagonal_type, floor, z0, z1, z2, z3) - tune room sector collision geometry on level loading.
    • setSectorCeilingConfig(room_id, index_x, index_y, penetration_config, diagonal_type, ceiling, z0, z1, z2, z3) - tune room sector collision geometry on level loading.
    • setSectorPortal(room_id, index_x, index_y, portal_room_id) - .
    • setSectorFlags(room_id, index_x, index_y, fp_flag, ft_flag, cp_flag, ct_flag) - .
    • sameRoom(entity_id1, entity_id2) - true if entity1.room == entity2.room.
    • similarSector(entity_id, dx, dy, dz, ignore_doors, (ceiling)) - .
    • getSectorHeight(entity_id, (ceiling), (dx, dy, dz)) - .
    • sectorTriggerClear(room_id, index_x, index_y) - delete trigger effects from sector.
    • sectorAddTrigger(room_id, index_x, index_y, function, sub_function, mask, once, timer) - .
    • sectorAddTriggerCommand(room_id, index_x, index_y, function, operands, once, (cam_index, cam_move, cam_timer)) - .
    • setGravity() - .
    • getGravity() - .
    • setSecretStatus(secret_id, (value)) - .
    • getSecretStatus(secret_id) - .
    • addRoomToNearList(room_id, room_to_list_id) - .
    • addRoomToOverlappedList(room_id, room_to_list_id) - .
    • createBaseItem(item_id, model_id, world_model_id, type, count, (name)) - .
    • deleteBaseItem(item_id) - .
    • getBaseItemInfo(item_id) - .
    • getBaseItemInfoByWorldID(world_model_id) - .
    • spawnEntity(model_id1, room_id, x, y, z, ax, ay, az, (custom_new_id)) - .
    • deleteEntity(entity_id) - do not use in event handler functions.
    • getLevel() - return loaded level id.
    • gameflowSend(opcode, param) - .
    • setGame(gameversion, (level_id)) - .
    • loadMap(map_name, game_id, level_id) - .
    • setPlayer(entity_id) - .
    • setGlobalFlipState(flip_state) - heavy, for TR1 save / load.
    • setFlipState(flip_index, flip_state) - .
    • setFlipMap(flip_index, flip_mask, flip_operation) - .
    • getFlipState(flip_index) - .
    • setRoomActiveContent(room_id1, room_id2) - heavy, for save / load.
    • setRoomStaticEnability(room_id, static_id, value) - .
    • setBoxBlocked(box_id, value) - for ai path blocking by doors.
    • genUVRotateAnimation(model_id) - for anim textures generation on level loading.
    • playFlyby(flyby_id, once) - .
    • setCameraFrame(lerp) - rewind current flyby camera.
    • setCinematicTransform(x, y, z, (az), (ax), (ay)) - set cutscene transform.
    • setCameraViewDistance(distance) - .
    • setCameraPos(x, y, z) - .
    • setCameraAngles(az, ax, ay) - .
    • cameraLookAt(x, y, z) - .
    • playVideo(video_file_path) - .