ID:167387
 
I'm looking for a couple of basic things for a PvP system. All I really would like to know is how to initiate one and keep it running until one players HP becomes less than 0. No turn based stuff, just so its like an action RPG random battle thing.

I'm going to try and modify some peoples code and see what I can do by myself, but I could use the help.

Thanks in advance.
go here, it has what you need


http://www.angelfire.com/games4/byond/
In response to Albire
Well, an easy way to do it is set a variable for the player called PVP, make it = 0. Then, went they enter somewhere change it to 1 if they can't attack there. Then, when attacking, check the player PVP.

mob/var/PVP = 0 //set the PVP var to 0

turf
City_limit
Enter(mob/M) //when the mob enters
if(M.PVP == 0) //if PVP = 0
M.PVP = 1 //make it 1, works for entering town
if(M.PVP == 1) //if its 1
M.PVP = 0 //make it 0, for leaving it

mob/verb/Attack()
if(usr.PVP == 1) //check the players PVP var, if its 1
usr << "You cannot attack here!" //tell them no no
return //end the proc
//continue with the rest of attacking procedure


A very simple and basic way to do it. I've only shown a procedure on how to do it, I haven't actually put in all the neccesary stuff, like icons and whatnot for a turf.
In response to Pyro_dragons
turf
City_limit
Enter(mob/M) //when the mob enters
if(M.PVP == 0) //if PVP = 0
M.PVP = 1 //make it 1, works for entering town
if(M.PVP == 1) //if its 1
M.PVP = 0 //make it 0, for leaving it

That code is redudent.

turf
City_limit
Enter(mob/M) //when the mob enters
M.PVP=!M.PVP

This is better.
In response to Flame Sage
It'll work nonetheless, no matter how redundant it is. Redundancy has nothing to do with effectiveness in this case, at least I don't think so.
In response to Flame Sage
Flame Sage wrote:
> turf
> City_limit
> Enter(mob/M) //when the mob enters
> M.PVP=!M.PVP
>

This is better.

It's not better when it still doesn't work right. The enterer of the turf won't always be a mob, and you are assuming it is one. You need to check if the enterer is a mob, otherwise the code will break when a non-mob object enters the city limit.

~~> Unknown Person
In response to Unknown Person
eurgh.
mob/verb/Attack(mob/M in get_step(usr,usr.dir))
if(M && !istype(M.loc,/turf/safe))
...

turf/safe


Variables will just mess up bigtime. What if you teleport someone / summon someone? Nah, this is better. (Or so methinks :( )
ArcaneVirus wrote:
I'm looking for a couple of basic things for a PvP system. All I really would like to know is how to initiate one and keep it running until one players HP becomes less than 0. No turn based stuff, just so its like an action RPG random battle thing.

I'm going to try and modify some peoples code and see what I can do by myself, but I could use the help.

Thanks in advance.

You need to define the frame of your PvP system more thoroughly; What are the EXACT rules ? Once you know, you can then piece together the system in accordance to those rules.

Think of it like a board-game, you wouldn't just plop down and say, 'Yeah, I need board game rules. I'm going to modify some existing ones and try what I can come up with, but anyone got some basics ? I want there to be ongoing turns that keep going until one players HP becomes less than 0'

I realize you probably have a more refined idea than that, but stop assuming people know exactly what a given system is unless you specify an *exact* game to use as an example. Even then, I'd omit the game and tack down the system seperately instead of expecting people to know the game.

My 2 cents ;)