ID:179995
Sep 22 2001, 3:47 pm
|
|
How do i make mobs attacks users and follow them if there on the screen??
|
Sep 22 2001, 3:49 pm
|
|
get daedrons combat system
|
well you will need a basic monster AI programmed into a parent for all monsters, then each monster can use that for their behavior.
mob/monsters var hp attack defense walkspeed warspeed New() checkarea() proc wander() walk_rand(src,src.walkspeed) attack() for(var/mob/M in oview(1)) M.hp -= src.attack - M.defense M.deathcheck() src.wander() checkarea() for(var/mob/M in oview(4)) walk_to(src, M, 0, src.warspeed) src.attack() spawn(30) src.checkarea() now this is the parent, and this behavior is like so: the monsters walk around randomly until a mob is withing 4 spaces of them. They then walk to that mob and when they get close enough, they call attack, which damages the mob, then they walk a bit more, and then damage is done again. This will keep happening until the mob dies, or the monster dies. The only way this code will compile error free is if all mobs have the hp, attack, defense, variables, and if they have the deathcheck proc. --FIREking |