restoration altar and other questions

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
The cube
Posts: 94
Joined: Tue Apr 23, 2013 6:09 pm
Location: Barren Desert

restoration altar and other questions

Post by The cube »

Hi guys!
I´m learning new things all the time, but still have no idea how some things work.
in the dungeon i`m currently working on,you will pick up a custom asset item called corpse, and place it to an altar.
then, the code`s supposed to remove the corpse and add a new champion to your party.
I use the Item on a alcove puzzle in modding guides for checking the item, and i know how to add the character, but after that i have no idea
what to do.Here`s what i tried:

Code: Select all

function restoreCorpsel()
   -- iterate through all contained items on altar, checking for a matching name
   for i in altarOfRestoration:containedItems() do
      if i.name == "corpse" then
        local champ = party:getChampion(2);
        if ( champ:getEnabled() == false ) then
           -- here it sets the champion`s stats and such 
              end 
          end
        break
        else
          hudPrint("The altar can`t restore that")
       end
   end
end
so how do i
1.make this work? :|
2. set it so that it will remove the corpse from the altar?



To the next question we go!

when you progress a little further, all torches in the room you are in are supposed to be deactivated by a script when the party presses a pressure plate.
in this one, i have no idea on how to do it. :oops: also, when the torches are deactivated, they trigger this piece of code:
Credit to mahric for making this piece of code below:

Code: Select all

function keepTorch(t)
	t:addItem(spawn("torch"))
	setMouseItem(nil)
	hudPrint("This torch is bolted to the wall and can't be removed")
end 
does that cause any problems?

Thanks for reading this far, if you can help me, please reply and explain me how should i do it. :)
Last edited by The cube on Wed May 01, 2013 5:14 pm, edited 1 time in total.
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: restoration altar and other questions

Post by msyblade »

on the 2nd question, you can select whether the torch is in a torchholder or not in a selection box once it is placed. If you want a torch, but do not want the player to be able to remove it, then you would connect the torchholder to a "script entity" in your dungeon, with exactly the script from above pasted or written in the script entity. Also, the torcholder connection must be set to de-activate, so when a player tries to REMOVE the torch, it triggers that script, which actually instantly destroys the torch they pick up, spawns a new one in the holder, and hudPrints "You cannot remove this torch" or whatever. Hope that helps! Credit to Mahric for making that really creative solution to the "controlled lighting" issue back in Wine Merchants Basement, and then sharing it with us.
Currently conspiring with many modders on the "Legends of the Northern Realms"project.

"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
User avatar
The cube
Posts: 94
Joined: Tue Apr 23, 2013 6:09 pm
Location: Barren Desert

Re: restoration altar and other questions

Post by The cube »

Yeah the keep torch script is awesome, but thats not what i asked, i asked how to make a script that removes the torches from the torchholders,
that are set to trigger the keeptorch function when they are deactivated. admitted, after reading my message again, i was confused myself too.
i`ll fix the original post so nobody will get confused by the 2nd question again.
User avatar
Damonya
Posts: 134
Joined: Thu Feb 28, 2013 1:16 pm
Location: France
Contact:

Re: restoration altar and other questions

Post by Damonya »

You can't, but destroy the torch_holder and together spawn a new torch_holder without torch.
Orwak - MOD - Beta version 1.0
User avatar
The cube
Posts: 94
Joined: Tue Apr 23, 2013 6:09 pm
Location: Barren Desert

Re: restoration altar and other questions

Post by The cube »

Great! Got that to work! still struggling with the first question, i don`t mind if the altar would be destroyed for removing the bones.
User avatar
Damonya
Posts: 134
Joined: Thu Feb 28, 2013 1:16 pm
Location: France
Contact:

Re: restoration altar and other questions

Post by Damonya »

Sorry but I didn't understand what was your first problem. You are from finland and me from france, so maybe we have difficulties to understand us in English. ^^

You want only to know how destroy an item in a alcove or other thing?
Orwak - MOD - Beta version 1.0
User avatar
The cube
Posts: 94
Joined: Tue Apr 23, 2013 6:09 pm
Location: Barren Desert

Re: restoration altar and other questions

Post by The cube »

Oh, i just was really stupid, and didin`t connect the altar to the code.. :oops:
also got that to work :)
Post Reply