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!
I been trying to get this to work but no luck maybe someone can help.
Doors is set to - combinationDoor
Levers are set to - combinationLever1, combinationLever2, combinationLever3
All 3 levers connected to script.
error- attempt to call method 'getLeverState' (a nil value)
-- combination lock puzzle
function pullLever()
if combinationLever1:getLeverState() == "activated" and
combinationLever2:getLeverState() == "deactivated" and
combinationLever3:getLeverState() == "activated" then
combinationDoor:open()
else
combinationDoor:close()
end
end
-- combination lock puzzle
function checkLevers()
if combination_lever_1.lever:isActivated() and not combination_lever_2.lever:isActivated() and combination_lever_3.lever:isActivated() then
combination_door.door:open()
else
combination_door.door:close()
end
end
I been using this which works.What would I have to add to the script if a want a trap or monster to spawn if a fail on combination after pushing
button. Anyone have a link on info or add code thanks.
function testlock()
if counter_1.counter:getValue() == 1 and
counter_2.counter:getValue() == 0 and
counter_3.counter:getValue() == 1 and
counter_4.counter:getValue() == 0 and
counter_5.counter:getValue() == 1 then
test_door.door:open()
else
test_door.door:close()
end
end
Hi man try this (function). Simple to implement. There are of course better ways to do this function, but this is easy to understand I hope this is what you are after.
The only problem is if the player continues to do the lever, button sequence again and again it will continue to spawn the monster.
function testlock()
if counter_1.counter:getValue() == 1 and
counter_2.counter:getValue() == 0 and
counter_3.counter:getValue() == 1 and
counter_4.counter:getValue() == 0 and
counter_5.counter:getValue() == 1 then
test_door.door:open()
else
spawn("herder",1,1,1,1,0)
party.party:shakeCamera(1,1) ---Not Needed
playSound("lighting_bolt_hit",1,1,1,1,0) ---Not Needed
test_door.door:close()
end
I been working on a combination lever puzzle but am having some trouble. I have 5 groups of levers with 5 levers in each of them on the wall shaped like a diamond.
I want each on of these groups of levers to open one door when each combination gets solved. I figure I might need a counter but not sure how to make it work in
a script. Can anyone help. I have this setup x5 scripts right now all different combination.
function checkLevers()
if combination_lever_1.lever:isActivated() and
combination_lever_2.lever:isActivated() and
combination_lever_3.lever:isActivated() and
combination_lever_4.lever:isActivated() and
combination_lever_5.lever:isActivated() then
combination_door.door:open()
else
combination_door.door:close()
end
end
THOM formaly known as tschrage _______________________________________________ My MOD (LoG1):Castle RingfortThread My MOD (LoG2):Journey To JusticeThread | Download
Does it work for GR2? I think this will work for what I need. I'll try the other one to you mentioned.
function checkLevers()
if lever_1_1.lever:isActivated() and
lever_2_1.lever:isActivated() and
lever_3_1.lever:isActivated() and
lever_4_1.lever:isActivated() and
lever_5_1.lever:isActivated() and
lever_1_2.lever:isActivated() and
lever_2_2.lever:isActivated() and
lever_3_2.lever:isActivated() and
lever_4_2.lever:isActivated() and
lever_5_2.lever:isActivated() and
lever_1_3.lever:isActivated() and
lever_2_3.lever:isActivated() and
lever_3_3.lever:isActivated() and
lever_4_3.lever:isActivated() and
lever_5_3.lever:isActivated() and
lever_1_4.lever:isActivated() and
lever_2_4.lever:isActivated() and
lever_3_4.lever:isActivated() and
lever_4_4.lever:isActivated() and
lever_5_4.lever:isActivated() and
lever_1_5.lever:isActivated() and
lever_2_5.lever:isActivated() and
lever_3_5.lever:isActivated() and
lever_4_5.lever:isActivated() and
lever_5_5.lever:isActivated() then
playSound("chime_01")
combo_door_1b.door:open()
else
combo_door_1b.door:close()
end
end