Console command list?
Re: Console command list?
I've been busy with those console commands and the following I use quite often:
party:setPosition(x,y,facing,level) where x=1 to 31, y = 1 to 31, facing 0 to 3 to get past a locked door which key you can't find
spawn("name_key") to spawn any known key, but it doesn't work for custom dungeon keys with weird names
party:heal() fully heals the party
party:getChampion(p):addTrait("lightning_speed") where p is champion 1 to 4 to get the thunderstruck trait
party:getChampion(p):addSkillPoints(x) whereby x is a negative value to remove the levelup message of maxed champions
party:getChampion(p):setStatMax(stat,x) & :setStat(stat,x) to edit a stat x points for stats like "vitality", "protection" to make a stronger party for exploration (map) hard zones.
I still have to find the proper command to open doors, locks and close pits. I typed in all kind of entities commands without success. The ones that don't give an error don't do anything else.
For some this is cheating, for others it's mapping hard levels and for me it's educational.
party:setPosition(x,y,facing,level) where x=1 to 31, y = 1 to 31, facing 0 to 3 to get past a locked door which key you can't find
spawn("name_key") to spawn any known key, but it doesn't work for custom dungeon keys with weird names
party:heal() fully heals the party
party:getChampion(p):addTrait("lightning_speed") where p is champion 1 to 4 to get the thunderstruck trait
party:getChampion(p):addSkillPoints(x) whereby x is a negative value to remove the levelup message of maxed champions
party:getChampion(p):setStatMax(stat,x) & :setStat(stat,x) to edit a stat x points for stats like "vitality", "protection" to make a stronger party for exploration (map) hard zones.
I still have to find the proper command to open doors, locks and close pits. I typed in all kind of entities commands without success. The ones that don't give an error don't do anything else.
For some this is cheating, for others it's mapping hard levels and for me it's educational.
Re: Console command list?
Here's what you need to do to open a door ahead of the party, but it's a lot to compress in one line:
Code: Select all
dx, dy = getForward(party.facing)
for e in entitiesAt(party.level, party.x, party.y) do
if e.setDoorState and e.facing == party.facing then e:open() end
end
for e in entitiesAt(party.level, party.x + dx, party.y + dy) do
if e.setDoorState and e.facing == (party.facing + 2) % 4 then e:open() end
end
Re: Console command list?
If I read this correctly the first line returns the x,y coordinates from the party. I already see that in the bottom debug line. Then you check if the party is facing the door or must turn around. I don't get the % 4.
If I already know x,y and the level can this not be simplified in something like party:entityAt(level,x, y):setDoorState:open() ? And does this only work for unlocked doors?
If I already know x,y and the level can this not be simplified in something like party:entityAt(level,x, y):setDoorState:open() ? And does this only work for unlocked doors?
Re: Console command list?
No, to find entities, you have to make a loop ( for e in entitiesAt(level, x, y) do ), then for each of those e in the tile, you need to check if it's a door which is most easily done by checking if it has a setDoorState method you can call ( if e.setDoorState then ). If you don't verify that, calling e:open() on, let's say, a sword on the floor returned by allEntities, will crash as it cannot find that method on that entitity.
Then you must check the facing to check that the door is facing the party. A tricky thing with doors, is that as they are placed "between" two tiles, they can be in either one. So a door in front of you can be either on the party square facing in the same dir as the party, or it can be in the square in front of the part, facing the opposite direction. (Which the + 2 % 4 does. The % is a modulo operation, which returns the remainder of a division, an easy way to make sure the number is between 0 and 3). So you need to run entitiesAt on two tiles to find the door.
Then you must check the facing to check that the door is facing the party. A tricky thing with doors, is that as they are placed "between" two tiles, they can be in either one. So a door in front of you can be either on the party square facing in the same dir as the party, or it can be in the square in front of the part, facing the opposite direction. (Which the + 2 % 4 does. The % is a modulo operation, which returns the remainder of a division, an easy way to make sure the number is between 0 and 3). So you need to run entitiesAt on two tiles to find the door.
Re: Console command list?
I tried to type over the big script exactly like shown with spaces and all, but the last part I had to do blindly as the console doesn't have word wrap. Afterwards nothing happened. Did I actually have to fill in coordinates and level shown in the debug line?
If we assume the maker made the door facing the proper way on the square next to the party, what would I have to type in then?
I also think it is possible to write anti-cheat scripts. Let's say the unique key must be picked up from a specific location. You can check if it hasn't been picked up yet and then hasn't been used on the lock yet. So the player must have used a spawn("key") command. Then if the door is still closed the player must have used the party:setPosition command. So a double check if the door is still closed and the key is still on its place, then decrease party's health with a cheater message.
If we assume the maker made the door facing the proper way on the square next to the party, what would I have to type in then?
I also think it is possible to write anti-cheat scripts. Let's say the unique key must be picked up from a specific location. You can check if it hasn't been picked up yet and then hasn't been used on the lock yet. So the player must have used a spawn("key") command. Then if the door is still closed the player must have used the party:setPosition command. So a double check if the door is still closed and the key is still on its place, then decrease party's health with a cheater message.
Re: Console command list?
You should arrange it as one line in a text editor to make sure it's correct, such as notepad++, the copy and then Alt-Tab back to Grimrock and paste
Finished Dungeons - complete mods to play
Re: Console command list?
My Mac needs cmd+C to copy, but LoG needs ctrl+V to paste. Hence I couldn't copy it before. I removed all the hard returns so it had normal spaces and the door opened. I also made it a little shorter by putting 2-letter variables up front and I made it a function. It did work for most doors, but for one specific portculis it didn't work on either side. Is there a difference in open, activate and toggle if the state is "closed"? Or in this case there are multiple triggers for the portculis to be open?
function Sesame() fa = party.facing; le = party.level; xx = party.x; yy = party.y; dx, dy = getForward(fa) for e in entitiesAt(le, xx, yy) do if e.setDoorState and e.facing == fa then e:open() end end for e in entitiesAt(le, xx + dx, yy + dy) do if e.setDoorState and e.facing == (fa + 2) % 4 then e:open() end end end
I don't know anything about LoG lua programming, but I just wonder if the script can be shorter. Now you can have multiple closed doors within the 2 squares and the script stops when it finds one that the party is facing in the right square. But it looks for all entities within a square and then the next. Can't you search only for entities the party is facing and the opposite direction of the next square? I know EntitiesAt(level, x, y) won't allow that, but AH might not have shown the full syntax and there actually is a entitiesAt(level, x, y, [facing]) syntax.
From this script I made a new one to move through a wall (default use 2 for st):
function Ghost(st) fa = party.facing; dx, dy = getForward(fa) party:setPosition(party.x + dx * st, party.y + dy * st, fa, party.level) end
Next step I want to know which lock is on the wall or door and where I can find it. With a similar script you can find the lock. Is there a getOpenedBy() command that returns a keyName? I don't know whether that is the variable we need for findEntity(id). It would be nice to have an Oracle like helper in mods that require limited tokens for hints (opening a door requires more tokens than finding a key)
function Sesame() fa = party.facing; le = party.level; xx = party.x; yy = party.y; dx, dy = getForward(fa) for e in entitiesAt(le, xx, yy) do if e.setDoorState and e.facing == fa then e:open() end end for e in entitiesAt(le, xx + dx, yy + dy) do if e.setDoorState and e.facing == (fa + 2) % 4 then e:open() end end end
I don't know anything about LoG lua programming, but I just wonder if the script can be shorter. Now you can have multiple closed doors within the 2 squares and the script stops when it finds one that the party is facing in the right square. But it looks for all entities within a square and then the next. Can't you search only for entities the party is facing and the opposite direction of the next square? I know EntitiesAt(level, x, y) won't allow that, but AH might not have shown the full syntax and there actually is a entitiesAt(level, x, y, [facing]) syntax.
From this script I made a new one to move through a wall (default use 2 for st):
function Ghost(st) fa = party.facing; dx, dy = getForward(fa) party:setPosition(party.x + dx * st, party.y + dy * st, fa, party.level) end
Next step I want to know which lock is on the wall or door and where I can find it. With a similar script you can find the lock. Is there a getOpenedBy() command that returns a keyName? I don't know whether that is the variable we need for findEntity(id). It would be nice to have an Oracle like helper in mods that require limited tokens for hints (opening a door requires more tokens than finding a key)
Re: Console command list?
what is the command if you need to summon some item which you have lost by accident ? for example silver_coin. thanks
Re: Console command list?
spawn("silver_coin")Drakkan wrote:what is the command if you need to summon some item which you have lost by accident ? for example silver_coin. thanks
it will pop up at your feet.
Re: Console command list?
Otherwise you could code a search of every square and run through every item and if the name matches then print the level number and x y coordinates.
Finished Dungeons - complete mods to play