Re: [CODE] what on earth is wrong here??

From: Ebon Mists (mud@quake.cloudnet.com)
Date: 10/13/96


> only sometimes, cause he's also a scavenger so he can pick up things.
> 
> Problem is sometimes when you're in room with spoof, you get teleported
> away, no matter *WHAT* you do, code is as follows :
> 
> /* START SPOOF */ 
> 
> SPECIAL(spoof)
> {  
>   struct char_data *vict;
>   extern int top_of_world;
> 

Because whoever is in the room with spoof and types a command, it runs the
special using THEM as ch, in essence, they become spoof. First off, add:
  if(cmd)
    return 0;
This'll stop the thing from happeneing when people type commands. Also, add
at the top:
struct char_data *spoof = (struct char_data*)me;
Then use spoof for the character spoof... because in mob specials, ch is
whoever activated the special. In this case, spoof will ALWAYS be the mob.
me is a void * pointer... it has no set type, it just passes information.
you set spoof to cast a  char_data struct from me, which is the void pointer
to the mob's structure. That made no sense. If you need more explanation
write me back. I have to go out now. :)

Hades


>   if (GET_POS(ch) != POS_FIGHTING) 
>   {
>     switch (number(0,30))
>     {
>       case 0:
>       	act("$n peers around to see if anyone is looking.\r\n",FALSE,
> ch,0, 0, TO_ROOM)
>       	act("$n makes a magical gesture and suddemly
> disappears.\r\n",FALSE, ch,0, 0, TO_ROOM)
>       	act("You Teleport somewhere else.\r\n",FALSE, ch,0, 0, TO_ROOM)
>         char_from_room(ch);
>         char_to_room(ch, number(0, top_of_world));
> 	act("You hear something that sounds like *SPOOF*", FALSE, ch, 0, 0,
> TO_ROOM);
>         look_at_room(ch, 0);
>        return(1);
>        default:
>        return(0);
>     }  
>    }
> }
> 
> /* END SPOOF */
> 
> Noway I can see what is wrong, of course it adds a little spice to the
> game that you teleport somewhere else just by being nearby this fella
> and just look, but thats not the intention of it.
> 
> Anyone any idea to what i'm doing wrong??? It's no use of putting in a
> check if it's a mob or not, then it's only mobs who will get teleported
> around, but still, it's only spoof who needs to be teleported.
> 
> Help1 :)
> 
> /Soren total overseeing the obvious.
> +-----------------------------------------------------------+
> | Ensure that you have read the CircleMUD Mailing List FAQ: |
> |   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
> +-----------------------------------------------------------+
> 

+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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