sourcefiles of original LoG2 campaign

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
rick2025
Posts: 1
Joined: Mon Feb 10, 2025 4:43 pm

sourcefiles of original LoG2 campaign

Post by rick2025 »

i want to change and recreate parts of the original campaign. is there any way i can access the script files of the original campaign so that i can see how the original dungeons are build (dungeon source files, not the asset files).

thank you!
User avatar
Isaac
Posts: 3188
Joined: Fri Mar 02, 2012 10:02 pm

Re: sourcefiles of original LoG2 campaign

Post by Isaac »

Make a new map in the editor, and save the project; optionally name it Grimrock2.

Open the project file ( grimrock2.dungeon_editor ) in a text editor (like Notepad.exe).

Edit or replace the text with this:

Code: Select all

dungeonName "Legend of Grimrock 2"
author "Almost Human"
description ""
dungeonFolder "assets/dungeons/grimrock2"

Optionally change the description to suit you. The important value here is having dungeonFolder set to: "assets/dungeons/grimrock2".

This will allow you to load the base game into the editor.
This allows you to play and edit the maps, and allows reading scripts in the editor.

This does not allow you to save your changes to the base game.

* The location "assets/dungeons/grimrock2" is within the game's internal encrypted grimrock2.dat file. It's not a folder that can be directly explored with the OS file manager.

Ask minmay or 7Soul for information about uMod access to the game's internal systems.
User avatar
Sutekh
Posts: 129
Joined: Sun Nov 25, 2012 9:58 am
Location: UK

Re: sourcefiles of original LoG2 campaign

Post by Sutekh »

For anyone who's interested:

It is possible to use a crude work-around that allows us to save any changes we make to a cloned copy of Grimrock 2 created using the method above.

1: Open the project folder found at Documents > Almost Human > Legend of Grimrock 2 > Dungeons > Name of Project.
2: Here we will find a folder named mod_assets and the project's .dungeon_editor file. Make a new folder and name it assets.
3: Open this new folder and then make another one named dungeons.
4: Again, open this new folder, make another one and name it grimrock2.

This should now give us the following directory structure:
Documents > Almost Human > Legend of Grimrock 2 > Dungeons > Name of Project > assets > dungeons > grimrock2

All going well, we should now be able to open the project in the editor and save any changes we make.
User avatar
Isaac
Posts: 3188
Joined: Fri Mar 02, 2012 10:02 pm

Re: sourcefiles of original LoG2 campaign

Post by Isaac »

That sounds really cool. But I might have misunderstood —something.

I followed the instructions as I've understood them. In the editor, I moved the branch at Shipwreck Beach, at the cage, to a tile away, and exported the dungeon.

When I loaded the dungeon into the regular game the branch was unchanged; still in its original location. I had speculated that the saved changed might overwrite the base game .dat data in ram when loaded (after it), but that didn't seem to happen.

Does this method only work with new content changes?

Edit: I added an ogre in front of the cage; that didn't show up in the export either.
User avatar
Sutekh
Posts: 129
Joined: Sun Nov 25, 2012 9:58 am
Location: UK

Re: sourcefiles of original LoG2 campaign

Post by Sutekh »

I tried the same thing and yes, it appears that the changes don't stick when playing an exported version, only in the editor.

So, I then tried copying the dungeon.lua that was generated in the new folders after saving the project and pasting it into a brand new project, this time replacing the dungeon.lua in the standard mod_assets > scripts folder.
This produced an error message, as it was looking for an undefined object named world_map.
I was able to bypass this error message by opening the dungeon.lua in Notepad and commenting out 4 lines relating to the world_map object:

Code: Select all

--spawn("world_map",11,18,3,0,"world_map_1")
--spawn("script_entity",10,18,3,0,"script_entity_41")
--script_entity_41.script:setSource("world_map_1:setWorldPosition(vec(32.8, 0.9, 40))\
--world_map_1:setWorldRotationAnglesWithOrder(0, 130, 0, \"xzy\")\
I was then able to load the new project without issue, and the exported version loads with the changes I made.

I'm not sure if the world_map object is critical or not, but at least this way we can skip a lot of work in recreating the original game for the purposes of playing around with it. ;)
Post Reply