ID:144486
 
Code:
mob
proc
FindKill(var/mob/player/M in world)
if(src.killer == M)
M.kills++
M.Slayer()
src.killer = ""
else
M.kills++



Death(mob/M)
if(src.type == /mob/player)
PlayerDie()
else
if(src.health <= 0)
range() << "[src] has been killed by [usr]!!"
src.killer = usr
src.FindKill()
del(src)
PlayerDie(mob/M)
if(src.health <= 0)
src.frozen = 1
src.density = 0
src.icon_state = "dead"
src.wep = "None"
src<<"<small><font color = blue> Rejoin in [spawnrate]"
sleep(spawnrate)
src.density = 1
src.icon_state = "dead"
src.health = 100
src.shield = 100
src.weight = 0
src.wep = ""
src.killer = usr
src.FindKill()
for(var/obj/O in src)
O.loc=src.loc
if(mode == "Slayer")
if(map == "Blood Gluch")
src.loc=locate(pick(/turf/bg1,/turf/bg2,/turf/bg3,/turf/bg4,/turf/bg5))
src.icon_state = ""
src.frozen = 0
if(map == "Warlock")
src.loc=locate(pick(/turf/wa1,/turf/wa2,/turf/wa3,/turf/wa4,/turf/wa5,/turf/wa6))
src.icon_state = ""
src.frozen = 0


Problem description:It's suppose to give the player the kill, but it dosen't, it has no runtime error. Someone help.


Ok, where at in the code is it supposed to give him the kill?
In response to Revojake
mob
proc
FindKill(var/mob/player/M in world)
if(src.killer == M)
M.kills++
M.Slayer()
src.killer = ""
else
M.kills++




Death(mob/M)
if(src.type == /mob/player)
PlayerDie()
else
if(src.health <= 0)
range() << "[src] has been killed by [usr]!!"
src.killer = usr
src.FindKill()
del(src)
PlayerDie(mob/M)
if(src.health <= 0)
src.frozen = 1
src.density = 0
src.icon_state = "dead"
src.wep = "None"
src<<"Rejoin in [spawnrate]"
sleep(spawnrate)
src.density = 1
src.icon_state = "dead"
src.health = 100
src.shield = 100
src.weight = 0
src.wep = ""
src.killer = usr
src.FindKill()
for(var/obj/O in src)
O.loc=src.loc
if(mode == "Slayer")
if(map == "Blood Gluch")
src.loc=locate(pick(/turf/bg1,/turf/bg2,/turf/bg3,/turf/ bg4,/turf/bg5))
src.icon_state = ""
src.frozen = 0
if(map == "Warlock")
src.loc=locate(pick(/turf/wa1,/turf/wa2,/turf/wa3,/turf/ wa4,/turf/wa5,/turf/wa6))
src.icon_state = ""
src.frozen = 0
In response to Lendgens
The argument in your FindKill() perimeter isn't valid. I think what you want is this:

FindKill()
for(var/mob/Player/M in world)
if(killer==M)
...
else M.kills++


Though I don't think this is system is going to turn out good.

Also, "No usr in proc. Ungh!" (Copyright 2006 Lummox JR)

Tikey
In response to Mega fart cannon
Thanks man :), a few errors with the coding but i'll fixi t myself.
In response to Mega fart cannon
Mega fart cannon wrote:
The argument in your FindKill() perimeter isn't valid.

Methinks you mean parameter.

I think what you want is this:

> FindKill()
> for(var/mob/Player/M in world)
> if(killer==M)
> ...
> else M.kills++
>


Uh, why would you go through a loop like that? If the killer var is already a mob, then you don't need to loop through all the mobs to ask "Is this you?" When I was a kid I once spent half an hour looking for something that was in my hand. (True story.) This is kind of the same deal.

Also, you can't use the else statement after a for() loop.

The FindKill() proc is bogus anyway. Assigning credit for the death should be done in the death check. Also, there really shouldn't be separate PlayerDeath() and MonsterDeath() procs. The same proc should be used for both, although it can certainly be overridden to provide different behavior. When something is killed or wounded its DeathCheck() proc should be called, passing along info on who hurt it. Using the same proc for both players and monsters gives you consistent behavior, which in turn makes the code more reliable.

Lummox JR