Your entire battle system errors out on me. keep getting like 18 errors, I even tried copy and paste instead of writing it out. And I still get those errors.
In response to Dokujin
Dokujin wrote:
Your entire battle system errors out on me. keep getting like 18 errors, I even tried copy and paste instead of writing it out. And I still get those errors.

Did you indent it?
In response to Dokujin
Could you specify what the errors are? It's difficult to debug code without knowing what's wrong.
is this the right way to make npc's attack? if not can you tell me what is it?




mob/Enemies
Attack()
flick("Attack",src)
for(var/mob/M in get_step(src,src.dir))
var/Damage=max(0,src.Str-M.Def)
view(M)<<"[src] hit [M] for [Damage] Damage!"
M.TakeDamage(Damage,src)
TakeDamage(var/Damage,var/mob/Attacker)
src.HP-=Damage
src.DeathCheck(Attacker)
DeathCheck(var/mob/Killer)
if(src.HP<=0)
if(src.client)
world<<"[Killer] Killed [src]!"
src.HP=src.MaxHP
src.loc=locate(5,5,1)
else
Killer<<"You Killed [src] for [src.Exp] Exp"
Killer.Exp+=src.Exp
Killer.LevelCheck()
del src
Red_Guy
icon='spider zombie.dmi'
Level=1
Exp=5
MaxHP=100
Str=10
Def=5
Green_Guy
icon='rat zombie.dmi'
Level=2
Exp=20
MaxHP=150
Str=20
Def=10
You have to use <dm></dm> tags to make the code appear correctly.

As for your question, there is no specific way to make NPCs attack. You have to decide how you want to do it.
how then cause their just standing their
mob/Enemies
Red_Guy
icon='spider zombie.dmi'
Level=1
Exp=10
MaxHP=100
Str=10
Def=5
Green_Guy
icon='rat zombie.dmi'
Level=2
Exp=30
MaxHP=150
Str=20
Def=10
Zombie
icon = 'zombie.dmi'
Level=10
Exp=120
MaxHP=800
Str=100
Def=50
mob/Enemies/New()
src.HP=src.MaxHP
spawn(-1) src.CombatAI()
return ..()
mob/Enemies/proc/CombatAI()
while(src)
for(var/mob/player/M in oview())
if(get_dist(src,M)<=1)
src.dir=get_dir(src,M)
src.Attack()
else
step_to(src,M)
break
sleep(rand(4,8))
In response to Ishtylercc
There's no usr in your CombatAI() proc, and oview()'s Center defaults to usr. Change it to oview(src).

And make sure your players are of the type /mob/player.
im not a good coder at all so what would it be? this?


mob/Enemies
Red_Guy
icon='spider zombie.dmi'
Level=1
Exp=10
MaxHP=100
Str=10
Def=5
Green_Guy
icon='rat zombie.dmi'
Level=2
Exp=30
MaxHP=150
Str=20
Def=10
Zombie
icon = 'zombie.dmi'
Level=10
Exp=120
MaxHP=800
Str=100
Def=50
mob/Enemies/New()
src.HP=src.MaxHP
spawn(-1) src.CombatAI()
return ..()
mob/Enemies/proc/CombatAI(usr)
while(src)
for(var/mob/player/M in oview(src))
if(get_dist(src,M)<=1)
src.dir=get_dir(src,M)
src.Attack()
else
step_to(src,M)
break
sleep(rand(4,8))
mob/Enemies
var/wander
New()
if(wander) walk_rand(src)
..()
In response to Ishtylercc
I didn't mean add usr to the proc, I meant to say that usr is null. Since oview() defaults to center around usr, it's building a list of nothing around nothing.
so what do i do?
how do I make good npcs like the ones who kill bad guys
ty it worked
In response to Goodiesohhi
Goodiesohhi wrote:
how do I make good npcs like the ones who kill bad guys

i have no idea but i wish i knew
Falacy, what if you had a mob thats widespead across the maps. What if you wanted them to respawn back in the original place that they were supposed to respawn back to?

for instance

Rogue NPC = 100 of them

instead of having only one spawn point, how can you make it to where they all spawn in their original source locations they were put on the map?
Use their New() proc to store their location upon creation.
                    if(src!=killer)
if(istype(src,/mob/NPCFighter/RougeNinja))
if(killer.needbox==1)
killer<<"<br><center><font color=green size=3>You find a lunch box lying at his feet!</font><br>"
killer.needbox=2
New()
if(src.fighternpc)
spawn(600)
if(src)
src.Reset()
src.loc=deathloc


So something like this then?
No. New() is called when something is created. You don't call it yourself. I recommend looking at the Guide and Reference and back off of the naruto rips.
    TakeDamage(var/Damage,var/mob/Attacker)
src.HP-=Damage
src.DeathCheck(Attacker)

i get a damage error with this TakeDamage(var/Damage,var/mob/Attacker) can anyone help
In response to Wildcanine
What error are you receiving?
Page: 1 2 3