Below is the code for the Spirit Gun with the code that the demo developer set up to implement the damage and the death for enemy which should in theory this should give me x amount of exp x being what ever i wanna set the exp for the mob for but its just not happining
obj
Eatk
icon = 'BeamAttacks.dmi'
icon_state = "head"
density = 1
layer = 100
New()
spawn(100)
del src
Bump(A)
CanDamage(Gowner,A,src)
..()
Move()
var/obj/k = new/obj/ETrail(loc)
k:dir = dir
..()
proc/CanDamage(mob/Owner,atom/A,obj/beam)
if(ismob(A))
var/mob/M=A
if(M==Owner) return
var/damage=CuaseDMG(Owner,M)
M.hp-=damage
Owner.J_Death(M)
view(8, Owner)<<"<b><font color = red>[Owner] hit [M] with his Spirit Gun for [damage] damage!"
Owner.firing=0
del(beam)
proc/CuaseDMG(mob/M,mob/P)
var/dmg=M.se - (P.def)
if(dmg<1) dmg=1
return dmg
obj
ETrail
layer = 100
icon = 'BeamAttacks.dmi'
icon_state = "middle"
New()
..()
spawn(8)
del(src)
///////////Enegry Attack Verbs///////////
mob
skill
verb/Spirit_Gun()
set category = "Specil Techs"
if(safe) return
if(se < 10)
src << "<b>Not enough enegry!"
return
if(!firing)
view(8) << "<b>[src]: Spirit Gun"
firing = 1
se -= 10
var/obj/K = new/obj/Eatk(loc)
K.Gowner = src
K.dir = dir
walk(K, dir)
mob/var
tmp/firing=0
tmp/safe = 0
obj
var
b//////Trail
The next 2 pieces of code are for the death and level up the code has no issues compiling or anything
Death
J_Death(mob/killer)
view()<<"\red <center><code>[src.name] has been killed by [killer.name]!!!"
killer.xp += xp_give
killer<<"<small>You have gained [xp_give] experience."
if(killer.xp >= killer.xpmax) killer.J_Level()
killer.target = null
if(killer.target_sign) del(killer.target_sign)
if(!killer.client)
var/mob/Monster/M=killer
M.target=null
M.active=0
M.walk_back=1
M.J_WB()
if(!client)
src.J_dienpc()
else
hp = hpmax
J_update(src)
J_Level()
if(!CAN_NPC_LEVEL)
if(!client) return
if(xp >= xpmax)
xp = 0
xpmax += 100//Increase how much experience is needed to level up agian.
lvl++
//Increase varibles by random digits
hpmax += rand(15, 20)
str += rand(5, 7)
def += rand(4, 6)
att += rand(2, 3)
semax += rand(15,20)
hp = hpmax
src<<"<b>You have been promoted to level [lvl]!"
J_update(src)
if(xp >= xpmax) J_Level()//If you can level up agian do it
J_getdmg(mob/T)
var/dmg=rand( (3*(str+str_boost)) ,(6*(str+str_boost)) )
dmg-=round(rand((0.3*(T.def+T.def_boost)),(0.8*(T.def+T.def_boost))))
if(dmg<0) dmg=0
return dmg
It seems like you're calling the death proc for the person who fired the projectile, and then the killer is M.
Shouldn't this be M.J_Death(Owner) ?