Added Apr 27, 1998. Click the link below to read it or download it. From: Tony Robbins <tonyr@NWPACLINK.COM> Subject: Snippet portal modified for object use structs.h Add an item type for portal: #define ITEM_PORTAL 24 /* or whatever the next highest number is */ constants.c Add a listing in item_types[] for portals. limits.c After the code to extract a corpse but within that for statement add: if (GET_OBJ_TYPE(j) == ITEM_PORTAL) { if (GET_OBJ_TIMER(j) > 0) GET_OBJ_TIMER(j)--; if (!GET_OBJ_TIMER(j)) { act("A glowing portal fades from existance.", TRUE, world[j->in_room].people, j, 0, TO_ROOM); act("A glowing portal fades from existance.", TRUE, world[j->in_room].people, j, 0, TO_CHAR); extract_obj(j); } } spells.h Add: #define SPELL_GATE 53 /* or whatever the netx highest number is */ And where the other ASPELL prototypes are: ASPELL(spell_gate); spell_parser.c In the spell names list: "gate", In call_magic() where other manual spells are called: case SPELL_GATE: MANUAL_SPELL(spell_gate); break; Anywhere in mag_assign_spells() between spellos: spello(SPELL_GATE, 50, 50, 0, POS_STANDING, TAR_CHAR_WORLD | TAR_NOT_SELF, FALSE, MAG_MANUAL); spells.c Anywhere between the other ASPELL functions: #define PORTAL_OBJ 20 /* the vnum of the portal object */ ASPELL(spell_gate) { struct obj_data *portal, *tportal; struct extra_descr_data *new_descr, *new_tdescr; char buf[80]; if (ch == NULL || victim == NULL) return; /* create the portal */ portal = read_object(PORTAL_OBJ, VIRTUAL); GET_OBJ_VAL(portal, 0) = world[victim->in_room].number; <-- modification GET_OBJ_TIMER(portal) = (int) (GET_LEVELX(ch, CLASS_MAGIC_USER) / 10); CREATE(new_descr, struct extra_descr_data, 1); new_descr->keyword = str_dup("portal gate gateway"); sprintf(buf, "You can barely make out %s.", world[victim->in_room].name); new_descr->description = str_dup(buf); new_descr->next = portal->ex_description; portal->ex_description = new_descr; obj_to_room(portal, ch->in_room); act("$n conjures a portal out of thin air.", TRUE, ch, 0, 0, TO_ROOM); act("You conjure a portal out of thin air.", TRUE, ch, 0, 0, TO_CHAR); /* create the portal at the other end */ tportal = read_object(PORTAL_OBJ, VIRTUAL); GET_OBJ_VAL(tportal, 0) = world[ch->in_room].number; GET_OBJ_TIMER(tportal) = (int) (GET_LEVELX(ch, CLASS_MAGIC_USER) / 10); CREATE(new_tdescr, struct extra_descr_data, 1); new_tdescr->keyword = str_dup("portal gate gateway"); sprintf(buf, "You can barely make out %s.", world[ch->in_room].name); new_tdescr->description = str_dup(buf); new_tdescr->next = tportal->ex_description; tportal->ex_description = new_tdescr; obj_to_room(tportal, victim->in_room); act("A glowing portal appears out of thin air.", TRUE, victim, 0, 0, TO_ROOM); act("A glowing portal opens here for you.", TRUE, victim, 0, 0, TO_CHAR); } _____________________________________ You also need to create an object in one of your .obj files for a portal template, this is the one I use: #20 portal gateway gate~ a glowing portal~ A glowing portal hovers here forming a gateway to another place.~ ~ 24 0 0 0 0 0 0 0 0 0 ____________________________________ If you use an object with a different vnum you need to change the value of the PORTAL_OBJ define before ASPELL(spell_gate). To be able to enter portals (probably pretty useful, eh?) you need to add this piece of code to do_enter in act.movement.c: above 'int door;' struct obj_data *obj = NULL; after 'if (*buf) {' and before 'for (door = 0; door < NUM_OF_DIRS; door++)' if ((obj = get_obj_in_list_vis(ch, buf, world[ch-<in_room].contents))) { if (CAN_SEE_OBJ(ch, obj)) { if (GET_OBJ_TYPE(obj) == ITEM_PORTAL) { if (GET_OBJ_VAL(obj, 0) != NOWHERE) { char_from_room(ch); char_to_room(ch, GET_OBJ_VAL(obj, 0)); } else if (real_room(GET_OBJ_VAL(obj, 1)) != NOWHERE) { char_from_room(ch); char_to_room(ch, real_room(GET_OBJ_VAL(obj, 1))); } look_at_room(ch, 1); return; } } } ---- I think that's it for modifications. Simple eh? Check out http://democracy.queensu.ca/~fletcher/Circle/Snippet for all the stuff you wanted to do, but someone else did first. All credit/blame for this code to: Ground Zero Enterprises <zero@cnw.com> ---- Note that this is Mailer-Code, and I may have accidently left something out. (This code is not currently in my MUD as I am recoding it.) << Portal Spell (Code) [by Glenn Campbell] | Reply | View as text | Threaded | Potion Brewing Code [by Franco] >>
|
|
|
Typo by StormeRider (silk@ici.net) on Tuesday, February 15th @ 02:13:34 PM http:// |
Change the - |
[ Reply to this comment ] |