citizen.c

./lib/doc/examples/monster/citizen.c · 2.0 KB

From the archive heaven7_2v06.tar.gz

Download the archive   « Back to the archive contents

/* Monster which talks both during a fight, and during */
/* peace. This monster also has a weapon wielded.      */
/* It also moves in a random direction for each reset  */
/* it gets. If there is no player in the room the      */
/* monster can also wander around more often than once */
/* at each reset.                                      */
/* Author : Goosestep                                  */

inherit "/inherit/monster";

void reset(status arg) {
  ::reset(arg);
  if(!present("shortsword")) {
    object ssword;

    ssword = clone_object("doc/examples/weapons/ssword");
    move_object(ssword, this_object());
    init_command("wield shortsword");
  }
  if(arg) return;
  set_name("codlamin citizen");
  set_alt_name("citizen");
  set_level(3);
  set_short("Codlamin citizen");
  set_long(
  "This is a resident of the city of Codlam.  He looks very intelligent and\n"+
  "strong, and he is armed.  The Codlamin people are generally peaceful.\n");
  set_alignment(-50);

  /* chat while not fighting */

  load_chat(5, ({
    "The Citizen says: If you don't like the weather...wait ten minutes.\n",
    "The Citizen says: You're not from here, are you?\n",
    "The Citizen says: The wharves are dangerous...\n",
    "The Citizen scratches his chin.\n",
    "The Citizen says: Try the local vodka at Bart's. It's very tasty.\n",
    "The Citizen looks up to check the weather.",
    "The Citizen eyes you suspiciously.\n",
  }));

  /* chat when fighting */

  load_a_chat(35, ({
    "Citizen exclaims: Take that!\n",
    "Citizen shouts: Help, Guards!\n",
    "The Citizen squares off against you.\n",
  }));
  set_race("human");
  set_gender(1);
  add_money(random(100));   /* Give him some money */
  set_move_at_reset(1);     /* make him move to a new location at each reset */
  set_wander(0,120);        /* wander every 4 minutes if no player present */
}

/*
Notes: set_wander() has changed a little, yet to keep it compatible
with the old format, set_wander(chance, time). Time is still number of
heart beats. Chance is a dummy arg for old set_wander() fn uses.
 */

Site Stats

Snippets: 1791
Codebases: 571