Legend of Grimrock 2

Legend of Grimrock 2

评价数不足
Console commands
由 lolboy4 制作
The console and how to use it, because information about it is otherwise scattered and hard to find.
   
奖励
收藏
已收藏
取消收藏
Intro
I've learned a fair bit about how to use the console in this game, and information on it is weirdly hard to find, so I'll share the significant stuff I know.

To start out, you need to actually enable the console. Go into Documents, Almost Human, Legend of Grimrock 2, and open "grimrock.cfg" with a text editor. In that file, find the line "console = false" and change false to true. Then, ingame, you can open the console by pressing ~. If your keyboard doesn't have that, change the number of the "consolekey" line in that file to something else. Look up "key numbers" for an explanation of them.

You can scroll the cursor back and forth with left and right, and go between previous commands with up and down. The console accepts pasted commands, so you can just copy them into it. Keep in mind, having the console open doesn't pause the game.
Basic commands
All "#" refer to numbers of your choice. Where there are "", put text in between them. Depending on the command though, the latter may be unnecessary. All commands are case sensitive. Anything that uses "set" can also use "get" instead, and containing a "get" command in the brackets of "print()" will write the result to the console.

spawn("",#,#,#,#,#,"")
Creates an item, object, or enemy. Fill the first quotes with the entity's internal name, all else is optional. In order: Level, X and Y positions, facing, elevation, and custom ID. You can check internal names in the dungeon editor; they're what's in that list on the bottom left.

spawn("").item:setStackSize(#)
Create an item and set how many are in the stack of it. Use with unstackable items at your own risk.

setMouseItem(spawn("").item)
Spawn something by making it be held by the mouse. Remove everything between the outer brackets to instead delete what's being held with the mouse.

print(getMouseItem().go.name)
This'll get you the internal name of whatever you're holding with the mouse. Pretty handy for spawning modded items!

party:setPosition(#,#,#,#,#)
Sets your position. The numbers, in turn, reference desired X and Y position (0-31), facing direction (0-3), height (0+), and level (1-However many levels the dungeon has).
Values that don't fit in those ranges will crash the game. And yes, the arguments are in a different order from the spawn command for some reason.

print(X:getPosition())
Gets the position of something. Items are almost always "item_name_#", where item_name is the item's internal name and # is a number. Use "party" to get your own coordinates. Don't use "" here!
The coordinates given are in the same order as setPosition, though it skips one and I'm not sure which.

GameMode.setTimeOfDay(#)
Set the time of day, between 0 and 1.9999999999999. 0 is day, 1 is night.
Party commands
These exclusively have effects on your characters.

party.party:heal()
Fully restores all characters, as if you used a healing crystal.

party.party:setMovementSpeed(#)
Sets movement speed. 1 is normal. Mods that include "Toorum mode" set this to 1.5.

party.party:getChampion(#):
Used for commands relating to specific characters, replace # with the desired character's inventory button.

party.party:getChampion(#):setName("")
Changes the corresponding character's name.

party.party:getChampion(#):setSex("")
Changes the corresponding character's gender (male/female). Neither this nor the previous command have any built in effect, but mods may add functions to them.

party.party:getChampion(#):setRace("")
Changes the corresponding character's race (human/minotaur/lizardman/ratling/insectoid)

party.party:getChampion(#):setPortrait("")
Changes the corresponding character's portrait. Replace the blank with a filepath, though I'm not sure where it starts from.

party.party:getChampion(#):trainSkill("",#,bool)
Raises one of the corresponding character's skill levels by X, which can be negative (Fill the quotes with a skill's name, maybe don't raise any past 5). Bool can be true or false, and is whether it affects skill points, defaulting to true if not specified. This won't bring points below 0, but it'll still work without them.

party.party:getChampion(#):addTrait("")
Adds the specified trait to the character. Trait internal names are kinda hard to find, but are generally what you'd expect. Look up "grimrock 2 asset pack" to get the vanilla assets to look through for the weird ones.

party.party:getChampion(#):addSkillPoints(#)
Adds or removes skill points. This can bring them below 0.

party.party:getChampion(#):levelUp()
Selected character gains a level. This is permanent; no command can reduce a character's level.

party.party:getChampion(#):setBaseStat("",#)
Changes one of the corresponding character's stats to #, which can be negative. Replace the blank with the desired stat, the list of which will be detailed below the next command.

party.party:getChampion(#):upgradeBaseStat("",#)
Same as previous, but adds # to their current value instead of replacing it. This can be negative, reducing the stat instead.

Stats that can be changed: health, max_health, energy, max_energy, strength, dexterity, vitality, willpower, protection, evasion, resist_X (X being the element), max_load, exp_rate, food_rate, health/energy_regeneration_rate, cooldown_rate

Negative stats tend to actually function weirdly well given that they're unintended. The regen stats in particular can actually reduce health/energy if they're negative.
Simple scripts
Here's a few scripts I developed or found that you can play around with. Feel free to comment any fun new ones you develop! I'd LOVE one that makes secret buttons easy to find!

[Universal pseudo-Toorum]
party.party:getChampion(1):upgradeBaseStat("cooldown_rate",100)
party.party:setMovementSpeed(1.5)
party.party:getChampion(1):setPortrait("assets/textures/portraits/toorum.tga")
For the proper experience, make only 1 character.
Changing the portrait is optional.

[Skill point to attributes]
party.party:getChampion(#):addSkillPoints(-1)
party.party:getChampion(#):upgradeBaseStat("strength",1)
party.party:getChampion(#):upgradeBaseStat("dexterity",1)
party.party:getChampion(#):upgradeBaseStat("vitality",1)
party.party:getChampion(#):upgradeBaseStat("willpower",1)
You may want to copy this into notepad and change the character number there.

[Teleport one tile forward]
local dx,dy = getForward(party.facing)
party:setPosition(party.x + dx, party.y + dy, party.facing, party.elevation, party.level)
2 条留言
lolboy4  [作者] 10 月 16 日 下午 5:52 
@Liro Raériyo
It's a lot of fun, yeah! There was actually a little while where it was my preferred playstyle, though I've since changed back to mostly just playing normally.
Liro Raériyo 10 月 13 日 上午 3:15 
Oh baby, a toorum mode for grimrock 2? that sounds awesome!