> > ----- Original Message ----- > > From: "Jeremy Maloney" <riodan@CYBERSPACE.ORG> > > > Hey all, I'm still after several months fiddling with this damnable > > > gate spell I coded in and I need an idea as to what to put in to > > > remove or purge the gate once you enter it. Mind you this is a spell. > > > The primary function of the spell is of course to open a gate to a > > > location and then after those who want to enter, enter the gate, > > > and the caster steps through, the gate should immediately vanish. > > > > > > This is taken from my spells.c file: > > > > > > #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) = victim->in_room; hereabout, add GET_OBJ_VAL(portal, 3)=(!IS_NPC(ch) ? GET_IDNUM(ch) : 0); > > > GET_OBJ_TIMER(portal) = (int) (GET_LEVEL(ch) / 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 gateway out of thin air.", > > > TRUE, ch, 0, 0, TO_ROOM); > > > act("You conjure a gateway 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) = ch->in_room; and here: GET_OBJ_VAL(tportal, 3)=(!IS_NPC(ch) ? GET_IDNUM(ch) : 0); > > > GET_OBJ_TIMER(tportal) = (int) (GET_LEVEL(ch) / 15); > > > 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 gateway appears out of thin air.", > > > TRUE, victim, 0, 0, TO_ROOM); > > > act("A glowing gateway opens here for you.", > > > TRUE, victim, 0, 0, TO_CHAR); > > > } and in do_enter, where you let people go through the portal (we were asked for an idea - an idea, not code, is given): 1. if the person entering is the caster (check on GET_IDNUM()): 2. search the target room for the corresponding (return)portal (can be recognized since it leads to ch->in_room && has GET_IDNUM(ch) set as value 3. when found, first move the char, then either set GET_OBJ_TIMER() to 0, or extract_obj() right away for both of the portals. You might even want to send a message to the room, like 'As <whoever> enters the gate a large flash blinds you momentarily. When you are able to see again, the gate has disappeared.' :P This should work, because GET_IDNUM() is unique. However, it is also PC only, and needs a !IS_NPC() check every time you use it. Thanks to Tony Robbins for a nice (readable) piece of code. Welcor of Cruel World +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 04/10/01 PDT