rdr3_discoveries Documentation

repository·master·Indexed 18 days ago

https://github.com/femga/rdr3_discoveries

A repository documenting findings, data, and mechanics for Red Dead Redemption 2 (RDR2) and RedM. It provides detailed references for animal tuning (bool and float params), carrying flags, combat action disable flags, combat attributes, combat floats, combat styles and mods, CPED config and reset flags, entity proof bitmasks, and AI event data retrieval in Lua.

Tokens
358K
Snippets
275
Records
339
Agent score
62%

What's inside rdr3_discoveries

  1. Overview of hud_quick_select (Weapon Wheel Integration)

    master

    The hud_quick_select integration (commonly referred to as the weapon wheel) allows developers to interact with and monitor the weapon wheel UI. It provides a set of events that can be listened to in order to track the state of the weapon wheel, including:

    • The currently selected item.
    • The previously selected item.
    • When the weapon wheel is opened.
    • When the weapon wheel is closed.
  2. Use the rpfs info folder as a reference

    master
    The useful_info_from_rpfs directory serves as a centralized reference for information extracted from RDR3 RPF files. Instead of manually searching through files using tools like OpenIV, you can use the contents of this folder to quickly find specific data and information related to the game's archives.
  3. How input contexts work

    master

    RedM uses Contexts to group inputs. The game automatically switches contexts based on player state (e.g., switching from OnFoot to OnMount when mounting a horse).

    Key Rules:

    1. You can only detect inputs that are valid within the current context. For example, INPUT_WHISTLE_HORSEBACK is only detectable in the OnMount context, not OnFoot.
    2. Changing the context can disable almost all inputs. For example, setting the context to UIFeedInteractOverride will restrict inputs to only INPUT_FEED_INTERACT and cause the player to lose character control.

    Context Management Natives

    • SetControlContext(control_type, context): Manually change the current context. This does not need to be run every frame.
    • GetCurrentControlContext(control_type): Check the current context for a specific control_type.
  4. What are Composites and how to use them for herb pickup

    master

    In the context of RDR3 discoveries, Composites are scenarios used to handle herb pickup. They allow you to spawn a herb entity and an associated scenario at specific coordinates.

    Workflow for using Composites:

    1. Identify the Composite Name: Use a string identifier like "COMPOSITE_LOOTABLE_EVERGREEN_HUCKLEBERRY_DEF" and convert it to a hash using GetHashKey().
    2. Request the Composite: Use the native 0x73F0D0327BFA0812 to request the specific composite hash.
    3. Wait for Loading: Poll the native 0x5E5D96BE25E9DF68 to ensure the composite has successfully loaded before attempting to spawn it.
    4. Create the Composite: Once loaded, use the native 0x5B4BBE80AD5972DC to spawn the herb entity and scenario at the desired coordinates. This returns a composite_scenario_id.

    Important Performance Note:

    Creating too many composites can crash the game. To prevent this, you must manually delete unnecessary scenarios when they are no longer needed (e.g., when the player moves a certain distance away) using the native 0x5758B1EE0C3FD4AC.

    -- Example of creating a composite
    local composite_name = "COMPOSITE_LOOTABLE_EVERGREEN_HUCKLEBERRY_DEF"
    local composite_name_hash = GetHashKey(composite_name)
    
    -- Request COMPOSITE
    Citizen.InvokeNative(0x73F0D0327BFA0812, composite_name_hash)
    
    -- Wait for load (polling native 0x5E5D96BE25E9DF68)
    -- ... (wait logic) ...
    
    -- Create COMPOSITE
    composite_scenario_id = Citizen.InvokeNative(0x5B4BBE80AD5972DC, composite_name_hash, x, y, z, 0.0, 0, Citizen.PointerValueInt(), -1, Citizen.ReturnResultAnyway())
    
    -- Delete COMPOSITE scenario when done
    Citizen.InvokeNative(0x5758B1EE0C3FD4AC, composite_scenario_id, 0)
  5. Understand Item Interaction Types and Hashes

    master

    Item interactions in RDR3 are categorized by their interaction type (e.g., PrimaryItem) and identified by specific string names and hexadecimal hashes. These interactions represent different states or animations for an item, such as BASE, INTRO, FLIP_TO_FRONT, FLIPPED_BASE, OUTRO, or HOLSTER.

    Common interaction patterns include:

    • Documents: Often involve a sequence of INTRO -> BASE -> FLIP_TO_FRONT/BACK -> FLIPPED_BASE -> OUTRO.
    • Cigarette Cards: Use states like INTRO, BASE, FLIP_TO_FRONT, FLIPPED_BASE, and HOLSTER.
    • Cylinders: Use states like HOLD, UNHOLSTER, or INSPECT_THEN_TAKE.

    Developers can use these hashes to trigger specific item animations or inspect states in-game.

    |             -             | CI_TAG_INSPECT_SHOTGUN_SEMI_AUTO                                                    |        0xF2AF4ADF         |
    |        PrimaryItem        | CIGARETTE_CARD_W10-7_H6-5_SINGLE_BASE                                               |        0x18CEE7C6         |
    |        PrimaryItem        | DOCUMENT_INSPECT@NEWSPAPER_BASE                                                    |        0xBBFFFCCD         |
    |        PrimaryItem        | DOCUMENT_INSPECT@Paper_D2_H32_Rolled_READ                                           |        0x8A9DE39F         |
  6. Understand Item Interaction Types (InspectZ and InspectY)

    master

    In rdr3_discoveries, item interactions are categorized by their geometric interaction volumes, specifically RECTANGLE@L7-6_W9-2_H7-4_InspectZ and SPHERE@D8-4_InspectY. These types define how an item is interacted with in the game world and are associated with specific item hashes.

    • InspectZ (Rectangle): Typically associated with ammunition or specific weapon-related items (e.g., S_INV_SHOTGUNAMMO01X).
    • InspectY (Sphere): Typically associated with consumable food items, pickups, or small objects (e.g., p_apple01x, s_pickup_jewelrybag01x).
  7. Structure of a Scenario and ConditionalAnim

    master

    A Scenario is composed of several hierarchical elements. Use this structure to understand how animations and transitions are nested:

    • Scenario
      • Scenario Conditions
      • ScenarioInfo Flags
      • ConditionalAnim A
        • Conditions, Flags, PropData
        • Clips: Enter (start), Base (main), Exit (end), Active looks (attention), Reactions (start/enter/exit).
      • ConditionalAnim B
        • (Same structure as A)
      • ConditionalAnim Transition A to B
        • Transition Conditions & Flags
        • TransitionFromConditionalAnim List
        • TransitionToConditionalAnim List
        • Transition Clips
  8. Understand Blip Conditional Behaviors

    master

    Blips in the game often change behavior based on the player's proximity or current activity. When working with blip logic, be aware of these common patterns:

    • Area Dimming: Many mission and objective blips (like BLIP_STYLE_PROC_MISSION) apply AUTO_MODIFIER_AREA_DIM_WHEN_INSIDE when an entity has been inside the blip area for 100ms.
    • Automatic Removal: Some blips, such as BLIP_STYLE_RANDOM_EVENT or BLIP_STYLE_SP_CORPSE_FADE, are designed to fade out and be removed after a specific duration (e.g., 3,000ms or 4,000ms).
    • Vehicle-Based Hiding: Certain blips are hidden when the player is interacting with specific vehicles. For example, BLIP_STYLE_TRAIN applies BLIP_MODIFIER_HIDDEN when the player is driving a train, and BLIP_STYLE_TEMPORARY_HORSE applies BLIP_MODIFIER_HIDDEN when riding a horse.
    • Radar Visibility: Some styles are explicitly set to be Hidden on Radar (e.g., BLIP_STYLE_SP_CORPSE, BLIP_STYLE_TOWN, or BLIP_STYLE_RCM_BOUNTY_HIDDEN) to prevent cluttering the mini-map while remaining visible on the main map.
  9. Understand Item Interaction Types and Frame Shapes

    master

    Item interactions in this project utilize specific frame shapes and dimensions to define how objects (like pictures or frames) are rendered or interacted with. The two primary interaction types are:

    • OVAL: Uses a specific coordinate and dimension format: FRAME@OVAL@L[Length]_W[Width]_H[Height]-5_A[Angle].
    • RECTANGLE: Uses a specific coordinate and dimension format: FRAME@RECTANGLE@L[Length]_W[Width]_H[Height]_A[Angle].

    These identifiers are used in conjunction with specific asset names (e.g., s_pic_CHARLESPARENT01x) to define the visual interaction area.