Using assets without dungeon mod

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
Grimples
Posts: 4
Joined: Wed Jan 24, 2018 9:58 pm

Using assets without dungeon mod

Post by Grimples »

Is it possible to use items.lua as a standalone mod, if so what is the directory structure, i have tried several.

Thankyou
User avatar
Isaac
Posts: 3172
Joined: Fri Mar 02, 2012 10:02 pm

Re: Using assets without dungeon mod

Post by Isaac »

Are you trying to use the file, or to distribute it as a mod?
As a standalone file—just by itself, no; it won't work. A user mod/map needs more than just the items.lua file. It requires the init.lua file as well (which loads the default assets for the game); the game looks for it when loading the mod.

If you have a script named 'items.lua' (with object definitions you'd like to import)... A new editor project expects it to exist in the mod's scripts folder... This is because the default location for most start-up scripts are listed in the init.lua file; also in the scripts folder.

Lua is case sensitive, and uses the back-slash character as a control code for string text...Windows (and MAC or Linux) OS uses the back-slash character as a delimiter in its file paths...
So Grimrock games use the forward-slash in their script's internal path definitions—to avoid the conflict; the game engine just handles it, so they will work. (Use forward slashes)

Ensure that the import path for items.lua is named in lowercase, and is given in the init.lua file like so:

Code: Select all

-- import custom assets
import "mod_assets/scripts/items.lua"
This should already be there by default; and the items.lua file (as mentioned), should be in the mod's script folder.
Last edited by Isaac on Sat Jan 27, 2018 11:26 pm, edited 1 time in total.
Grimples
Posts: 4
Joined: Wed Jan 24, 2018 9:58 pm

Re: Using assets without dungeon mod

Post by Grimples »

No intentions creating any map mods, i just want to edit some of the items for personal use only. I played MasterQuest up to lvl6 & found the trap doors too difficult so i downloaded the source pack with the intention of trying to slow the trap doors or just remove them, i discovered items.lua :D What you say does not make much sense to me, pretend you want to create a mod without a map, just the items.lua, how would you go about it step by step if you have the patience & time.

Introduction kind of:
Am 56 & i am not new to modding or changing parameters using hex, the last few years i have had problems with comprehension, i find it very difficult explaining in type what i am thinking, been here 20 minutes so far.
In the old days of my Amiga1200 i played Dragon Crypt & EoB1 & back further again Knight Lore on my Spectrum 48, there were more but i forget. First games for PC were Might & Magic 6, 7 & 8 & i still have the CD's. Discovering Grimrock has brought back some memories, loving the gameplay but it is rather difficult, using Cheat Engine to slow the game down helps but those timed traps doors are :evil:
User avatar
Isaac
Posts: 3172
Joined: Fri Mar 02, 2012 10:02 pm

Re: Using assets without dungeon mod

Post by Isaac »

You can enable the Console interface for the game, and then be able to run scripts. To do this, find the grimrock.cfg file in the game's folder in the Almost Human folder, in your documents folder.

In the grimrock.cfg file, find: console = false, and change that to true. Save and restart the game. You should now be able to open the console by pressing the grave/tilde key (it's the default key for the console; top-left under the ESC key.)

Image

With the console enabled, and open, you can paste in script commands.

Here are a few useful scripts to use: (copy/paste/enter)

Toggle open/close a door or pit that is in front of the party:

Code: Select all

dx, dy = getForward(party.facing)
	for each in entitiesAt(party.level, party.x+dx, party.y+dy) do 
		if each.name:match("door") or each.name:match("pit") then each:toggle() end 
	end 
Close and Stop scripted pit: (For performance reasons, try to use this sparingly, and never twice in the same place.)

Code: Select all

dx, dy = getForward(party.facing)
	for each in entitiesAt(party.level, party.x+dx, party.y+dy) do 
		if each.name:match("pit") then 
		spawn(each.name:sub(1,each.name:find('_')-1)..'_pit', each.level, each.x, each.y, each.facing):addTrapDoor():close()  
		break 
		end 
	end
Open door or pit in front of the party: (useful if there are two pits in the same place, but in opposite states; caused by the previous script)

Code: Select all

dx, dy = getForward(party.facing)
	for each in entitiesAt(party.level, party.x+dx, party.y+dy) do 
		if each.name:match("door") or each.name:match("pit") then each:open() end 
	end 
Close door or pit:

Code: Select all

dx, dy = getForward(party.facing)
	for each in entitiesAt(party.level, party.x+dx, party.y+dy) do 
		if each.name:match("door") or each.name:match("pit") then each:close() end 
	end 
________

By the way: If you played 'Eye of the Beholder' before, you might like to play it again on the PC (emulated).
GOG sells all three (with all of the clue books), and updated to install & run easily in Windows. I played them recently.
Although the PC versions were always missing the Amiga outro. :(

https://www.gog.com/game/forgotten_real ... ection_one

*These do go on sale every once in a while; with a decent price cut.
Last edited by Isaac on Sun Jan 28, 2018 4:21 am, edited 4 times in total.
Grimples
Posts: 4
Joined: Wed Jan 24, 2018 9:58 pm

Re: Using assets without dungeon mod

Post by Grimples »

I already knew about the console, i use it to spawn certain items. Those scripts will come in very handy, thankyou, but i would like to know how i can use an edited items.lua without an actual map mod. What would solve this is how do i extract .dat files, i could then edit the items.lua with the mod & then export it in the editor, i have done this Master Quest, the changes i have made in items.lua (i also cloned an extra satchel) show up in game.
User avatar
Isaac
Posts: 3172
Joined: Fri Mar 02, 2012 10:02 pm

Re: Using assets without dungeon mod

Post by Isaac »

Grimples wrote: What would solve this is how do i extract .dat files, i could then edit the items.lua with the mod & then export it in the editor, i have done this Master Quest, the changes i have made in items.lua (i also cloned an extra satchel) show up in game.
With Grimrock 1, you need to redefine most objects that you plan to change. Mods use custom assets, and the default assets. The default assets are not in the dat file. The game has those internally.

If you have the mod project files (as you mention with Master Quest), then you can edit them with Notepad (or a better) text editor, but the dat files are compressed editor output, with only the custom assets; and not intended for extraction—certainly the authors probably don't want that... but some don't mind sharing, and they do upload the unpacked version of their mods.

To get (and be able to edit) the default assets (like doors), you download the Asset Pack hosted here.
http://www.grimrock.net/modding_log1/asset-pack/

With these, you can copy a door definition, make changes to it, and add it to the objects.lua file in the mod; it will replace the default asset (for being defined after it). When finished, export the dat file, and play the custom game.
___

Allow me to recommend the One Room Round Robin II mod, for Grimrock 1. We (22 designers) spent over a year on it, and the source files are available.
One of its features is that much of its content is optional, and so won't necessarily impede progress if ignored.
viewtopic.php?f=14&t=6453

The premise of the mod is that each designer make their own 9x9(~x3) room in the dungeon. Solving a room grants you a special key; these keys open the doors to later levels. Most rooms in the mod are optional to visit.

It also has a complete Let's Play of it, by the author of Master Quest. 8-)
https://www.youtube.com/watch?v=JxkJxhH ... 5ubUbq7BDm
User avatar
Resu
Posts: 141
Joined: Tue Nov 10, 2015 12:09 am

Re: Using assets without dungeon mod

Post by Resu »

I see you improved your explaination about what is a console command even more, Isaac :D Well done! What would people just do without you? ;) You are really helpful. If I could I would give you a medal :D Remembers me about my own stuff I have to fix some day...
Post Reply