Amulet of Bushwalking

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
Zo Kath Ra
Posts: 944
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Amulet of Bushwalking

Post by Zo Kath Ra »

Eons ago, the Adepts of Nex were faced with a problem: when they walked the forest, looking for rare herbs, bushes often blocked their path. Not only that, but the bushes also tore at the precious fabric of their expensive robes.

Out of sheer desperation, they resolved to create a powerful artifact enabling the wearer (and anyone in their party) to walk through bushes as if they did not exist.

After many moons, the Amulet of Bushwalking was completed. Ancient scrolls from this legendary time period show the code they used...

Put this in your mod's init.lua:

Code: Select all

defineObject{
    name = "party",
    baseObject = "party",
    components = {
        {
            class = "Party",
            
            onMove = function(self, dir)
                for entity in self.go.map:entitiesAt(self.go.x, self.go.y) do
                    if (entity.name == "forest_plant_cluster_01") then   -- does the tile we're currently on contain a "forest_plant_cluster_01"?
                        entity.obstacle:setBlockParty(true)   -- if it does, block it
                    end
                end
                
                local champion_wearing_amulet = false
                for i = 1, 4 do
                    local champion = self:getChampionByOrdinal(i)
                    if (champion:getItem(ItemSlot.Necklace) ~= nil) then
                        if (champion:getItem(ItemSlot.Necklace).go.name == "bushwalker_pendant") then
                            champion_wearing_amulet = true
                        end
                    end
                end
                
                if (champion_wearing_amulet) then
                    local dx,dy = getForward(dir)
                    for entity in self.go.map:entitiesAt(self.go.x + dx, self.go.y + dy) do
                        if (entity.name == "forest_plant_cluster_01") then   -- does the tile we're moving onto contain a "forest_plant_cluster_01"?
                            entity.obstacle:setBlockParty(false)   -- if it does, unblock it
                        end
                    end
                end
            end,
            
            onTurn = function(self, direction)
                for entity in self.go.map:entitiesAt(self.go.x, self.go.y) do
                    if (entity.name == "forest_plant_cluster_01") then   -- does the tile we're currently on contain a "forest_plant_cluster_01"?
                        entity.obstacle:setBlockParty(true)   -- if it does, block it
                    end
                end
            end
        }
    }
}
And this in items.lua:

Code: Select all

defineObject{
	name = "bushwalker_pendant",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "assets/models/items/spiritwalker_pendant.fbx",
		},
		{
			class = "Item",
			uiName = "Amulet of Bushwalking",
			description = "This powerful amulet lets you walk through bushes!",
			gfxIndex = 307,
			weight = 0.3,
			traits = { "necklace" },
		},
	},
}
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: Amulet of Bushwalking

Post by petri »

Hah! Awesome concept! Little details like the history of the amulet really give life to the setting. This is how we approached the design of items and monsters and other lore elements. Not all of it is revealed in the game but the thought process behind the desings make the island a consistent place I believe.

:)
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: Amulet of Bushwalking

Post by bongobeat »

great stuff! thanks :D
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
Azel
Posts: 808
Joined: Thu Nov 06, 2014 10:40 pm

Re: Amulet of Bushwalking

Post by Azel »

Love the Amulet! Although... I'm not sure I'm ready to let ya' in to my brush, na mean? :shock:
User avatar
Dr.Disaster
Posts: 2876
Joined: Wed Aug 15, 2012 11:48 am

Re: Amulet of Bushwalking

Post by Dr.Disaster »

;) i had to check the item name twice to make sure it's not an
SpoilerShow
Amulet of Bushwhacking
Post Reply