[Memhack] BoardPawn - Redacted-Rice/ITB-RedactedRiceExts GitHub Wiki

Memhack BoardPawn

The Memhack BoardPawn struct represents a pawn (BoardPawn) in game memory and provides access to its data.

It has the standard Base Struct functions/fields.

Note: pilot uses a smart ("double") pointer pattern like other pilot pointers in the game. Pointer fields here use noSetter - there is no generated setter for the pointer itself. Mech core ints are read/written through the pointed-to addresses via get/set HpCore and get/set MoveCore.

Table of Contents

Data

Field Type Offset Description
pilot pointer ([Pilot ](/Redacted-Rice/ITB-RedactedRiceExts/wiki/[Memhack]-Pilot)) 0x980 Smart pointer to the pilot currently in this pawn (noSetter)
moveCore pointer (int) 0xC4C Pointer to the innate mech move core int (noSetter)
hpCore pointer (int) 0xC5C Pointer to the innate mech hp core int (noSetter)

Core int values are Constants : memhack.CORE_TYPE_NORMAL (1), CORE_TYPE_SKILL_BONUS (2), or CORE_TYPE_UNDOABLE (3).

Data Functions

getPilot

  • Pilot or nil BoardPawn:getPilot()

Returns the wrapped Pilot struct for this pawn, or nil if the pointer is null.

Prefer Pawn:GetPilot() from Pawn Functions .

Example:

local pawn = Game:GetPawn(0)
local pilot = pawn:GetPilot()
if pilot then
    LOG("Pilot: " .. pilot:getNameStr())
end

getPilotPtr

  • int BoardPawn:getPilotPtr()

Returns the raw pointer value at offset 0x980. Prefer getPilot() unless you need the raw address.

getMoveCore

  • int or nil BoardPawn:getMoveCore()

Reads the int at the moveCore pointer. Returns a memhack.CORE_TYPE_* value, or nil if the pointer is null/zero.

Prefer Pawn:GetMoveCore().

Example:

local moveCore = Game:GetPawn(0):GetMoveCore()
if moveCore == memhack.CORE_TYPE_SKILL_BONUS then
    LOG("Move core is a skill bonus core")
end

setMoveCore

  • boolean BoardPawn:setMoveCore(value)
Argument name Type Description
value int memhack.CORE_TYPE_NORMAL, CORE_TYPE_SKILL_BONUS, or CORE_TYPE_UNDOABLE

Writes the move-core int through the moveCore pointer. Returns false if the pointer is null/zero, otherwise true.

Prefer Pawn:SetMoveCore(value).

Example:

Game:GetPawn(0):SetMoveCore(memhack.CORE_TYPE_SKILL_BONUS)

getMoveCorePtr

  • int BoardPawn:getMoveCorePtr()

Returns the raw pointer at offset 0xC4C (address of the move-core int). Prefer getMoveCore() / setMoveCore().

getHpCore

  • int or nil BoardPawn:getHpCore()

Reads the int at the hpCore pointer. Returns a memhack.CORE_TYPE_* value, or nil if the pointer is null/zero.

Prefer Pawn:GetHpCore().

Example:

local hpCore = Game:GetPawn(0):GetHpCore()
LOG("HP core type: " .. tostring(hpCore))

setHpCore

  • boolean BoardPawn:setHpCore(value)
Argument name Type Description
value int memhack.CORE_TYPE_NORMAL, CORE_TYPE_SKILL_BONUS, or CORE_TYPE_UNDOABLE

Writes the hp-core int through the hpCore pointer. Returns false if the pointer is null/zero, otherwise true.

Prefer Pawn:SetHpCore(value).

Example:

Game:GetPawn(0):SetHpCore(memhack.CORE_TYPE_SKILL_BONUS)

getHpCorePtr

  • int BoardPawn:getHpCorePtr()

Returns the raw pointer at offset 0xC5C (address of the hp-core int). Prefer getHpCore() / setHpCore().