ID:164877
 
ok, im attempting to make a fighting dragonball z game that has to do with the world tournament. I want it so if they walk out of the ring they will lose the battle. But I also want it so that if they are flying then they can go outside the ring without losing. I can pretty much figure out the second part but im having trouble with the first part. Could anyone help me out? I'm baffled :P
mob/var/flying/*set this to 1 with your fly verb or whatever you have and to 0 when the player lands*/
turf/out
Enter(mob/m)
if(istype(m,/mob))//always good to check
if(m.flying !0)//they are flying
..()//continue as normal
else
src.lose()/*or src.whatever the proc that makes them lose is called()*/

That should work
any errors, check the indentation, it might be a bit off



You could use an area for the ring (assuming you only had one ring, or if you make multiple subtypes) to do this very easily. When you step out of the ring, you get disqualified. You can also use this to prevent certain players (like the audience) from stepping into the ring, as well as do pre-arena tasks such as i.e. "protecting" inventory items (if you have looting in your game).
Here's a small example:

area
tournament_ring //the ring!
Enter(mob/M)
if(istype(M))
if(M in contestants) return 1 //only allow contestants in!
return 0 //prevent projectiles from entering the ring
Exited(mob/M)
if(istype(M))
M<<"You have lost the fight!"
...

<small>Keep in mind this is just an example of how areas work. You need to make your own version from scratch in order to make it work.</small>

If you want multiple rings, you can archive this like so:

area/tournament_ring
ring1
ring2
ring3
...


Just be sure to check for those types and make sure that your rings will properly check lists like "contestants" and losing the round.
In response to Cml100 (#1)
Cml100 wrote:
That should work
any errors, check the indentation, it might be a bit off

1. Use the <DM> tag.
2. Using turfs for this is bad, since there are ways to avoid this (what if the player teleports out of the arena somehow? If Move() is used to do this, the player still loses!). See my post for an example usage of areas in this fashion.
In response to Android Data (#2)
AFAIK it should still work perfectly with multiple 'area sections' with the same type (no subtypes needed). Only difference is that if you have a contestants per ring you'll need to store that elsewhere that way.
Also, you shouldn't straight-out return 1 in Enter() like that in cases like this. Use 'return ..()' so it follows the default rules.