ID:178212
 
ok, theres a var called armor

Like,

mob/var/armor = 0

and i asign diff types of armor with this var.. and theres a verb called attack and it goes through the damage.. and the damage counts on the attackers strength.. when u wear the armor it adds more armor.

how would i make a verb called attack and the damage depends on how much var of armor the person being attacked has.. like the higher the armor var.. the lower the damage.. the lower the armor var.. the more damage..
ShadowSiientx wrote:
ok, theres a var called armor

Like,

mob/var/armor = 0

and i asign diff types of armor with this var.. and theres a verb called attack and it goes through the damage.. and the damage counts on the attackers strength.. when u wear the armor it adds more armor.

how would i make a verb called attack and the damage depends on how much var of armor the person being attacked has.. like the higher the armor var.. the lower the damage.. the lower the armor var.. the more damage..

Until you give us some insight into your attack system and the variables you have, the best we can come up with is something along the lines of:

damage = damage - target.armor
if(damage < 0)
return
In response to Spuzzum
mob/var/strength = 10
mob/var/damage = 0
mob/var/armor


mob/verb/attack(mob/M as mob in oview(1))
if(M.armor == WHAT HERE TO put like if their armor is somewhere between 1 - 10?)
var/damage = usr.strength/ rand(20,10)
usr <<"You attack [M] for [damage]!"
M <<"
[usr] attacks you for [damage]!"
M.HP -= damage
if(M.armor == WHAT HERE TO put like if their armor is somewhere between 10 - 20?)
var/damage = usr.strength/ rand(10,10)
usr <<"You attack [M] for [damage]!"
M <<"
[usr] attacks you for [damage]!"
M.HP -= damage
if(M.armor == WHAT HERE TO put like if their armor is somewhere between 20-30?)
var/damage = usr.strength/ rand(5,10)
usr <<"You attack [M] for [damage]!"
M <<"
[usr] attacks you for [damage]!"
M.HP -= damage
if(M.armor == WHAT HERE TO put like if their armor is somewhere between 30-50?)
var/damage = usr.strength/ rand(1,5)
usr <<"You attack [M] for [damage]!"
M <<"
[usr] attacks you for [damage]!"
M.HP -= damage
In response to ShadowSiientx
is that a wrong why to program an armor sys?
In response to ShadowSiientx
mob/var/health = 5
mob/var/max_health = 5
mob/var/strength = 3
mob/var/defense = 1
mob/var/armor = 0

mob/verb/Attack(mob/M in oview(1)) // This will attack any mob right next to you (within reach)
var/damage = rand(strength, strength / 2) // This will make the damage anywhere between the user's strength, and the user's strength when it's halved (divided by two)
damage -= M.armor + M.defense
if(damage <= 0)
view() << "[usr] swings at [M], but misses!"
else
M.health -= damage
view() << "[usr] swings at [M], doing [damage] points of damage!"


This should be pretty functional, you will need to add a death checking system, which checks to see if their health is at or below 0, then do whatever you want to kill them. (I recommend setting their location to null, src.loc = null, sleeping a bit, then putting them back in the game, and refilling their health). Blah blah blah. Hopefully I confused you, and now your going to stumble around in a daze for the next 3 hours.



Yes, I'm sarcastic; Polatrite