Page 2 of 2

Re: LUA clueless, need help.

Posted: Mon Mar 23, 2015 9:31 pm
by Azel
Well then I very much expect there to be a House Wife and Chauffeur NPC in your Mod. MAKE IT HAPPEN :P

Re: LUA clueless, need help.

Posted: Mon Mar 23, 2015 10:02 pm
by minmay
utopia570 wrote:Ok so for now, my only other question would be, is it possible to edit someone else's dungeon? I have 0 intention of reuploading a modified dungeon or "ruining" someone else's work. I simply want to alter a dungeon to my play style. It would be just an offline change for my own purposes. Thank you.
Some modders distribute their source files so that you can edit their dungeons. If the dungeon does not have source files released then you would need to extract the .dat file with a tool like offzip and match up the resulting hashed filenames to their original filenames. I do not recommend this.
However there are a lot of changes you can make simply by using the debug console (enable with "console = true" in your grimrock.cfg and press the consoleKey ingame to open, '\' by default.) which is simply a Lua console; see the scripting reference for what you can do with it. For example, to make secret buttons more noticeable, you can run this line to draw white boxes around all ClickableComponents on objects with ButtonComponents:

Code: Select all

for l = 1,Dungeon.getMaxLevels() do for e in Dungeon.getMap(l):allEntities() do local clickables = {} local button = false for _,c in e:componentIterator() do if c.getFrontFacing then table.insert(clickables,c) elseif c.getDisableSelf and c.getSound and not (c.isActivated) then button = true end end if button then for _,c in ipairs(clickables) do c:setDebugDraw(true) end end end end
Or in 2.4.4, you can give the party Toorum movement speed (turning speed is still stuck at 1.0 though) with this line:

Code: Select all

party.party:setMovementSpeed(1.5)

Re: LUA clueless, need help.

Posted: Tue Mar 24, 2015 5:36 am
by Isaac
utopia570 wrote:Ok so for now, my only other question would be, is it possible to edit someone else's dungeon? I have 0 intention of reuploading a modified dungeon or "ruining" someone else's work. I simply want to alter a dungeon to my play style. It would be just an offline change for my own purposes. Thank you.
Any modding of a user dungeon that is not offered as an editor project, will [usually] be done in-game through the Lua console, using Lua script commands.

If the idea is to remove spiders ~for instance, it's possible in theory (to swap them for another monster), but in practice, some of them are spawned via scripts, and it's not as simple as replacing all monsters of a given type with another. Basic console commands can add equipment, open doors, kill monsters, and even move the party around, but in a complex scripted mod, it's sometimes possible to cause problems in it by changing things (unexpectedly); use with caution.

Re: LUA clueless, need help.

Posted: Tue Mar 24, 2015 11:33 am
by petri
minmay wrote:

Code: Select all

for l = 1,Dungeon.getMaxLevels() do for e in Dungeon.getMap(l):allEntities() do local clickables = {} local button = false for _,c in e:componentIterator() do if c.getFrontFacing then table.insert(clickables,c) elseif c.getDisableSelf and c.getSound and not (c.isActivated) then button = true end end if button then for _,c in ipairs(clickables) do c:setDebugDraw(true) end end end end
btw. Component:getClass() was added in 2.2.4.