ID:149210
 
can anyone tell me how to change the maxdamage & mindamage to use the users Att power instead of putting a figure!

i though it might go like this
maxdamage = usr.Att
or
maxdamage = (usr.Att)
or
maxdamage = src.Att
or the same with (src.Att)

but none of this seems to work.

im currently looking for a battle code that will use Strength Defence Dexterity and Agility, like in this demo
if anyone could make me one i'll pay dimes for it.

THIS CODE IS USED FROM KUNARKS TURN BASED ATTACKING SYSTEM

mob
var
maxdamage = 15
mindamage = 5
opponent = ""
move
Att = 100
AGI = 21
DEX = 15
DEF = 8
EXP = 0
EXPgive = 0
fleeing = 0
cantattack = 0


mob/verb/flee()
if(fleeing == 0 && usr.opponent != "")
usr << "You get ready to flee!"
fleeing = 1
cantattack = 1
else
if(fleeing == 1)
usr << "You are already trying to flee!"
if(usr.opponent == "")
usr << "Your not in a battle!"

mob
proc/PCattack(mob/M)
var/hitpercent = 50 + src.DEX
var/hitpercent2 = hitpercent - M.AGI
if(hitpercent2 > 100)
hitpercent2 = 100
if(hitpercent2 < 0)
hitpercent = 0
var/hitpercent3 = rand(1,100)
var/damagefirst = rand(src.mindamage,src.maxdamage)
var/damagecount = damagefirst - M.DEF
if(src.fleeing == 1)
if(hitpercent3 <= hitpercent2)
view() << "[src] ran from the battle!"
src.fleeing = 0
src.cantattack = 0
M.cantattack = 0
M.opponent = ""
src.opponent = ""
src.move = 1
M.move = 1
return
else
view() << "[src] tried to run from the battle, but couldn't escape!"
M.opponent = src
src.opponent = M
src.move = 0
M.move = 0
if(src.cantattack == 0)
if(hitpercent3 <= hitpercent2)
if(damagecount > 0)
view() << "[src] attacks [M]([damagecount])"
flick("3",src)
M.Health -= damagecount
M.Deathcheck(src)
else
view() << "[src]'s attack bounced off of [M]"
else
view() << "[src] attacks [M], but misses"
if(src.opponent == M)
sleep(10)
if(M == null)
src.opponent = ""
src.move = 1
return
else
M.PCattacking(src)


mob/verb/attack(mob/M in oview(1))
if(M.opponent == "" && usr.opponent == "")
var/hitpercent = 50 + usr.DEX
var/hitpercent2 = hitpercent - M.AGI
if(hitpercent2 > 100)
hitpercent2 = 100
if(hitpercent2 < 0)
hitpercent = 0
var/hitpercent3 = rand(1,100)
var/damagefirst = rand(usr.mindamage,usr.maxdamage)
var/damagecount = damagefirst - M.DEF
if(usr.fleeing == 1)
if(hitpercent3 <= hitpercent2)
view() << "[usr] ran from the battle!"
usr.fleeing = 0
usr.cantattack = 0
M.cantattack = 0
M.opponent = ""
usr.opponent = ""
usr.move = 1
M.move = 1
return
else
view() << "[usr] tried to run from the battle, but couldn't escape!"
M.opponent = usr
usr.opponent = M
usr.move = 0
M.move = 0
if(usr.cantattack == 0)
if(hitpercent3 <= hitpercent2)
if(damagecount > 0)
view() << "[usr] attacks [M]([damagecount])"
flick("3",src)
M.Health -= damagecount
M.Deathcheck(usr)
else
view() << "[usr]'s attack didn't harm [M]."
else
view() << "[usr] attacks [M], but misses."
if(usr.opponent == M)
sleep(10)
if(M == null)
usr.opponent = ""
usr.move = 1
return
else
if(M.client)
M.PCattack(src)
else
M:attack()

mob/proc/attacking(mob/M)
var/hitpercent = 50 + usr.DEX
var/hitpercent2 = hitpercent - M.AGI
if(hitpercent2 > 100)
hitpercent2 = 100
if(hitpercent2 < 0)
hitpercent = 0
var/hitpercent3 = rand(1,100)
var/damagefirst = rand(usr.mindamage,usr.maxdamage)
var/damagecount = damagefirst - M.DEF
if(usr.fleeing == 1)
if(hitpercent3 <= hitpercent2)
view() << "[usr] ran from the battle!"
usr.fleeing = 0
usr.cantattack = 0
M.cantattack = 0
M.opponent = ""
usr.opponent = ""
usr.move = 1
M.move = 1
return
else
view() << "[usr] tried to run from the battle, but couldn't escape!"
usr.opponent = M
M.move = 0
usr.move = 0
M.opponent = usr
if(usr.cantattack == 0)
if(hitpercent3 <= hitpercent2)
if(damagecount > 0)
view() << "[usr] attacks [M]([damagecount])"
flick("3",src)
M.Health -= damagecount
M.Deathcheck(usr)
else
view() << "[usr]'s attack did not harm [M]."
else
view() << "[usr] attacks [M], but misses."
if(usr.opponent == M)
sleep(10)
if(M == null)
usr.opponent = ""
usr.move = 1
return
else
if(M.client)
M.PCattacking(src)
else
M:attack()

mob/proc/PCattacking(mob/M)
var/hitpercent = 50 + src.DEX
var/hitpercent2 = hitpercent - M.AGI
if(hitpercent2 > 100)
hitpercent2 = 100
if(hitpercent2 < 0)
hitpercent = 0
var/hitpercent3 = rand(1,100)
var/damagefirst = rand(src.mindamage,src.maxdamage)
var/damagecount = damagefirst - M.DEF
if(src.fleeing == 1)
if(hitpercent3 <= hitpercent2)
view() << "[src] ran from the battle!"
src.fleeing = 0
src.cantattack = 0
M.cantattack = 0
M.opponent = ""
src.opponent = ""
src.move = 1
M.move = 1
return
else
view() << "[src] tried to run from the battle, but couldn't escape!"
src.opponent = M
M.move = 0
src.move = 0
M.opponent = src
if(src.cantattack == 0)
if(hitpercent3 <= hitpercent2)
if(damagecount > 0)
view() << "[src] attacks [M]([damagecount])"
flick("3",src)
M.Health -= damagecount
M.Deathcheck(src)
else
view() << "[src]'s attack bounced off of [M]"
else
view() << "[src] attacks [M], but misses"
if(src.opponent == M)
sleep(10)
if(M == null)
src.opponent = ""
src.move = 1
return
else
M.PCattacking(src)


mob/proc/Deathcheck(mob/M)
if(src.client)
if(src.Health <= 0)
src.Health = src.MaxHealth
src.move = 1
M.move = 1
src.opponent = ""
M.opponent = ""
view() << "[M] is the winner of the battle!"
src.loc = locate(1,1,1)
return
else
if(src.Health <= 0)
src.move = 1
M.move = 1
src.opponent = ""
M.opponent = ""
view() << "[usr] is the winner of the battle!"
var/underlevel = usr.Level - 5.
if(src.Level > underlevel)
usr << "You gained [src.EXPgive] experience!"
usr.EXP += src.EXPgive
else
usr << "You gained no experience from [src] due to it's low level"
var/Thegold = rand(1,src.gold)
usr << "You find [Thegold] gold!"
usr.gold += Thegold
usr.Leveling_up()
sleep(2)
del(src)
return
mob/Move()
if(!move) return 0
. = ..()

mob/Monster
icon = 'mobs.dmi'
icon_state = "2"
Health = 50
mindamage = 2
maxdamage = 10
Level = 1
Att = 60
DEF = 3
DEX = 20
AGI = 12
gold = 35
EXPgive = 25
attack()
if(src.opponent == usr)
var/hitpercent = 50 + src.DEX
var/hitpercent2 = hitpercent - usr.AGI
if(hitpercent2 > 100)
hitpercent2 = 100
if(hitpercent2 < 0)
hitpercent = 0
var/hitpercent3 = rand(1,100)
var/damagefirst = rand(src.mindamage,src.maxdamage)
var/damagecount = damagefirst - usr.DEF
if(hitpercent3 <= hitpercent2)
if(damagecount > 0)
view() << "[src] attacks [usr]([damagecount])"
flick("4",src)
usr.Health -= damagecount
usr.Deathcheck(src)
else
view() << "[src]'s attack didn't harm [usr]"
else
view() << "[src] attacks [usr], but misses"
if(src == null)
return
if(usr == null)
src.opponent = ""
return
else
if(src.opponent == usr)
sleep(10)
usr.attacking(src)



mob/proc/Leveling_up()
var/EXPneeded = usr.MaxHealth * 2
if(usr.EXP >= EXPneeded)
usr.EXP = 0
usr.Level += 1
view() << "[usr] levels to [usr.Level]!"</0></0></0></0></ 0>
replace the usr.mindamage and usr.maxdamage with the vars you want. Usually you'll want to use some operators too.