ID:162090
 
is there a way to make a skill raise only if you kill someone with that skill? like say you use an axe for most of the attack but your final attack is with a throwing star is there a way to make throwing star skill raise ?
Depends how you handle things. The most elegant option would be to have deathcheck() return a value (1 if the mob dies, 0 if it does not). This, specifically, probably won't work, because you probably delete the mob when it dies, which prevents deathcheck() from returning anything. However, you could go with something logically backwards: if it returns 1 then the mob is still alive, and if it returns null, then the mob has been killed. So, like so:

mob/verb/kill(var/mob/M)
M.hp = 0
//if we killed M
if(!M.deathcheck(src))
exp += 100


Now, you just have to put a similar line for each attack:

mob/verb/axeaquestion(var/mob/M)
M.hp -= 10
if(!M.deathcheck(src))
axe += 1

mob/verb/spearsomechange(var/mob/M)
M.hp -= 10
if(!M.deathcheck(src))
spear += 1


Just remember to put "return 1" at the end of the deathcheck() proc.
In response to Garthor
this should work correct?
                if(damage >= 1)
M.health -= damage
view(M) << "[M] was hit by [O]'s Axe for [damage] damage!!"
M.Death(O)
O.axekill+=1
In response to Bluntmonkey
Only if you want to give skill on every attack, not just kills.