Modding FOGD part II

Hi and welcome to the second mod-lesson for a Family of Grave Diggers!

Well, the first post was just an overview so we could consider this one to be the first real mod post, but enough talking, lets dive in and get to work! Now, now, not too fast, lets start with something easy just to check things out.

A potion that adds 1 point of attack permanently, the Strength Potion (Graphics Credits Ail)!

So what do we need:

  • A 34×34 icon for the item (right click, save link as…)
  • A text editor (for example Notepad++)
  • Around 20 minutes

Ready?

Go!

  1. Open your game folder, the copied one (see post 1 for instructions where you have copied it), open Mod/gfx/item and copy the icon in the two folders /mapsize and /slotsize.
  2. Move up two levels (or back if you prefer) to the  /Mod folder and open /Script/Item/potion
  3. Create a new file named “strength potion.lua” (if you can’t see the extension, see this post!)
  4. Open the file with your favourite text editor (or another if you feel rebellious).

The items in a Family of Grave Diggers are all made up like this, a graphic part and a “code” (or script) part.

Come back, it’s really easy to script things!

The file needs 6 functions, this is what make the item tick and moreover it tells the game what to do with it (I put what we’ll use in parentheses).

  1. What type is it? (see below, but it’s “USE”)
  2. What kind of characteristic does it give when equipped (we can’t equip it so nothing)
  3. How many charges does it have if any. (It’s just a one shot so no charges)
  4. An ingame description. (That’s the hard one!)
  5. The variation, so for example a weapon can have different variations (no need here though!)
  6. The scary Function that gets called when the item is used! (see below…)

For the type, there are a bunch of types: USE, EAT, SHOES, HEAD and so on, we’ll use the “USE” type as the player will actually use the item.

The only other specificity is the sixth bulletpoint, the USE function!

Here we can do whatever we want to, spawn a new map, invoke monsters, remove all the hitpoints except one, but lets not do that and instead, add +1 to the players attack:

(Hint: right-click and choose “save as” to download the whole .lua file)

Almost done!

Well, we are done actually but the item will never drop so we can’t test it…

Let’s insert it in the random drops! Go up two steps to /Mod/Script and open droprandomitem.lua.

It’s a fairly powerful item so lets make it a level 2 item!

Search for “itemlevel2arr” and add it to the list of drops, with a half-low droprate (droprates are just important comparing to other items in the same level, they are not percentages).

Note: the name is the filename without the .lua extension.

Done! Now just play for hours and hope the monster you just killed will drop it!

Or maybe we’ll cheat a little bit to check if we didn’t make some typo when we wrote all those script lines right?

So hold your hat because we are going to cheat!

A little bit.

In the folder where GravbeDiggers.exe lives (one step below /Mod), once you have ran the game and exited normally  at least once, you will have 3 save files;

  • maps.bin for the maps
  • data.xml for running monsters, items, bonuses et al.
  • and finally glob.txt which is the most hideous one but it’ll do our deed.

Now just a word of caution, you don’t want to break any of those three files, so

Back them up!

I mean it! If you mess it up, you’ll loose all your progress and the game will just go bananas.

You have been warned!

Let’s calm down and open glob.txt, which is just a ton of variable names and numbers and stuff and search for SHOPITEMS_FOOD

On the line following SHOPITEMS_FOOD, you’ll find a list of all the things the first shopkeeper (the green guy with the cheesy cubes on his head) sells.

The line (warning, never erase or insert a newline in this file!) is composed of a name, a comma, a number (the variation) and a semicolon. Now lets add our potion to the line!

So before it looked like something like this:

And after it will look like this: (you add a semicolon, the name, a comma and a zero)

Save the file, take a deep breath and start the game.

And voilà, the shopkeeper now gives away free potions!

Have fun with an abnormous attack and see you in the next episode!

Cheers

 

Ludvig Larsson aka Valmond @ Mindoki Games

 

 

Modding FOGD part I

Hi everybody!

You remember that a Family of Grave Diggers was specifically built to enable easy modding right? So today I’ll start talking about how you can dive in and mod the game!

Step 1:

Find the game:

If you bought it on Steam:

  • Open the Steam client
  • go to your [Library]
  • scroll down to a Family of Grave Diggers (yeah, it’s under ‘F’)
  • right click and select ‘Properties’.
  • Select the tab [Local Files]
  • click the button [Browse local files...]

If you bought it elsewhere then I can’t know where it’s installed but as you most probably launch the game with an icon, do this!

  • Right click icon
  • Click ‘Properties’
  • Click the button [Open File Location] (or ‘Find Target’ on XP)

If you don’t have an icon, then you’ll know where GraveDigger.exe lives, just open that folder.

Found it? Phew! Lets copy it over somewhere so we won’t meddle with the ‘original’ game files as it will be overwritten by any new Steam update for example, so go up one level and copy the folder [a Family of Grave Diggers] somewhere else on your computer.

Enter the freshly copied folder and you should now see all of the compiled code and data, it should look something like this (plus a couple of save files probably):

This is the root folder, and it’s filled with terrifying files mortals shouldn’t meddle with (just kidding) but don’t fret, we won’t touch anything in there with the exception of the ‘Mod’ folder and eventually, save files. And of course launch the GraveDiggers.exe to check out our newly brewed mod!

But enough talking, open the Mod file and you’ll find something like this:

Doesn’t seem like a lot eh, but here we actually have all the nifty things that we’ll want to modify or add to. Or delete if there is something you dislike!

  • font : here we store fonts for the game (lets skip this for now)
  • gfx : All the graphics are stored here
  • map : All the fullblown maps, like the map where you start or the wizards tower
  • mapparts : the Schrödinger map parts, it’s like puzzle pieces that’s get stuck together to generate the maps
  • music : hmm hmm ta daaa!
  • Script : here lives all the scripts who control about everything in the game
  • sound : Bang crash, sound effects here!

So lets dive in shall we?

Follow me to part two then!

 

Steam Greenlight is ON!

So I finally jumped the fence, got some nice screenshots, fixed a “logo” and even made a video (by user request) and submitted a request for Greenlighting my Roguelike on Steam!

First surprise, 5% of (supposed) need to get greenlit in the first 2 days!!

If you want to check it out, you can do it through your steam app, here is the Big Button, just waiting to be clicked:

Or if you want to, you can check it out on their website too: Greenlight!.

Eating cheese and drinking wine right now, thanking you all for the massive support so far!

Cheers to you all and see you tomorrow!

Valmond