I'm stumped... help!

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Aazlan
Posts: 13
Joined: Thu Sep 13, 2012 6:59 pm

Re: I'm stumped... help!

Post by Aazlan »

Finally...

Just in case someone else wanted to insert varied color gems in eye sockets:

Code: Select all

cloneObject{
		name = "green_eye_right",
		baseObject = "eye_socket_right",

		onInsertItem = function(green_gem)
		print("Green Gem Inserted Right")
		return true
		end,
}
Obviously place this in your "../mod_assets/scripts/objects.lua" and replace green and/or right with your needs.
User avatar
Shadowfied
Posts: 47
Joined: Wed Apr 11, 2012 10:42 pm

Re: I'm stumped... help!

Post by Shadowfied »

Can anyone explain how to use the Door:setOpenedBy(key) script?

Do you just put this in a script entity? How do you specify which door is gonna be opened by this item?
User avatar
antti
Posts: 688
Joined: Thu Feb 23, 2012 1:43 pm
Location: Espoo, Finland
Contact:

Re: I'm stumped... help!

Post by antti »

Shadowfied wrote:Can anyone explain how to use the Door:setOpenedBy(key) script?

Do you just put this in a script entity? How do you specify which door is gonna be opened by this item?
Yeah, add a script entity and refer to the door with its ID. For example, if you would want to open a with the ID of dungeon_door_wooden_locked_1 with an iron key, you could add the following line to a script entity:

Code: Select all

dungeon_door_wooden_locked_1:setOpenedBy("iron_key")
Steven Seagal of gaming industry
User avatar
Shadowfied
Posts: 47
Joined: Wed Apr 11, 2012 10:42 pm

Re: I'm stumped... help!

Post by Shadowfied »

antti wrote:
Shadowfied wrote:Can anyone explain how to use the Door:setOpenedBy(key) script?

Do you just put this in a script entity? How do you specify which door is gonna be opened by this item?
Yeah, add a script entity and refer to the door with its ID. For example, if you would want to open a with the ID of dungeon_door_wooden_locked_1 with an iron key, you could add the following line to a script entity:

Code: Select all

dungeon_door_wooden_locked_1:setOpenedBy("iron_key")
Oh, so I had it correct already. Just had to be an iron key. Is there a way to make it work with other keys?

Thanks.
User avatar
antti
Posts: 688
Joined: Thu Feb 23, 2012 1:43 pm
Location: Espoo, Finland
Contact:

Re: I'm stumped... help!

Post by antti »

Shadowfied wrote:
antti wrote:
Shadowfied wrote:Can anyone explain how to use the Door:setOpenedBy(key) script?

Do you just put this in a script entity? How do you specify which door is gonna be opened by this item?
Yeah, add a script entity and refer to the door with its ID. For example, if you would want to open a with the ID of dungeon_door_wooden_locked_1 with an iron key, you could add the following line to a script entity:

Code: Select all

dungeon_door_wooden_locked_1:setOpenedBy("iron_key")
Oh, so I had it correct already. Just had to be an iron key. Is there a way to make it work with other keys?

Thanks.
Any key should work
Steven Seagal of gaming industry
User avatar
Shadowfied
Posts: 47
Joined: Wed Apr 11, 2012 10:42 pm

Re: I'm stumped... help!

Post by Shadowfied »

The brass key didn't.
User avatar
Montis
Posts: 340
Joined: Sun Apr 15, 2012 1:25 am
Location: Grimrock II 2nd playthrough (hard/oldschool)

Re: I'm stumped... help!

Post by Montis »

What he means is that you can swap out the yellow part below to any key object that exists, afterwards it should work with that kind of key.

dungeon_door_wooden_locked_1:setOpenedBy("iron_key")
When destiny calls, the chosen have no choice.

My completed dungeon (LoG1): Hypercube
User avatar
resonansER
Posts: 92
Joined: Fri Mar 02, 2012 2:02 pm
Location: Kiev, Ukraine
Contact:

Re: I'm stumped... help!

Post by resonansER »

antti wrote:Yeah, add a script entity and refer to the door with its ID. For example, if you would want to open a with the ID of dungeon_door_wooden_locked_1 with an iron key, you could add the following line to a script entity:

Code: Select all

dungeon_door_wooden_locked_1:setOpenedBy("iron_key")
Any key should work
WHERE put this code? In which file? :(
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: I'm stumped... help!

Post by Komag »

You just add a script "lua" to your map, anywhere, with that line in it, that's all. Then it will work

I wrote it more detailed here:
viewtopic.php?f=14&t=3099
Last edited by Komag on Fri Sep 14, 2012 1:09 pm, edited 1 time in total.
Finished Dungeons - complete mods to play
User avatar
Montis
Posts: 340
Joined: Sun Apr 15, 2012 1:25 am
Location: Grimrock II 2nd playthrough (hard/oldschool)

Re: I'm stumped... help!

Post by Montis »

resonansER wrote:
antti wrote:Yeah, add a script entity and refer to the door with its ID. For example, if you would want to open a with the ID of dungeon_door_wooden_locked_1 with an iron key, you could add the following line to a script entity:

Code: Select all

dungeon_door_wooden_locked_1:setOpenedBy("iron_key")
Any key should work
WHERE put this code? In which file? :(
Image

See also highlight.
When destiny calls, the chosen have no choice.

My completed dungeon (LoG1): Hypercube
Post Reply