From twilight@boreal.alfred.eduWed Nov 22 15:04:50 1995 Received: from maxvax.alfred.edu by mail.netcom.com (8.6.10/Netcom) id LAA19957; Mon, 20 Mar 1995 11:45:26 -0800 Received: from aucmpsci.alfred.edu by bigvax.alfred.edu (MX V4.1 VAX) with SMTP; Mon, 20 Mar 1995 14:46:13 EST Received: from boreal.alfred.edu.aucmpsci by aucmpsci.alfred.edu (4.1/SMI-4.1) id AA11766; Sun, 19 Mar 95 22:13:01 EST Received: by boreal.alfred.edu.aucmpsci (4.1/SMI-4.1) id AA03535; Sun, 19 Mar 95 22:13:07 EST Date: Sun, 19 Mar 1995 22:13:06 -0500 (EST) From: Twilight Mud <twilight@boreal.alfred.edu> To: merc-l@netcom.com Subject: Object trap stuff Message-Id: <Pine.SUN.3.91.950319221205.3531A-100000@boreal.alfred.edu> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII For those of you interested i am sending out Twilight and Vego muds object trap stuff....it has been used a bit...but i won't guarantee it is totally bug free....just make these changes and add in the trap.c file. Hope i didn't forget anything ;) --Helix Here is the object trap stuff..... >>Add this to merc.h obj_data struct: sh_int trap_eff; sh_int trap_dam; sh_int trap_charge; >> Add this to merc.h areas of interest to builders /* All new trap stuff */ #define TRAP_DAM_SLEEP -1 #define TRAP_DAM_TELEPORT 0 #define TRAP_DAM_FIRE 1 #define TRAP_DAM_COLD 2 #define TRAP_DAM_ACID 3 #define TRAP_DAM_ENERGY 4 #define TRAP_DAM_BLUNT 5 #define TRAP_DAM_PIERCE 6 #define TRAP_DAM_SLASH 7 #define TRAP_EFF_MOVE 1 /* trigger on movement */ #define TRAP_EFF_OBJECT 2 /* trigger on get or put */ #define TRAP_EFF_ROOM 4 /* affect all in room */ #define TRAP_EFF_NORTH 8 /* movement in this direction */ #define TRAP_EFF_EAST 16 #define TRAP_EFF_SOUTH 32 #define TRAP_EFF_WEST 64 #define TRAP_EFF_UP 128 #define TRAP_EFF_DOWN 256 #define TRAP_EFF_OPEN 512 /* trigger on open */ >> Add a new object extra flag in merc.h #define ITEM_TRAP #### >> Add these to do_functions in merc.h: DECLARE_DO_FUN( do_trapset ); DECLARE_DO_FUN( do_trapremove ); DECLARE_DO_FUN( do_trapstat ); DECLARE_DO_FUN( do_traplist ); >> Add these to bottom of merc.h with other functions: /* trap.c */ bool checkmovetrap args( ( CHAR_DATA *ch, int dir) ); bool checkgetput args( ( CHAR_DATA *ch, OBJ_DATA *obj) ); bool checkopen args( ( CHAR_DATA *ch, OBJ_DATA *obj) ); >> Add these to interp.c: { "traplist", do_traplist, POS_DEAD, L_DEI, LOG_NORMAL }, { "trapstat", do_trapstat, POS_DEAD, L_DEI, LOG_NORMAL }, { "trapset", do_trapset, POS_DEAD, L_DEI, LOG_NORMAL }, { "trapremove", do_trapremove, POS_DEAD, L_DEI, LOG_NORMAL }, >> Add this to act_move.c in move_char: >> after the bug for bad door block.... if ( checkmovetrap(ch, door) ) return; >> Add this to act_move.c in do_open: >> before REMOVE_BIT(obj->value[1], CONT_CLOSED); if (checkopen(ch, obj) ) return; >> Add this to act_obj.c in get_obj: >> after "You can't take that!" block if (checkgetput(ch, obj) ) return; >> Add this to act_obj.c in do_put: >> after the closed container check. if (checkgetput( ch, container) ) return; >> And of course...put in trap.c ;) >> Below here is all the stuff required to load traps from .are files >> Add to obj_index_data struct in merc.h: sh_int trap_eff; sh_int trap_dam; sh_int trap_charge; >> Add this to db.c in load_objects: >> below pObjectIndex->extra_flags = fread_number( fp ); if (IS_SET(pObjIndex->extra_flags, ITEM_TRAP) ) { pObjIndex->trap_eff = fread_number( fp ); pObjIndex->trap_dam = fread_number( fp ); pObjIndex->trap_charge = fread_number( fp ); } else { pObjIndex->trap_dam = 0; pObjIndex->trap_eff = 0; pObjIndex->trap_charge = 0; } >> add this to db.c in create_object: >> below the obj->cost assignment obj->trap_eff = pObjIndex->trap_eff; obj->trap_dam = pObjIndex->trap_dam; obj->trap_charge = pObjIndex->trap_charge; >> That should do it...... Just whenever you wanna load a trap..set the extra bit, then after the extra bit place values for trap_eff, trap_dam, and trap_charge. Works like a charm ;) NOTE: Be very careful when using areas from other muds because if the ITEM_TRAP extra bit is used in an area file....it will be looking for the trap numbers after it. --Helix ============================================================================= / ______ _______ ____ _____ ___ __ _ ______ ____ ____ _____ / \ | ____|__ __| _ \ / ____\ / _ \| \ / | ____| / __ \| _ \ / ____\ \ / | |__ | | | |_| | | | |_| | |\/| | |___ | | | | |_| | | / / | ___| | | | ___/| | __| _ | | | | ____| | | | | __/| | ___ \ \ | | | | | | | |___| | | | | | | | |____ | |__| | |\ \| |___| | / / |_| |_| |_| o \_____/|_| |_|_| |_|______|o \____/|_| \_|\_____/ \ \ / ============================================================================ ------------------------------------------------------------------------------ ftp://ftp.game.org/pub/mud FTP.GAME.ORG http://www.game.org/ftpsite/ ------------------------------------------------------------------------------ This archive came from FTP.GAME.ORG, the ultimate source for MUD resources. ------------------------------------------------------------------------------