obj
Thundershock
icon='thundershock.dmi'
density=1
Bump(A)
if(ismob(A))
var/mob/M = A
if(M.Faint>=1)
usr<<"This Pokemon is fainted"
return
else
var/damage1 = round(src.AttackD*src.Level)
var/damage2 = round(src.Attack*2 + damage1)
var/damage3 = round(damage2 - M.Defense)
Problem description:
I get an error src.AttackD, src.Level, src.Attack are all undefined.. But they are defined on that very script.
Why wont src work here (usr. doesnt work it will be 0.AttackD and have thousands of errors)
You want the mob that fired the thundershock object - you need to store a reference to it.
Then you just need to pass a reference to the mob firing the thundershock object when you create the object, like so:
I'll finish off by noting that the New() procedure for your thundershock object should probably take a direction argument, too, and then make the object move in that direction.