Difference between revisions of "Lua Console"

From PioneerWiki
Jump to: navigation, search
m (Adding refuel cheat)
(Updating the console commands to "require")
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
  
 
Due to the evolving code of pioneer, we still sometimes need to change the save format, making all previous saves useless. In this case, you can give your player character back what he had, by manually cheating:
 
Due to the evolving code of pioneer, we still sometimes need to change the save format, making all previous saves useless. In this case, you can give your player character back what he had, by manually cheating:
 +
 +
'''Note:''' Since the 2020-12-22 Release candidate, how you input these has changed a bit: instead of '''import("Game").player:''' you need to write '''require "Game".player:'''
  
 
*Add said amount of money to player:  
 
*Add said amount of money to player:  
  
  import("Game").player:AddMoney(100000)
+
  require "Game".player:AddMoney(100000)
  
 
*Set said amount of money to player:  
 
*Set said amount of money to player:  
  
  import("Game").player:SetMoney(100000)
+
  require "Game".player:SetMoney(100000)
  
 
*Set the amount of propellant in the tank:  
 
*Set the amount of propellant in the tank:  
  
  import("Game").player:SetFuelPercent(100)
+
  require "Game".player:SetFuelPercent(100)
  
 
*Set the player ship to the one specified:  
 
*Set the player ship to the one specified:  
  
  import("Game").player:SetShipType("shipname")
+
  require "Game".player:SetShipType("shipname")
  
 
"shipname" is the filename of the ship's .json in the data/ships/ directory (without extension). Eg: ''...SetShipType("amphiesma")''
 
"shipname" is the filename of the ship's .json in the data/ships/ directory (without extension). Eg: ''...SetShipType("amphiesma")''
Line 26: Line 28:
 
*Set reputation of player:  
 
*Set reputation of player:  
  
  import("Character").persistent.player.reputation = 42
+
  require "Character".persistent.player.reputation = 42
  
 
*Set kills of player:  
 
*Set kills of player:  
  
  import("Character").persistent.player.killcount = 5
+
  require "Character".persistent.player.killcount = 5
  
 
*Add the specified amount of equipment or cargo to the players ship  
 
*Add the specified amount of equipment or cargo to the players ship  
  
  import("Game").player:AddEquip("equip", amount)
+
  require "Game".player:AddEquip("equip", amount)
  
 
Amount can be omitted, and cargo capacity applies. [http://eatenbyagrue.org/f/pioneer/codedoc/files/LuaConstants-cpp.html#Constants.EquipType Available equipment and cargo.]
 
Amount can be omitted, and cargo capacity applies. [http://eatenbyagrue.org/f/pioneer/codedoc/files/LuaConstants-cpp.html#Constants.EquipType Available equipment and cargo.]

Latest revision as of 18:07, 10 February 2021

Lua console allows you to manipulate the game universe by injecting lua code directly into the game engine. You can open the console in-game by pressing '`' (default key, you can change it in the keybinding options).

Useful for restoring save

Due to the evolving code of pioneer, we still sometimes need to change the save format, making all previous saves useless. In this case, you can give your player character back what he had, by manually cheating:

Note: Since the 2020-12-22 Release candidate, how you input these has changed a bit: instead of import("Game").player: you need to write require "Game".player:

  • Add said amount of money to player:
require "Game".player:AddMoney(100000)
  • Set said amount of money to player:
require "Game".player:SetMoney(100000)
  • Set the amount of propellant in the tank:
require "Game".player:SetFuelPercent(100)
  • Set the player ship to the one specified:
require "Game".player:SetShipType("shipname")

"shipname" is the filename of the ship's .json in the data/ships/ directory (without extension). Eg: ...SetShipType("amphiesma")

  • Set reputation of player:
require "Character".persistent.player.reputation = 42
  • Set kills of player:
require "Character".persistent.player.killcount = 5
  • Add the specified amount of equipment or cargo to the players ship
require "Game".player:AddEquip("equip", amount)

Amount can be omitted, and cargo capacity applies. Available equipment and cargo.