Challenge(var/mob/PC/M as mob in world)
set category = "Battle"
if(istype(M,/mob/PC))
if(arena == 0)
arena = 1
var/challenge = input(M,"[usr] has challenged you to one-on-one combat. Do you accept?") in list("Yes","No")
if(challenge == "Yes")
usr << "[M] has accepted your challenge"
M << "You have accepted [usr]'s challenge"
M.OLDx = M.x
M.OLDy = M.y
M.OLDz = M.z
usr.OLDx = usr.x
usr.OLDy = usr.y
usr.OLDz = usr.z
M.loc = locate(/area/pvp2)
usr.loc = locate(/area/pvp1)
spawn(1)
challengetimer()
if(M.HP <= 0)
world << "[M] has been defeated by [usr]"
usr.loc = locate(usr.OLDx,usr.OLDy,usr.OLDz)
if(usr.HP <= 0)
world << "[usr] has been defeated by [M]"
M.loc = locate(M.OLDx,M.OLDy,M.OLDz)
arena = 0
if(challenge == "No")
usr << "[M] has declined your challenge"
M << "You have declined [usr]'s challenge"
arena = 0
else
usr << "You cant challenge [M]"
the first problem is that when a person is killed, the alive person isnt transported back to their original location. Also, i know that the
if(usr.HP <=0)
What I would do is make a few seperate procs, nothing is worse (in my opinion) than trying to do everything from the verb. You'll need, at the very least, a loop that checks the HP of the combatants, like so:
The above snippet is a proc that takes the arguments of Attacker and Defender (the two mobs fighting) and loops through combat until one of their HP totals falls to 0 or below. It then displays a message to the world telling of victory depending on who has HP left. After the message is given, it transports the victor to wherever you need them (insert your own code for that). You can modify it as needed to transport both the victor and the defeated if you don't take care of that in a death proc.
That's a basic outline of a proc you might use. It's probably not what you need exactly, but it should spark some ideas. Good luck :)