Thread: Why isn't this givelife right?

Results 1 to 4 of 4
  1. #1 Why isn't this givelife right? 
    Registered Member
    Join Date
    Dec 2012
    Posts
    102
    Thanks given
    7
    Thanks received
    8
    Rep Power
    11
    Solved.

    One of the ints was wrong
    Reply With Quote  
     

  2. #2  
    Banned
    Join Date
    Jan 2013
    Posts
    153
    Thanks given
    64
    Thanks received
    25
    Rep Power
    0
    Quote Originally Posted by aceflare0 View Post
    I want it to be 0 items kept on death normally AND skulled, +1 with item prot, and +3 if the player dies with a Holy book equipped.
    I read through and tried to understand what I could, and you can see if you search "== 3840" that I've tried coming up with the code on my own but it doesn't protect any extra items with the book equipped.


    Code:
    		public void giveLife() {
    	
    		c.isDead = false;
    		c.faceUpdate(-1);
    		c.freezeTimer = 0;
    		if(c.duelStatus <= 4 && !c.getPA().inPitsWait()) { // if we are not in a duel we must be in 
    
    wildy so remove items
    			if (!c.inPits && !c.inFightCaves()) {
    					c.getItems().resetKeepItems();
    					if(!c.isSkulled) {
    						for (int i = 0; i < 1; i++)
    							c.getItems().keepItem(i, true);
    					}	
    
    					if(c.prayerActive[10] && System.currentTimeMillis() - 
    
    c.lastProtItem > 700 || c.curseActive[0] && System.currentTimeMillis() - c.lastProtItem > 700) {
    						c.getItems().keepItem(1, true);
    					}
    					c.getItems().dropAllItems();
    					c.getItems().deleteAllItems();
    					if(!c.isSkulled) {
    						for (int i1 = 0; i1 < 0; i1++) {
    							if(c.itemKeptId[i1] > 0) {
    								c.getItems().addItem
    
    (c.itemKeptId[i1], 1);
    							}
    						}
    					}
    			
    					if(c.playerLevel[5] <= 0) {
    					c.playerLevel[5] = 0;
    					c.getPA().refreshSkill(5);
    					c.getCombat().resetPrayers();
    					}
    
    					if(c.playerEquipment[c.playerShield] == 3840) {
    						c.getItems().keepItem(3, true);
    					}
    					if(c.playerEquipment[c.playerShield] == 3840) {
    						if(c.itemKeptId[3] > 0) {
    							c.getItems().addItem(c.itemKeptId[3],  
    
    1);
    						} 
    					} 			
    					if(c.prayerActive[10] || c.curseActive[0]) {
    						if(c.itemKeptId[1] > 0) {
    							c.getItems().addItem(c.itemKeptId[1], 
    
    1);
    						}
    					}
    				}
    				c.getItems().resetKeepItems();
    			} else if (c.inPits) {
    				Server.fightPits.removePlayerFromPits(c.playerId);
    				c.pitsStatus = 1;
    			}
    		c.getCombat().resetPrayers();
    		c.constitution = c.maxConstitution;
    		for (int i = 0; i < 20; i++) {
    			c.playerLevel[i] = getLevelForXP(c.playerXP[i]);
    			c.getPA().refreshSkill(i);
    		}
    		if (c.pitsStatus == 1)
    			movePlayer(2399, 5173, 0);
    		else if(c.duelStatus <= 4) { // if we are not in a duel repawn to wildy
    			movePlayer(Config.RESPAWN_X, Config.RESPAWN_Y, 0);
    			c.isSkulled = false;
    			c.skullTimer = 0;
    			c.attackedPlayers.clear();
    		} else if (c.inFightCaves()) {
    			c.getPA().resetTzhaar();
    		} else { // we are in a duel, respawn outside of arena
    			Client o = (Client) Server.playerHandler.players[c.duelingWith];
    			if(o != null) {
    				o.getPA().createPlayerHints(10, -1);
    				if(o.duelStatus == 6) {
    					o.getTradeAndDuel().duelVictory();
    				}
    			}
    			movePlayer(Config.DUELING_RESPAWN_X+(Misc.random
    
    (Config.RANDOM_DUELING_RESPAWN)), Config.DUELING_RESPAWN_Y+(Misc.random
    
    (Config.RANDOM_DUELING_RESPAWN)), 0);
    			if(c.duelStatus != 6) { // if we have won but have died, don't reset the duel 
    
    status.
    				c.getTradeAndDuel().resetDuel();
    			}
    		}
    		//PlayerSaving.getSingleton().requestSave(c.playerId);
    		PlayerSave.saveGame(c);
    		c.getCombat().resetPlayerAttack();
    		resetAnimation();
    		c.startAnimation(65535);
    		frame1();
    		resetTb();
    		c.isSkulled = false;
    		c.attackedPlayers.clear();
    		c.headIconPk = -1;
    		c.skullTimer = -1;
    		c.damageTaken = new int[Config.MAX_PLAYERS];
    		c.getPA().requestUpdates();
    	}
    that sound completely pointless, but it's in applydead not givelife
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Dec 2012
    Posts
    102
    Thanks given
    7
    Thanks received
    8
    Rep Power
    11
    Quote Originally Posted by Lexxy View Post
    that sound completely retarded, but it's in applydead not givelife
    Thank you for insulting my ideas. And no, it's not.

    Code:
    	public void applyDead() {	
    
    
    		c.respawnTimer = 15;
    		c.isDead = false;
    		Client o = (Client) Server.playerHandler.players[c.killerId];
    		if(c.duelStatus != 6) {
    			c.killerId = findKiller();
    			if(o != null) {
    				c.playerKilled = c.playerId;
    				if(o.duelStatus == 5) {
    					o.duelStatus++;
    				}
    				if (Server.playerHandler.players[c.playerId].connectedFrom != o.lastKilled) {
    					o.sendMessage(Killmessage());
    					o.attackedPlayers.clear();				
    					o.pkp = (o.pkp + 5);
    					o.KC += 1;
    					o.lastKilled = Server.playerHandler.players[c.playerId].connectedFrom;
    				} else {
    					o.sendMessage("You do not recieve PK Points because you have killed " +c.playerName+ " twice in a row.");
    				}
    				}
    				
    			}
    
    		/*if(c.duelStatus != 6) {
    			c.killerId = findKiller();
    			Client o = (Client) Server.playerHandler.players[c.killerId];
    			if(o != null) {
    				if (c.killerId != c.playerId) {
    					o.sendMessage("You have defeated "+c.playerName+"!");
    					if (!c.connectedFrom.equals(o.lastKilled)) {
    						o.pkp++;
    						c.DC++;
    						o.KC++;
    						o.sendMessage("You recieve a PK point for your kill. You now have " + o.pkp + " PK points.");
    					} else
    						o.sendMessage("You have already killed " + c.playerName + " recently. You do not recieve a PK point.");
    					o.lastKilled = c.connectedFrom;
    				}
    				c.playerKilled = c.playerId;
    				if(o.duelStatus == 5) {
    					o.duelStatus++;
    				}
    			}
    		}*/
    		c.faceUpdate(0);
    		EventManager.getSingleton().addEvent(new Event() {
    			public void execute(EventContainer b) {
    				c.npcIndex = 0;
    				c.playerIndex = 0;
    				b.stop();
    			}
    		}, 2500);
    		c.stopMovement();
    		if(c.inFFA()) {
    			c.getItems().deleteAllItems();
    			c.safeTimer = 0;
    		} else if(c.duelStatus <= 4) {
    			c.sendMessage("Oh dear you are dead!");
    			c.safeTimer = 0;
    			c.DC += 1;
    		} else if(c.duelStatus != 6) {
    			c.sendMessage("You have lost the duel!");
    		}
    		resetDamageDone();
    		c.specAmount = 10;
    		c.getItems().addSpecialBar(c.playerEquipment[c.playerWeapon]);
    		c.lastVeng = 0;
    		c.vengOn = false;
    		resetFollowers();
    		c.attackTimer = 10;
    		
    	}
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Dec 2012
    Posts
    102
    Thanks given
    7
    Thanks received
    8
    Rep Power
    11
    Can someone at least hint to what the problem is please? >_<;
    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. (PI) Givelife method prob...
    By Hellobuddyhowareyou in forum Help
    Replies: 3
    Last Post: 05-22-2011, 10:20 AM
  2. [PI] applydead and givelife method correct?
    By Ninja assassin in forum Help
    Replies: 3
    Last Post: 04-10-2011, 09:53 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
  •