Projectile()//a long range attack, which will follow hit your target only.
if(!usr.targeting)
usr<<"Target someone you'd like to throw projectile at."
return
else
var/mob/j = usr.Tgt
if(j in oview(usr,usr.client.view))//This checks if your target is in your view, so that it might not follow your target from map to map
var/obj/Energyball/K = new /obj/Energyball
K.owner = usr
K.loc = usr.loc
K.power = usr.power
K.elvl = usr.elvl
K.money =usr.money
K.kills = usr.kills
K.name = "[usr]"
K.owner = usr
walk_towards(K,j.loc)
sleep(15)
del(K)
obj
Energyball
icon = 'Attacks.dmi'
icon_state = "energy ball"
density = 1
Bump(A)
if(ismob(A))
var/mob/M = A
var/damage = round(src.power*src.elvl)
if(damage >= 1)
M.hp -= damage
view(M) << "[M] was hit by Energyball for [damage] damage!!"
M.deathcheck()
del(src)
if(istype(A,/turf/))
var/turf/T = A
if(T.density)
del(src)
if(istype(A,/obj/))
del(src)
else
M << "You killed [src.name]."
M.money+=src.money
M.exp+=src.exp
M.kills++
oview(M) << "<font color=red><b>[M.name] killed [src.name]."
sleep(5)
del(src)
Problem description: The first part of the the code, is the verb, second part, the obj, third part, the deatcheck.
When I use the melee attack, same enemy, it works just fine, but when the projectile is used, it doesn't due to the code not being able to process any of the killer's variables such as money, kills or exp. I've tried to combat that by giving the obj those varaibles but still not working. This also works on a targeting system that works fine and if you take out all lines from deathcheck besides del(src) it works just fine. Please help.