How do trapped chests work?Edit
A chest is an item of the containter type. When we look at the .dbr file of a container we find no way a container could harm the player except with a skill. The .dbr has a heading 'skill', containing the variables
- skillName (dbr file of type skill)
- skillDelay (floating point numeral)
What will happen? Well, obviously, when the player opens the container, the skill will be invoked after the specified delay.
Let us make a test mod.
Art manager: Make a new mod and name it 'Containertest'
Editor: Add a test level with a spawnplayer. Save.
Art Manager: Create an asset for your map. Then import the database record of any container (records/item/containers). We will be using this container for all our tests, so copy it and paste it to a new folder in your database. Let's call that folder TestStuff. Open the copy of your container, and choose a skill from the skill folder to enter as the container's skill. (Use the button with the ellipsis (...)) Build the mod.
Editor: place one of our lab containers from the TestStuff folder. Save all.
Art Manager: Build the mod again.
We are ready to go: test your map.
Disappointment awaits; the container opens and things fall out, but no sign of a skill.
Only special skills work with containers.
We will look at a container with a known skill next, in order to find out what type of skill that is. One of the trapped sarcophagi from greece will do.
Art Manager: Open our mod and import records\item\containers\greece\sarcophagi\sarcophagia01_all_poison_01.dbr.
Let us see: the skill it uses is called Records\Creature\Devices\ChestTraps\Skills\ChestTrap_PoisonSummon_Greece02.dbr.
So now we know where to search for skills for our container. Copy the skill from the sacophagus .dbr and paste it to our test container. Build the mod and try again: a very satisfying poison cloud rewards our work.
How does that skill work?Edit
Let us have a look, and import that skill itself into our database. As we will be messing with it, copy and paste it into the TestStuff folder. Build the database and then change our container's skill to our copy at the new location.
Now open the .dbr file. This is interesting: we find variables for a monster, a 'time to live', two sound files and two effect files. So we can suppose, that there may be a sound and a graphics effect in warning, a sound and a graphics effect on activation of the trap (after the delay), and then a monster will be summoned which will live a preordained number of seconds. The monster in this case is called Records\Creature\Devices\ChestTraps\Trap_Poison_Greece02.dbr.
Just to check our conclusion, change the monster to a more familiar one. I suggest a skeleton. You could also add a warning sound or some fx. Build the mod and try: the monster you selected should be spawned. Refrain from killing it and see it collapse after 10 secs (or whatever you set timeToLive to).
What kind of monster is that poison cloud, anyway?Edit
We will now probe a little deeper. The sarcophagus led us to the skill, the skill leads us to a strange kind of monster. Import it to our database, copy and paste as before. Then open the .dbr for inspection. This monster has got nearly nothing, only a name tag, a controller, a finger (on which it wears a cheap ring) and -- a skill.
Time for our next experiment. After making sure the container's skill points to our copy of the poison monster instead of the original, we try to change the poison cloud's skill. Sadly, it seems to work with its own skill exclusively.
But never mind, there are other ways. I can leave you on your own now. Try summoning a monster with a projectile skill and making it invisible somehow (No, just deleting the mesh will not work...). Or replace the monster's controller with a guard controller so that it will fight on the player's side. Of course in that case it should live longer than 10 secs.
A trapped chest has got a skill. The skill is used after a delay when the player opens the chest. By the skill a 'monster' is summoned. The monster in turn has another skill which it uses to attack the player. After a period of time, the monster 'dies' and the effect ends.