[Memhack] Pawn Functions - Redacted-Rice/ITB-RedactedRiceExts GitHub Wiki

Memhack Pawn Functions

This page describes functions added to the Pawn (BoardPawn) class by memhack.

Table of Contents

GetMemhackObj

  • BoardPawn Pawn:GetMemhackObj()

Returns the memhack BoardPawn struct for this pawn userdata. Cached on the pawn and refreshed if the userdata address changes. Prefer the wrappers below unless you need the raw struct.

Example:

local boardPawn = Game:GetPawn(0):GetMemhackObj()
local pilot = boardPawn:getPilot()

GetPilot

  • Pilot Pawn:GetPilot()

Returns the Pilot struct for the pilot currently piloting this pawn. Returns nil if the pawn has no pilot.

Example:

local pawn = Game:GetPawn(0)
local pilot = pawn:GetPilot()

if pilot then
    LOG("Pawn is piloted by " .. pilot:getName())
    LOG("Pilot level: " .. pilot:getLevel())
else
    LOG("Pawn has no pilot")
end

GetHpCore

  • int or nil Pawn:GetHpCore()

Returns the innate mech HP core type (memhack.CORE_TYPE_*), or nil if the pointer is unavailable. See Constants for return values.

Example:

local hpCore = Game:GetPawn(0):GetHpCore()
if hpCore == memhack.CORE_TYPE_SKILL_BONUS then
    LOG("HP core is a skill bonus core")
end

SetHpCore

  • boolean Pawn:SetHpCore(value)
Argument name Type Description
value int memhack.CORE_TYPE_*

Writes the innate mech HP core type. Returns false if the pointer is null/zero, otherwise true. See Constants for memhack.CORE_TYPE_* details.

Example:

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

GetMoveCore

  • int or nil Pawn:GetMoveCore()

Returns the innate mech move core type (memhack.CORE_TYPE_*), or nil if the pointer is unavailable. See Constants for return values.

Example:

local moveCore = Game:GetPawn(0):GetMoveCore()
LOG("Move core type: " .. tostring(moveCore))

SetMoveCore

  • boolean Pawn:SetMoveCore(value)
Argument name Type Description
value int memhack.CORE_TYPE_*

Writes the innate mech move core type. Returns false if the pointer is null/zero, otherwise true. See Constants for memhack.CORE_TYPE_* details.

Example:

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