Page 1 of 1
Scripting an alcove puzzle
Posted: Fri May 29, 2020 1:41 am
by Isaac_the_Khajiit
I'm trying to script an alcove to open a door when a specific item is inserted.
I've found tons of example scripts on this forum, but none of them work. I am a complete scripting novice. I know I need to swap out the names of the door, alcove, and items with my own names, but beyond that I can't understand what I'm doing wrong.
http://www.grimrock.net/modding_log1/ho ... ve-puzzle/ The script I found here crashes the editor.
Re: Scripting an alcove puzzle
Posted: Fri May 29, 2020 5:46 am
by Zo Kath Ra
Board index < Legend of Grimrock 2 < Mod Creation
http://www.grimrock.net/modding_log1/ho ... ve-puzzle/
Do you want to make a script for Grimrock 1 or 2 ?
Re: Scripting an alcove puzzle
Posted: Fri May 29, 2020 4:42 pm
by Isaac_the_Khajiit
Grimrock 2.
Re: Scripting an alcove puzzle
Posted: Fri May 29, 2020 5:16 pm
by Isaac
Connect the alcove to this script; adjust the door id, and the item name to suit.
Code: Select all
function checkItem(surface, item)
if item.go.name == "rock" then --target item name
local door = findEntity('dungeon_door_wooden_1') --target door id
if door then
door.door:open()
end
end
end
Welcome to the forum.

Re: Scripting an alcove puzzle
Posted: Fri May 29, 2020 5:27 pm
by Zo Kath Ra
In LoG 2, it's simpler:
Code: Select all
function itemPuzzle(caller, item)
if item.go.name == "pitroot_bread" then
playSound("level_up")
end
end
"caller" contains the alcove's Surface component.
"item" contains the inserted object's Item component.
".go" references the component's game object.
(LoG 1 didn't have components)
To learn more about the differences between LoG 1 and LoG 2 scripting, I'd recomend the LoG 2 modding guide:
http://www.grimrock.net/modding/
Re: Scripting an alcove puzzle
Posted: Fri May 29, 2020 6:08 pm
by Isaac_the_Khajiit
Thank you both!