Author Topic: Basic Editor Tutorial - Or How I Learned to Stop Worrying and Love the Editor  (Read 60642 times)

Kashlavor

  • Posts: 79
  • Spike Dodger.
    • View Profile
So you want to be a map maker?



Here is as comprehensive a tutorial as I can make, as I think the community could really benefit from it.  I won't claim to be an expert, but hopefully I'm good enough that you can learn something from it.  This tutorial will be divided into a few sections.  If you have at least a passing familiarity with the editor you should be able to skip Getting Started and get right into it.

  • Getting Started - Here we go through initial setup
  • Making the Hall of Doom - Follow along with an extensive example of making a dungeon, learn scripting, custom monsters, add a custom class, and see a full level in action
  • The Editor - Basic overview of editor and commands
  • Custom XMLs - Take a more advanced look as we break down how to edit XMLs for players and monstesr
  • Theory and Motivation - Understanding how and why to commit to a project such as this, and an overview of level design

Getting Started

Find the Hammerwatch folder. Starting from the very bottom, the super simple stuff.  First you need to be ready to do plenty of learning on your own, understand that level design is often a frustrating and lengthy (but rewarding!) process, and always take time out of your day to be polite with and interact with the community.  You should probably bookmark/shortcut this folder as you will be using it quite a bit.  Locate the folder Hammerwatch is stored in.  Dig through your steamapps folder, or right click on it in steam, hit properties, and then browse local files.  Hopefully you already had that part, otherwise you're in for a long....long haul.

Quick Tip! - Yes its very frustrating to be told to "just google it" in response to your questions, but be prepared to NEED to do research on your own.  This tutorial was made in an attempt to put as much of the information in one place as possible, but in reality the only way you actually get good is to look up ancient forum posts, struggle with it, experiment, and just plain dedicate time.  There is no magic answer.  Understand that often a community is reluctant to answer questions because many of them sound like "I want to be a NASCAR driver, but I don't know what this 'gas peddle' is, a lot of people mention it...but what is it?"  I'm gonna do my best here to take you from 0 to editor hero, but at the end of the day its on you.

Unpack the assets.bin.  In the main Hammerwatch folder find the assets.bin, copy and paste this into the "editor" subfolder and then click and drag this onto the ResourceExtractor.exe.  This will turn the bundled up assets into a ton of folders to look at.  Within all of these are all of the art, monsters, tiles, and everything which makes up Hammerwatch.  Look at the xmls for your favourite (or most feared) monsters, and try to understand how they are set up.  Boot up the debug version of Hammerwatch (the one inside the "editor" folder) and then run the example level as a custom map, check it out, learn something.  The folders which are generated should look something like this.



Make your own map! Copy and paste the example folder and rename it to something cool sounding for your own map, like Lair of the Archnecromantrix or something sweet.  Lets look inside that folder.



These are the basic components you will need to make a Hammerwatch campaign.  You should save all of the levels you make with the Hammerwatch editor in the levels folder.  The icon.png is the graphic which Hammerwatch displays for your campaign on the level select screen, and the info.xml (open it up, its pretty simple) is the brief description it gives.  levels.xml we will look at later, editing that file allows you to have multiple floors, acts, overworlds, levels, or whatever you come up with inside your campaign.  Lastly see that we already have a "doodads" and "actors" folder.  These dirrectly correspond to the whole list of folders Hammerwatch has already (doodads, effects, buffs...).  Should you ever need to say add a custom buff to your game, simply make a new folder here called "buffs" and put yours in.  Your game already has access to all the base Hammerwatch stuff, adding new folders here is how you add or modify these elements with some of your own.  Keep in mind that your specific folders always have precedence.  If you have something here with the exact same name as an existing Hammerwatch asset then your version will be the one Hammerwatch uses.  Don't think that arrow skeletons do enough damage yet? Copy/paste their xml into the actors folder, open it up, and change how much damage they do (or don't...they're pretty dangerous already).

Heres where the fun begins.  Open up the HammerEditor, and then open up one of the new levels within your levels folder (or create your own).  Here the editor will bring up the map.  By clicking the tabs in the top right you can look at the various things you can put into a level.  Try adding in a few walls, maybe go to characters and throw in some liches.  After this save your level and then run it, thats Tools->Run, or simply Ctrl-T.  Feel free to experiment, see what you can come up with.  Left click to drag stuff around, right click to add.  From here you can either skip to the editor section to get a better grounding in how the editor works, or follow along with how I create the HALL OF DOOM.

Making the Hall of Doom

Rather than going on about this and that I'm just gonna run through a whole example.  First I made a basic outline of what I want.



So we're gonna have a long hallway full of monsters and traps, a few vendors off to the side, and then this huge treasure at the end which the players need to grab, and then run back to the entrance Indiana Jones style before they get crushed.  First I'm going to open up the editor, decide what look I want to go for and rough out the walls.  Now the first thing you will notice is that its incredibly dark with no lights, so for now we're just going to turn up the ambient brightness of the whole level.



Click on the lighting tab, then change the ambient setting to be something much lighter.  If we want to later we could go in and turn it back down and place in some torches and lights, but for now we will just leave it pretty bright. Now we can put in some walls, here I've added in the basic shape of the starting room.



I decided to use some theme_b for this one.  On the right you can see I have the doodads tab open and I've typed in theme_b so that way the editor only displays doodads which either have theme_b in the name or are from the theme_b folder.  Walls are named things like b_h_16 (theme_b, horizontal section, 16 units wide).  Mostly you will need to experiment with doodads to find the ones you want.  Right click to place, left click to drag around.  I also find it far easier to make little sections of what I need on the map and then either copy/paste (Ctrl-C Ctrl-V) or duplicate (Ctrl-D) more sections as I need them as opposed to digging through the whole listing trying to find that one b_crn_l_dn that I need.  Also, use the WASD keys to move around the map, and you can press 0 to turn on or off displaying the grid if you think it helps you line things up.

So this map is boring, we need to add a lot.  This next step is going to be a bit bigger so follow along.  First we need a floor, so I'm going to switch to the Tilemap side and paint down some floor.  Don't make it just one color either, add in some grass and dirt and little things.  Plus we need to embellish the walls, so I'm going to pick out some chains and flags and whatnot, some little deco pieces to spice it up.  Most importantly though we need to make the walls look solid.  The way we do that is by using large color sections like color_theme_b_128 and placing them ontop of the walls to make the area past it appear solid.  Now if you try to put some of these down you might notice that they don't quite line up with the walls, either covering them totally or floating next to them.  Below you can see how they should look and then we can see how you get that.



That looks more like a real Hammerwatch level, still a little uninspired but we're working fast here.  In order to place things down right you have to know that everything in the HammerEditor snaps to the grid.  You can change the grid size with the number keys, or through the menu at the top.  This lets you line things up on a smaller refinement (such as the big color sections) if you need to.  A quick bit of scripting and we will have a working level.  Go to the scripting tab and lets put down a LevelStart element right infront of the entry teleporter there.  Now its fully functional, all we would have to do is hit save and test it out, run around in what we have so far.

Now to add in some monsters, just go to the Characters tab, pick out your favorite enemies, and put some down.  For this we're going to start off light with a group of bats to hack down.  Remember that its not about making a map "hard", anyone can edit a monster's file to give it 99999999 health and damage, its about making it fun.  Theres one last thing that we're missing, and thats treasure.  EMPTY SPACE IS BORING.  Fun maps let you run around breaking crates and looting things and hacking and monsters and running from traps, so lets throw in a few vases as well in our next hallway section.  After all that it should look like this.



At this point you should have pretty much everyhing you need to make a basic Hammerwatch level.  Walls, loot, monsters, a good design.  From here we go deeper: into scripting, custom monsters, and good stuff.  Lets take a look at the short section of hallway between the entrance and our bat room.



Lets ramp up the tension early, and introduce our players to the idea of having sudden, dangerous ambushes in the Hall of Doom.  By introducing it early like this it will make having a big one as part of the epic conclusion have a bit more context and seem more exciting.  So lets set up some monsters on either side which burst out as soon as the player steps halfway down the hall.  In order to do that lets set up what it will look like once the ambush has been sprung, then hide it, then set up the scripts we need to spring the ambush.  Heres what it is going to look like when the walls open up.



Next we need to cover this over with what the dungeon will look like before it springs.  In order to do this we have to make sure that our new doodads appear "on top" of the existing ones so it covers up those corner pieces and walls.  To do this we can change what layer they exist on by holding Ctrl and pressing the number keys while we have our wall selected, so what we want to do is make a wall section and bring it to a higher layer (Ctrl+6 worked for me).  Like so.


On the left you can see that we made a wall section, selected it, and brought it to a higher layer, then dragged it overtop our existing walls to hide them.  Next all we need to do is put a big block of color_theme_b ontop and it will be totally concealed.

I'm gonna do this for each of the four areas and then come back to show you how to set up the "burst out and attack the players!" script.

To do that lets put down a RectangleShape in the middle of the hall, and then change its height and width so it covers the whole thing.  We will also set its "Trigger times" to 1 since we don't need it to go off multiple times.  Next we put down an AreaTrigger so that way we can link our RectangleShape to the stuff we need it to do.  Once you have the AreaTrigger down just click the "Shape" box, left click once the RectangleShape, then hit Esc to exit the selection menu.  Notice how the edges of the screen turn blue when you are in a selection mode, keep an eye out for accidentaly leaving yourself in a selection mode if suddenly the editor stops doing what it should.  Next we set up a DestroyObject script and select the little wall bits as well as the section of color_theme_b covering up our ambush area.  This means that when the DestroyObject element gets triggered it will remove the walls and reveal the area, thus unleashing the horde of mummys and their scaraby allies.  In order to link the AreaTrigger to the DestroyObject (so that way it all actually works) select the AreaTrigger, then hold Ctrl+Alt and left click the DestroyObject, now these two elements are linked (you can see the arrow).  This means that when the AreaTrigger gets triggered (by a hapless player entering the ambush) it will trigger the DestroyObject and unleash the horde (well...small crowd really).



I'm going to hook up the other three ambush areas, and then go play through it to make sure it works.  REGULAR TESTING.  Regular Testing x 1000, always playtest your levels regularly to make sure that they work as intended, and have the fun that you're going for.

So playing through it all our script elements work but it still doesn't... feel like an ambush.  I mean, walls disappear, a few of the enemies sort of politely file out to greet you.  Theres definitely some stuff we could do to add some AMBUSH!!! to our hallway.  First we need a sound effect for when it happens to add to the sense of "something just occured here!"  All we have to do is add in a PlaySound element and also hook our AreaTrigger to it, I choose the wall_move sound as that seemed most appropriate.  I also want the enemies to do a bit more attacking, so what I'm going to do is use the MoveAI script to tell them that as soon as the walls are gone to go out into the hallway and attack.

The MoveAI script node can be used to tell a group of enemies to go someplace, note that they won't do any attacking on their way there, so if you want them to ambush make sure to put the PathNode thats their destination just a bit short of where you expect players to be.  To set it up all we need to do is put down a MoveAI node, press the Actors button and select everyone in the room, and then put down a PathNode element and select that PathNode as the "destination."  Heres what it looks like, (I moved the color_theme_b ceiling away temporarily so you can see.



Notice also that our hallways is becoming a hot mess of lines and scripts.  If at any time you want to view a level more for its aesthetics and work on just its design without worrying about scripting know that you can always go to Layers->Rendered Layers and turn off scripting so you don't have to see it (thats Shift-F3 for the lazy, yea I turn it on and off a bunch).  I'm gonna set up all the path nodes and whatnot for the ambush and try it out, see if it seems more ambushy with the sound and all as well.  Don't forget that you actually need to hook up your MoveAI scripts to the AreaTrigger otherwise they won't go off.   As an afterthough I also decided to throw in some coins (valuable_1,2,3...) of previous victims in their ambush rooms as an extra little reward.  Coins and boxes are in the items tab, remember to use them.

Seems more ambush-y now, I also changed the AreaTrigger to also have a "Trigger times" of 1 since I was getting a few weird glitches with the PathNodes, I think that resolved it.



Lets move on to the next part after the bats.  In this bit we can add doors and keys, as well as vendors and a small "dungeon crawl" section.  Doors are easy, just look under the Items tab for door_a_something and put them down.  Whenever a player touches a connected series of doors they will all dissapear and the appropriate key will be removed from their inventory.  I'm going to quickly run through and set up a little side dungeon (the messy area to the right on our graph paper plan) so we can hide some keys in it.  After we're going to add in our own custom monster their to defend the gold key.

Quick Tip! - I just remembered how tedious placing down wall sections can be.  If you want to you can create a black and white only image in say Paint or any other raster image editor.  If you then copy the image and paste it the black parts of the image will become walls using theme_a.  From there you can directly edit your level xml (using a text editor not the HammerwatchEditor) and then use find and replace to replace all the theme_a walls with whatever theme you want instead.  Keep in mind though that while this technique is fast you often won't get as good results compared to hand placing the walls with more care.

Heres an outline of our little dungeon crawl area.  I'm also going to put in how you make secret bridges to that middle island but won't be covering it in this tutorial, open up the map to look at the scripting for that, but if you made it through creating the ambush the bridge should be no problem.  Down in the bottom right near the bats is where we will be creating our insidious miniboss bat.  So lets get started with that.



One final detail about scripting before we dig deep into the xmls.  Our players may know that they are in some sort of dungeon, but lets let them know they are in none other than the Hall of Doom itself.  To do that all we need to do is add a GlobalEventTrigger set to "LevelLoaded" and link that to an AnnounceText announcing the name of our level in big bold letters as soon as they enter.

Now lets make our own miniboss.  First we need to create a file for it.  I'm going to copy and paste bat_1.xml and bat_1.png from the overall actors folder which we got from unpacking the assets.bin, and paste them into our own actors folder within our level's own folder.  So in my case its ending up in C:\Program Files (x86)\Steam\SteamApps\common\Hammerwatch\editor\tutorial_HALL_OF_DOOM\actors.  I'm also renaming them bat_mb_doom.xml and bat_mb_doom.png so that way we can have our own monsters.  Right now if we reloaded the assets in the HammerwatchEditor (Ctrl-R) we would see that bat_mb_doom is now an entry in the Characters tab.  We could put one down but right now since hes just a copy of bat_1.xml it won't be anything spectacular.  First lets open up his xml (bat_mb_doom.xml) with some sort of text editor (I'm using Notepad++, also using Notepad++ to author this tutorial by the way) and make him more dangerous and awesome.

One thing all minibosses have in Hammerwatch is their own little health bar.  To figure out how to do this all we need to do is open up a few of the other miniboss's xmls and notice the one line they all have in common which stands out from most monsters.

Code: XML
  1. <vec2 name="hp-bar">0 -1.0</vec2>
  2.  

Quick Tip! - Don't know how to do something? Look at the rest of the monsters.  You can either just copy/paste the bits you like or try to figure out how the xmls work by example.  Think of each and every entity in Hammerwatch as an example showing you how to make more of them.

Want to know what the 0 and -1.0 mean? Experiemnt and find out.  Hint: it specifies where the health bar appears in relation to the sprite, allowing you to move it around if need be for larger or smaller monsters. 

The next big step is that we're going to change his AI type to composite.  Best way to learn about that would be to look at some other monsters which have a composite AI type, and learn from example, as well as checking out the entire sticky'ed thread on the composite AI.  Basically this AI type lets you make custom monsters with a wide range of awesome abilities, as we shall demonstrate.

So what else do we need to change?  First we can remove the "speed" and "dmg" entries as the composite type doesn't use them, and we need to add in a movement type inside the <dictionary> tag inside his <behavior>  like so.

Code: XML
  1. <actor collision="5" behavior="composite" minimap="menus/minimap.xml:enemy_mb">
  2.         <behavior>
  3.                 <dictionary>
  4.                         <entry name="hp"><int>200</int></entry>
  5.                         <entry name="aggro-range"><float>15</float></entry>
  6.                         <entry name="max-range"><float>20</float></entry>
  7.                         <entry name="death-snd"><string>sound/monsters.xml:death_bat</string></entry>
  8.                         <entry name="hit-effect"><string>effects/particles.xml:hit_bat_1</string></entry>              
  9.                         <entry name="hit-particle"><string>effects/particles.xml:particle_bat_1</string></entry>
  10.  
  11.                         <dictionary name="movement">
  12.                                 <string name="type">melee</string>
  13.                                 <float name="speed">0.75</float>
  14.                         </dictionary>                  
  15.  
  16.                         <vec2 name="hp-bar">0 -1.0</vec2>
  17.                 </dictionary>
  18.         </behavior>
  19.  

I also gave him more hp (no self-respecting miniboss has 5 hp), changed his behaviour type, minimap icon, and gave him a pretty fast movement and larger aggro range.  Now he needs some deadlier skills to harass players with.  Lets have him...spawn more bats when he gets hit...and shoot death beams...and spawn spawners...why not?  Maybe a bit ridiculous but hey, its only a tutorial, and its called the HALL OF DOOM, so lets see if we can make that happen.  It may just be easiest to copy/paste and modify stuff from the other post on skills, so lets do that.

Always keep in mind, test regularly! Especially when working with the xmls, its easier to find out what went wrong if you make changes one at a time.

Quick Tip! - Right after I added that bit my HammerwatchEditor crashed unexpectedly.  Make regular backups and save often, don't let a single corrupted file destroy hours of work.  Now since I knew that I had been working on bat_mb_doom.xml I removed that from my actors folder, which got the editor working again.  This tells me that I did something horribly horribly wrong inside my bat miniboss file.  Who knows why a single mistake inside an actor causes the whole editor to crash?  Keep in mind that everything has to be right and errors can come from weird places, so keep careful track of how you make changes on where, and TEST OFTEN. (Maybe a composite AI with no active skills crashes the game?)

Shooting death beams

Code: XML
  1.                         <array name="skills">
  2.                                 <dictionary>
  3.                                         <string name="type">shoot</string>
  4.                                         <string name="anim-set">attack</string>
  5.                                         <int name="cooldown">2000</int>
  6.                                         <float name="min-range">2.5</float>
  7.                                         <float name="range">20</float>
  8.                                         <string name="sound">sound/monsters.xml:lich_seeker</string>
  9.                                         <string name="proj">projectiles/enemy_wisp_1.xml</string>
  10.                                 </dictionary>
  11.                         </array>
  12.  

Remember that all active skills need to go inside an array called "skills" (as above) and all passive skills need to go in an array called pskills.  Now lets expand our "skills" array to add in the spawning spawners bit (so were gonna put it just after the last </dictionary> but before the last </array>, you can look at the full thing to see how it all comes together.  Here it is.

Code: XML
  1.                                 <dictionary>
  2.                                         <string name="type">summon</string>
  3.                                         <string name="anim-set">attack</string>
  4.                                         <int name="cooldown">3000</int>
  5.                                         <float name="range">100</float>
  6.                                         <float name="dist">4</float>
  7.                                         <string name="sound">sound/monsters.xml:lich_summon</string>
  8.                                         <int name="num">2</int>
  9.                                         <int name="arc">150</int>
  10.                                         <string name="actor">actors/spawners/bats.xml</string>
  11.                                         <bool name="safety-raycast">true</bool>                                
  12.                                 </dictionary>
  13.  

Its a bit silly really, and might end poorly if a player gets trapped by destroyed spawners...feel free to change that in your own maps.  But it works!  The last part, making more bats when he gets hit.  This is a passive skill so we need a new array called "pskills."

Code: XML
  1.                         <array name="pskills">
  2.                                 <dictionary>                           
  3.                                         <string name="type">drop</string>
  4.                                         <string name="sound">sound/monsters.xml:death_tick_golden</string>
  5.                                         <int name="hp">5</int>
  6.                                                 <dictionary name="loot">
  7.                                                         <string name="origin">0 0</string>
  8.                                                         <float name="spread">1.5</float>
  9.                                                                 <array name="loot">
  10.                                                                         <array>
  11.                                                                                 <int>100</int><string>actors/bat_3.xml</string>
  12.                                                                                 <int>200</int><string>actors/bat_2.xml</string>
  13.                                                                                 <int>700</int><string>actors/bat_1.xml</string>
  14.                                                                         </array>       
  15.                                                                         <array>
  16.                                                                                 <int>100</int><string>actors/bat_3.xml</string>
  17.                                                                                 <int>200</int><string>actors/bat_2.xml</string>
  18.                                                                                 <int>700</int><string>actors/bat_1.xml</string>
  19.                                                                         </array>       
  20.                                                                 </array>
  21.                                                 </dictionary>                                  
  22.                                 </dictionary>
  23.                         </array>
  24.  

Well we've officially hit ludicrous levels of bats.  Lets just glaze over this in terms of good level design and game design and take it as an example of just how far you can push the editor if you really want to....plus its actually kinda fun.  Theres only one problem, our epic boss bat still just looks like a regular bat.  So what we need to do is open up out bat_mb_doom.png and change his look.

For this we're going to take the easy way out and perform the cardinal, mortal, unforgivable sin of pixel art.  Taking someone else's work and palette swapping it as our own.  That is we are just going to take bat_1.png and make him red.  Normally this is considered poor form, bordering on the plagiarism, but in this case I think we can let it slide as we aren't claiming we made it ourselves, merely altering one part of Hammerwatch in order to add more flair to Hammerwatch itself.  It still doesn't really seem that cool yet though, since hes tiny, lets also double his size so he seems more impressive (and change how big his collision is as well at the top).  If you're really interested in pixel art I'm not the one to ask, I'm just getting started myself, but there are plenty of tutorials and hlepful forums online for you, just takes practice.



Unfortunately if we reload our assets in the editor this won't actually work, as resizing the sprite has totally thrown off how it renders based on his xml.  Lets pull up a part of his animation so we can see what happened.

Code: XML
  1.         <sprite scale="16" random-start="true" name="east">
  2.                 <texture>actors/bat_1.png</texture>
  3.                 <origin>6 5</origin>
  4.                 <frame time="250">39 0 13 16</frame>
  5.                 <frame time="250">52 0 13 16</frame>
  6.                 <frame time="250">65 0 13 16</frame>
  7.                 <frame time="250">52 0 13 16</frame>                           
  8.         </sprite>
  9.  

So if we look we see the first we have one huge problem, we're still using the texture from bat_1.png.  Lets search and replace so that way we start using our own texture instead.

Code: XML
  1.         <sprite scale="16" random-start="true" name="east">
  2.                 <texture>actors/bat_mb_doom.png</texture>
  3.                 <origin>6 5</origin>
  4.                 <frame time="250">39 0 13 16</frame>
  5.                 <frame time="250">52 0 13 16</frame>
  6.                 <frame time="250">65 0 13 16</frame>
  7.                 <frame time="250">52 0 13 16</frame>                           
  8.         </sprite>
  9.  

Now that thats out of the way we can see we have his idle animation while he's facing east.  For bats this doesn't matter as they use the same animation no matter which direction they're facing, but its still necessary to specify each direction and is more important for more humanoid sprites.  Now the reason that it doesn't work is that the frames no longer line up with our new, larger image.  The first line there, where it lists the numbers 39 0 13 16.  This says "for this first frame go to the 39th pixel from the left of the image, 0 pixels from the top, and then take a section which is 13 pixels wide and 16 pixels high and make that this frame."  So we need to change all this numbers to reflect our new image.  (As an aside, frame time="250" simply specifies how long that frame is in milliseconds).

Quick Tip! - How fast a most monsters attack is determined by the length of their attack animation, you can reduce the time of their attack frames in order to make them attack faster.  This is the main reason why the eyeballs are deadlier than the ticks from the first level.

So it should end up looking something like this.

Code: XML
  1.         <sprite scale="16" random-start="true" name="south">
  2.                 <texture>actors/bat_mb_doom.png</texture>
  3.                 <origin>12 10</origin>
  4.                 <frame time="250">79 0 24 32</frame>
  5.                 <frame time="250">104 0 26 32</frame>
  6.                 <frame time="250">130 0 26 32</frame>
  7.                 <frame time="250">104 0 26 32</frame>                  
  8.         </sprite>
  9.  

I'm going to go change all the animations to be right, and then we can put him down next to the gold key and test it out.



Might be slightly too dangerous, feel free to try it out, rebalance him to your heart's content.

There is another step that we need to take care of before we can publish any map, editing the info.xml and levels.xml files in your custom campaign's folder.  They should be fairly easy to understand once you look through them.  info.xml simply specifies what text to display when people are selecting levels, icon.png is the icon which it uses.  The levels.xml is a bit more complex, but all you need to do is copy and paste more lines to add additional floors.  Feel free to look through those when you download the map.

Now lets set up the little vendor area behind the gold door on the west.  Setting up a basic vendor is pretty easy, just put down a vendor doodad to mark where you want it, then place down a RectangleShape and a ShopArea, and then select the RectangleShape as the ShopArea's "Shape."  After this all you have to do is type in a list of what categories of items the vendor sells (off1, misc1...).  In order to see what these categories are and to make a custom category of our own we need to pull in the tweak folder to our campaign.  Copy the tweak folder from the assets and put it in the folder for your campaign (next to the levels, actors, buffs, and whatever other folders you have).

Inside the tweak folder are xmls for each of the classes.  Feel like you know how to balance the game better than the devs do? Go for it then, open up those files and change all sorts of stuff about the classes.  Inside each of them it also lists out each upgrade available.  Lets look at the warlock's second lightning damage upgrade as an example.

Code: XML
  1.                 <dictionary id="lightningdmg2" cost="2400" req="lightningdmg1" cat="off3"
  2.                         name="lightningdmg-uname" desc="lightningdmg-udesc">
  3.                         <int name="lvl">2</int>
  4.                         <int name="lightning-dmg">26</int>
  5.                 </dictionary>
  6.  

In order to alter or add new vendor options first we have to know how this works.  Look at the category (cat="") this tells the game to only display this upgrade if the vendor has off3 specified as one of his categories.  Next is the req, this is a required upgrade which has to be unlocked in order to display this one, specified by id.  Note that if you add your own upgrade you must have a unique ID, if you don't it will crash.  The last two entries in the top section are the name and desc.  The funny looking things up there just indicate that the name and description are fully spelled out in the English language xml in a different file, when we add our own we can just type them out explicitly here.

Now everything after that tag (except the "lvl") specifies what this upgrade does.  In this case it simply sets the lightning-dmg parameter to 26.  If you look at the top section of the class's file you can see everything which can be changed.  You could have an upgrade which set lightning-dmg to 2, made lightning-mana-cost negative 10 (so it gave you 10 mana every time you used it), changed your movement speed but set your health to 1.  Anything is possible if you just spell it out one piece at a time.  Now we're going to add a new upgrade, but this one we're going to do in the shared folder since we want all classes to have access to it.  This one will be a little different though, it won't actually DO anything to the player, but will exploit another facet of upgrades.  Purchasing an upgrade can always send out a signal to scripting events, in this case we're going to make a suspicious thief who offers to sabotage some of the Hall of Doom's traps for you, giving you a bit of an edge during the final encounter.  It looks like this.

Code: XML
  1.                 <dictionary id="sabotage" cost="100" cat="sabotage"
  2.                         name="Sabotage Traps" desc="For a small fee I could ensure that the Hall of Doom has a...malfunction...">
  3.                 </dictionary>
  4.  

Notice that we even made a new category, this is fine and totally works, we just have to set our suspicious thief fellow to sell from the "sabotage" category.  Now when we want to actually do the sabotaging all that we need to do is set up a GlobalEventTrigger to wait for the "sabotage" (the id of our upgrade) event.



At this point I'm going to take everything we've talked about and finish off the epic conclusion to the Hall of Doom.  Hopefully at this point you have enough to open it up yourself and look through it, I'll highlight a few key points if anything comes up which seems notable.
« Last Edit: May 31, 2014, 04:47:59 PM by Kashlavor »
Starting work on the Lair of the Archnecromantrix, a Hammerwatch campaign!

Kashlavor

  • Posts: 79
  • Spike Dodger.
    • View Profile
Part 2
« Last Edit: May 31, 2014, 04:48:31 PM by Kashlavor »
Starting work on the Lair of the Archnecromantrix, a Hammerwatch campaign!

Hipshot

  • Developer
  • Posts: 455
  • Level Designer
    • View Profile
Nice write, maybe I should sticky this one, since we have none, if it's ok?

Linaru

  • Moderator
  • Posts: 113
  • That Collectable coin is mine!
    • View Profile
its a great tutorial so far, explains things far better than my old one did.
-----------------------------------------------------------
Stabaddey Stabaddey Zap
-----------------------------------------------------------

Kashlavor

  • Posts: 79
  • Spike Dodger.
    • View Profile
Thanks, and sure that would be cool if you stuck it up there.  Gonna add in some more stuff today, its hard to remember what stuff seems obvious now (Ctrl+Alt click to link scrip elements...) that new people probably don't know yet.  I think I'm gonna slim it down some so its not too long and instead just go through an actual example of "making a room."
Starting work on the Lair of the Archnecromantrix, a Hammerwatch campaign!

clo

  • Posts: 8
  • Hello
    • View Profile
Thank you very much Kashlavor. I just checked my other thread and saw you replied linking me here. Great work.

Kashlavor

  • Posts: 79
  • Spike Dodger.
    • View Profile
Still adding more to it, keep checking back if you're still interested.
Starting work on the Lair of the Archnecromantrix, a Hammerwatch campaign!

Kashlavor

  • Posts: 79
  • Spike Dodger.
    • View Profile
I'd like to fit in a section listing out editor commands and stuff, but I'm already pushing the 20,000 character limit pretty hard...I'll figure something out in the morning.
Starting work on the Lair of the Archnecromantrix, a Hammerwatch campaign!

Hipshot

  • Developer
  • Posts: 455
  • Level Designer
    • View Profile
Char limit increased... so try now and btw, I just added a code highlighter to the forum, so you can use [code=xml] if you want, look at the composite skill list for an example.
« Last Edit: May 31, 2014, 02:51:44 PM by Hipshot »

NekoBaron

  • Posts: 124
  • Scripting Wizard
    • View Profile
You could write it up on multiple pages on the hammerwatch wikia http://hammerwatch.wikia.com/wiki/Hammerwatch_Wiki if you wanted the writing space and you can also reference other pages if needed.

Kashlavor

  • Posts: 79
  • Spike Dodger.
    • View Profile
Took some days off while I try to figure out how to set up the grand finale to the little tutorial level.  Thanks for the offer NekoBaron but I think 100,000 characters should be enough.  And while you guys have done a great job with the wiki I don't really want to write this out twice, I didn't even realize how much there would be to this writing it out once before I started lol.

Also, is there any way to use like a
Spoiler for Hiden:
tag kind of thing so that big sections of the tutorial can be "minimized" so its not quite so unwieldy.
« Last Edit: June 07, 2014, 10:32:17 AM by Kashlavor »
Starting work on the Lair of the Archnecromantrix, a Hammerwatch campaign!

Linaru

  • Moderator
  • Posts: 113
  • That Collectable coin is mine!
    • View Profile
i added a basic spoiler tag add-on to the forum for you. 

Code: [Select]

[spoiler=title goes here]content goes here[/spoiler]

-----------------------------------------------------------
Stabaddey Stabaddey Zap
-----------------------------------------------------------

shiftyBOT

  • Posts: 44
  • KlokWorkz main artist and level designer.
    • View Profile
I'm running linux,I have mono-complete and all the other needed things installed to make HammerEditor and LevelPacker work.
but I cant make the ResourceExtractor to work:/
is there any place I could download the resources from?
(I want them so I can base my custom things off them)
EDIT:
got it to work :P
I derped and forgot about paths.
:/
« Last Edit: July 07, 2014, 02:05:54 AM by shiftyBOT »

flesh420

  • Posts: 3
  • Maggot Crusher.
    • View Profile
The moveAI needs to be linked to Area Trigger, right?

Kashlavor

  • Posts: 79
  • Spike Dodger.
    • View Profile
The moveAI needs to be linked to Area Trigger, right?

Yes. I need to update that pic.
Starting work on the Lair of the Archnecromantrix, a Hammerwatch campaign!