Class ConsoleHelper
Provides a stable, modder-friendly abstraction over the in-game console system. Use these helpers from mods instead of referencing the game's console types directly.
public static class ConsoleHelper
- Inheritance
-
ConsoleHelper
- Inherited Members
Methods
AddItemToInventory(string, int?)
Gives the player an item by code. Optionally specify a quantity.
public static void AddItemToInventory(string itemCode, int? quantity = null)
Parameters
ClearInventory()
Clears the player's inventory.
public static void ClearInventory()
ClearTrash()
Instantly removes all trash from the world.
public static void ClearTrash()
ClearWanted()
Clears the player's wanted level and crimes.
public static void ClearWanted()
DiscoverProduct(string)
Marks a product as discovered by its item code.
public static void DiscoverProduct(string productCode)
Parameters
productCodestring
GiveXp(int)
Gives the player experience points.
public static void GiveXp(int amount)
Parameters
amountint
GrowPlants()
Instantly sets all plants in the world to fully grown.
public static void GrowPlants()
LowerWanted()
Lowers the player's wanted level.
public static void LowerWanted()
RaiseWanted()
Raises the player's wanted level.
public static void RaiseWanted()
RunCashCommand(int)
Executes the ChangeCash command with the given amount. Positive values add cash; negative values remove cash.
public static void RunCashCommand(int amount)
Parameters
amountint
RunOnlineBalanceCommand(int)
Changes the player's online bank balance by the specified amount.
public static void RunOnlineBalanceCommand(int amount)
Parameters
amountint
SaveGame()
Forces a save of the current game state.
public static void SaveGame()
SetLawIntensity(float)
Sets the intensity of law enforcement activity (0-10).
public static void SetLawIntensity(float intensity)
Parameters
intensityfloat
SetNpcRelationship(NPC, float)
Sets the relationship scalar for an NPC (0-5).
public static void SetNpcRelationship(NPC npc, float level)
Parameters
SetNpcRelationship(string, float)
Sets the relationship scalar for an NPC by id (0-5).
public static void SetNpcRelationship(string npcId, float level)
Parameters
SetPlayerEnergyLevel(float)
Sets the player's energy to a value between 0 and 100.
public static void SetPlayerEnergyLevel(float amount)
Parameters
amountfloat
SetPlayerHealth(float)
Sets the player's health to the specified value.
public static void SetPlayerHealth(float amount)
Parameters
amountfloat
SetPlayerJumpMultiplier(float)
Sets the player's jump force multiplier. Must be non-negative.
public static void SetPlayerJumpMultiplier(float multiplier)
Parameters
multiplierfloat
SetPlayerMoveSpeedMultiplier(float)
Sets the player's movement speed multiplier. Must be non-negative.
public static void SetPlayerMoveSpeedMultiplier(float multiplier)
Parameters
multiplierfloat
SetQuality(Quality)
Sets the equipped item's quality.
public static void SetQuality(Quality quality)
Parameters
qualityQualityAPI quality value to set.
SetQuestState(string, QuestState)
Sets the state of a quest by name.
public static void SetQuestState(string questName, QuestState state)
Parameters
questNamestringstateQuestState
SetTime(string)
Sets the time of day using a 24h HHmm string (e.g., "1530").
public static void SetTime(string hhmm)
Parameters
hhmmstring
SpawnVehicle(string)
Spawns a vehicle by code at the player's location.
public static void SpawnVehicle(string vehicleCode)
Parameters
vehicleCodestring
Submit(IEnumerable<string>)
Submits a console command and arguments (e.g. Submit(["settime","1530"]). Works across both IL2CPP and Mono builds.
public static void Submit(IEnumerable<string> arguments)
Parameters
argumentsIEnumerable<string>Command word followed by its arguments.
Submit(string)
Submits a raw console command string (e.g. "settime 1530"). Works across both IL2CPP and Mono builds.
public static void Submit(string command)
Parameters
commandstringThe full command line to execute.
UnlockNpc(NPC)
Unlocks the given NPC's connection.
public static void UnlockNpc(NPC npc)
Parameters
npcNPC