Key Lock Puzzle maybe

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
User avatar
Mysterious
Posts: 226
Joined: Wed Nov 06, 2013 8:31 am

Key Lock Puzzle maybe

Post by Mysterious »

Hi guys I originally got this code from DesperateGames and now I got it to work. Ok here is what you need for 2 Locks:

1 x door: mine is. dungeon_door_wooden_9
1 x counter called: unlockCounter2
Value = 0
1 x Script Entity called: What ever you like.
2 x Locks: (on the wall) or more see (below)
opened by 2 different Keys eg: brass and silver.
Connect the 2 Locks to: function addUnlock1()

When the 2 keys are placed into the locks the door will open. Also I have added at the end of the code away to use extra locks.

Code: Select all

unlockCounter2 = 0

function addUnlock1() ---Connect both locks to this function yeah---

playSound("secret")
unlockCounter2 = unlockCounter2 + 1

if unlockCounter2 ==1 then
hudPrint("First lock unlocked.")

elseif unlockCounter2==2 then
hudPrint("Second lock unlocked.")

dungeon_door_wooden_9.door:open()
party.party:getChampion(1,4):gainExp(50)
hudPrint("DRACO: Well what can I say")
hudPrint("")
hudPrint("Gained 50 Xp") 
end
	end

--- If you want to add more locks with more Keys---
--- Third Lock: I have just added more code ---

unlockCounter2 = 0

function addUnlock1()

playSound("secret")
unlockCounter2 = unlockCounter2 + 1

if unlockCounter2 ==1 then
hudPrint("First lock unlocked.")

elseif unlockCounter2==2 then
hudPrint("Second lock unlocked.")

elseif unlockCounter2==3 then    ---added extra code here---
hudPrint("Third lock unlocked.")

---add another lock here if you wish eg:
--if unlockCounter2 ==4 then
--hudPrint("Forth lock unlocked.")

dungeon_door_wooden_9.door:open()
party.party:getChampion(1,4):gainExp(50)
hudPrint("DRACO: Well what can I say")
hudPrint("")
hudPrint("Party Gained 50 Xp") 
end
	end
Anyway it is simple for the coders, but for me well.....it works that's what matters :) Any how's if there are problems call me.
User avatar
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Key Lock Puzzle maybe

Post by Eleven Warrior »

Now I need this man I rem this from the guys and almost forgot it. Thxxs bro.

EDIT: Hey add this to the Thread guys it's good...........
Post Reply