mob
NPC
Scaryguy
name = "bug"
icon = 'scaryguy.dmi'
HP = 10
Max_HP = 10
strength = 2
var/mob/PC/P
New()
.=..()
spawn(1)
Wander()
proc/Wander()
while(src)
if (usr in oview(5))
step_towards(src,usr)
else
step_rand(src)
for(usr in view(src))
break
sleep(5)
spawn(40)
Wander()
Bump(mob/M)
if (istype(M,/mob/characters))
Attack(M)
proc/Attack(mob/M)
flick("attack",src)
sleep(2)
var/damage = rand(1,strength)
M.HP -= damage
view(src) << "[src] attacks [M]!"
view(src) << "[damage] damage!"
M.PCDeathCheck()
Why wont scary guy step towards and attack a player??
ID:149559
Apr 5 2002, 3:35 am
|
|
In response to Skysaw
|
|
No there is none the compile says its fine i tried to shrink it down for the forum
|
In response to Raiden2k2
|
|
Raiden2k2 wrote:
No there is none the compile says its fine i tried to shrink it down for the forum That's fine, but you should clean up the indentation on the forum so we can tell more clearly what's going on. For example, you have the following line: while(src) It looks like nothing is indented under it. Is that the case in your original code? Because if it is, you've got an infinite loop that is keeping the rest of the proc from executing. |
Hutchy2k1 wrote:
No its not like that the code works the only thing is the bug dosent attack or go after a charater he just wanders I wish I could help you, but I can't read your code. |
In response to Raiden2k2
|
|
Raiden2k2 wrote:
No there is none the compile says its fine i tried to shrink it down for the forum Your intent may be nice. However, you might get a better response if you click the edit button, delete the code that is there, and paste in the actual code you are using (with its original indentation). It won't be bumped. No one who knows better will yell at you. It will just be easier to read and possibly show if any indentation errors exist. (Indentation counts a lot.) |
Here's some information on clean indentation:
http://www.deadron.com/Admin/BYOND_FAQ.html#N3291