ID:179660
 
i am using firekings battle system and i was wonder how i could make the monsters stay still until they see some one
there should be this code under monster AI:

mob/monsters
typechar = "monster"
var
walkspeed
warspeed
New()
wander()
checkarea()
proc
wander()
walk_rand(src,walkspeed)
checkarea()
for(var/mob/M in oview(4))
if(M == null)
return 0
if(M.typechar == "normal")
walk_to(src,M,0,warspeed)
monsterattack()
spawn(30)
checkarea()
monsterattack(mob/M in oview(1))
if(M == null)
return 0
if(src.attack - M.defense > 0)
M.hp -= src.attack - M.defense
M.DeathCheck()
else
M << "[src.name] cannot hurt you, dont be alarmed!!"

You just take out the wander under New() and that should do it..


hope i helped


-Rcet
In response to Rcet
The problem I'm having is when the monsters get to the player, they keep walking around the player and don't attack. Also when I try attacking, nothing happens.

proc
checkarea()
for (var/mob/M in oview(4))
if(M == null)
return 0
if(M.chartype == "normal")
walk_to(src,M,0,2)
monstatk()
spawn(30)
checkarea()
monstatk(var/mob/M as mob in oview(1))
walk(M,0) //tried to fix it but this did nothing.
if(M == null)
return 0
else
var/atkroll = rand(1,20) + src.atkbonus
world << "[atkroll] [M.AC]"
if (atkroll >= M.AC)
if (M.HP <= 0)
return 0
else
oview() << "[src] attacks [M]!"
var/damage = src.damage
oview() << "[damage] damage!"
M.HP -= damage
M.DeathCheck()
else
oview() << "[src]'s attack against [M] failed"
In response to Evilkevkev
Evilkevkev wrote:
The problem I'm having is when the monsters get to the player, they keep walking around the player and don't attack. Also when I try attacking, nothing happens.

proc
checkarea()
for (var/mob/M in oview(4))
if(M == null)
return 0
if(M.chartype == "normal")
walk_to(src,M,0,2)
monstatk(M)
spawn(30)
checkarea()
monstatk(var/mob/M as mob in oview(1))
walk(M,0) //tried to fix it but this did nothing.
if(M == null)
return 0
else
var/atkroll = rand(1,20) + src.atkbonus
world << "[atkroll] [M.AC]"
if (atkroll >= M.AC)
if (M.HP <= 0)
return 0
else
oview() << "[src] attacks [M]!"
var/damage = src.damage
oview() << "[damage] damage!"
M.HP -= damage
M.DeathCheck()
else
oview() << "[src]'s attack against [M] failed"

fixed
In response to FIREking
Well, the monster attacks me now, but I still can't attack it, and It won't stop moving.
In response to Evilkevkev
cuz it doesnt like you =P