Skip to main content

How do i enable pvp in a specific area

Comments

9 comments

  • Chris Fuge any thoughts?

    0
  • Chris Fuge
    Beacon of Knowledge

    I was thinking about this the other day. My understanding is that PVP true/false is a general gamerule that would apply to the entire world. I could be wrong, but I'm not aware of a way to limit it to a certain area/player.

    What I have done in my battle arena game is start with PVP false (use the command: /gamerule pvp false) for the start of the game while players are joining and getting ready. Then, I have a countdown and run the command: /gamerule pvp true.

    Another option, that I use when players are defeated in the arena, is to give them a weakness effect so that even if they try to attack one another, they don't really do any damage. 

    /effect @p weakness 9999 255 true
    This will be the max effect 255, for 9999 seconds.

    Then, if you want to start another round, just make sure to clear all effects.
    /effect @a clear

    Hope this helps!

    0
  • Brett Girod

    Create different zones with barrier blocks. Then have students enter the zone through a portal that forces them to step on a pressure plate, push a button, or pull a lever to trigger the needed commands. I use commands like Chris Guge, /effect @p weakness 9999 255 true

    0
  • Dat Chu

    How can I play PvP maps with other people because I don’t have anyone to play with ?

    0
  • Aleece Landis
    Bug Zapper Beacon of Knowledge Super Star

    Yea, it would be nice to have an easy way to enable certain gamerules only in certain regions.

    At the moment I'm handling it by changing gamemode of players in certain regions so when they go into the Arena, they are placed in adventure mode and when they come out of the arena they are back in creative mode.  And PVP is only enabled while people are in/around the arena.  Border, deny and allow blocks abound in the area so that creative mode players can't disrupt things.

    0
  • Brett Girod

    Just as a general update. I now use radius effects for zones. A command block can be set to repeat and loop the command /gamemode s @a[r=5] for instance to change the gamemode of anyplayer within a 5 block radius of the command block. Another useful tip when doing this is to set /commandblockoutput false

    0
  • that's a good use of the repeating command block -- do you hide them? And have you found any server lag when running multiple repeating command blocks?

    0
  • Aleece Landis
    Bug Zapper Beacon of Knowledge Super Star

    I have found that depending on WHAT the command blocks are doing, it can cause lag if there are many of them.  It is best to limit and select as much as possible so the command blocks are only running what is needed when it's needed.  I've modified on this Idea https://youtu.be/3bwc3-W5t5Y  

    so the Video is about how to remove players from a scoreboard when they leave the game. 

    you can do /detect @a to detect whenever people enter or leave the world (it does use a little redstone) but you can have that detector running and have it impulse command blocks to run chains of commands ONLY when the detector sees a change.  AND you can /detect @a for a region or radius so that the impulse command blocks will will change things when people Leave the area.  It does require tags or scores to select for the players and where they are.

    I have not noticed the detector set up causing too much lag but I have not gotten to use it too much with more than just a few players in the game.  I have a world set up for the students where they each have a creative area, and there is an arena under the creative areas and when they leave that zone they are put into survival mode.  So that detector and array of blocks handles switching gamemodes and it checks everyone when ever some one enters or leaves the area.

    I am also using a detector set up sort of like this in the spelling world now to handle removing tags and ticking areas when ever some one enters/leaves the world or when ever some one returns to the "home" location.

    0
  • Aleece Landis
    Bug Zapper Beacon of Knowledge Super Star

    There is another thread I started about this "Elvis left the Building Detector"  https://educommunity.minecraft.net/hc/en-us/community/posts/4408110861076-Elvis-Left-the-Building-detector 

    Detecting that people are NOT in an area is tricky unless you can do Radius min and max to handle the operation.  It generally involves adding tags or scores to everyone and then selecting if they are IN the area to remove the tag and then everyone who is Not in the area gets selected for whatever comes next.

    0

Please sign in to leave a comment.