Legend of Grimrock
สร้างและดาวน์โหลดดันเจียน ไอเท็ม ปีศาจ และสภาพแวดล้อมใหม่ ๆ
ใช้ Dungeon Editor เพื่อสร้างการผจญภัยครั้งใหม่และสร้างความท้าทายให้กับผู้เล่นอื่น เติมเต็มดันเจียนของคุณด้วยปริศนา กับดัก หรือแม้กระทั่งไอเท็ม ปีศาจ และสภาพแวดล้อมใหม่ทั้งหมด ด้วยภาพกราฟิกและเสียงที่สร้างขึ้นเอง คลิก ที่นี่ เพื่อเรียนรู้เพิ่มเติม
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! :)
< >
กำลังแสดง 1-9 จาก 9 ความเห็น
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
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 :)
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!
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
โพสต์ดั้งเดิมโดย 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! :)
โพสต์ดั้งเดิมโดย 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:
}
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.
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.
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.
< >
กำลังแสดง 1-9 จาก 9 ความเห็น
ต่อหน้า: 1530 50