ID:179895
 
here is my code

if(usr.MAXPL >= 20000)
for(var/X in typesof(/mob/Goku_SSJ/verb))
src.verbs += X

here is error

verbs.dm:45:error:X:bad var

and i have 2 verbs in

/mob/Goku_SSJ/verb

whats wrong?
Eponick wrote:
here is my code

if(usr.MAXPL >= 20000)
for(var/X in typesof(/mob/Goku_SSJ/verb))
src.verbs += X

here is error

verbs.dm:45:error:X:bad var

and i have 2 verbs in

/mob/Goku_SSJ/verb

whats wrong?


all you have to do is

src.verbs+=/mob/Goku_SSJ/proc/Verb_Name//Add that to where your adding verbs.
In response to Nadrew
I think what he was trying to do was add all the verbs in an easier way than you posted, which is smarter if you've got lots of verbs to add. You can do it by creating the mob first, heres an example:

mob/verb/add_verbs(mob/M in world)
for(var/a in M.verbs)
src.verbs += a
if(a in src.verbs)
src << "You gained the ability to [a]"

Alathon
In response to Alathon
Alathon wrote:
I think what he was trying to do was add all the verbs in an easier way than you posted, which is smarter if you've got lots of verbs to add. You can do it by creating the mob first, heres an example:

mob/verb/add_verbs(mob/M in world)
for(var/a in M.verbs)
src.verbs += a
if(a in src.verbs)
src << "You gained the ability to [a]"

Alathon

I don't think that code will work as such. The if() check should always come up true because a has already been added to src.verbs. Perhaps this is a better approach:
mob/proc/add_verbs(mob/M in world)
for(var/a in M.verbs)
if(!(a in src.verbs))
src << "You gained the ability to [a]"
else src.verbs+=a

I changed this from a verb to a proc, because if it's a verb then the src references are pointless anyway, since M==src and there's no reference to usr.

Lummox JR
In response to Lummox JR
The only reason the if check is there, I guess is just because my verb adding is acting funky, isnt adding right sometimes and is leaving verbs out entirely. Not sure why I added it in though

Alathon
Well, whenever I need to shift verbs around in a game, I have a slightly unorthodox take on it. Since I don't like pulling verbs off mobs and objs and transferring them elsewhere, I do this

obj
verbbox
verb
myverb()

Now at any spot in the game I need to add it, using your example I would do this

if(usr.MAXPL >= 20000)
usr.verbs.Add(/obj/verbbox/verb/myverb)

It looks to me like you are trying to dump a bunch of verbs on usr at once. I have never tried that but I hope this information helps a little bit. I put a verbbox in all of my projects as a just in case 8). That way I know right where my adding verbs are 8)