dynamic torch removal

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
RayB
Posts: 116
Joined: Fri Mar 06, 2015 3:45 am

dynamic torch removal

Post by RayB » Thu Apr 23, 2020 4:07 pm

I am trying to remove a torch from a torch holder using script..

I have tried setting the 'hasTtorch' controller component to false but it doesn't work.
Even if I destroy the torch holder and then spawn a new one and set the' hasTorch' controller component to false (as done in the dungeon.lua file) it still doesn't work.

Can anyone tell me how to do this?

Zo Kath Ra
Posts: 829
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: dynamic torch removal

Post by Zo Kath Ra » Thu Apr 23, 2020 4:31 pm

RayB wrote:
Thu Apr 23, 2020 4:07 pm
I am trying to remove a torch from a torch holder using script..

I have tried setting the 'hasTtorch' controller component to false but it doesn't work.
Even if I destroy the torch holder and then spawn a new one and set the' hasTorch' controller component to false (as done in the dungeon.lua file) it still doesn't work.

Can anyone tell me how to do this?
Destroying the torch seems to work.

Code: Select all

if torch_holder_1.socket:count() == 1 then
	torch_holder_1.socket:getItem().go:destroy()
end

RayB
Posts: 116
Joined: Fri Mar 06, 2015 3:45 am

Re: dynamic torch removal

Post by RayB » Thu Apr 23, 2020 11:44 pm

Once again, Thank you.

Post Reply