The easiest way to make "magical" container

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
User avatar
Adrageron
Posts: 165
Joined: Thu Nov 08, 2012 1:22 pm

The easiest way to make "magical" container

Post by Adrageron » Wed Nov 24, 2021 1:54 pm

I apologize if this has already been discussed somewhere, I did not find such information on the forums.
To prevent the container from taking into account the weight of its content, you just need to give a custom name to the ContainerItem component. Like this:

Code: Select all

class = "ContainerItem",
name = "sack",
And that's it, the game will not recalculate it's weight. Be careful though if you already have such non-empty containers on the map, because the editor will generate an error when trying to initialize them.
To be honest, I have not tried to achieve this effect, quite the opposite, one of my custom containers "broke", and I tried to figure out the root of this bug for quite a some time :)

minmay
Posts: 2718
Joined: Mon Sep 23, 2013 2:24 am

Re: The easiest way to make "magical" container

Post by minmay » Wed Nov 24, 2021 8:58 pm

Unfortunately this will have some other side effects:
- The "(Right-click to open)" text won't appear on in the tooltip for the item
- PartyComponent:isCarrying() won't detect items in the container
- Compasses inside the container won't work
- Herbs inside the container won't multiply for Alchemists
- The dungeon editor won't recognize that the ids of objects inside the container are taken, so for example, if you have an item in the container called "rock_1", the dungeon editor will still auto-generate "rock_1" as the default id for the next rock you place.
- The dungeon editor's search dialog won't be able to find the object
- CraftPotionComponent won't be able to use herbs from the container
- The container won't be highlit in the inventory while open
- The object inspector in the dungeon editor will allow recursive inspection of containers inside the container (this could actually be useful though!)
- onInit hooks for objects inside the container won't run
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.

User avatar
Adrageron
Posts: 165
Joined: Thu Nov 08, 2012 1:22 pm

Re: The easiest way to make "magical" container

Post by Adrageron » Wed Nov 24, 2021 11:58 pm

minmay wrote:
Wed Nov 24, 2021 8:58 pm
Unfortunately this will have some other side effects:
Wow, that was informative!
Thank you for warning! No easy way to do magick it seems :mrgreen:

Post Reply