A Development Tutorial: Chapter 06
|A Development Tutorial: Chapter 6|
|Get the developer tools and try building new content for this game!|
|This Chapter||06: Monsters, Loot, and Scripts|
|More Chapters||Title Page|
Development Kit Setup
The World Map Editor
Create a 2-Map Zone
Monsters, Loot, and Scripts
Tracking Quest Progress
Setup of Scripting Environment
Understanding Quest Scripts
Dialogue: The "SAY" Menu
Floating FA Text
Dialogues vs Scripts
Simple Kill Quest
Mysterious Stranger Perk
Black Jack Game
Black Jack Installation
Adding monsters, loot, and some basic pre-written scripts.
So, next in line is, adding some monsters to the map, with some basic script. We will not make scripts, only use some default ones. The first thing you might notice, is that if you place a critter on the map, for example a Mole Rat, it will stay idle and do nothing, unless attacked. In order to make a Critter be aggressive or semi-aggressive, it will need some scripts. There are some good basic scripts in the Klamath map (Rats/Geckos), we will use those. (The are in the scripts files not in the map of course, but you can access them by checking Klamath map with Mapper.)
- First things first, if you haven't, create a new bat file to launch your server. It should delete all fosmapb from the maps, and launch server after. This way you will never run in circles trying to figure out, why things don't works, when the only problem was, that you forgot to clean, rebuild the maps and reload the world. In case you don't know how to make batch files, just make a new text file with the name CleanWorld.bat in the Server folder and add the following 3 lines to it:
- "del maps\q*.fomapb"
- "del save\world*.fo"
This will delete ur current world save as well, so every progress your char had, except it's creation and location is lost.
- Launch Mapper.
- Create a cave (or copy one, but remove useless "tech" objects so u don't accidentally get random monsters generated) and place some rats in it.
- Use the property editor (press F9 to toggle on/off) to set the mobs (I will refer to monsters/critters as mobs from now on) script to the following:
- Set ScriptName to "mob" (This will tell which script file to check for the function below. Server\Scripts\mob.fos )
- Set FuncName to "critter_init" (This is the function (script) to be called when creating this mob)
- Save the map and try it. Use your new batch file.
- Select the mob (click on it, have details window turned on - F9)
- On the bottom panel select Norm, double click it and filter for ammo.(You target on the map still should be the rat.)
- Now Alt+Click on some shotgun shells.
- On the bottom panel select Inve, you should see the shotgun shells added. You can Alt+Click to remove them.
- To set the amount of the shells, just click on the shells and edit the Count to a different value than 0.
- Launch server and client, to try it out.
- Kill the mob for your reward: 1 shotgun shell ;)
The result should look like this in Mapper: (images soon)
Adding aggressive mobs usually does not fulfill all of the quest writers desires. So our next step is, to add some mobs, that do not move/attack, until they are triggered to do so. For this, we will also make a new dialog. The molerat will talk to the player, and the player will have some options how to engage it. The choice "I will exterminate you and all your vermints." will trigger all mobs who see the player to attack him, otherwise the player can leave peacefully or take on the molerat in a man versus rat duel.
- Launch Dialog Editor and create a new dialog.
- Make the dialog tree as the picture below shows.
- After saving it, make sure you edit the dialog list (Server\dialogs\dialog.lst)file and add to it the dialog you made, I used 2102 for dialog ID.
- Add the dialog ID to the Molerat Dialog property.
- Add some small rats around the Molerat and set their ScriptName to "mob" and FuncName to "_DontMove".
- Add some weapons to the entrance of the cave, so your character can survive the rat attack.
- Save map and try.
Note: Use Demand or Result to add scripts to dialogs. The one we added, was in the script file named dialog and the scripts function name was r_Alert. We will do more complicated scripts later on, but if you want, feel free to study some of the script files.