ID:177884
 
If so could you tell me how. Here Is the coding please edit it to work. I want it to stay on icon "turfs.dmi" icon state "grass2"

Also how do I make you gain money from each kill?





mob/monster/slime
icon = 'monsters.dmi'
icon_state = "slime"
health = 25
maxhealth = 25

var/mob/characters/P

New()
.=..()
spawn(1)
Wander()

proc/Wander()
while(src)
if (P in oview(5))
step_towards(src,P)
else
step_rand(src)
for(P in view(src))
break
sleep(5)
spawn(40)
Wander()

Bump(mob/M)
if (istype(M,/mob/characters))
NPCAttack(M)
proc/NPCAttack(mob/M)
M.damage(M)
The answer to your first question can be found in [link]

In answer to your second question, you should make a proc under /mob/monster (or whatever you have decided is the type path for monsters in your game) that does damage to src (the monster) when called (I'll assume that you've called it damage() ). In that proc should be a check to see if the monster has 0 or less health (i.e. it's dead), and if so, call a die() proc or similar that deletes the monster, possibly also displaying a message that the monster has been killed. Assuming you've done all that, add an argument to your die() and damage() procs, called attacker. Every time you call damage(), make sure you pass in that argument (it should be the mob that's attacking the monster, in case you hadn't already worked that out). In damage(), also include the argument in the call to die(). Then in die(), add the amount of gold you want the user to get to the user's gold or money variable (or whatever you've called it).

I hope that was long enough for you. ;)