Back Home

Setting up Treasure Chests in Dungeon Defenders

INTRO


Like most things in a level in Dungeon Defenders (DD), chests are controlled with kismet and archetypes via kismet, they can also have a fair few properties for mana count, and item quality. You can also set multiple chests up to respawn or only a few, while most maps in DD have about 4 to 6 chests you can set up as many as you wish.
As my last tutorial I'll be using the provided DD_LevelTemplate map, because it saves you (and me) setting up all of the kismet required for the game.
By default the template level has 4 chests in it that provide some low level items and 40mana. What we will do in this tutorial is add two new chests, one that spawns only on the initial wave and another that respawns every round. Along with how to modify the mana count and item quality.

THE SETUP

So let's get started, first things first, lets add our new chests to the level so we can position them where we want. To do this we need to open the content browser up, from here you can use the My Collections on the left and click Misc, or find the 'DunDefArchetypes' package and browse through it, what we are looking for is the archetype named ' TreasureChestPlacerMesh'.
Once you've located this, click on it, from here you can drag it into the level or once selected you can right click in the level then 'Add Actor > Add Archetype: SleletalMeshActor DunDefArchetypes.TreasureChestPlacerMesh'



This treasure chest is one that we will tell kismet that needs respawning each round. But what if we want a chest that only spawns once? For this we need to place a separate archetype, these are placed in the same place as the spawner chest, although they're named 'BasicTreasureChest_Area#' # being the numbers 1, 2 and 3. A higher number gives more mana and better items.
I'll use the 'Area2' chest, so drag this out into your level.



Now if you were to test your level now, only one of these would spawn, the single spawning one only. What we need to do is tell kismet that this new chests exists.

THE KISMET

So hop into kismet, on the top level sequence you can see your 'Global Wave Scaling Variables -- Edit These' in here you have two variables that need to be adjusted for our new treasure chest.

They are named; 'GlobalTreasureChestNum' and 'GlobalTreasureChestSpawnLocations' . The first value is the amount of chests in the map (that respawn), the second is the spawning locations of all of them.

Select the 'GlobalTreasureChestNum' and set its 'Int value' to 5 in the properties, then select 'GlobalTreasureChestSpawnLocations'.

This is an object list, it contains a list of the treasure chest models for where to respawn them every wave. What we need to do is click the green '+' on the right side of the 'Obj List' row to add a 5th value. In this we need to type the name for the chest we placed (that will respawn). So select it in your level and check it's name either through properties (F4) or the bottom of the editor window, once you have it type it into the Obj List in kismet, in my case it is 'SkeletalMeshActor_19', now hit enter.



Go ahead and test in game, if everything worked you should have a chest already spawned and another chest that spawns in after a few seconds.

Now, what if we want to change the amount of mana avaliable to players in the game? By default these chests in the template level give 40 mana. What if we want 100? Well that's fair straight forward (mainly because Trendy already has a template for 100)

Make sure you have kismet open, from here we want to check the kismet that is spawning the chests. So look for the sub sequence 'SpawnTreasureChests'.



This will bring you to a sequence that controls the respawning of the chests per wave, you can see a few things here, like there's currently only 12 spawn outputs, this should be enough for most but can be increased if you need by copying the current setup and increasing the amount in the properties. But for now we're looking at adjusting the content of our chests. If you check the bottom right of the actor factory you can see an attached 'GlobalTreasureChestArchetype', this is actually a named variable, which means it is looking through kismet for a variable with the name 'GlobalTreasureChestArchetype' which we will add in to the top level sequence where our other editable variables are located. If you copy the name of this variable we can go back up to the top level sequence with out editable variables.



Once you're back to the top level we need to create a new variable with the name we just copied.
Do this by right clicking and going New variable > Object > Object



Now in its properties paste the name you copied into the 'Var Name' box, with this done we need to find the archetype that gives us 100 mana, which is 'BasicTreasureChest_Area3'.
So open up the content browser, (for some reason this is not located in the collection 'Misc') So find this by looking for the DunDefArchetype packages. Once located, right click it and 'Copy full name to clipboard'.

The jump back into kismet and paste this copied name (DunDefTreasureChest'DunDefArchetypes.BasicTreasureChest_Area3' ) into the 'Obj Value' of the variable you just created.



Now when you test your level your respawning treasure chests should drop 100 mana.

MORE MANA

But what if we want a mega chest that gives 1000 mana?
Well let's see what we can do.

We want to create our own archetype, to do this, we'll make a copy of the one we're using currently for including in our own level. So find the ' BasicTreasureChest_Area3' in the content browser again, this time right click and select 'Create a copy'

This will give you a dialogue box, In 'Package' we want to add the package we're using for our level, this is simply the same name your level is, in our case DD_LevelTemplate, a group is a folder of sorts, it isn't required but can help keep things organised. And the New name is what it will be called, lets call this 'BasictreasureChest_1000' now click 'Ok'





Now the content browser will jump to your new archetype in your package, double click it to bring up its properties. And expand the 'DungeonDefense' heading. Now we can edit a few values here, things like the global equipment drop chance, and the quality of dropped items, along with modifying their cost. But i'll let you test those yourself.
What we want is 'Max Mana' and 'Min Mana' you can have random mana values from a drop chest by having a different value in min and max, but for now we want 1000.



Now we have an archetype setup to give 1000 mana we have to go into kismet and assign it.

We need to copy the name of our newly created archetype from the content browser, or another method is to select the archetype in the content browser, then in kismet select the object variable ' GlobalTreasureChestArchetype', and next to 'Obj Value' click the green arrow to assign the selected object in the content browser.



Give it a test and enjoy your 1000 mana!



PERFORMANCE IMPACT

One issue that can arise however, is that if you put too high a value in you can create enormous lag on systems, one way around this is to obviously lower your mana count and increase your chest count. Or you can change the type of mana dropped, so you get less mana but the same value.

To do this, open the properties of the archetype you created in your level package, expand 'DungeonDefense' and look for 'Super Mana Token Template'

if you click on the magnifying glass icon on the right end of the row, you'll get directed to the current used archetype in the content browser, from here you can locate other tokens to use.

In this example i've found the 'MassiveManaToken_2K', copy it's name to clipboard, go back to your properties and paste it in.

Now you can increase your max and min mana to higher values with much less impact on performance.



GIVING ITEMS FROM CHESTS

Chests drop weapons randomly, these weapons are all the default ones in the game. What if you want to drop a specific modified weapon from your chests? have a look at my Rewarding and Customising items tutorial to find out!.

THAT'S IT!

I hope this quick tutorial has helped you with setting up some of your own treasure chests, if you still have questions feel free to check out the official DD forums.

HTML hit counter - Quick-counter.net

Back Home