Legend of Grimrock
 
Create and download new dungeons, items, monsters, & environments
Use the Dungeon Editor to build entirely new adventures and challenges for other players to solve. Fill your dungeons with puzzles, traps, or even totally new items, monsters and environments with custom graphics and audio! Click here to learn more.
Detective Inspector Hardbody Dec 5, 2012 @ 6:07pm
Alcove Item Scripting
I'm having some real trouble here... I've watched videos, copied scripting but so far it's not working. My aim is to get an alcove to only activate a door when a green gem is placed in it, but so far I can only get it so that either everything opens the door or nothing does. I've checked the LOG tips for editing, even going into the specific page that describes exactly what I want, copied the script and changed names... but it won't work for me. If there are any kind souls out there who can offer me advice I would be very grateful. I'm not the most computer savvy person concerning scripts and editing but I have been looking and so far to no avail!

Thanks in advance for any help offered! :)
Showing 1-9 of 9 comments
< >
Billick 2 Dec 6, 2012 @ 1:15pm 
If you posted the script you have so far, I could take a look at it. You also might want to try the official modding forum, as there are quite a few friendly active modders over there who would be happy to help you out over there.
http://www.grimrock.net/forum/viewforum.php?f=14
Detective Inspector Hardbody Dec 7, 2012 @ 6:25am 
This is the script that I've added in from the scripting page of the modding site, directly copied:


function itemPuzzle()
= iterate through all contained items on alcove, checking for a matching name
for i in itemPuzzleAlcove:containedItems() do
if i.name == "green_gem_2" then
playSound("level_up")
break
end
end
end

I've changed things around but in this case have changed nothing but the item name from pitroot bread to green gem. I'm wanting to have a gem puzzle and the player is required to use gems to get into certain rooms and then must have them all to progress. I'm also wanting to add a timer to the doors of say 5 seconds but I imagine that's somewhere else. The door is called 'green_door' and will also be replaced with red and blue door. I also want to make a script for 3 alcoves that require each gem to be placed correctly fort he next door to open. I've followed the instructions for a combination lock so I imagine it would be much like that?

Thanks again :)
Billick 2 Dec 7, 2012 @ 9:54am 
There's a few possibilities, the most likely being that "green_gem_2" is the id of the item you're searching for and not the name. ids are unique (green_gem_1, green_gem_2, etc.) while names are generic (green_gem). You may want to try switching to
if i.id == "green_gem_2" then ... or
if i.name == "green_gem" then ...
It depends on if you want that specific green_gem, or any green_gem
It's also possible you forgot to point your alcove to your script function or your script function is referencing the wrong alcove (I've done both of these many times)
If all else fails throw some print statements in there to debug it like
print(i.name)
good luck!
Detective Inspector Hardbody Dec 7, 2012 @ 10:19am 
I will try a few of those things, thank you :)

One more Issue I'm having that you might be able to help with, should be simpler solution and it's another problem with copied script from the modding site. I'm trying to create a custom asset (In this case a sword) and I copy the script:


cloneObject{
name = "super_machete",
baseObject = "machete",
uiName = "Super Machete",
attackPower = 12,
damageType = "shock",
description = "This machete radiates with strange energy.",

I tried changing things, didn't work, so I also just kept it directly as it is, but everytime I try to load or re-load my map it gives me an error message stating that:

Unexpected symbol near '<eof>'

It references the lua file in the assets subfolder of LOG... sorry to hurl another question at you but I figure this one should be a simpler fix... fingers crossed :P
Detective Inspector Hardbody Dec 7, 2012 @ 10:25am 
Originally posted by Kevdogg155:
There's a few possibilities, the most likely being that "green_gem_2" is the id of the item you're searching for and not the name. ids are unique (green_gem_1, green_gem_2, etc.) while names are generic (green_gem). You may want to try switching to
if i.id == "green_gem_2" then ... or
if i.name == "green_gem" then ...
It depends on if you want that specific green_gem, or any green_gem
It's also possible you forgot to point your alcove to your script function or your script function is referencing the wrong alcove (I've done both of these many times)
If all else fails throw some print statements in there to debug it like
print(i.name)
good luck!

Fantastic! Thank you I think it was the ID problem. My dungeon can continue! :)
Billick 2 Dec 8, 2012 @ 8:04am 
Originally posted by Officer Mr Nice guy:
I will try a few of those things, thank you :)

One more Issue I'm having that you might be able to help with, should be simpler solution and it's another problem with copied script from the modding site. I'm trying to create a custom asset (In this case a sword) and I copy the script:


cloneObject{
name = "super_machete",
baseObject = "machete",
uiName = "Super Machete",
attackPower = 12,
damageType = "shock",
description = "This machete radiates with strange energy.",

I tried changing things, didn't work, so I also just kept it directly as it is, but everytime I try to load or re-load my map it gives me an error message stating that:

Unexpected symbol near '<eof>'

It references the lua file in the assets subfolder of LOG... sorry to hurl another question at you but I figure this one should be a simpler fix... fingers crossed :P
You need a closing bracket character at the end of your object definition:
}
[TCG]Beersmith Jan 29, 2013 @ 9:22pm 
cloneObject{ Attempt to call global 'cloneObject' (a nil value)
name = "super_machete",
baseObject = "machete",
uiName = "Super Machete",
attackPower = 12,
damageType = "shock",
description = "This machete radiates with strange energy."}

Not sure why I am getting this error. I copy and pasted.
LD-SK 2 Feb 11, 2013 @ 12:57am 
But where is the actual "Open door" action? before the break, you should add (assuming the door in question has id "puzzleDoor"):

puzzleDoor:open()


regarding your object error -- where are you putting this? in your mod_assets subdirectory, there is "scripts" folder, then in it, you will have objects.lua . the object cloning stuff MUST go into this file.
[TCG]Beersmith Feb 11, 2013 @ 7:17am 
I put it in the objects.lua but it does not seem to help - I will just use defualt item. Any way you could help me end my dungeon?
When the game is finished it writes game over tiny and allows the player to keep moving.
I have a tga file for intro and ending but I cant get either to work.
Showing 1-9 of 9 comments
< >
Per page: 15 30 50