Assigning Spec Procs on the fly...

From: Ground Zero Enterprises (zero@baker.cnw.com)
Date: 06/21/96


I have coded a new spell called gate that creates two portals, one where 
the caster is and one where the target is and I wrote a special that 
should let people enter the gate to go to the other room.  The problem is 
I can't figure out how to assign the special as I create the object.  The 
creation is just a mimick of the code to create a corpse except I have 
added a special item type for portals.  Here is my code for the gate spell:

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;

  if (ROOM_FLAGGED(victim->in_room, ROOM_PEACEFUL | ROOM_NOMAGIC)) {
    send_to_char("Your magic cannot penetrate into that room!", ch);
    return;
  }

  /* create the portal */
  portal = create_obj();
  portal->item_number = NOTHING;
  portal->in_room = NOWHERE;
  portal->name = str_dup("portal gate gateway");
  portal->description = str_dup("A glowing portal forms a gateway to 
another place.");
  portal->short_description = str_dup("a glowing portal");
  GET_OBJ_TYPE(portal) = ITEM_PORTAL;
  GET_OBJ_VAL(portal, 0) = victim->in_room;
  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_index[?????].func = portal; */
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  obj_to_room(portal, ch->in_room);
 
 /* create the portal at the other end */
  tportal = create_obj();
  tportal->item_number = NOTHING;
  tportal->in_room = NOWHERE;
  tportal->name = str_dup("portal gate gateway");
  tportal->description = str_dup("A glowing portal forms a gateway to 
another place.");
  tportal->short_description = str_dup("a glowing portal");
  GET_OBJ_TYPE(tportal) = ITEM_PORTAL;
  GET_OBJ_VAL(tportal, 0) = ch->in_room;
  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_index[?????].func = portal; */
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  obj_to_room(tportal, victim->in_room);
}

I have tried several ways of assigning the procedure but i get several 
compilation errors.  Any help would be appreciated, as this spell is 
basically useless unless I can assign the special :)

Thanks,
Chris



This archive was generated by hypermail 2b30 : 12/18/00 PST