Hello its me kalzimere again and again lol. I took a little break to refresh my mind and just get off my game so wouldn't get to frustrated and drp whole idea. Well now to my question i have been searching for a tutorial or demo anythng that could some how explain to me how to create mob that would walk up and attack. Well i found some things and managed to put them into a small code which is this:
mobloop()
var/mob/M
if(get_dist(src,usr) >= 1)
step_towards(src,usr)
spawn(respawn) mobloop()
else
M.life -= (usr.attackpower)
M.DeathCheck()
spawn(respawn) mobloop()
Thne i wasn't sure what exactly the spawn(respawn) mobloop() purpose was?, so theres one of my questions. I think it is just telling the code to keep calling back up to the top so if runs and runs in a LOOP lol but then again im prob wrong. I think the respawn is a tiem so do i need to have a clock?, i placed 600 which i thought weere seconds under mob.Secondly i created a mob then placed the code like so:
monsters
Evilelf
mobloop()
icon_state="elfM"
name = "Evil-Wood-Elf"
density = 1
life = 100
lifemax = 100
attackpower=2
defense=2
respawn=600
now when i come more then a dist. of 1 the mobn does nothing and when i right next to the mob he still does nothing lol. So if you know what the problem is i be ver grateful in your help. And i also just want to say thanks for all your help in the past you guys do a great job in helping and i hope i can get my game up some day lol. Thansk again.
-kalzimere
ID:149957
Jan 17 2002, 4:31 pm
|
|
In response to ACWraith
|
|
Well i didn't really want to use any libraries i wanted to stick to a all coded kalzimere game but thank you for the sugestion.
Oh yeah M was for var/mob/M incase i had the (src,usr). I wasn't sure if perhaps i was suppose to have mob for one of hose instead thansk for reminding me. -kalzimere |
[snip]
[snip]
What is M being initialized to?
Also, may I suggest possibly using the walk family of procs or Deadron's pathfinding library?