ID:138475
 
Hello all.

I think this question may be in some way related to the previous thread involving a spell system, but I didn't understand a lot of it, so bare with me please. :)

Thanks to Guy T. , I have progressed to the point where I can get one mob to kick another mob and have it do things to the mobs.

Then I got ambitious and decided to work with objects that could do things to other mobs etc. only when in posession of a mob.

For example, I was working on a wand of invisibility. I wanted the posessor of the wand to be able to zap it at a mob, obj, or turf and make it invisible.

Suffice it to say that I tried a whole lot of things with a variety of results. The closest I came was getting the mob to be able to zap everything, but I found out it didn't matter it he had the wand or not. :)

Anyway, if someone would be so kind as to post a code snippet that does the following:

1.Activates a verb such as "zap" for the mob that has the item, but only when he has the item(not just when he is close - I already figured that out, too :). The verb should actually belong to the obj(in this case the wand).

2.Enables the mob to use the item on another mob, obj, or turf. In this case, I want the mob to be able to pick up a a wand, be able to zap the wand at a mob, obj,or turf and make it invisible.


Another thing that has probably been addressed before. When you make something invisible using it's visibility variable, it makes it disappear, but also makes it where you can no longer do things to it like pick it up or destroy it. It still has it's density set where you can't walk through an invisible mob, but you can't do anything to it either. And when you make an item in a mob's contents invisible, it seems to actually be removed from the contents. Is there a way around this?


Thanks,

Taipan




On 7/22/00 2:24 pm Taipan wrote:
1.Activates a verb such as "zap" for the mob that has the
item, but only when he has the item(not just when he is
close - I already figured that out, too :). The verb
should actually belong to the obj(in this case the wand).

2.Enables the mob to use the item on another mob, obj, or
turf. In this case, I want the mob to be able to pick up
a a wand, be able to zap the wand at a mob, obj,or turf
and make it invisible.


Here's some stuff from my head. Should get you started in the right direction - sounds like it's mostly a matter of not knowing how to reference objects. These examples should help.


obj/wand/var/charges=10
obj/wand/verb/zap(O) // O= could be obj, mob, area, turf
set src in usr // Verb gets added to whomever holds it
if(O:visible == 1) // O:visible instead of O.visible
// because we don't know what O is
src.charges-=1
O:visible=0
world << "[usr.name] zaps [O:name] with \an [src.name]! [O:name] disappears!"
if(src.charges <= 0)
src.verbs.Remove(/obj/wand/verb/zap)
return

obj/wand/verb/wave(O) // O= Could be object, mob, turf, area
set src in usr // verb added to whomever holds it
world << "[usr.name] waves \his [src.name] at [O:name]"

obj/wand/verb/wave(mob/M) // M= Mob
set src in usr // verb added to whomever holds it
world << "[usr.name] waves \his [src.name] at [M.name]."

obj/wand/verb/wave(obj/O) // O= object
set src in usr
world << "[usr.name] waves \his [src.name] at \an [O.name]."

obj/verb/get()
set src in view(1) // verb usuable by anyone in one tile
src.loc = usr
world << "[usr.name] picks up \an [src.name]."
src.verbs.Remove(/obj/verb/get())
return

obj/verb/drop()
set src in usr
O.loc = usr.loc
src.verbs.Add(/obj/verb/get)
world << "[usr.name] drops \an [src.name]."
return
On 7/22/00 2:24 pm Taipan wrote:
Thanks to Guy T. , I have progressed to the point where I can get one mob to kick another mob and have it do things to the mobs.

Then I got ambitious and decided to work with objects that could do things to other mobs etc. only when in posession of a mob.


The old tutorial had good coverage of these sorts of things....I volunteer Tom to write a tutorial about object interaction!

Doing the "invisibility" wand would probably be a great example too, and Guy T has already provided a start...
In response to Deadron
Doing the "invisibility" wand would probably be a great example too, and Guy T has already provided a start...

Although I posted it under my alternate identity, "Gabriel." :)

Actually, this code is very timely for me... I spent a couple hours Friday night typing up an "outline" node tree for a game that will need wands. One less detail to worry about!