Name of Treasure Chest Monster [Solved]

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
User avatar
Jouki
Posts: 127
Joined: Fri Oct 24, 2014 12:57 pm

Name of Treasure Chest Monster [Solved]

Post by Jouki »

Hello, does anyone know the name of treasure chest monster? :P
Last edited by Jouki on Tue Oct 28, 2014 9:40 pm, edited 1 time in total.
Ixnatifual

Re: Name of Treasure Chest Monster

Post by Ixnatifual »

Mimic.
User avatar
Jouki
Posts: 127
Joined: Fri Oct 24, 2014 12:57 pm

Re: Name of Treasure Chest Monster

Post 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?
NutJob
Posts: 426
Joined: Sun Oct 19, 2014 6:35 pm

Re: Name of Treasure Chest Monster

Post 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.
User avatar
Jouki
Posts: 127
Joined: Fri Oct 24, 2014 12:57 pm

Re: Name of Treasure Chest Monster

Post 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)
DrKojak
Posts: 23
Joined: Fri Oct 24, 2014 11:19 am

Re: Name of Treasure Chest Monster

Post 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!
User avatar
Jouki
Posts: 127
Joined: Fri Oct 24, 2014 12:57 pm

Re: Name of Treasure Chest Monster

Post 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 :)
Ixnatifual

Re: Name of Treasure Chest Monster [Solved]

Post 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.
User avatar
Mal85
Posts: 103
Joined: Fri Nov 16, 2012 10:56 am

Re: Name of Treasure Chest Monster [Solved]

Post 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.
Post Reply