Re: [newbie] questions...

From: Mike Stilson (
Date: 08/30/02

On Fri, Aug 30, 2002 at 09:47:13PM +0100, Arjay Hwang wrote:
>okay, i'm really sorry if this is annoying, I'm a bit
>of a newbie and I've been searching through the lists
>and seen these questions asked before, but I haven't
>been able to find the answers... anyway sorry just
>little things that have been troubling me...
>1) has anyone else ever had my disappearing object
>   problem? (see 'mag matereials and losing 31.obj)

Not me.  No clue.  I still go with the problem-with-obj-file idea since
objects above and below the missing vnums are loading, unless you have
some other code that does something to the errant vnums.  What happens
when you oedit one of the missing objects?

>2) How do I get things about an obj/mob/room/char, ie
>   GET_OBJ_VNUM, what other things am I able to call
>   and what files do I need to include?

#include "utils.h"
All the GET_{OBJ,MOB}_VNUM() macros (along with 94% of the others) are
in that file.
how to get them?

void myfunc(struct obj_data *obj) {
obj_vnum onum = GET_OBJ_VNUM(obj);

>3) Is it possible to get mobs to send things over the
>   grats/quest/gossip channel etc?

Yeah, take out the if(IS_NPC(ch)) { return; } from do_gen_comm (I think
that's the function). then add whatever mobprog/script/spec_proc you

>4) How can I make my spec-proc mob respond not to the
>   command 'say' itself, but to what word the person
>   actually spoke?

By catching the 'say' command and parsing the argument.

>5) Can I call things like wield or drop in a special
>   procedure or a spell? (ie when char walks into the
>   room and mob yells get out of here, then wields the
>   sword, unwields it when the room is empty, and does
>   it all over again? and I have a spell that I want
>   to make its victim drop everything)

Sure.  You can call whatever you want from a spec_proc, (well, as long
as it makes some kind of sense.  a spec_proc calling heartbeat() would
be, umm... bad.)

>6) I tried to make a command that only worked in one
>   room, ie bathe, put it in interpreter.c etc, then
>   in act.other.c I had an if statement, if the room
>   vnum != 3123 then send "Huh?!?"... But it sends
>   'Huh?!?' anyway, and the special procdure doesn't
>   pick up on the command... So then I made it a
>   social and the special procedure picked up on it, but did
>   the social as well, after doing the proc.

Your if() statement was something like:
        if(GET_ROOM_VNUM(IN_ROOM(ch)) != 3123) {
                send_to_char(ch, "Huh!?\r\n");
right?  (GET_ROOM_VNUM is a macro for world[room_rnum].number)

>7) I have a mob who is a witch, and she casts spells,
>   but when I tested it it made me cast the spell on
>   myself... I thought ch would be the mob, and vict
>   would be me, but it seems to think both are me.

Sounds like you have vict and ch swapped.

>8) I want to have a mob that steals something from the
>   char if he is in the room for too long, how do I
>   make my mob do the skill 'steal' ( I know how to do
>   make it cast a spell, but are skills the same? )
>   and how can I send it something from the inventory,
>   ie ("steal %s", item_from_chars_inv)

How about just modifying the currently existing thief spec_proc?
You just need a couple static vars and some real simple counter for a
timer.  You'll need to tweak up npc_steal() too, or just make it use the
regular steal skill.  Requires a workaround for the skill-check though
so you can give/simulate a mobs skill level.

>again sorry if this bugs you, I looked at the newbie
>list but I don't know if they are able to help out...

Just slightly, but at least you did put [newbie] in the subject.

Education time:
Almost every single question you asked (Pretty much except #1), you can
find MOUNTAINS of examples by looking through the code, or by just
applying some very simple logic...

Thought: I want mobs to use skills, but they can't.
Question: Why not?
Action: Look at the code for the skills.
Revelation: "if(IS_NPC(ch)) return;"

if that general line in most of the skills doesn't turn on a lightbulb,
you've got a lot of work to do.


PS: As a side note, almost everything you want to do can very easily be
done with either mobprogs or dg scripts.

   | FAQ: |
   | Archives: |
   | Newbie List:   |

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