ID:167373
 
Help!
Does anyone know how to show a verb if you have a specific item in your inventory e.g.:-

usr.contents = 'sabre'
add
verb
Frenzy Attack()
if anyone knows what I am doing wrong please tell me
obj/sword
name="sword"
verb
FrenzyAttack()
etc

I think thats it, not too sure though
In response to Ramza Beoulve
I tried it like that but I end up with a weird runtime error you i can use the FrenzyAttack without the sabre being in usr.contents
In response to TheLunarWolf
That would be the proper way to do it, let me show a more thorough example.
obj/sword
name="sword"
verb
FrenzyAttack()
set src in usr //this line will make the verb only available when the item is in your inventory
//continue
In response to Detnom
Haha, yeah, forgot that part ^^;
In response to Ramza Beoulve
Ah, Thanks for that but what I was getting at was Unlocking verbs that had hidden above them e.g:-
hidden
verb
Bloodlust(mob/M in view (4))
Damage()// This is defined in another file
In response to TheLunarWolf
I still don't quite get what you're after.

Verbs can be set hidden, so they cannot be seen but still be used, like this:
mob/verb/Say(T as text)
set hidden=1
view()<<"[T]"

That would allow someone to use the say verb, regardless of the fact that they can't see it.


Or, if you want verbs that exist but aren't accessable until you give them the verb, you could do something like this:
mob/special/verb  //make verbs under type mob/special
Special1() //The verb is named Special1()
Damage() //Merely following your example

//And to give someone the verb:
mob/verb //This'll just be an example verb
Grant_Special(mob/M in world)
set hidden=1 //hide the verb
if(usr.key=="TheLunarWolf" && M.client) //make it so only you can grant it, and check if the mob has a client (is a player)
M.verbs+=/mob/special/verb/Special1
M<<"[usr] has granted you a special attack!" //fairly obvious

The verb can also be taken in a fairly similar fashion, using -= instead of +=.

Of course, you don't have to use a verb to assign the special attack, you can have it appear when they equip it, or something to that effect.

I hope I've hit on something similar to what you're after, otherwise let me know, 'cause I'm lost. =P
</DM>
In response to Detnom
That was exactly what I was after Thank You