Re: magical traps

From: Welcor (welcor@dune.net)
Date: 04/10/02


----- Original Message -----
From: "Edward J Glamkowski" <eglamkowski@ANGELFIRE.COM>
> So, my question is: is there any danger in doing that, using pfilepos
> as an identifier for the trap setter in my trap struct, and possibly
> having to load the char to memory not just to char_file_u, but to
> an actual char_data?  Wouldn't that screw up his last logon time?
> What other consequences might arise from doing this?
>
You might consider going another way. Use a caster proxy mob;

1. create the proxy (dg scripts use puff)
2. rename the instance of the mob to something meaningful (you
   might want to keep a string in the trap struct, or just use
   the traps' shortdesc.
3. set the mobs level to something appropriate.
4. char_to_room()
5. call_magic()
6. extract the mob.

This is how the dg script system handles casting by objects
(and rooms). I've included a snip from dg_cast:

    caster = read_mobile(DG_CASTER_PROXY, VIRTUAL);
    if (!caster) {
      script_log("dg_cast: Cannot load the caster mob!");
      return;
    }
    /* set the caster's name to that of the object, or the gods.... */
    if (type==OBJ_TRIGGER)
      caster->player.short_descr =
        str_dup(((struct obj_data *)go)->short_description);
    else if (type==WLD_TRIGGER)
      caster->player.short_descr = str_dup("The gods");

    char_to_room(caster, real_room(caster_room->number));
    call_magic(caster, tch, tobj, spellnum, GET_LEVEL(caster), CAST_SPELL);
    extract_char(caster);

Welcor

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT