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
}
}
}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" },
},
},
}