ID:160079
 
I'm working on a sort of clone NPC, where it takes the targets form, copies their attacks and verbs. The mob has the spells, attacks, verbs, etc. But, I don't know how to make it call the verb.

Here is just an example of one of the verbs I'd like to use.

Heal()
set category="Spells"
usr.HP=usr.MHP
var/image/i = image('Spells.dmi', icon_state="episky")
M.overlays+=i
sleep(10)
M.overlays-= i

You might find the built-in verbs var useful.
In combination with istype() and typesof() you could even allow your clone to use spells in a specific list, like casting any healing spell if it obtained one.
In response to Schnitzelnagler
I've already given the Clone the verbs to work with, which is the person it's clones abilities. But I need to know how the Clone is to call on those verbs while running through an attack proc of some sort..

But while searching, I found the call(). I put call(src,"Heal")() and I'm still not coming out with any luck.
In response to Valen45
Verbs can basically be called just like procs can, in the same exact way. call() is for dynamic calling of verbs/procs, you don't need it.
In response to Kaioken
I thought that, but whenever I try putting src.Heal(), it doesn't reconize it. Am I doing something wrong, is there something I should check for?
In response to Valen45
I think you misunderstood me and I'm sorry if I didn't express myself properly.
I meant to explain the fact that you could use a general proc(edure) that reads in the clones verbs var(iable) to (randomly) pick and execute one of them.
There is not much difference in calling a proc(edure) and a verb, since both behave similar.

[Edit: Bah... while I was still typing, there have been two replies already :p]
I found the reason that it wasn't working was that the verb was not the same type as the Clone. So I changed that around it works..in a way.

    proc/attack()
while(target)
var/mob/Spells/M = target
if(src.HP <= src.MHP/10 && /mob/Spells/verb/Heal in src.verbs && prob(20))
src.target_mob = src
M.Heal()
step_towards(src, target)
sleep(10)


M is equal to the thing its attacking. Whenever I try src.Heal(), it never works. But when I run it through the one its attacking..it works fine. So confusing >.>
In response to Valen45
Try using the entire type path, or take out src. and ().
In response to Jeff8500
Did this ever get figured out? Because I'm having the same problem. I'm using this code:

for(var/obj/Items/I in src)
if(!I.equipped)
I.drop()


But it tells me:
93:error:I.drop:undefined proc

If I use just 'I.drop' it tells me:
93:I :warning: unused label
93:drop :warning: unused label

If I use only 'drop':
93:drop :warning: unused label
In response to Sprin
Well, if you look at my previous post in this thread, there's not really a lot to figure out. Can you show your definition for the drop() proc? Possible problems include:
  • Your proc is actually named Drop(). Such properties in DM are case-sensitive, so "drop" and "Drop" isn't the same; you have to use the same case as you have in your declaration for the compiler to recognize it.
  • Your proc is actually not present on that subnode of /obj, and may instead be defined somewhere else, like on /mob.

In response to Kaioken
I did read the other posts, but obviously not carefully enough.

It was the second one, I should have defined it as /obj/Items/Getables. Hopefully this helps anyone else searching the forums :)

Thanks for the help