This code gives quite alot of errors, seven, but two are listed.
mob/monster/bug // very first monster, just make more based off this model if you want some more monsters (of course you do!)
icon = 'monsters.dmi'
icon_state = "ghost"
HP = 10
MAXHP = 10
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) // This is called when an NPC bumps into a anything
if (istype(M,/mob/characters)) // This checks to make sure it's a player
NPCAttack(M)
proc/NPCAttack(mob/M)
M.damage(M) // call the players damage process to decide amount of damage, etc.
damage(mob/M in world) // This isn't gonna be really advanced... just a simple damage doer. No advanced stuff here like calculating defense into it, etc.
var/dam = rand(1,usr.Strength) // dam is a variable and is now defined with a random number between 1 through 10
dam -= rand(1,M.Armor) // small algorithm. ;)
if (dam > 0)
M.HP -= dam // subtract the damage from the victim's health
view(6) << "[usr] attacks [M] for [dam] health!" // sends a message to anyone on your screen
else
view(6) << "[usr] attacks [M] but MISSES!"
if (M.HP <= 0) // Is the character's health less then or equal to 0?
Death(M) // As defined earlier, kill the victim. :D
All the variables and procs here are defined, but damage and M.damage(M) are errored.
ID:149094
Jul 7 2002, 5:15 am
|
|
I assume you mean the line where damage() is defined, and the call to M.damage(), are giving you errors?
Where damage() is defined you didn't use proc/damage(). I'm not even sure if it's indented correctly. One thing's for sure, though: The "in world" part is unnecessary.
Lummox JR