ID:142331
 
Code:
            Bump(atom/M)
if(isturf(M)) // If whatever the head bumps is a turf..
owner.fired = 0 // Allow the owner to fire another beam
owner.move = 1 // Allow them to move
for(var/obj/O in src.Beam) // Checks for objects in the Head's Beam list...
del(O) // Deletes any objects found
del(src) // Deletes the head
else if(ismob(M))
var/mob/A = M
var/damage = rand(src.owner.Reip/3)
A.Health -= damage


if(A.Health <= 0)
A.Death(A)//Here is where you would want to add damage or such ect..


// If whatever the head bumps is a mob...
view(src.owner) << "[src.owner]'s sword hits [M] for [damage] damage!" // For all in the owner's view, gives a message
owner.fired = 0 // Allows the owner to fire another beam
owner.move = 1 // Allows them to move
for(var/obj/O in src.Beam) //For all objects in the Head's Beam list...
del(O) //Delete any objects found
del(src) // Delete the head
else
if(!ismob(M) && !isturf(M) && !isobj(M) && !isarea(M))
owner.fired = 0 // Allow the owner to fire another beam
owner.move = 1 // Allow them to move
for(var/obj/O in src.Beam) // Checks for objects in the Head's Beam list...
del(O) // Deletes any objects found
del(src) // Deletes the head


============death check proc============
proc
Death(mob/M)
if(src.inko==1)
return
if(istype(src,/mob/monster/Weak_Hollow ))
usr<<"You have defeated a Weak Hollow!, Your Hollow Killing Rank has been raised"
usr.Weakhollowkills+=1
usr.Exp+=src.expgive
usr.Expover()
del(src)
return
if(istype(src,/mob/monster/Medium_Hollow))
usr<<"You have defeated a Snake Hollow!, Your Hollow Killing Rank has been raised"
usr.Snakehollowkills+=1
usr.Exp+=M.expgive
usr.Expover()
del(src)
return
if(istype(src,/mob/monster/Spider_Hollow))
usr<<"You have defeated a Spider Hollow!, Your Hollow Killing Rank has been raised"
usr.Spiderhollowkills+=1
usr.Exp+=src.expgive
usr.Expover()
del(src)
return
if(src.client&&src.Health<=0)
src<<"You got knocked out"
src.overlays+='ko.dmi'
src.move=0
src.Spirit+=40
src.inko=1
sleep(100)
src.inko=0
src.overlays-='ko.dmi'
src.Health=src.Mhealth
src.move=1
src<<"You gained concious" //death proc with M as usr or as the creature you killed
if(src.client&&src.Spirit>=99)
src<<"Good job, You got owned"
src.loc = locate(32,24,4) //sends M to 1,1,1 on map
src.Spirit=0
src.Health = src.Mhealth
src.Rei=src.Mrei


==========run time ========
runtime error: Cannot read 0.Snakehollowkills
proc name: Death (/mob/proc/Death)
usr: 0
src: Snake Hollow (/mob/monster/Medium_Hollow)
call stack:
Snake Hollow (/mob/monster/Medium_Hollow): Death(Snake Hollow (/mob/monster/Medium_Hollow))
Head (/obj/Beams/Head): Bump(Snake Hollow (/mob/monster/Medium_Hollow))
Head (/obj/Beams/Head): Move(Grass (49,35,1) (/turf/Grass), 2)
Head (/obj/Beams/Head): Move(Grass (49,35,1) (/turf/Grass), 2)
Head (/obj/Beams/Head): Move(Grass (49,35,1) (/turf/Grass), 2)


Problem description:

So the problem is that whenever my beam attacks the mob it doesnt die and it gives me a runtime, can anyone help?
No put usr in proc. Ungh.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
No put usr in proc. Ungh.

Lummox JR

i have to use usr in proc, because the monster is known as the src, if i was to use src , it wouldnt work it would make everything used by the monster thats dieing. Ungh.
In response to Agrey123
Agrey123 wrote:
Lummox JR wrote:
No put usr in proc. Ungh.

Lummox JR

i have to use usr in proc, because the monster is known as the src, if i was to use src , it wouldnt work it would make everything used by the monster thats dieing. Ungh.

There are ways around that. Ungh. <_< (hint hint, call Death() differently)
In response to DivineTraveller
how can i call it diffrently?
I'm going to cut down some code, you see if you can fix the rest based on my example.

Agrey123 wrote:
Code:
>           Bump(atom/M)
> if(isturf(M)) // If whatever the head bumps is a turf..
> owner.fired = 0 // Allow the owner to fire another beam
> owner.move = 1 // Allow them to move
> for(var/obj/O in src.Beam) // Checks for objects in the Head's Beam list...
> del(O) // Deletes any objects found
> del(src) // Deletes the head
> else if(ismob(M))
> var/mob/A = M
> var/damage = rand(src.owner.Reip/3)
> A.Health -= damage
>
>
> if(A.Health <= 0)
> Death(A)//Here is where you would want to add damage or such ect..
>
>
> // If whatever the head bumps is a mob...
> view(src.owner) << "[src.owner]'s sword hits [M] for [damage] damage!" // For all in the owner's view, gives a message
> owner.fired = 0 // Allows the owner to fire another beam
> owner.move = 1 // Allows them to move
> for(var/obj/O in src.Beam) //For all objects in the Head's Beam list...
> del(O) //Delete any objects found
> del(src) // Delete the head
> else
> if(!ismob(M) && !isturf(M) && !isobj(M) && !isarea(M))
> owner.fired = 0 // Allow the owner to fire another beam
> owner.move = 1 // Allow them to move
> for(var/obj/O in src.Beam) // Checks for objects in the Head's Beam list...
> del(O) // Deletes any objects found
> del(src) // Deletes the head
>
> proc
> Death(mob/M)
> if(M.inko==1)
> return
> if(istype(M,/mob/monster/Weak_Hollow ))
> src<<"You have defeated a Weak Hollow! Your Hollow killing rank has been raised."
> src.Weakhollowkills+=1
> src.Exp+=src.expgive
> src.Expover()
> del(M)
>

(I think I changed all the instances that needed to be changed, anyway.)
In response to DivineTraveller
That did not work in 2 ways, first , i got an error saying Death was an undefined proc wheni did the Death(A) second, when i put the M instead of src they kill them selves whenever they attack me.
In response to Agrey123
Agrey123 wrote:
i have to use usr in proc, because the monster is known as the src, if i was to use src , it wouldnt work it would make everything used by the monster thats dieing. Ungh.

Welcome, Novice Programmer. Looks like you need some good ol' DM Guide learning.
usr and src aren't the only possible variables in DM, and usr isn't the only way to pass information from a proc to another. This is basic knowledge. If you think that if you can't use src then you HAVE to use usr, apparently because that's all that is left, it's very bad. Hint: Look up "arguments" in the DM Reference, which are also quite basic knowledge. Reading this article by Lummox will also be very beneficial to you.