NPC
Punk
name = "Punk"
icon = 'spy.dmi'
HP = 10
Max_HP = 10
strength = 2
give_exp = 5
var/mob/PC/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/PC))
Attack(M)
proc/Attack(mob/M)
sleep(2)
var/damage = rand(1,strength)
M.HP -= damage
view(src) << "[src] attacks [M] with a crowbar!"
view(src) << "[damage] damage!"
M.PCDeathCheck()
The punk walks towards and attacks but when you attack him he wont die what have i done wrong?
ID:149558
Apr 5 2002, 8:52 am
|
|
In response to Lummox JR
|
|
verb
Attack(mob/M in oview(1)) if(usr.attacking == 0) usr.attacking = 1 var/damage = rand(1,strength) usr << "you attack [M] with your fists!" usr << "[damage] damage!" M << "[usr] attacks you with their fists!" M << "[damage] damage!" M.HP -= damage M.PCDeathCheck() sleep(10) usr.attacking = 0 is that the one thats the problem? |
In response to Raiden2k2
|
|
That doesn't look like it's the problem. The problem is probably in your PCDeathCheck().
|
In response to English
|
|
proc
DeathCheck(mob/M) //Named deathcheck, and when I put M in the coding for this proc, it will mean the mob (not src, but other mob) if(src.type == /mob/PC) //If the mobs type is that of /mob/PC PCDeathCheck() //Then do the PCDeathCheck on it else //Otherwise... if(src.HP <= 0) //if its HP is less than or equal to 0... usr.exp += src.give_exp src.loc = locate(100,99,2) PCDeathCheck(mob/M) if(src.HP <= 0) if(istype(src,/mob/PC/C.I.A/)) usr.oak += 1 src.loc = locate(144,45,1) else if(src.team == "black") src.loc = locate(70,87,1) if(src.team == "red") src.loc = locate(44,12,1) if(src.team == "orange") src.loc = locate(144,45,1) src.HP = Max_HP usr.cash += 10 usr.in_base = 1 This is my deathcheck proc i thought it was ok |
In response to Raiden2k2
|
|
whast wrong with my daeth check english?
|
In response to Raiden2k2
|
|
Please don't bump.
Your going to want to change to using mob/M and src instead of usr and src. This is mainly because you use those procs when it's just the mob attacking. You have no way of knowing what usr is going to be because of this. That could cause problems with your mobs attacking and killing. As for players attacking and killing. It appears that you should be calling M.DeathCheck() instead of M.PCDeathCheck() because you have a testing statement in DeathCheck to see which one should be used. Other than that I don't really see any problems. You may want to put in some checks in there like world << "[team]" to make sure they're on valid teams and that sort of thing. |
What you did wrong was to show us the wrong code. You didn't show us the code for the player attacking the punk--only the punk attacking the player.
Lummox JR