mob/npc/attackers /*this will only effect the mobs defined as mob/npc/"name"*/
var
think_delay = 10 /*this is a default think delay*/
New()
..()
spawn(rand(1,think_delay)) AILoop()
proc/AILoop()
var/mob/M /*this monster attacks mobs only*/
for(M as mob in oview(src)) break /*this is done to the mob closest*/
if(!M)
spawn(think_delay) AILoop()
return
if(get_dist(src,M) > 1)
step_towards(src,M)
spawn(think_delay) AILoop() /*this means, that if the opponent is more then a block away, the mob will walk toward him*/
else
flick("attack",src)
M.HP -= 10 /*again, this just takes hp from the opponent*/
M.DeathCheck() /*again this insures that the deathcheck proc is in effect*/
spawn(think_delay) AILoop() /*this means that the mob will wait its think_delay until attacking again*/
mob/npc/attackers/Archer
icon = 'Archer.dmi' /*make sure the icon you use for it exhists*/
name = "Samukae"
density = 1 /*this is set so a person cannot walk through the mob*/
think_delay = 15 /*put any number here, the smaller, the faster, the larger the slower, get
how would i turn this code for Npc's to attack players into a code that allows the Npc's to fire projectiles.
Super saiyan3
ID:261323
Dec 17 2001, 7:29 am
|
|
In response to Spuzzum
|
|
Can you leave an example within the code snippet i posted.
<font color="red"> Super saiyan3</font> |
Instead of checking whether the user is further than a tile away, check to see if the user is further than the archer's range away. Where you attack before, you shoot instead and don't subtract hit points unless the projectile hits.
(That code looks familiar. ;-))