Page 1 of 1

Name of Treasure Chest Monster [Solved]

Posted: Tue Oct 28, 2014 6:46 pm
by Jouki
Hello, does anyone know the name of treasure chest monster? :P

Re: Name of Treasure Chest Monster

Posted: Tue Oct 28, 2014 6:56 pm
by Ixnatifual
Mimic.

Re: Name of Treasure Chest Monster

Posted: Tue Oct 28, 2014 8:48 pm
by Jouki
thanks, how can I do that as in original game - looking like true chest and when looting the treasure chest changes to Mimic?

Re: Name of Treasure Chest Monster

Posted: Tue Oct 28, 2014 8:51 pm
by NutJob
Much the same way here when he's spawning in the Ogre, just remove the chest and put the mimic in it's x,y.

Re: Name of Treasure Chest Monster

Posted: Tue Oct 28, 2014 9:39 pm
by Jouki
NutJob wrote:Much the same way here when he's spawning in the Ogre, just remove the chest and put the mimic in it's x,y.
ok actually I've found better solution

Code: Select all

chest_3.chest:setMimic(true)

Re: Name of Treasure Chest Monster

Posted: Wed Oct 29, 2014 12:10 pm
by DrKojak
Jouki wrote:
NutJob wrote:Much the same way here when he's spawning in the Ogre, just remove the chest and put the mimic in it's x,y.
ok actually I've found better solution

Code: Select all

chest_3.chest:setMimic(true)
time to try this out!

Edit* Works a treat, thanks man!

Re: Name of Treasure Chest Monster

Posted: Wed Oct 29, 2014 4:37 pm
by Jouki
DrKojak wrote:
Jouki wrote:
NutJob wrote:Much the same way here when he's spawning in the Ogre, just remove the chest and put the mimic in it's x,y.
ok actually I've found better solution

Code: Select all

chest_3.chest:setMimic(true)
time to try this out!

Edit* Works a treat, thanks man!
glad to help :)

Re: Name of Treasure Chest Monster [Solved]

Posted: Wed Oct 29, 2014 7:29 pm
by Ixnatifual
You can make things a little more interesting using this function:

Code: Select all

function mimics()
  local i = 1
  local entity = findEntity("chest".."_"..i)

  while entity ~= nil do
    if math.random(1,10) == 1 then
      entity.chest:setMimic(true)
    end
    i = i + 1
    entity = findEntity("chest".."_"..i)
  end
end
Note that I use a timer with a 0.1 interval to trigger the function once before disabling itself. If I have this code run immediately instead of with a delay (in this case provided by the timer) it appears math.random generates the same sequence of numbers every time, which means it's always the same chests that are mimics. With the timer in place the mimic placement varies, which is my intention.

Re: Name of Treasure Chest Monster [Solved]

Posted: Thu Dec 18, 2014 5:44 pm
by Mal85
Worth noting, any items placed in said chest using the, setMimic(true) will cause the mimic monster spawned by it, to drop those same items when it is killed.