Example MUD Prog – Randomly Restrung NPC’s

These progs will show you a simple framework for randomly named NPC’s.  The example will randomly set the gender, name, short and long description for the NPC.  The mob will load a random set of clothing and possibly a piece of loot.

Please note, these MUD Progs were written and tested on a Dawn of Time version 1.69s_beta5 MUD. The scripts do require my snippet to give mobiles access to the SHORT and STRING commands in the MP Commands List.

You need a generic mobile that will morph into a random npc when it loads into the game. I’m using mobile 3006, a Dusk Elf. The program that kicks off the random generation is number 3200 in my example, so I have set the Dusk Elf mobile to call that program with a repop trigger.

MUDPrograms for [ 3006]:
Mudprogs on this mob will not ignore questers
Mudprogs on this mob WILL NOT ignore non questers
Mob mudprog triggers: repop 
 Number Vnum Trigger Phrase   
 ------ ---- ------- --------------------
[    0]  3200   repop 100   

Read moreExample MUD Prog – Randomly Restrung NPC’s

Snippet – Giving NPC’s the String and Short Commands

Editing

By giving mobiles the ability to use the immortal commands STRING and SHORT, amazing things can happen. In my next post, I’m going to show you how to write three scripts that will give your cities a plethora of randomly named NPC’s. Those scripts depend on this snippet.

Please note, this snippet is compatible with version 1.69s_beta5.

mp_cmds.cpp

add to the delcarations near the top:

DECLARE_DO_FUN( do_short);
DECLARE_DO_FUN( do_string);

Then around line 197 in the table of mp commands, add the following:

	{"short",do_short,"Works just like the Imm command SHORT."},	
	{"string",do_string,"Works just like the Imm command STRING."},	

Read moreSnippet – Giving NPC’s the String and Short Commands