Need help with a script
Posted: Tue Nov 06, 2018 7:22 pm
Hello there!
I'm quite new to modding and an absolute noob when it comes to scripting.
But since I'm working on my own dungeon I though I'd give it a try and I ended up confused...
I've tried to use the script from this post viewtopic.php?f=22&t=8214 for a simple puzzle, where you just need to walk in a circle and therefore removed everything that has to do with the torches and the light.
That's what I finally got:
And i ended up with "attempt to index a nil value X" for line 9. And I'm pretty sure there's more that's wrong...
Sadly I'm still learning about lua, which is why I can't figure out, what to do in order to make it work and I'm grateful for anyone, how can help me here
I'm quite new to modding and an absolute noob when it comes to scripting.
But since I'm working on my own dungeon I though I'd give it a try and I ended up confused...
I've tried to use the script from this post viewtopic.php?f=22&t=8214 for a simple puzzle, where you just need to walk in a circle and therefore removed everything that has to do with the torches and the light.
That's what I finally got:
Code: Select all
pathcount = 0
pathsolved = 0
function pathpuzzlecircle()
if pathsolved == 0 then
local currentactivated = {}
for i = 1,12 do
currentactivated[i] = findEntity("pathtrigger"..i)
if currentactivated[i].floortrigger:isActivated() then
if i == pathcount + 1 then
pathcount = pathcount + 1
if pathcount == 12 then
return invisible_wall_182: destroy()
end
elseif i == pathcount then
--do nothing
elseif i == 1 then
--start reset
pathcount = 1
else
-- total reset
pathcount = 0
end
end
end
end
end
Sadly I'm still learning about lua, which is why I can't figure out, what to do in order to make it work and I'm grateful for anyone, how can help me here