Marvel Rivals

Functions for interacting with player data, world coordinates, bones, and game objects.

marvel_rivals.get_local_player

Signature: marvel_rivals.get_local_player()

Description: Returns information about the local player, including pointers to various game objects and bone IDs.

Parameters: None

Returns:

  • table: A table containing the following fields:

    • player_controller (integer): Pointer to the player controller

    • skeletal_mesh (integer): Pointer to the skeletal mesh

    • root_component (integer): Pointer to the root component

    • child_actor_component (integer): Pointer to the child actor component

    • child_actor (integer): Pointer to the child actor

    • bone_array (integer): Pointer to the bone array

    • health_component (integer): Pointer to the health component

    • player_state (integer): Pointer to the player state

    • pawn (integer): Pointer to the pawn

    • hero_name (string): Name of the hero

    • bone_id_* (integer): Various bone IDs (e.g., bone_id_head, bone_id_chest, etc.)

Returns nil if local player data is not available.

Example:

local local_player = marvel_rivals.get_local_player()

if not local_player then
    engine.log("Local player not available", 255, 0, 0, 255)
    return
end

engine.log("Hero: " .. local_player.hero_name, 0, 255, 0, 255)

-- Access bone IDs
engine.log("Head bone ID: " .. tostring(local_player.bone_id_head), 255, 255, 255, 255)
engine.log("Chest bone ID: " .. tostring(local_player.bone_id_chest), 255, 255, 255, 255)

marvel_rivals.get_player_list

Signature: marvel_rivals.get_player_list()

Description: Returns a table of all players in the game, with the same data structure as get_local_player for each player.

Parameters: None

Returns:

  • table: A table of player data, where each entry contains:

    • skeletal_mesh (integer): Pointer to the skeletal mesh

    • root_component (integer): Pointer to the root component

    • child_actor_component (integer): Pointer to the child actor component

    • child_actor (integer): Pointer to the child actor

    • bone_array (integer): Pointer to the bone array

    • health_component (integer): Pointer to the health component

    • player_state (integer): Pointer to the player state

    • pawn (integer): Pointer to the pawn

    • hero_name (string): Name of the hero

    • bone_id_* (integer): Various bone IDs

Returns nil if player list is not available.

Example:

local players = marvel_rivals.get_player_list()

if not players then
    engine.log("Player list unavailable", 255, 0, 0, 255)
    return
end

engine.log("Players found: " .. #players, 0, 255, 0, 255)

for i, player in ipairs(players) do
    engine.log("Player " .. i .. ": " .. player.hero_name, 255, 255, 0, 255)
    
    -- Check if this player has a health component
    if player.health_component ~= 0 then
        -- Process health component
        engine.log("  Has health component", 0, 255, 0, 255)
    end
end

marvel_rivals.get_world

Signature: marvel_rivals.get_world()

Description: Returns the pointer to the UWorld object.

Parameters: None

Returns:

  • integer: Pointer to the UWorld object.

Example:

local world_ptr = marvel_rivals.get_world()

if world_ptr == 0 then
    engine.log("UWorld not available", 255, 0, 0, 255)
    return
end

engine.log("UWorld pointer: 0x" .. string.format("%X", world_ptr), 0, 255, 0, 255)

marvel_rivals.get_game_instance

Signature: marvel_rivals.get_game_instance()

Description: Returns the pointer to the UGameInstance object.

Parameters: None

Returns:

  • integer: Pointer to the UGameInstance object.

Example:

local game_instance_ptr = marvel_rivals.get_game_instance()

if game_instance_ptr == 0 then
    engine.log("UGameInstance not available", 255, 0, 0, 255)
    return
end

engine.log("UGameInstance pointer: 0x" .. string.format("%X", game_instance_ptr), 0, 255, 0, 255)

marvel_rivals.get_game_state

Signature: marvel_rivals.get_game_state()

Description: Returns the pointer to the AGameStateBase object.

Parameters: None

Returns:

  • integer: Pointer to the AGameStateBase object.

Example:

local game_state_ptr = marvel_rivals.get_game_state()

if game_state_ptr == 0 then
    engine.log("AGameStateBase not available", 255, 0, 0, 255)
    return
end

engine.log("AGameStateBase pointer: 0x" .. string.format("%X", game_state_ptr), 0, 255, 0, 255)

marvel_rivals.world_to_screen

Signature: marvel_rivals.world_to_screen(x, y, z)

Description: Converts 3D world coordinates to 2D screen coordinates.

Parameters:

  • x (number): X coordinate in world space

  • y (number): Y coordinate in world space

  • z (number): Z coordinate in world space

Returns:

  • x (number): X coordinate in screen space

  • y (number): Y coordinate in screen space

Returns nil if conversion fails.

Example:

-- Convert world position to screen position
local world_x, world_y, world_z = 100, 200, 300
local screen_x, screen_y = marvel_rivals.world_to_screen(world_x, world_y, world_z)

if screen_x and screen_y then
    engine.log("World (" .. world_x .. ", " .. world_y .. ", " .. world_z .. ") -> Screen (" .. screen_x .. ", " .. screen_y .. ")", 0, 255, 0, 255)
    
    -- Draw a marker at the screen position
    render.draw_circle(screen_x, screen_y, 5, 255, 0, 0, 255, 1, true)
else
    engine.log("Failed to convert world position to screen position", 255, 0, 0, 255)
end

marvel_rivals.get_bone_position

Signature: marvel_rivals.get_bone_position(skeletal_mesh, bone_id)

Description: Returns the world position of the specified bone.

Parameters:

  • skeletal_mesh (integer): Pointer to the skeletal mesh

  • bone_id (integer): ID of the bone to get the position of

Returns:

  • x (number): X coordinate of the bone in world space

  • y (number): Y coordinate of the bone in world space

  • z (number): Z coordinate of the bone in world space

Returns nil if conversion fails.

Example:

local local_player = marvel_rivals.get_local_player()

if not local_player then
    engine.log("Local player not available", 255, 0, 0, 255)
    return
end

-- Get the world position of the player's head
local head_x, head_y, head_z = marvel_rivals.get_bone_position(local_player.skeletal_mesh, local_player.bone_id_head)

if head_x then
    engine.log("Head position: (" .. head_x .. ", " .. head_y .. ", " .. head_z .. ")", 0, 255, 0, 255)
    
    -- Convert to screen coordinates and draw a marker
    local screen_x, screen_y = marvel_rivals.world_to_screen(head_x, head_y, head_z)
    if screen_x and screen_y then
        render.draw_circle(screen_x, screen_y, 5, 255, 0, 0, 255, 1, true)
    end
else
    engine.log("Failed to get head bone position", 255, 0, 0, 255)
end

marvel_rivals.get_class_dump

Signature: marvel_rivals.get_class_dump(pointer)

Description: Returns a table containing the class fields for the specified class pointer in Marvel Rivals. This is useful for reverse engineering or understanding the internal structure of class objects at runtime.

Parameters:

  • pointer (integer): The memory address of the class you want to dump.

Returns:

  • table: A table of class fields with the following structure:

    {
        [1] = { name = "PlayerController::AcknowledgedPawn", offset = 0x120 },
        [2] = { name = "Controller::ControlRotation", offset = 0x154 },
        ...
    }

Returns nil and logs an error if:

  • Argument is missing or not an integer

  • Pointer is null

  • Dump is empty

Example:

-- Basic usage
local pointer = 0x1A2B3C4D  -- Replace with actual class pointer (e.g., uworld)
local dump = marvel_rivals.get_class_dump(pointer)

if dump == nil then
    engine.log("Class dump failed.", 255, 0, 0, 255)
    return
end

for i, entry in ipairs(dump) do
    engine.log(string.format("%s = 0x%X", entry.name, entry.offset), 0, 255, 0, 255)
end

-- Saving to a file
local pointer = marvel_rivals.get_world()  -- For example, dump the UWorld class
local dump = marvel_rivals.get_class_dump(pointer)

if dump == nil then
    engine.log("Class dump failed.", 255, 0, 0, 255)
    return
end

local lines = {}
for i, entry in ipairs(dump) do
    table.insert(lines, string.format("%s = 0x%X", entry.name, entry.offset))
end

local text = table.concat(lines, "\n")
fs.write_to_file("class_dump.txt", text)
engine.log("Class dump written to class_dump.txt", 0, 255, 0, 255)

Available Bone IDs

The following bone IDs are available for use with get_bone_position:

Head and Torso

  • bone_id_upper_head: Upper head bone

  • bone_id_head: Head bone

  • bone_id_neck: Neck bone

  • bone_id_chest: Chest bone

  • bone_id_stomach: Stomach bone

  • bone_id_pelvis: Pelvis bone

Left Arm

  • bone_id_left_shoulder: Left shoulder bone

  • bone_id_left_elbow: Left elbow bone

  • bone_id_left_hand: Left hand bone

Right Arm

  • bone_id_right_shoulder: Right shoulder bone

  • bone_id_right_elbow: Right elbow bone

  • bone_id_right_hand: Right hand bone

Left Leg

  • bone_id_left_hip: Left hip bone

  • bone_id_left_knee: Left knee bone

  • bone_id_left_foot: Left foot bone

Right Leg

  • bone_id_right_hip: Right hip bone

  • bone_id_right_knee: Right knee bone

  • bone_id_right_foot: Right foot bone

Last updated

Was this helpful?