ID:139092
 
Code: Damage and Death proc
obj
var
str = 0
def = 0
owner

paw
icon = 'skills.dmi'
icon_state = "paw"
density = 1
Bump(mob/M)
var/mob/A = src.owner
var/dam = (src.str) - (M.def + M.agi + M.ryku)
if(dam <= 0)
dam = 1
src.Damage(M,A,dam)
sleep(1)
del(src)



obj
proc
Death(mob/M,mob/B)
world << output("PEEP","SM")
if(M.npc)
if(M.hp <= 0)
M.hp = M.mhp
M.loc = locate(M.orgx,M.orgy,M.orgz)
if(M.hp <= 0)
M << output("You died by the hands of [B]!","SM")
M.hp = M.mhp
M.en = M.men
M.spi = M.mspi
spawn() M.spawner()
B << output("You killed [M]")

if(B.pirate)
if(M.marine)
B.bounty += M.level * 10
if(M.pirate)
B.bounty += M.level * 5
else
B.bounty += M.level * 2
if(B.marine)
if(M.pirate)
B.bounty += M.level * 10
if(M.marine)
B.bounty -= M.level * 5
else
B.bounty -= M.level * 2
for(var/mob/C in world)
if(C.npc)
continue
if(C.power == "Hawkins")
if(M in C.Basils)
C.Basils -= M


Damage(mob/M,mob/B,var/dam)
if(M.npc)
src.Death(M,B)
return
if(M.dtype == "Logia")
if(M.protect)
oview(src,8) << output("[B]'s attack went trough [M]!","chat")
del(src)
return
else
oview(src,8) << output("[M] was hit by [B]'s [src]!","chat")
M.hp -= dam
spawn() src.Death(M,B)
del(src)
return
if(M.power == "Hawkins")
if(M.Basils.len > 0)
for(var/mob/C in world)
if(C in C.Basils)
C.hp -= dam
spawn() C.Health_Bar()
C << output("You take damage from an unknown source","SM")
src.Death(C,B)
else
continue
M.hp -= dam
spawn() M.Health_Bar()
M << output("You take damage from [B]'s [src]","SM")
src.Death(M,B)
else
M.hp -= dam
spawn() M.Health_Bar()
M << output("You take damage from [B]'s [src]","SM")
src.Death(M,B)
else
if(M.tekkai == 1)
var/defi = M.def + M.defb
if(defi >= B.str * 1.5)
M << output("You blocked the attack with Tekkai!","SM")
B << output("You were unable to do damage!","SM")
if(defi < B.str * 1.5)
var/newdam = (dam/ 2)
M.hp -= newdam
spawn() M.Health_Bar()
M << output("You managed to reduce the damage!","SM")
B << output("Some of the damage on [M] was blocked!","SM")
src.Death(M,B)
if(defi < B.str )
M.hp -= dam
spawn() M.Health_Bar()
oview(src,8) << output("[M] was hit by [B]'s [src]!","chat")
src.Death(M,B)
else
M.hp -= dam
spawn() M.Health_Bar()
oview(src,8) << output("[M] was hit by [B]'s [src]!","chat")
src.Death(M,B)
return


Problem description: Basically my mind goes away every time i try to think of ways to make damage dealt by "objects" run trough the normal damage/death procs. My solution was to make two seperate procs for objects and run it through there.

Well, the rough output of the procs works, but i fail to but through the player using the "attacks" to the very end of it all. i.e(error: cannot read null.pirate). Now any solution to my problem is good, and if it can't be done the way i am attempting to do it, say so! and suggest alternatives.


What are your player vars?
In response to Lugia319
nvm. player vars were not the problem.

Fixed all the issues now it seems.