[INACTIVE][FUN] FortressAssault v1.2.2 - Build, Attack, Defend Group PvP Game [670]

Discussion in 'Inactive/Unsupported Plugins' started by ssell, Mar 24, 2011.

  1. Offline

    ssell

    Fortress Assault - Group PvP Game
    Version: v1.2.2

    Major thanks to codezen for providing v1.2.0+!
    Note: This post has not been fully updated to represent the changes in 1.2.0. It will be updated later tonight. For full list of changes, see this post.


    Join with a group, build a fortress, and try to destroy the opposing team's Gizmo while defending yours!

    Fortify
    During this initial phase of the game, you and your teammates construct the fortress that will house your Gizmo. The Gizmo is a special Sponge block that may only be placed once per team, so be careful of who/where it is set down.​

    At the start of the phase, all inventories are saved and stored away and the players are provided with building resources. Everyone participating is made invulnerable to prevent fall damage and protect against over-zealous enemies.​

    When time is up, the next phase begins. But make sure the Gizmo is placed. Any team that has not placed it will automatically lose!​

    Assault
    This is the time for PvP!​

    Inventories are once again replaced with the patented BattlePack that provides all players equal armor, weapons, food, and other useful items.​

    During this time, all PvP between players is monitored, so that at the end of the game the stats (kills/deaths/destructions) can be printed.​

    But nothing else matters other than destroying the other team's Gizmo before they get yours! Simply hit it and it will begin a 5-second self-destruct. If no one on the opposing team has canceled the self-destruct (by hitting it after you have), then you and your team wins!​

    Also during this phase, when a player dies and respawns they are provided with replacement gear so they do not have to enter the battle naked.​

    Links

    Commands
    /faTime <IntegerValue>
    Set how long the Fortify phase lasts. Default 5 minutes.​

    /faResource <1-3>
    The amount of resources provided at the beginning of the Fortify phase. 1 = little, 2 = normal, 3 = lots.​

    /faAdd <TeamColor> <PlayerName>
    Adds the specified player to the team. BLUE or RED teams only.​

    /faStart
    Begins a game. Each team needs at least one member.​

    /faStop
    Stops the current game and returns original inventories.​

    Notes

    Minimum two players (1 for each team).​

    If possible, do not play on the 'Peaceful' setting. The automatic replenishing health interferes with the pre-death check and will cause premature awarding of PvP kills/deaths.​

    There is also no guarantee for the safety of your original inventory. Disconnecting or rare bugs may cause the mod to fail to restore your inventory when the game is over.​

    Because of this, if you are carrying something you can not afford to lose, stash it before playing.​

    Generally though, there should be no issues with this.​

    To-Do
    • /faQuit, /faSwitch, /faTimeLeft commands
    • Maintain an external inventory list in the event of server shutdown during game.
    • Cleanup/Optimize code
    • Any other suggestions that come up.
    Known Bugs

    • Mod forgets about players when they die. They are re-added to the mod when they respawn but this delay may prevent players from appearing in the battle report if they are at the 'dead' screen when the game ends
    Changelog


    v1.1.0
    Initial release to Bukkit Forums
     
    kahlilnc and claytja like this.
  2. Offline

    Crash

    I was gunna do something like this but I think I actually like your idea a lot better than mine :)
    Good job.
     
  3. Offline

    tee jay

    This sounds extremely cool, I can't wait try it.

    EDIT: While I like your idea a lot, I think a lot of your code can be cleaned up/improved upon. Repetitive code like when you're adding the time warnings could easily be reduced a lot by changing/adding a method. Also, returnInventory could be about half it's size.

    Code:
    public void returnInventory( Player player )
    	{
    		if( player != null )
    		{
    			for( int i = 0; i < inventoryList.size( ); i++ )
    			{
    				if( inventoryList.get( i ).first.equalsIgnoreCase( player.getDisplayName( ) ) )
    				{
    					//Stashed inventory found.
    					List< ItemStack > oldInventory = inventoryList.get( i ).second;
    
    					if( oldInventory != null )
    					{
    						PlayerInventory newInventory = player.getInventory( );
    
    						newInventory.clear( );
    
    						for( int j = 0; j < oldInventory.size( ); j++ )
    						{
    							newInventory.addItem( oldInventory.get( j ) );
    						}
    
    						inventoryList.remove( i );
    
    						//DEPRECATED. need to find alternative
    						player.updateInventory( );
    					}
    
    					break;
    				}
    			}
    		}
    		else
    		{
    
    			for( int i = 0; i < inventoryList.size( ); i++ )
    			{
    				Player tempPlayer = getServer( ).getPlayer( inventoryList.get( i ).first );
    
    				//Stashed inventory found.
    				List< ItemStack > oldInventory = inventoryList.get( i ).second;
    
    				if( ( oldInventory != null ) && ( tempPlayer != null ) )
    				{
    					PlayerInventory newInventory = tempPlayer.getInventory( );
    
    					newInventory.clear( );
    
    					//Add old items into the inventory
    					for( int j = 0; j < oldInventory.size( ); j++ )
    					{
    						if( oldInventory.get( j ) != null )
    						{
    							if( oldInventory.get( j ).getType( ) != Material.AIR )
    							{
    								newInventory.addItem( oldInventory.get( j ) );
    							}
    						}
    					}
    
    					//DEPRECATED. need to find alternative
    					tempPlayer.updateInventory( );
    				}
    			}
    
    			inventoryList.clear( );
    		}
    	}
    could very easily be
    Code:
    	public void returnInventory( Player player )
    	{
    		for( int i = 0; i < inventoryList.size( ); i++ )
    		{
    			Player tempPlayer = (player == null) ? getServer( ).getPlayer( inventoryList.get( i ).first ) : player;
    
    			//Stashed inventory found.
    			List< ItemStack > oldInventory = inventoryList.get( i ).second;
    
    			if( ( oldInventory != null ) && ( tempPlayer != null ) )
    			{
    				PlayerInventory newInventory = tempPlayer.getInventory( );
    
    				newInventory.clear( );
    
    				//Add old items into the inventory
    				for( int j = 0; j < oldInventory.size( ); j++ )
    				{
    					if( oldInventory.get( j ) != null )
    					{
    						if( oldInventory.get( j ).getType( ) != Material.AIR )
    						{
    							newInventory.addItem( oldInventory.get( j ) );
    						}
    					}
    				}
    
    				//DEPRECATED. need to find alternative
    				tempPlayer.updateInventory( );
    			}
    		}
    
    		inventoryList.clear( );
    	}
    or something similar.

    Also, what if the server gets stopped while a game is running?

    Unless you have some sort of persistence I'm missing, I suggest there be something onDisable that will see if a game is running first and if so, try to add player inventories right back before exiting.


    Anyway, really cool plugin and cool idea, I hope you take a look at what I've suggested.
     
    nbirk94 likes this.
  4. Offline

    Sosser

    Without actually having tried this, I wanna suggest ladders in the battlepack. If it already has this, then ignore this :p
    And this sounds awesome for LAN's :D
     
  5. Offline

    ssell

    It already has ladders :)

    At the beginning of Assault Phase everyone gets 10 ladders. When they are killed and respawn, they are given 5 ladders.

    I will probably make it so that the resources given to the players is customizable.
     
  6. Offline

    tee jay

    Again, I really like the idea this has, and I was wondering if you had any objection to my making my own(not using your code--just something rather similar in idea)?
     
  7. Offline

    ssell

    None whatsoever.

    And feel free to look at the source if needed (its why I put it up on GitHub :)). I didn't comment too well anything beyond FortressAssault.java, so you are warned.

    I don't mind even if you take a chunk of the source for your project. Just credit me somewhere if you do.

    Edit: just saw your edited post above. This was my first plugin so was unsure about a lot of it. There is definitely a lot of clean up I can/will do.

    When making this I was also working on two projects for school and one for work so was rushing it a bit.

    Thanks for the info you posted.

    Edit2: My brain might just be frazzled (in the middle of writing documentation for my work project. Or it might be because Java is not my primary language. C++ is.) but does the edited returnInventory() you posted above allow for only a single inventory to be returned?

    I had it broken into two separate parts: one for individual inventory (to specified player), the other to return all inventories (if null was provided).
     
  8. Offline

    tee jay

    It should function just as yours did, unless I messed something up(I didn't test, just did that quickly in a text editor).

    Code:
    Player tempPlayer = (player == null) ? getServer( ).getPlayer( inventoryList.get( i ).first ) : player;
    Should set tempPlayer to player provided player is not null, in which case it would operate just as the first half did before and find just the inventory of that player.

    If, however, player IS null, it will set tempPlayer to getServer( ).getPlayer( inventoryList.get( i ).first, hopefully acting just as the second half did before(Player tempPlayer = getServer( ).getPlayer( inventoryList.get( i ).first ))


    EDIT: Actually, I did spot one problem with my code. There is no check that the player at i IS in fact player, so there would in fact have to be one additional if statement for when player is != null and the current player is the right one
    Code:
    if (player != null && !inventoryList.get( i ).first.equalsIgnoreCase( player.getDisplayName( ) ))
        continue;
    Roughly translates to: "If we're looking for that specific player(player !null) and we are not at the right player in the list yet, continue on to the next loop iteration(skip over current i)."
     
  9. Offline

    LtDan

    i havent downloaded it either because im not sure how its start, can it be started by a command like its stopped?
     
  10. Offline

    ssell

    oh oops. Missed that command in the original post. Its /faStart.

    Each team (blue or red) must have at least one member or else it wont start. It will let you know what team is missing a player.
     
  11. Offline

    bakon balázs

    hm interresting.
    DD style pvp : > like

    idea: assing players auto via portal? :)
     
  12. Offline

    epsolon77

    I feel like this could get very destructive to a persistent server. Have you considered either a auto resetting battlefield or somehow limiting the players?
     
  13. I would like to see this in action, anyone have this on their server or is there a test server i can check out?
     
  14. Offline

    Soecer1194

    When an assault ends what happens to the fortress that was built?
     
  15. Offline

    thepackett

    is this going to be updated for 1.4 and cb 600+?
    i really love this mod :D
     
  16. Offline

    ssell

    @Soecer1194
    It remains there. I will make the fortress go away/fix the landscape.

    @thepackett
    It will be updated eventually. I will probably do a quickfix tomorrow or around then so it works with the newest Craftbukkit.

    I am currently mainly focusing on TentThis, but do plan on returning to this to improve/add functionality.
     
  17. Offline

    Tom Kimberlin

    Hey, I don't really understand this.
    I built the fortress thing, then what?
    It said: Red Team has placed their Gizmo!
    Then what? Do I destroy it? Do I place mine then ? Why did it stop? If it stopped then where wre my stats?
    How do Kill?
     
  18. Offline

    thepackett

    there are three "modes" in fortress assault.
    well, two technically, but anyway:
    the first (which doesn't count as a mode) is the normal mode, this is where your server functions normally, as if you didn't even have the mod.
    its during this period of time which you set the time limit and resource limit for the fortification mode.

    The fortification mode is the first real mode of gameplay. during this period all players participating in fortress assault will be invincible. during the time which lasts however long you set it to be you build a fortress to protect your gizmo from the opposing team.

    when the time limit runs out you enter the third and final mode. this is where the PvP takes place. during this period you attempt to destroy the other teams gizmo while protecting your own. note that when you kill a player they lose their armor and are still there. then (IMPORTANT: correct me if i'm wrong) you kill them again to send them to spawn.

    IMPORTANT: you can NOT destroy the opposing team's gizmo with tnt. it will simply disappear without giving your team credit. (might want to look into this Ssell).
    i advise having spawn in between the fortresses so when players die they are not in a far away place.

    @Ssell: I love this mod as i stated before but you may want to look into two things:
    1- TnT that destroys a gizmo will not end the game and leaves one team without a gizmo to defend so they can focus on attack. obviously unfair and not good :O
    2-Maybe making it so you can set a temporary red team spawn and blue team spawn that will disappear at the end of the game? two opposing teams sharing the same spawn causes some problems :O
    3-Make it so you can maybe choose to make all blocks placed in fortification mode optionally disappear at the end of the game? i have old ruins all over my server xD
    that or you could restore the area where fortification took place to what it was before the fortification mode

    Hope this helps :D
     
  19. Offline

    WhosDaMan

    Havent tried this out yet, but it looks VERY promising, and i am just about to download it. Unfortunately its late and all my friends are prob asleep so i cant test it out and THEN i go on vacation...so yeah.
    I can see how this can ruin a game and it probably should be included in the next update because after people start to die then the spawn becomes a free-for-all and a little chaotic. Also here are some more ideas:
    1) Make a respawn time about 5 seconds long because if you implement two temporary spawns in each base you dont want people rapidly spawning on the Gizmo, if you have ever played Star-Wars Battlefront and the enemy has 1 more command post left, its hard to infiltrate it (because when they die they just come right back, and the command post is the only place they can spawn)
    2) Customizable resources and all over more customizable config. so you can have a wide range of battles, from breaking into sand castles to mining through obsidian walls :D
    3) Possible classes, like a kit can be assigned to each class:
    Medic: Carries around food and is equipped with a bow, iron armour
    Infiltrator: uses TnT to blow apart walls (has 1 or 2 tnt to prevent abuse), equipped with a stone sword, leather armour
    Warrior: Full diamond gear, diamond sword, ladders
    etc...etc...etc
    4) Game variations: CTF, Siege
    Siege: Defenders have 10 minutes to build a castle with a large amount of durable resources
    Attackers have the same amount of time to build things such as cannons, shields, and other contraptions to aid them
    Defender Kit: Lava bucket (2) Bow and arrow w/ 2 stacks of arrows, diamond sword, iron armour
    Attacker Kit: TnT (1), bow w/ 1 stack of arrows, iron sword, diamond armour
    Defenders only have 1 life while attackers can keep on attacking, defenders must keep their Gizmo safe for 15 minutes of combat (configurable lives, time)

    Those are my suggestions that i would of coded myself if my head didnt nearly pop when trying to learn the basics :p
     
  20. Offline

    zazzy_macdaddy

    You really need to make this work with 600+ it sounds like a really fun mod.
     
  21. Offline

    Tfs Halo

    it is :D and no one is posting it makes me sad
     
  22. Offline

    belboz

    This sounds awesome, please update it! We would love to do a video of a group of playing this!
     
  23. Offline

    viper1993

    Sounds like great feature for my server, begging for update! :)
     
  24. Offline

    AgentKid

    Yea, any ETA on when it'll be updated?
     
  25. Offline

    Uciapany

    It have too many bugs to use. Teams restart only when server is restarted. If somebody die after game he gets items from assault phase. If somebody reloag after setup teams then he dont get items in build phase.
    But I like it, and when it will be finished i will be use it.
     
  26. Offline

    kenjamen

    man this is sweet, gonna be updated to 617?
     
  27. Offline

    steve m

    Please update! My friend and I Friggin LOVE this plugin!
     
  28. Offline

    Codezen

    This sounded like a fun mod so I decided to try updating it as my first crack at programming for bukkit. I ended up doing alot more than just updating it. I fixed a couple of bugs as well. You can get it here: http://www.leagueofpirates.com/codezen/minecraft/Fortress-Assault-1.1.1b.jar

    I have only tested it locally with a friend, if you have a server please send me the info so I can try it out.

    I intend to upload it back to git just a soon as I figure out how. Sounds like i need to fork or get added to the project.
     
  29. Offline

    Tfs Halo

    omfg thank you if it works :D can't really test it because i don't have no one else to test it with.... lol i forgot i have two other accounts :D ok going to test it .

    it worked for me and i have build 617 or atleast i think it says build 612 when i start it up but i installed 617...
    anyways which bugs did you fix? i was thinking the bug for existing buildings after but that isn't as important because my players can keep on building on to their castles/bases.

    i think you fixed the inventory bug because i noticed a '' inv:halo 25'' or something but i wasn't too sure what it was

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 13, 2016
  30. Offline

    Codezen

    i fixed mainly issues with players disconnecting. the entity id changes when you re-log. Also the end of game didn't clear the gizmo properly. Some bugs where it would change game phase even though it just told you that you don't have enough players. also i added /fateams to show current teams, and made commands not case sensitive.

    that inv: message was some debug code i forgot to remove, i'm working on it returning inventory if you log off during the game or are dead at the end.
     

Share This Page