ID:263303
 
Problem description:
On my attacking code, I am getting a run-time error.
I don't see how it is a type mismatch..
--
runtime error: type mismatch
verb name: Attack (/mob/verb/Attack)
source file: Combat.dm,17
usr: Justin Black (/mob/Player)
src: Justin Black (/mob/Player)
call stack:
Justin Black (/mob/Player): Attack()
Attack (/obj/Skills/Attack): Click("Offensive Skills")
---
Code:
                    if(istype(A,/mob/))
var/mob/M = A
var/Damage = 0
var/Block = 0
Block = round((M.Endurance+M.Defense)/2,1)
Damage = round((src.Strength+src.Attack)/2,1) // This would be line 17
Damage -= Block
M.HP -= Damage
s_damage(M,Damage,"red")
M.Attack = src
M.Death()
return



The problem is that either src.Strength, or src.Attack is not a number. I'm guessing it's Attack because you are setting M's Attack variable to a non-number value. You can't add a number to a reference.

~~> Unknown Person
In response to Unknown Person
Woopsy! Thanks, I had a variable called "Attacker"..and I forgot the "er", thank you.