Ask a simple question, get a simple answer

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!
User avatar
KhrougH
Posts: 76
Joined: Tue Sep 04, 2018 11:45 pm
Location: Roma

Re: Ask a simple question, get a simple answer

Post by KhrougH »

i did it :D

Code: Select all

function connectBreakables()
    local objects = Dungeon.getMap(self.go.level):allEntities()
	for obj in objects do
		local oggetto = findEntity(obj.id)
		if oggetto.obstacle and oggetto.health and oggetto.health:getConnectorCount() < 1 then 
			print("oggetto: "..oggetto.id)
            oggetto.health:addConnector("onDie", self.go.id, "spannatorcia")
        end
    end
end

function spannatorcia(oggetto)
    if oggetto then
        local OG = oggetto.go
        oggetto.go:spawn("torch", OG.x, OG.y, OG.facing, OG.elevation)
    end
end
after some test and imprecations i finally found the way :P
[...]
All those moments will be lost in time, like tears in rain.
Time to die.
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

KhrougH wrote: Sat Sep 28, 2024 1:59 am

Code: Select all

if oggetto.obstacle and oggetto.health and oggetto.health:getConnectorCount() < 1 then 
Should be: [My mistake for not including it earlier.]

Code: Select all

if oggetto and oggetto.obstacle and oggetto.health and oggetto.health:getConnectorCount() < 1 then 
The reason being that if findEntity(obj.id) ever returns as nil then calling the oggetto object will cause a crash.
User avatar
KhrougH
Posts: 76
Joined: Tue Sep 04, 2018 11:45 pm
Location: Roma

Re: Ask a simple question, get a simple answer

Post by KhrougH »

right. better! :D
[...]
All those moments will be lost in time, like tears in rain.
Time to die.
User avatar
KhrougH
Posts: 76
Joined: Tue Sep 04, 2018 11:45 pm
Location: Roma

Re: Ask a simple question, get a simple answer

Post by KhrougH »

where are files where i can take or modify images like "editorIcon" or "gfxIndex"?
i can't find files who contains these references
[...]
All those moments will be lost in time, like tears in rain.
Time to die.
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

KhrougH wrote: Sat Sep 28, 2024 9:06 am where are files where i can take or modify images like "editorIcon" or "gfxIndex"?
i can't find files who contains these references
For the editor icons, it requires editing the grimrock2.dat file.
For gfxIndex, they use the three item image atlases found in \assets\textures\gui. [items.dds, items_2.dds, items_3.dds ]
User avatar
DaggorathMaster
Posts: 53
Joined: Thu Sep 08, 2022 7:29 pm

Re: Ask a simple question, get a simple answer

Post by DaggorathMaster »

For gfxIndex, in the definition files you can add:
'gfxAtlas = "mod_assets/textures/atlas/<user_atlas_1>.tga,"'
'gfxIndex = (#),'
To individual game object definitions.

(user_atlas_1, or whatever your own files are named).
Then you can keep the default icons for most things, and add your own for new/changed entities.

The atlas image needs to be exported as dds, BC3 / DXT5 (which gives decent transparency).
GIMP has a free downloadable exporter for that.
No mipmaps needed for the atlas.
The file you save is .dds, but for some reason the game looks for it with a .tga extension.
User avatar
KhrougH
Posts: 76
Joined: Tue Sep 04, 2018 11:45 pm
Location: Roma

Re: Ask a simple question, get a simple answer

Post by KhrougH »

DaggorathMaster wrote: Sun Sep 29, 2024 10:59 pm For gfxIndex, in the definition files you can add:
'gfxAtlas = "mod_assets/textures/atlas/<user_atlas_1>.tga,"'
'gfxIndex = (#),'
To individual game object definitions.

(user_atlas_1, or whatever your own files are named).
Then you can keep the default icons for most things, and add your own for new/changed entities.

The atlas image needs to be exported as dds, BC3 / DXT5 (which gives decent transparency).
GIMP has a free downloadable exporter for that.
No mipmaps needed for the atlas.
The file you save is .dds, but for some reason the game looks for it with a .tga extension.
what about 'tiles' icons?
[...]
All those moments will be lost in time, like tears in rain.
Time to die.
User avatar
KhrougH
Posts: 76
Joined: Tue Sep 04, 2018 11:45 pm
Location: Roma

Re: Ask a simple question, get a simple answer

Post by KhrougH »

DaggorathMaster wrote: Sun Sep 29, 2024 10:59 pm The atlas image needs to be exported as dds, BC3 / DXT5 (which gives decent transparency).
GIMP has a free downloadable exporter for that.
last version of GIMP has this exporter already integrated.
[...]
All those moments will be lost in time, like tears in rain.
Time to die.
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

@KhrougH

Do you have the LoG2 asset pack installed? This gives you nearly all of the scripts and textures of the game, including monsters and some UI elements; atlas textures.

You can use or substitute these in your own scripts and asset definitions.
User avatar
ChaosLord316
Posts: 5
Joined: Sun Oct 13, 2024 9:58 pm

Re: Ask a simple question, get a simple answer

Post by ChaosLord316 »

Isaac wrote: Fri Oct 11, 2024 1:26 am
Do you have the LoG2 asset pack installed? This gives you nearly all of the scripts and textures of the game, including monsters and some UI elements; atlas textures.

You can use or substitute these in your own scripts and asset definitions.
Hello, Isaac. I'm a big fan of all the help you do around here, and your "tomb wall fix" was instrumental in making my dungeon that I just released.

I think I ask for a couple people when I ask, where and how would one go about getting and installing the LoGII Asset Pack in 2024? I've tried the links here, but they don't seem to work for me. Any help with this would be greatly appreciated. Thank you.
Post Reply