ID:149717
 
i want to make it so that an object gives you certain verbs but only when a certain variable is true...

for instance I want to be able to Slash() with a sword and that looks like this...

obj/Sword
verb
Slash()
//slash code here

then I want it so that when the character gains so much experience he can use a new attack. I have the exp var defined I just need to know how I make it where the verb only appears in the menu when the exp is so much.
Well then, under the slash attack code, put something like:
if(usr.expierience >= 500)
//attack here
else
usr << "Must have 500 exp. to use this!"


Hope i helped.

-Rcet
In response to Rcet
i tried that long before i posted here. i would get a runtime error or a compilation error when I tried to create the verb after the certain var was achieved...
In response to Canar
It may not be very pretty but you can just add and remove the verbs manually like this:

obj/Sword/proc
Slash()
set src in usr
//attack code
Super_Slash()
set src in usr
//attack code
Super_Duper_Slash()
set src in usr
//attack code
Attack_Check()
var/mob/M = loc
if(M.exp > 500 && M.exp < 1000)
verbs -= /obj/Sword/proc/Slash //remove old attack
verbs += /obj/Sword/proc/Super_Slash //add new attack
else if(M.exp >= 1000 && M.exp < 2000)
verbs -= /obj/Sword/proc/Super_Slash
verbs += /obj/Sword/proc/Super_Duper_Slash

mob/proc
Level_Up()
equiped.Attack_Check() //equiped is the mob var pointing to what is equiped
//rest of levelup code


If you need any further explanation of this just ask.
In response to English
thanks I'll try that and see if I like that better than what I already had.