ID:266709
 
How do you make a P.V.P Battle System With Zagreus I cant figure it out!! PLEASE REPLY!!!
Well first you type attack zagreus, then...

Ohh, you mean my combat system demo. Hrmm. I never really considered that. I'm not a big fan of PvP.

I would suggest creating a new verb called duel that starts a pvp proc. Basicaly copy and paste everything in the old battle system to a new one, rename it all, take out the random encounter stuff, change all instances of the monster your fighting to the victim of the duel command instead, and add prompts for the victim to get his own battle menu isntead of just automaticaly attacking back.

You could do the same with a whole lot of if statements isntead of just copying and pasting the old battle system, but that'd require more typing. Would save space at least. :)

I guess I can write that up and add it to the demo sometime... not soon.

(Edit: You would also want to add a timer to prevent abuse, and and add a check to logout to return the player to wherever.. )
In response to Zagreus
UM HELP!!!
In response to Master Flame Sage
Well, the first thing you want to do is replace your maincombat proc with this

maincombat(mob/attacker as mob, mob/target as mob)
if (istype(target, /mob/monster))
var/list/CombatOps1 = list("Attack", "Run", "Magic")
var/CombatOp1 = input(usr, "What do you wish to do?", "Combat", "Attack") in CombatOps1
switch (CombatOp1)
if ("Attack")
attack(attacker, target)
if ("Run")
flee(attacker, target)
if ("Magic")
magic(attacker, target)
else
var/list/CombatOps1 = list("Attack", "Run", "Magic")
var/CombatOp1 = input(usr, "What do you wish to do?", "Combat", "Attack") in CombatOps1
switch (CombatOp1)
if ("Attack")
pvpattack(attacker, target)
if ("Run")
pvpflee(attacker, target)
if ("Magic")
pvpmagic(attacker, target)


then move the click proc that activates it from mob/monster to just plain mob, making a check to make sure they're in a battlearea.

then add a duel command to warp them there like this.

mob/verb/duel(mob/M as mob in oview())
switch(alert(usr, "Are you sure you wish to duel [M]?" "Duel [M]", "Yes", "No"))
if ("Yes")
switch(alert(M, "[usr] has challenged you to a duel, accept?", "Duel Request", "Yes", "No"))
if ("Yes")
var/turf/battlearea/T
for(T in world)
if(!T.occupied)
T.occupied = 1)
usr.oldlocx = usr.x
usr.oldlocy = usr.y
usr.oldlocz = usr.z
usr.battlearea = T
spawn(1)usr.Move(usr.battlearea)
usr.oldbattlefield = usr.onbattlefield
usr.onbattlefield = null
M.oldlocx = M.x
M.oldlocy = M.y
M.oldlocz = M.z
M.battlearea = T
spawn(1)M.Move(usr.battlearea.x,usr.battlearea.y+4,usr.battl earea.z)
M.oldbattlefield = M.onbattlefield
M.onbattlefield = null
return 1
return 0


After that's done, just add a bunch of pvp procs like so (this isn't complete, just an example. It's up to you and your imagination on how you want to do it

pvpattack(mob/attacker as mob, mob/target as mob)
attacker << "You chose to attack [target]"
target << "[attacker] attacks you!"
if(prob(attacker.hit - target.evade))
normaldamage(attacker, target)
else
attacker << "You miss!"
target << "[attacker] missed!"
npcattack1(attacker, target)




pvpflee(mob/attacker as mob, mob/target as mob)
if (rand(1,3) == 1)
attacker << "You successfuly run from [target]"
target << "[attacker] has fled!"
pvpendbattle(attacker, target)
else
attacker << "You failed to run and loose a turn!"
target << "[attacker] tried to run but failed!"
pvpattack2(attacker, target)


//You didn't think you'd get a fully working magic system in my demo, did you?
magic()
usr << "Not implemented yet."





pvpnormaldamage(mob/attacker as mob, mob/target as mob)
var/maxdamage = attacker.attack - target.defense - (target.agility / 15)
var/damage = rand ((maxdamage / 2), maxdamage)
if (damage <= 0)
attacker << "You miss! (0 dmg)"
target << "[attacker] missed! (0 dmg)"
pvpmenu(attacker, target)
else
attacker << "You hit [src] for [damage] points of damage with a normal attack!"
target << "[attacker] hit you for [damage] points of damage with a normal attack!"
target.HP -= damage
pvpdeathcheck(attacker, target)



pvpmenu(mob/attacker as mob, mob/defender as mob)
var/list/CombatOps1 = list("Attack", "Run", "Magic")
var/CombatOp1 = input(usr, "What do you wish to do?", "Combat", "Attack") in CombatOps1
switch (CombatOp1)
if ("Attack")
pvpattack2(attacker, defender)
if ("Run")
pvpflee2(attacker, defender)
if ("Magic")
pvpmagic(attacker, defender)

pvpattack2(mob/attacker as mob, mob/defender as mob)
defender << "You chose to attack [attacker]"
attacker << "[defender] attacks you!"
if(prob(attacker.hit - target.evade))
pvpdefenddamage(attacker, defender)

This is just something unfinished that I typed up in like 5 minutes. I don't think it'll run by itself, and will require a bit of tweaking. Good luck man. :)