Recreate level 4 puzzle problems

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
neonille
Posts: 2
Joined: Fri Oct 19, 2012 9:46 pm

Recreate level 4 puzzle problems

Post by neonille »

I want to "recreate" the puzzle on level 4, where you have to put a specific scroll in a specific alcove.
I also want these scrolls to be found on an alcove or altar.

So..

1. The script from the website only makes it work for any scroll or any dagger as long as it is in the same "item group". I want it to only work with a very specific item (in this case a specific scroll)
Im guessing it will have something to do with the items id?

Code: Select all

function itemPuzzle()
   -- iterate through all contained items on alcove, checking for a matching name
   for i in itemPuzzleAlcove:containedItems() do
      if i.name == "scroll" then
         playSound("level_up")
         break
      end
   end
end
What should i add/change in the code to make this work?

2. I want these scrolls not to just lay around on the ground, these scrolls are gonna be put in an alcove or on an altar. But how do i give an item an uniqe id that i created via script?

Code: Select all

local message = spawn("scroll")
message:setScrollText("This is an important\nmessage!")

scrollAlcove:addItem(message)
What should i change/add here to make the item have a specific id?
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Recreate level 4 puzzle problems

Post by Komag »

I haven't actually tried this, but maybe it will work - spawn the scroll fully, with x, y, facing, and id:

Code: Select all

local message = spawn("scroll", 1, 13, 15, 2, "goodScroll1")
message:setScrollText("This is an important\nmessage!")
scrollAlcove:addItem(message)
for the alcove check, us i.id instead of i.name, then you can be specific:

Code: Select all

if i.id == "goodScroll1" then
Finished Dungeons - complete mods to play
neonille
Posts: 2
Joined: Fri Oct 19, 2012 9:46 pm

Re: Recreate level 4 puzzle problems

Post by neonille »

Komag wrote:I haven't actually tried this, but maybe it will work - spawn the scroll fully, with x, y, facing, and id:

Code: Select all

local message = spawn("scroll", 1, 13, 15, 2, "goodScroll1")
message:setScrollText("This is an important\nmessage!")
scrollAlcove:addItem(message)
for the alcove check, us i.id instead of i.name, then you can be specific:

Code: Select all

if i.id == "goodScroll1" then
Dosen´t work, says that the entity already exist
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Recreate level 4 puzzle problems

Post by Komag »

does it say that right when you start the play?

try this:

Code: Select all

scrollAlcove:addItem(spawn("scroll", 1, 13, 15, 2, "goodScroll1"):setScrollText("This is an important\nmessage!"))
that probably won't work though either

You have two other options: just spawn them on the ground (like they did on the original level 4), or you can define four new objects that clone a scroll which would allow you to go back to using i.name
Finished Dungeons - complete mods to play
User avatar
Edsploration
Posts: 104
Joined: Wed Sep 19, 2012 4:32 pm

Re: Recreate level 4 puzzle problems

Post by Edsploration »

Here's another solution, tested and it works for me:

Code: Select all

dungeon_alcove_1:addItem(spawn("scroll"))
local temp = dungeon_alcove_1:containedItems()
scrollReference = temp() -- gets 1st item in alcove, use a for loop + if check if multiple items are involved

-- scrollReference can now be called from anywhere in the same script entity
scrollReference:setScrollText("Scrolls are so much fancier than notes!")
Open Project -> Community FrankenDungeon: viewtopic.php?f=14&t=4276
Decayer
Posts: 65
Joined: Sat Oct 13, 2012 3:19 pm

Re: Recreate level 4 puzzle problems

Post by Decayer »

Code: Select all

my_alcove:addItem(spawn("scroll_fireburst", nil, nil, nil, nil, "my_id"))
seems to work nicely.
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Recreate level 4 puzzle problems

Post by Komag »

nice to see some new solutions to this!
Finished Dungeons - complete mods to play
Post Reply