Torch item in ring slot?
Torch item in ring slot?
Is it possible to make an item like a torch, but instead it makes light when in the character's ring slot? Thanks.
Grey Island mod(WIP): http://www.grimrock.net/forum/viewtopic ... 99#p123699
- Zo Kath Ra
- Posts: 931
- Joined: Sat Apr 21, 2012 9:57 am
- Location: Germany
Re: Torch item in ring slot?
This example should get you started.
You have to change the properties of the light component to make it look the way you want.
Unfortunately, I can't help you here, because I don't know what most of the LightComponent properties are for.
Code: Select all
defineObject{
name = "torch_ring",
baseObject = "base_item",
components = {
{
class = "Model",
model = "assets/models/items/brace_fortitude.fbx",
},
{
class = "Item",
uiName = "Torch Ring",
description = "A magic ring that provides light.",
gfxIndex = 75,
weight = 0.15,
traits = { "bracers" },
onEquipItem = function(self, champion, slot)
print("onEquipItem")
if (slot == ItemSlot.Bracers) then
print("on")
local light_component = party:createComponent("Light", "torch_ring")
light_component:setBrightness(15)
end
end,
onUnequipItem = function(self, champion, slot)
print("onUnequipItem")
if (slot == ItemSlot.Bracers) then
print("off")
party:removeComponent("torch_ring")
end
end,
},
},
}
Why did you delete your answer?
It was good, in fact this code is based on it.
Re: Torch item in ring slot?
I am not at home, and working on an underpowered windows tablet. I had trouble testing the answer, and found that the only thing that seemed to work was enabling or disabling the light component; changes to the component settings weren't working as expected.Zo Kath Ra wrote: ↑Wed Oct 21, 2020 1:15 pm @Isaac
Why did you delete your answer?
It was good, in fact this code is based on it.
*Also the tablet settings were the lowest render quality.
Re: Torch item in ring slot?
Thank you, this is very helpful. (the reason I needed this is because my dungeon is single-player, so I figured it would just make it harder if they had to use one of their hands holding a torch)
Grey Island mod(WIP): http://www.grimrock.net/forum/viewtopic ... 99#p123699