Please take a look at my simple script.

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
Tarbel
Posts: 4
Joined: Sat Feb 07, 2015 8:44 am

Please take a look at my simple script.

Post by Tarbel »

I like so many others are trying to re-create the statue puzzle. I have done all the searches and read all the posts. I have also looked at the training videos. I am still getting an error when this script executes.

function surfaceContains(surface, item)
for v,i in surface:contents() do
if i.go.name == item then return true
end
end
end


function CastleDoor()
if surfaceContains(beach_puzzle_statue_1.surface, "rapier") then
castle_entrance_door_1.door:open()
else
castle_entrance_door_1.door:close()
end
end


Any help would be greatly appreciated. Please be kind as this is my first post.

-Tarbel
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Please take a look at my simple script.

Post by minmay »

beach_puzzle_statue does not have a SurfaceComponent. It has a SocketComponent.

You can look at the main campaign in the editor to see how all the original puzzles etc. are done.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Tarbel
Posts: 4
Joined: Sat Feb 07, 2015 8:44 am

Re: Please take a look at my simple script.

Post by Tarbel »

Thank you Minmay for the quick response.

I am now able to call up the game in the editor and view the actual scripts used. This will be a huge help!

In reviewing the scripts used in "Shipwreck Beach" I didn't find anything that identified a "Rapier" as the item the statue is looking for. So I assumed it must be the default item. In my mod it works just fine with no script if I want the user to place a "Rapier" on the statue.

Is it possible to change the requirement to a different item? If so how?

Thanks, Tarbel
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Please take a look at my simple script.

Post by minmay »

Download the asset pack and look at the definition for beach_puzzle_statue.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Post Reply