Wednesday, October 17, 2012

Island Forge - A Guard Tutorial

This is another tutorial on using Island Forge's Island Builder. This time we're going to create a guardian creature using three actors, the guardian, something to appease it, and the person being guarded. You can see this in game by visiting the Isle of Test, and checking out the Guard Bunny, Sir Robin, and the nearby Pile of Grain. Save the grain for last so you can see the guard functionality.

Here's how I did this. Let's start with the easiest bit, creating actors that aren't actually in the actor list. IF supports the idea of a hidden actor. Placing an invisible actor on top of an object on the map (the grain and the bunny in this example) allows you to apply a script to anything in the game. Let's look at our actors one by one, starting with the simplest, Sir Robin.
Click for larger image
Sir Robin is a simple fellow. He has two bits of dialog, and spouts one or the other, depending on the state of the "Appease the Bunny" task (more on that later). The critical part here is the actual writing in node 2, the fail state response. It makes no mention of Sir Robin at all! Instead it tells you the way is blocked by the guard bunny, and offers a hint of how to appease it. Node 3, the success dialog, is just a throwaway line from Sir Robin, indicating success. Now let's look at Mr. Rabbit.
Click for larger image
He's a bit more complex. Here's what happens:

  • If he's been appeased, head for node 4, a simple fluffy bunny dialog.
  • If he hasn't been appeased, head for node 2, which describes the fierce guard bunny, and offers the opportunity to feed him. 
Feeding the bunny jumps to node 5, another branch node.

  • If you try to feed him without the grain, the action fails, leading to node 6
  • If you have the grain, the Appease the Bunny task gets flagged as finished in node 8, then the happy node 7 response is displayed.
Last, let's look at the grain.
Click for larger image
This is a pretty simple actor. We start with a branch node, almost always a good idea, and work our way forward from there. If the player has already taken the grain, there's nothing left, node 5, otherwise they have the option to take the grain, which sets the Take Grain task to finished. It's important to note that the actual task update is processed as part of the response to the "Take the grain" prompt, not as a response to the node 4 display. You always want to process tasks prior to displaying the results of the changes.

Now there are a couple things to note here. First I've only used the unset and finished states of the two tasks involved. This is fine, but when you do it, just be sure you treat the unused state consistently. I've treated started as finished, so if I accidentally trigger the task somewhere else it doesn't break anything. I've also been pretty sloppy with the Take Grain task here. If I were being picky I could reset the task to unset when you feed the rabbit, and have a third task to track the status of the grain pile itself. In this case the extra work isn't necessary, but using a tracking task for object state that's separate from the activity tracking task is sometimes necessary. More on that in a future post.

I think that about covers the bases for a simple guard creature tutorial. I hope you've found this useful. If so you can find other tutorials in the Island Forge tag. Enjoy!

No comments:

Post a Comment

Note: all comments are moderated to block spammers. Please be polite.