Repository navigation
[Memhack] Game Functions
This page describes functions added to the Game class by memhack.
- GetMemhackObj
- GetReputation
- SetReputation
- AddReputation
- GetGridPower
- SetGridPower
- AddGridPower
GetScoreSetScoreAddScore- GetStorage
- GetSquadPilots
- GetStoragePilots
- GetAvailablePilots
- GetPodRewardPilot
- GetPerfectIslandRewardPilot
- GetStrategySelectedPawn
-
GameMapGame:GetMemhackObj()
Returns a memhack GameMap struct for the Game object. This provides access to lower-level game state. Generally not needed outside of the GameMap functions implemented here.
Example:
local gameMap = Game:GetMemhackObj()-
numberGame:GetReputation()
Returns the current reputation value.
Example:
local reputation = Game:GetReputation()
LOG("Current reputation: " .. reputation)-
voidGame:SetReputation(reputation)
| Argument name | Type | Description |
|---|---|---|
reputation |
number | The reputation value to set |
Sets the reputation to the specified value.
Example:
Game:SetReputation(5)-
voidGame:AddReputation(amount)
| Argument name | Type | Description |
|---|---|---|
amount |
number | The amount to add (can be negative) |
Adds the specified amount to the current reputation. Use negative values to decrease reputation.
Example:
Game:AddReputation(2)
Game:AddReputation(-1)-
numberGame:GetGridPower()
Returns the current grid power
Example:
local grid = Game:GetGridPower()
LOG("Current grid power: " .. grid)-
voidGame:SetGridPower(grid)
| Argument name | Type | Description |
|---|---|---|
grid |
number | The grid value to set |
Sets the grid to the specified value without any animations or sound effects.
Example:
Game:SetGridPower(5)-
voidGame:AddGridPower(amount)
| Argument name | Type | Description |
|---|---|---|
amount |
number | The amount to add (can be negative) |
Adds the specified amount to the current grid power without playing animations or sound effects. Use negative values to decrease grid power.
Example:
Game:AddGridPower(2)
Game:AddGridPower(-1)TEMPORARILY REMOVED Only worked for GoG version due to offsets from base exe
-
numberGame:GetScore()
Returns the current score.
Example:
local score = Game:GetScore()
LOG("Current score: " .. score)TEMPORARILY REMOVED Only worked for GoG version due to offsets from base exe
-
voidGame:SetScore(score)
| Argument name | Type | Description |
|---|---|---|
score |
number | The score value to set |
Sets the score to the specified value.
Example:
Game:SetScore(5000)TEMPORARILY REMOVED Only worked for GoG version due to offsets from base exe
-
voidGame:AddScore(amount)
| Argument name | Type | Description |
|---|---|---|
amount |
number | The amount to add (can be negative) |
Adds the specified amount to the current score. Use negative values to decrease score.
Example:
Game:AddScore(500)
Game:AddScore(-100)-
StorageGame:GetStorage()
Returns the Storage struct containing all pilots and weapons currently in storage. Write operations for storage are not currently supported.
Example:
local storage = Game:GetStorage()-
tableGame:GetSquadPilots()
Returns an array of Pilot structs for all pilots currently in the squad (piloting mechs). The array may contain up to 3 pilots. Empty mech slots are not included. The order does not necessarily match pawn IDs.
Returned pilots will never be nil.
Example:
local squadPilots = Game:GetSquadPilots()
for _, pilot in ipairs(squadPilots) do
LOG("Squad pilot: " .. pilot:getName())
end-
tableGame:GetStoragePilots()
Returns an array of Pilot structs for all pilots currently in storage (not piloting mechs).
Returned pilots will never be nil.
Example:
local storagePilots = Game:GetStoragePilots()
LOG("Pilots in storage: " .. #storagePilots)-
tableGame:GetAvailablePilots()
Returns an array of all available Pilot structs, including both squad pilots and storage pilots. This does not include pod rewards or perfect island rewards that have not yet been claimed.
Returned pilots will never be nil.
Example:
local allPilots = Game:GetAvailablePilots()
for _, pilot in ipairs(allPilots) do
LOG("Available pilot: " .. pilot:getName())
end-
PilotGame:GetPodRewardPilot()
Returns the Pilot struct for a time pod reward before it is claimed to storage. Returns nil if there is no pilot reward or the pod UI is not open.
Example:
local podPilot = Game:GetPodRewardPilot()
if podPilot then
LOG("Pod contains pilot: " .. podPilot:getName())
end-
PilotGame:GetPerfectIslandRewardPilot()
Returns the Pilot struct for a perfect island reward before it is claimed to storage. Returns nil if there is no pilot reward or the perfect reward UI is not open.
Example:
local rewardPilot = Game:GetPerfectIslandRewardPilot()
if rewardPilot then
LOG("Perfect island reward pilot: " .. rewardPilot:getName())
end-
intGame:GetStrategySelectedPawn()
Returns the currently selected player pawn id in the strategy menu (between missions) or nil if none are selected
Example:
local pawnId = Game:GetStrategySelectedPawn()
if pawnId then
LOG("Selected strategy menu pawn: " .. pawnId)
end