ID:146409
 
Code:
mob
var
dead = 0
mob/verb/Attack()
var/mob/M
for(M in get_step(src,src.dir)) break
if(M)
var
/// FORMULAS START HERE ///
A = (src.strength-M.vitality/2)
R = (A*2)
C = rand(A,R)
D = (src.attack-M.defense)
damage = (D+C)
crit_damage = (damage*2)
/// FORMULARS END HERE ///
if(M.dead == 1)
return 0
if(M.dead == 0)
if(prob(((M.evasion*9.7)/src.accuracy)))
view() << "<small>[src] misses the [M].</small>"
return 0
if(prob(src.dexterity/(M.agility/3.7)))
M.hp-=crit_damage
view() << "<small><b>[src] hits [M] for [crit_damage]!</b></small>"
del(M)
else
M.hp-=damage
view() << "<small>[src] hits [M] for [damage]!</small>"
del(M)

mob
var
hp = 25
mp = 0
strength = 6
vitality = 2
agility = 5
dexterity = 4
spirit = 3
intelligence = 4
charisma = 5
attack = 20
defense = 15
accuracy = 10
evasion = 20


Problem description:
I'm kind of rusty at this um... How do I tell the verb to "return 0" if you're attemping to attack a PC?
mob/proc/Test(mob/M)
if(istype(M,/mob/PC)) return 1

if(Test(src==1))
In response to Flame Sage
Someone on my pager also told me if(M.client). Would that work?
In response to RainZero
Yes...
M.client checks to see if the client (an actual person) is in the current mob
In response to Flame Sage
"if(Test(src==1))"
Who the hell taught you to code? It should be:
if(Test(src))
In response to Ol' Yeller
Yeah I guess you could do that too, it really does not matter, because both are the same.
In response to Flame Sage
You wanna' bet? Your way is saying "Test(src equal 1)". MSF, you really need to get in order.
In response to Ol' Yeller
OH! What I ment was...
if(Test(src)==1)


Sorry about that.
In response to Ol' Yeller
Ol' Yeller wrote:
You wanna' bet? Your way is saying "Test(src equal 1)". MSF, you really need to get in order.

Calm down, no one has said anything to you sheesh. Have the people of the byond community gotten this bad sense I left a year ago? Seems so.
In response to RainZero
I'm getting really sick of people posting code which is very wrong, I admit, sometimes I do it, but it's getting old.