Thread: link a good fightpits tutorial with rewards

Results 1 to 6 of 6
  1. #1 link a good fightpits tutorial with rewards 
    Chow down on these noodles
    OodlesOfNoodles's Avatar
    Join Date
    May 2011
    Posts
    1,819
    Thanks given
    235
    Thanks received
    91
    Rep Power
    55
    if anyone can help me find a good fightpits tutorial that gives rewards to the winner like an item and amt that would be awesome
    been searchin awhile now and nothin >.<
    pi btw
    Reply With Quote  
     

  2. #2  
    Donator


    Join Date
    Jun 2011
    Posts
    2,549
    Thanks given
    539
    Thanks received
    402
    Rep Power
    683
    Just use the default PI fightpits system, or just rip it & add to it.
    Reply With Quote  
     

  3. #3  
    Chow down on these noodles
    OodlesOfNoodles's Avatar
    Join Date
    May 2011
    Posts
    1,819
    Thanks given
    235
    Thanks received
    91
    Rep Power
    55
    ... anyone else?
    Reply With Quote  
     

  4. #4  
    Donator


    Join Date
    Jun 2011
    Posts
    2,549
    Thanks given
    539
    Thanks received
    402
    Rep Power
    683
    ...

    Look, all you have to do is something like this, or set up a system relavent to this;

    ifPlayerWinsFightPits {

    (c.getPlayerName) c.sendmessage("congratulations, you've won the fightpits minigame, your rewards are CONFIG_ITEM, & CONFIG_ITEM"); addItem (####, 1)
    (####, 1)

    }

    Some crap like that, I don't even know.
    Reply With Quote  
     

  5. #5  
    Chow down on these noodles
    OodlesOfNoodles's Avatar
    Join Date
    May 2011
    Posts
    1,819
    Thanks given
    235
    Thanks received
    91
    Rep Power
    55
    no i mean mines completely messed up. the message board blinks every second and when you die it teleports you to home and if you kill someone the kill list doesnt go down so when everyoen else is dead you just sit there..
    Reply With Quote  
     

  6. #6  
    Donator


    Join Date
    Jun 2011
    Posts
    2,549
    Thanks given
    539
    Thanks received
    402
    Rep Power
    683
    Then @Minigames.java, replace your fightpits class with this;

    Code:
    package server.model.minigames;
    
    import server.model.players.Client;
    import server.util.Misc;
    import server.Server;
    
    /**
     * @author Russel
     */
    
    public class FightPits {
    
    	public int[] playerInPits = new int[200];
    	
    	private int GAME_TIMER = 140;
    	private int GAME_START_TIMER = 40;
    	
    	private int gameTime = -1;
    	private int gameStartTimer = 30;
    	private int properTimer = 0;
    	public int playersRemaining = 0;
    	
    	public String pitsChampion = "Nobody";
    	
    	public void process() {
    		if (properTimer > 0) {
    			properTimer--;
    			return;
    		} else {
    			properTimer = 4;
    		}
    		if (gameStartTimer > 0) {
    			gameStartTimer--;
    			updateWaitRoom();
    		} 
    		if (gameStartTimer == 0) {
    			startGame();
    		}
    		if (gameTime > 0) {
    			gameTime--;
    			if (playersRemaining == 1)
    				endPitsGame(getLastPlayerName());
    		} else if (gameTime == 0)
    			endPitsGame("Nobody");
    	}
    	
    	public String getLastPlayerName() {
    		for (int j = 0; j < playerInPits.length; j++) {
    			if (playerInPits[j] > 0)
    				return Server.playerHandler.players[playerInPits[j]].playerName;
    		}	
    		return "Nobody";
    	}
    	
    	public void updateWaitRoom() {
    		for (int j = 0; j < Server.playerHandler.players.length; j++) {
    			if (Server.playerHandler.players[j] != null) {
    				Client c = (Client) Server.playerHandler.players[j];
    				if (c.getPA().inPitsWait()) {
    					c.getPA().sendFrame126("Next Game Begins In : " + ((gameStartTimer * 3) + (gameTime * 3)) + " seconds.", 6570);
    					c.getPA().sendFrame126("Champion: " + pitsChampion, 6572);
    					c.getPA().sendFrame126("", 6664); 
    					c.getPA().walkableInterface(6673);
    				}	
    			}	
    		}	
    	}
    	
    	public void startGame() {
    		if (getWaitAmount() < 2) {
    			gameStartTimer = GAME_START_TIMER/2;
    			//System.out.println("Unable to start fight pits game due to lack of players.");
    			return;
    		}	
    		for (int j = 0; j < Server.playerHandler.players.length; j++) {
    			if (Server.playerHandler.players[j] != null )  {
    					Client c = (Client)Server.playerHandler.players[j];
    					if (c.getPA().inPitsWait())
    						addToPitsGame(j);
    			}	
    		}
    		System.out.println("Fight Pits game started.");
    		gameStartTimer = GAME_START_TIMER + GAME_TIMER;
    		gameTime = GAME_TIMER;
    	}
    	
    	public int getWaitAmount() {
    		int count = 0;
    		for (int j = 0; j < Server.playerHandler.players.length; j++) {
    			if (Server.playerHandler.players[j] != null )  {
    					Client c = (Client)Server.playerHandler.players[j];
    					if (c.getPA().inPitsWait())
    						count++;
    			}	
    		}
    		return count;
    	}
    	
    	public void removePlayerFromPits(int playerId) {
    		for (int j = 0; j < playerInPits.length; j++) {
    			if (playerInPits[j] == playerId) {
    				Client c = (Client)Server.playerHandler.players[playerInPits[j]];
    				c.getPA().movePlayer(2399, 5173, 0);
    				playerInPits[j] = -1;
    				playersRemaining--;
    				c.inPits = false;
    				break;
    			}
    		}
    	}
    	
    	public void endPitsGame(String champion) {
    		boolean giveReward = false;
    		if (playersRemaining == 1)
    			giveReward = true;
    		for (int j = 0; j < playerInPits.length; j++) {
    			if (playerInPits[j] < 0)
    				continue;
    			if (Server.playerHandler.players[playerInPits[j]] == null)
    				continue;
    			Client c = (Client)Server.playerHandler.players[playerInPits[j]];
    			c.getPA().movePlayer(2399, 5173, 0);
    			c.inPits = false;
    		}
    		playerInPits = new int[200];	
    		pitsChampion = champion;
    		playersRemaining = 0;
    		pitsSlot = 0;
    		gameStartTimer = GAME_START_TIMER;
    		gameTime = -1;
    		System.out.println("Fight Pits game ended.");
    	}
    	
    	private int pitsSlot = 0;
    	public void addToPitsGame(int playerId) {
    		if (Server.playerHandler.players[playerId] == null)
    			return;
    		playersRemaining++;
    		Client c = (Client)Server.playerHandler.players[playerId];
    		c.getPA().walkableInterface(-1);
    		playerInPits[pitsSlot++] = playerId;
    		c.getPA().movePlayer(2392 + Misc.random(12), 5139 + Misc.random(25), 0);
    		c.inPits = true;		
    	}
    }
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Can someone link me to a tutorial
    By .Optimum in forum Requests
    Replies: 1
    Last Post: 04-30-2011, 07:12 AM
  2. Good PK Rewards
    By noiss in forum Tutorials
    Replies: 7
    Last Post: 06-11-2008, 07:05 PM
  3. D-Link DI-704P Port Forwarding Tutorial
    By Fluro in forum Tutorials
    Replies: 5
    Last Post: 06-11-2008, 01:10 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •