A
          / \      _             Play Now                         Nemesis on fb
          | |     | |  _______   _        _   _______    _______   _    _______
          | |\    | | |   ____| |  \    /  | |   ____|  /   ____| | |  /   ____|
 /-------/-------------------------------------------------------------------,
O= Home <=XX|  About  News  Pics  Adventurers  Wizards  Download  Connect     >
 \-------\-------------------------------------------------------------------'
          | |   \   | |  |____  | |      | | |  |____   ___ \  \  | |  ___ \  \
          | |     \_| |_______| |_|      |_| |_______| |_______/  |_| |_______/
          \ /
           V  

Documentation Area

Document Path: /doc/monster/check_feeling


Lfun:	check_feeling - react to a targetted feeling

Synopsis:
	int check_feeling(string verb, object who, string adverb)

Description:
	check_feeling is called by secure/commander before a feeling
	targetted on a monster is executed.
	
	You can handle the feeling yourself, for example by giving your
	own message, or you can let the processing continue and react to
	the feeling.
		
	The soul commander exports a function which can be used to query
	the "friendlyness" of a feeling, to help to find an appropriate
	reaction.

Return value:
	1 if check_feeling is handling the result
	0 if standard processing should continue

Examples:
	// Handle a specific verb:
	inherit "obj/monster"

	reset(arg) {
	  if (arg) return;
	  set_name("ghost");
	  set_short("a ghost");
	}

	check_feeling(verb, who, adverb) {
	  if (verb == "kick") {
	    tell_object(who, "You try to kick the ghost, but miss!\n");
	    say(who->query_name()+" tries to kick the ghost, but misses.\n",
	      who);
	    return 1;
	  }
	}

	// React to unfriendly verb type:
	#include <daemon.h>
	inherit "obj/monster"

	reset(arg) {
	  if (arg) return;
	  set_name("dragon");
	  set_short("a huge sleeping dragon");
	  set_wc(20);
	  set_ac(20);
	  set_hp(800);
	}

	check_feeling(verb, who, adverb) {
	  if (SOUL_COMMANDER->query_feeling_type(verb) < 0) {
	    tell_object(who, "This might not have been a good idea...\n");
	    call_out("start_attack", 5, who);
	  }
	}

	start_attack(who) {
	  set_short("a huge dragon");
	  tell_object(who, "With a deafening roar the dragon rises high and "+
	                   "attacks you!\n");
	  say("With a deafening roar the dragon rises high and attacks "+
	      who->query_name()+"!\n", who);
	  attack_object(who);
	}

See also:


This page was generated in LPC

Imprint / Impressum