Snippet – Giving NPC’s the String and Short Commands

Snippet – Giving NPC’s the String and Short Commands

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."},	

act_wiz2.cpp

change the top 22 lines of of do_string to:

void do_string( char_data *ch, char *argument )
{
    char type [MIL];
    char arg1 [MIL];
    char arg2 [MIL];
    char arg3 [MIL];
    char logged[MIL];
    char_data *victim;
    OBJ_DATA *obj;

	if ((  !IS_HERO(ch) 
		&& !IS_IMMORTAL(ch)
		&& !IS_NPC(ch)
		&& !IS_RP_SUPPORT(ch)))
	{
		do_huh( ch, "" );
		return;
	}