I am not a newbie to Byond, nor do I wish to project that image, but at one point or another, we all need to ask for help. I have carefully designed this code, but it is not perfect. I can't find a way to code in the health of an enemy. Here is my code:
mob
Enemy_I
icon = 'Enemies.dmi'
icon_state = "Enemy I"
proc
DeathCheck()
if (HP <= 0)
world << "[src] Was Killed By [usr]!"
del(src)
If anyone can help me set the health of enemies, please reply. I thank you in advance.
Blade Falcon
ID:261531
Jun 12 2002, 5:05 am
|
|
In response to Garthor
|
|
Well, it looks as if it would work, but I just tried it... It doesn't. Maybe if you could give accurate spacing? I'm not sure, but any, here's the problem:
20:error:HP :duplicate definition 9:error:HP :previous definition See? This is how I spaced it: mob Enemy_I var/HP = 100 icon = 'Enemies.dmi' icon_state = "Enemy I" I'm not quite sure how to fix it. Blade Falcon |
In response to Blade Falcon
|
|
The duplicate definition error comes from the fact that var/HP is done in /mob and in /mob/Enemy_I. Under mob/Enemy_I, just leave off the "var/" part, since the HP var should be common to all mobs if you defined it under /mob.
I should also add that in your DeathCheck() proc, usr is probably not appropriate. You'd be better off to call DeathCheck(attacker) and then use attacker instead of usr if src dies. Lummox JR |
In response to Blade Falcon
|
|
Blade Falcon wrote:
Well, it looks as if it would work, but I just tried it... It doesn't. Maybe if you could give accurate spacing? I'm not sure, but any, here's the problem: it means you got the HP var in 2 locations. RaeKwon |
Enemy_I
var/HP = 25