INFO
	weapon - the OLD and OBSOLETE generic weapon

DESCRIPTION
	This file is rather obsolete. Use the /std/simple_weapon, and read the
	extensive doc on it in /doc/std/simple_weapon.doc .

	Obsolete text:
	There is a generic weapon avaliable. To set up do :
		object wobj;
	
		wobj = clone_object("obj/weapon");
	
	For customization the following routines are available :
	
	You should call these functions:
	set_name(n) 
	    string n. Sets the name and short description to n.
	    Sets long description to "You see nothing special.\n"
	
	set_class(c) 
	    int c. Sets how much damaged it will do. Refer to weapon.list to
	    get the suggested value.
	
	set_weight(w) 
	    int w. Sets the weight.
	
	set_value(v) 
	    int v. Sets the value.
	
	These are the optional functions:
	set_alt_name(n) 
	    string n. Adds an alternate name to weapon.
	
	set_alias(n) 
	    string n. Adds another alternate name to weapon.
	
	set_short(sh) 
	    string sh. Short description is set to sh. Long to capitalize(short)+"\n"
	
	set_long(long) 
	    string long. Long description is set to long.
	
	set_read(str) 
	    string str. str will be returned if it's read.
	
	set_info(n) { info = n; }
	    string n sets the info to n info is an extrastring that some
	    guilds/objects  uses to see special messages from the creator of the
	    object. ie. good use for this in magic- or quest items.
	
	set_hit_func(ob) 
	    object ob. Sets up a call to function 'weapon_hit' in object 'ob'.
	    'weapon_hit' is called every time the weapon strikes someone.
	    The argument given to 'weapon_hit' is the target of the attack.
	    The return value of 'weapon_hit' adds to the weapons wc for this hit.
	    Returning the string "miss" will cause the weapon to miss.
	
	set_wield_func(ob)
	    object ob. Sets up a call to function 'wield' in object 'ob'.
	    'wield' is called every time the weapon is wielded.
	    A return value of 0 from 'wield' means that the weapon will not 
	    be wielded. 1 that it's okey to wield it.
	
	set_magic()
	    calling this function will set the magicflag in the weapon.
	    Set_wield_func and set_hit_func will set the magicflag automatically.
	    Set this if you don't want your weapon to be modified by
	    weaponsharpers etc.
	
	set_hit_lines_object(ob)
	    object ob. Sets up a call to the function 'hit_lines' in object 'ob'.
	    'hit_lines' is called every time you hit something and is wielding the
	    weapon. The arguments given to 'hit_lines' is how much damage the attack 
	    does,  the target of the attack, and who the attacker is (the one that  
	    wields the weapon). 'hit_lines' should return an array containing of 
	    3 strings: ({ "Message to the target", "Message to the wielder", 
	    "Message to the rest of the people in the room" });
	    If an correct array isn't returned then the regular message will be used.
	    NOTE! All weapons that change the hit message must be approved by 23++.
	
	EXAMPLE
		/*
		 * This is a magic sword is has a wc of 9 as base
		 * and a wc of 19 if it's attacking an orc.
		 */
		orc_slayer = clone_object("/obj/weapon");
		orc_slayer -> set_name("short sword");
		orc_slayer -> set_alias("sword");
		orc_slayer -> set_short("a short sword");
		orc_slayer -> set_alt_name("orc slayer");
		orc_slayer -> set_long("This is a very fine blade.\n"+
			"It's covered with ancient runes.\n" + 
			"Engraved on it is a picture of the sword slicing an orc.\n");
		orc_slayer -> set_read("The only thing you can read is the word 'orc'.\n");
		orc_slayer -> set_class(9);
		orc_slayer -> set_weight(2);
		orc_slayer -> set_value(200);
		orc_slayer -> set_hit_func(this_object());
		orc_slayer -> set_hit_lines_object(this_object());
		.
		.
		.
	
	weapon_hit(attacker)
	{
	    if(attacker -> id("orc")){
		write("Ziiing\n");
		return 10;
	    }
	    return 0;
	}
	
	hit_lines(dam,target,hitter) 
	{
		string tarname, hitname;
		tarname = target->query_name();
		hitname = hitter->query_name();
		if (!dam) 
		 return ({ hitname+" tries to hit you, but you evade it beautifully\n",
		           tarname+" evades your attack.\n",
		           tarname+" evades "+hitname+"'s attack.\n" });
		if (dam < 15) 
		 return 0;
	        return ({ hitname+" hits you black and blue.\n",
			  "You hit "+tarname+" black and blue.\n",
			  hitname+" hits "+tarname+" black and blue.\n"});
	}

Help topics available:
armour drinks food key monster
smartmonster weapon

[START|BACK ]




[ NannyMuds main page | FAQ | Contact us ]

You are guest number 133 since November 2019.
This file was last modified: June 2000.