Mummy puzzle problem
Posted: Sun Apr 19, 2015 7:14 pm
I accidently posted to legend of grimrock 1 side of the forum
the puzzle:
You stand beetween two rows of mummies in forcefields. The other one has buttons underneath, the other one doesn't. You must get the mummies in the row with buttons to be in the same order as the mummies in the row with buttons. This is done by pressing two different buttonns, which changes the position of the two respective mummies.
But there is an error! it is: "could not look up class name".
The function works well all the way until it prints out "progressing".
Also, you may notice i am destoying and then spawning entities. If there is a way to move entities around i'd gladly use it!
Here's the rest of the code:
the puzzle:
You stand beetween two rows of mummies in forcefields. The other one has buttons underneath, the other one doesn't. You must get the mummies in the row with buttons to be in the same order as the mummies in the row with buttons. This is done by pressing two different buttonns, which changes the position of the two respective mummies.
Code: Select all
function switchPlaces(button)
if selected1 == 0 then
selected1 = button.go.x
print("first one selected!")
print(selected1)
else
selected2 = button.go.x
print("second one selected!")
print(selected2)
end
if selected1 ~= selected2 and selected2 ~= 0 then
print("Progressing!")
for e in party.map:entitiesAt(selected1,7) do
for i in party.map:entitiesAt(selected2,7) do
if checkIfIsMummy(i) and checkIfIsMummy(e) then
i:setPosition(party.map, selected1, e.y, 2, 0)
e:setPosition(party.map, selected2, e.y, 2, 0)
end
end
end
elseif selected1 == selected2 then
selected2=0
print("corrected you fool!")
end
endThe function works well all the way until it prints out "progressing".
Also, you may notice i am destoying and then spawning entities. If there is a way to move entities around i'd gladly use it!
Here's the rest of the code:
Code: Select all
selected1=0
selected2=0
function checksides()
local matches = 0
for x = 14,17 do
for e in party.map:entitiesAt(x,7) do
for i in party.map:entitiesAt(x,13) do
if checkIfIsMummy(i) and checkIfIsMummy(e) then
print(e.name)
print(i.name)
print("")
if e.name == i.name then
matches = matches + 1
end
end
end
end
end
if matches == 4 then
puzzledoor_1.controller:open()
end
end
function checkIfIsMummy(entity)
local mummyList = {"mummy","mummy1","mummy2","mummy3"}
for _, value in pairs(mummyList) do
if value == entity.name then
return true
end
end
return false
end