Click()
//alert("I'm sorry, but Im still working on this!", "Combat")
var/mob/M
var/list/mob/Target
var/atks
var/dam
var/attack
var/defence
for (M in world)
if (M.BattleNumber)
if (usr.BattleNumber == M.BattleNumber)
if (usr.teamnum != M.teamnum && M != usr)
Target += M
else if (!M.teamnum && M != usr)
Target += M
if (!Target)
alert("No one to attack")
return
atks = round(usr.spd/10)
if (atks < 1)
atks = 1
do
M = input("Who would you like to attack?","Attacks Left: [atks]") in Target
attack = roll(1.20) + round(usr.atk/2+usr.spd/2+usr.str)
defence = roll(1,20) + round(M.agi/2-5)+round(M.spd/2-5)+round(M.blk/2)
if (attack >= defence)
dam = (rand(round(usr.melee/2.1)+round(usr.str/2-5),usr.melee+round(usr.str/2-5))) - (round(M.con/2-5)+round(M.def/2))
usr << "You slash at [M] for [dam]!"
M << "[usr] slashes a you for [dam]!"
M.hp -= dam
atks -= 1
while(atks > 0)
Problem description: ok so after the mob is defined as M, Defence is being put together. unfortunate its saying that M is null when you run the game. however when your defining dam M is not null.
Done deal with typecasting the Target var. >_>