Page: 1 2 3 >>
Contents:
1. Introduction
2. The quest-setting character
3. Gunther's daily routine
4. The quest
5. The object of the quest
6. The "Quest completed" dialogue
1 Introduction
At the end of this tutorial, you'll have produced the elements
of a mini-mission, where the player has to retrieve a sword for
a non-player character. You'll create the quest-setting NPC, the
sword, and the necessary dialogues.
You'll need the Gothic Mod Devlopment Kit, and a text editor. UltraEdit
is the editor recommended by Piranha Bytes.
Note that this tutorial doesn't leave you with a stand-alone Mod,
it involves modifying actual Gothic game code. Once complete, your
new NPC will be part of your Gothic game, albeit not one the other
characters are very interested in.
Anything written after a // is a comment. If a comment continues
onto a second line, you need to start each line with //, to prevent
Gothic from treating it as code.
2. The quest-setting character
To add a new NPC to the game, you need to create a new instance
of the class C_Npc. (Bet you wish you'd paid attention in those
C++ classes now.) What follows is a short overview of the class,
which we'll then fill out with the values for our new NPC.
The class:
CLASS C_NPC
{
VAR INT id; // an ID number for the NPC
The id is a unique identifier for this NPC. An example of its
use is matching the right daily routine to the right NPC.
VAR STRING name [5]; // The NPC's name
This string is the one shown when the NPC is in focus or is speaking.
VAR STRING slot;
This string is unused at present, but is available for any special
situations that might come up.
VAR INT npcType;
This integer identifies particular groups of characters within
Gothic. For example Npc_TypeMain refers to an important plot character
such as Diego.
VAR INT flags;
Used to set the NPC as immortal, with flags = NPC_FLAG_IMMORTAL;
VAR INT attribute [ATR_INDEX_MAX];
The attribute values of an NPC are stored in an array - more
on this later.
VAR INT protection [PROT_INDEX_MAX];
The protection variable is handled in the same wasy as the Attributes
above. They can be used to give an NPC a natural armour against
certain damage types, e.g. fire.
VAR INT damage [DAM_INDEX_MAX];
Theoretically, this gives the ability for an NPC to do differing
amounts of damage in melee combat. In practice it's a bit pointless,
because damge is usually governed by the weapon-type. Should you
want to experiment, acceptable values are:
DAM_INDEX_BLUNT
DAM_INDEX_EDGE
DAM_INDEX_POINT
DAM_INDEX_FIRE
DAM_INDEX_FLY
DAM_INDEX_MAGIC
VAR INT damagetype;
Gives the type of damage done by the NPC, unless a wepaon is
used.
VAR INT guild, level;
Used to assign the NPC a particular guild and level. A typical
Guild might be GIL_NONE, for those with no guild.
VAR FUNC mission [MAX_MISSIONS];
Obsolete.
var INT fight_tactic;
This determines how the NPC will act in combat. If you're lucky,
there will be further discussion of FAIs (Fight AIs) later on.
VAR INT weapon;
Obsolete.
VAR INT voice;
Voice number for the NPC.
VAR INT voicePitch;
Can be used to alter the voice's pitch.
VAR INT bodymass;
Obsolete.
VAR FUNC daily_routine;
This describes which daily routine this character is to use.
VAR FUNC start_aistate;// Here you can give the 'state' which is
used when the character is first created.
// **********************
// Spawning
// **********************
VAR STRING spawnPoint;
This holds a waypoint where the NPC will respawn when killed.
If left empty, death is final.
VAR INT spawnDelay;
Delay (in real-time seconds) between death and respawning.
// **********************
// SENSES
// **********************
VAR INT senses;
NPCs have three senses:
SENSE_SEE. This is real sight, ie obstacles block it.
SENSE_HEAR. Walls block this, but trees, for example, don't.
NPCs can also hear behind them.
SENSE_SMELL. Nothing blocks the mighty sense_smell!
VAR INT senses_range;
Range of senses in cm.
// **********************
// Feel free to use
// **********************
VAR INT aivar[50];
An array of 50 variables which can be stored for each NPC.
VAR STRING wp;
C++ Code (in Gothic.exe) stores whichever waypoint here which
is currently associated with the NPC, usually the next one he'll
head to, given his daily routine.
// ***********
// Experience
// ***********
VAR INT exp; // Experience points
VAR INT exp_next; // Experience points needed to reach next level
VAR INT lp; // Learning points
};
These three variables are only useful for the player character.
Page: 1 2 3 >> |