Page 1 of 1

restoration altar and other questions

Posted: Wed May 01, 2013 1:35 pm
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. :)

Re: restoration altar and other questions

Posted: Wed May 01, 2013 3:48 pm
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.

Re: restoration altar and other questions

Posted: Wed May 01, 2013 5:12 pm
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.

Re: restoration altar and other questions

Posted: Wed May 01, 2013 6:01 pm
by Damonya
You can't, but destroy the torch_holder and together spawn a new torch_holder without torch.

Re: restoration altar and other questions

Posted: Thu May 02, 2013 3:17 pm
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.

Re: restoration altar and other questions

Posted: Thu May 02, 2013 11:03 pm
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?

Re: restoration altar and other questions

Posted: Fri May 03, 2013 1:44 pm
by The cube
Oh, i just was really stupid, and didin`t connect the altar to the code.. :oops:
also got that to work :)