Capture the flag

Discussion in 'Plugin Development' started by Telmovieira, Jun 20, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Telmovieira

    I am trying to develop a minigame where there are four team fighting for one territory in some kind of king of the hill sort of game...
    So what i am triyng to do is there is one territory in the middle that the players have to hold of during 45 minutes aganist other teams. The thing is that around that territory there will be smaller ones that will decrese the time needed to capture the middle territory. You will be able to fast travel to there or spawn there if you wish.
    What i was thinking was if i did some sort of event or method that detected the player in a certain area and did different things when a player of a certain team entered the capture area.
    I also want to note that if a team possesses a territory and is being attacked by other team, if the capture timer was triggered by one of the attackers, if there wore no more attackers in that area the timer will slowly regenarate to 0.
    I know its very complex and stuff, but i realy need help with this, at least in the capture mecanism (the player gets in an area an starts a timer, and if that player leaves the area the time decreses)
    If you have any questions ask down bellow.
    I am wating for an anwser

    Thanks in advance

    Telmovieira
     
  2. Offline

    TechNotes

    Telmovieira
    This is the wrong place to ask. There is a plugin request section here. This section is only for helping with coding (meaning you already have something that you started, and you've just run into a problem)
     
  3. Offline

    AoH_Ruthless

    Telmovieira
    Your title says capture the flag, but this is a King of the Hill, Mountain, ladder, etc., type plugin.

    In my King of the Hill plugin, hills rotate automagically. There is a timer that runs for the length of the arena and switches based on an algorithm I made, which is based upon how many hills there are and how long the arena is running. At any given time, the hill is a configurable location with a radius around it. In a PlayerMoveEvent, if the current hill is a nearby location, they earn points.
    This probably seems very confusing, and the link below will show you the source code. The documentation isn't excellent at this time so you could have a hard time following, but I hope you understood the gist of things.

    The bulk of hill-related stuff. (Remember, don't copy the source code: Learn how to accomplish what you want based on it).
     
  4. Offline

    Telmovieira

    Thanks, i will take a look
    And no, this is not a pluguin request, i just need help with one aspect of the game...
     
  5. Offline

    AoH_Ruthless

    Telmovieira
    Alright. I never said it was a plugin request, and if my source code doesn't seem to be helpful, there are a lot of other related minigames on BukkitDev that might have available source code to sift through. You should consider tahging (@<username>) so we see messages.
     
  6. Offline

    Telmovieira

    AoH_Ruthless
    When i mentioned if it was a plugin requesta or not i was not talking to you, i was talking to TechNotes.
    And thank you for the helpful advices!
     
  7. Offline

    Telmovieira

    AoH_Ruthless
    So, I was messing around from what i learned from your code and from otheres' and i was able to create a system that detected a presence of a player when he enters a defined area. The problem here now is that i have no idea how to do the folowing:
    -Start a countdown when a player is on that area
    -Stop the countdown when a player from the oponent team enters or if there are no players in the capturing area
    -Make the countdown decrese slowly to 0 if there are no players in the capture area
    -Figure out a way to not have the chat box spam when ever you mov in the capture area
    Here is my code for you to see what sort of way i am trying to pursue:
    Code:java
    1. public void onPlayerDominateHill(PlayerMoveEvent event) {
    2.  
    3. Location Hill = new Location(event.getPlayer().getWorld(), 274,
    4. 120, 41);
    5.  
    6. Player[] players = Bukkit.getOnlinePlayers();
    7. List<Player> PlayersCapturing = new ArrayList<Player>();
    8.  
    9. for (Player player : players) {
    10.  
    11. if (PlayersCapturing.contains(player) != true) {
    12. if (player.getLocation().distance(Hill) <= 10) {
    13. PlayersCapturing.add(player);
    14. player.sendMessage(ChatColor.BLACK + "["
    15. + ChatColor.RED + "ATTENTION" + ChatColor.BLACK
    16. + "] " + player.getDisplayName()
    17. + ChatColor.RED + " is Capturing The Hill");
    18.  
    19.  
    20. }
    21. }
    22. else if (PlayersCapturing.contains(player)) {
    23. //start timer with BarAPI for every one to see
    24. }
    25.  
    26. }
    27.  
    28. }
    29.  

    If you were able to help me with this four things i will be greatly apreciated!

    PS: If you think this way ist's not the apropriate to use in these stuation please tell me....
     
  8. Offline

    AoH_Ruthless

  9. Offline

    Telmovieira

    @AoH_Ruthless
    I know how to build the actual countdown using a BukkitRunnable, I just donĀ“t know how to triger it and stop it in those situatons
     
Thread Status:
Not open for further replies.

Share This Page