ID:175886
 
Every thing seems to work but i get these runtime errors in battle. See, when you get into a random battle a blue screen, similar to the ff series, appears. it has attack magic and run... right now im working on the attack part. anyways, I was using this:
mob/proc/Attack()
var/list/AttackList = new()
for (var/mob/M in view(usr))
if (M.BattleNumber == usr.BattleNumber && M != usr)
AttackList += M
AttackList += "Cancel"
var/mob/Defender = input("Who do you wish to attack?", "Attack", null) in AttackList
if (Defender == "Cancel")
return
if(usr.icon_state == "battlestance2")
usr.icon_state = "atk2"
else
usr.icon_state = "atk"
sleep(2)
var/maxdamage = usr.attack - Defender.defense - (Defender.agility / 15)
var/damage = rand ((maxdamage / 2), maxdamage)
view() << "[usr] attacks [Defender] for [damage] damage!"
Defender.HP -= damage
usr.IsMyTurn = 0
if (usr.icon_state == "atk2")
usr.icon_state = "battlestance2"
else
usr.icon_state = "battlestance"


I tried to make an npc attack proc, no errors but i had run time errors... can anyone help me make an npcattack proc say based on that code up there.
First post the run time errors you had, then I will be able to tell what you did wrong.
In response to Shattered
I deleted the npc attack proc because it wasn't working. But it said something like:
cant read null.HP
blahh blahh blahh


i don't really remember though.


but how would i distinguish the difference between you and the enemy... like npcattack(mob/P as mob, mob/M as mob)
but differen't where that is the monster on screen so I can do stuff like var/damage = enemy.attack - usr.defense
and what not.
No put usr in procs. Ungh.

Lummox JR