Ok I thought it would be easier than this, but what is the easiest way to make a verb that will give gold to only the mob/pc that is selected??
My own code as of now follows, the selection part works, but when you right-click the verb on that person it brings up all the mobs in the area, even mob/npc.
ive_Gold(mob/pc/M as mob, give as num)
set src in oview(1)
if (M == usr) return
if(gold < give) usr << "You don't have that much to give!"; return
M.gold += give
usr << "You gave [give] gold to [M]."
M << "[usr] gave [give] gold to you."
LJR
ID:150162
![]() Dec 4 2001, 3:48 pm
|
|
Your way won't work well, it will lead to negitive numbers.
mob/verb/Give_Gold(mob/M as mob in oview(1)) Should work. |
Well since that's not even a give gold verb it doesn't take gold from anyone making it a free gold verb, which isn't what he wanted.
|
Nadrew wrote:
Well since that's not even a give gold verb it doesn't take gold from anyone making it a free gold verb, which isn't what he wanted. hehehe yeah I caught after I posted. I got it all working now.. Now for sound control... I'm gonna check some demos and stuff for that first and if I can't get my sound checks to work I'll post. LJR |
LordJR wrote:
Ok I thought it would be easier than this, but what is the easiest way to make a verb that will give gold to only the mob/pc that is selected?? You're problem is in these two lines: ive_Gold(mob/pc/M as mob, give as num) src can be any mob in oview(1) of the usr, and M can be any mob in view() of the usr. You want one or the other, not both. Give_Gold(mob/pc/M as mob, give as num) set src = usr // default mob verb setting // rest of the verb can stay the same or Give_Gold(give as num) set src in oview(1) // src is the mob recieving gold, usr is the mob giving it if(usr.gold < give) usr << "You don't have that much to give!"; return src.gold += give usr << "You gave [give] gold to [src]." src << "[usr] gave [give] gold to you." Of course, you'll want to address the other concerns mentioned in this thread, like giving negative values and subtracting the gold from the usr. |
Gold(G as num,M as mob in world)
M.gold+=G