This little program creates pages of throw away NPCs. Enjoy.
- ------8X-- Snip Snip Snip -----------------------------------------------------
/* NPC.C -- A MegaTraveller Non-Player-Character Generator
Rob Miracle
Language: ANSI 'C'.
This program has been successfully compiled under Turbo 'C' V2.0 and
VAX/VMS 'C'.
Purpose
This program was written to generate pages of NPCs for MegaTraveller.
These NPC's are for Non-important characters who will most likely
be envolved in combat with the players and whose life span is so
short that they do not need more detail. The output is simple.
Each NPC has their 6 digit statistics which are hex digits ranging
from 0 to 15 (for simplicity, these range from 2 to 12). The stats
are coded in the following order:
STRENGTH DEXTERITY ENDURANCE INTELLEGENCE EDUCATION SOCIAL_STANDING
After the stats are their pluses to hit for Strength in hand-to-hand
situations, their pluses to hit for Dexterity for range combat. Their
pluses to hit for a particular hand to hand weapon and their pluses to hit
with a range weapon. Add the two together and get their total combat
pluses for each type of combat.
Now for the quasi-legal stuff. Due to the simple nature of the
process, I am not going to bother with the paper work and let the
Common Copyright Law take care of me! It is being placed in the
public domain. (Let's face it, would you pay for something this
simple?) This software comes without warrenty and the author is not
liable for any damages that it may cause. Any similarity to any other
work is purely conencidental. I mean, how many ways are there to do
this?
To Compile Under:
MS-DOS with Turbo C V2.0
tcc -mt -lt npc
VAX/VMS
cc npc
link npc
Unix System V and BSD
cc -o npc npc.c
To Execute Under:
MS-DOS and Unix:
npc n where n is the number of npc's to generate.
VAX/VMS
npc :==$'f$environment("default")'npc
npc n
*/
#include <stdio.h>
/* Big COMPLEX Dice Rolling function: s is the number of sides on a dice */
/* to roll */
int d(int s) {
return(rand() % s + 1);
}
/* Majorly Intricate function to generate headers at the top of a new page */
void newpage() {
printf("%c NPC UPP +Str +Dex Melee Firearm\n",12);
}
main(argc,argv)
int argc;
char *argv[];
{
int i,j,k,l,upp[10]; /* Counters, temp variables, and the stat registers */
int lineno = 70;
/* Very Difficult Command line Parsing procedure */
if(argc != 2) j = 30;
else j = atoi(argv[1]);
if (j == 0) j = 30;
/* Seed the random number generator with something semi-unique */
srand(time(NULL));
/* Loop for j NPCs */
for(i=1;i<=j;i++)
{
if (lineno > 59) { /* If we are past the page, then start a new one */
lineno = 0;
newpage();
}
/* Generate the six stats. This is the hardest part of the program */
for(k=0;k<6;k++) upp[k] = d(6)+d(6);
upp[6] = upp[0] / 5; /* Computer +'s to hit for str */
upp[7] = upp[1] / 5; /* and Dex */
l = d(6); /* Compute the hand-to-hand skills */
switch(l) { /* On a 1, 2, or 3, their skill level is 1 */
case 1 : /* On a 4 or 5 it is a 2, and on a 6 it is a 3 */
case 2 :
case 3 : upp[8] = 1; break;
case 4 :
case 5 : upp[8] = 2; break;
case 6 : upp[8] = 3; break;
}
l = d(6); /* Repeat the process for Fire Arms */
switch(l) {
case 1 :
case 2 :
case 3 : upp[9] = 1; break;
case 4 :
case 5 : upp[9] = 2; break;
case 6 : upp[9] = 3; break;
}
/* Print the results */
printf("%3d %1X%1X%1X%1X%1X%1X %3d %3d %3d %3d\n\n",
i,upp[0],upp[1],upp[2],upp[3],upp[4],upp[5],upp[6],upp[7],
upp[8],upp[9]);
lineno += 2; /* Increment the line number */
}
}
- ------8X-- Snip Snip Snip -----------------------------------------------------
Rob Miracle | Bitnet : [email removed] CIS: [email removed]
Programmer/Analyst-II | INTERNET : [email removed]
University of Louisville | UUCP : ...[email removed]