Thread: Hyperion Energy & Draining

Results 1 to 5 of 5
  1. #1 Hyperion Energy & Draining 
    Registered Member

    Join Date
    May 2012
    Posts
    474
    Thanks given
    93
    Thanks received
    74
    Rep Power
    634
    Okay I have a few questions but I can't ask some until others have been answered... so first off is this correct?

    Code:
    	public ActionSender sendEnergy() {
    		PacketBuilder bldr = new PacketBuilder(110).putByteA(1);
    		player.write(bldr.toPacket());
    		return this;
    	}
    As most of you know I'm trying to send the run energy packet.

    PacketBuilder(110) is the packet opcode and putByteA(1) is the length (in bytes).

    Everything works fine in-game but I'm getting 129% energy. I don't have draining added yet but I will add when I know that I'm doing this stuff correctly.

    Note: I don't want to be spoon fed, I'd like to learn something.
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Feb 2012
    Posts
    60
    Thanks given
    1
    Thanks received
    6
    Rep Power
    37
    You're not actually sending any data, just sending an empty packet.
    Reply With Quote  
     

  3. #3  
    Registered Member

    Join Date
    May 2012
    Posts
    474
    Thanks given
    93
    Thanks received
    74
    Rep Power
    634
    Quote Originally Posted by Wut Up Bruh View Post
    You're not actually sending any data, just sending an empty packet.
    That's kind of what I thought... hold on a second and I'll see what I can do.
    Reply With Quote  
     

  4. #4  
    Registered Member

    Join Date
    May 2012
    Posts
    474
    Thanks given
    93
    Thanks received
    74
    Rep Power
    634
    Okay, fixed the 129% energy by looking at other packets already done by Graham.
    Code:
    	public ActionSender sendEnergy() {
    		player.getSession().write(new PacketBuilder(110).put((byte) player.getRunEnergy()).toPacket());
    		return this;
    	}
    Reply With Quote  
     

  5. #5  
    Registered Member

    Join Date
    May 2012
    Posts
    474
    Thanks given
    93
    Thanks received
    74
    Rep Power
    634
    This is what I've come up with on my own for run energy draining... it probably sucks but I've just started delving into these things.
    Code:
    			if(runToggled || runQueue) {
    				if(player.getRunEnergy() < 0.01) {
    					walkPoint = getNextPoint();
    				} else if(player.getRunEnergy() > 0.01) {
    					runPoint = getNextPoint();
    					player.setRunEnergy((int) -0.88);
    				}
    
    			}
    I haven't tested it either, will do that now.

    Oh, and just above that I have:
    Code:
    			if(player.getRunEnergy() < 100) {
    				player.setRunEnergy((int) +0.25);
    			}
    Update: Yeah, that didn't work at all, client closed the connection when I logged in.

    Removed the check for less than 100 energy before the check of RunQueue or RunToggled.

    New code:
    Code:
    			if(runToggled || runQueue) {
    				if(player.getRunEnergy() < 0.01) {
    					walkPoint = getNextPoint();
    					player.setRunEnergy((int) +0.25);
    				} else if(player.getRunEnergy() > 0.01) {
    					runPoint = getNextPoint();
    					player.setRunEnergy((int) -0.88);
    				}
    
    			}
    Crashed when I clicked on the "Run" button.

    New code:
    Code:
    			if(runToggled || runQueue && player.getRunEnergy() > 0) {
    				runPoint = getNextPoint();
    Removed -->		player.setRunEnergy((int) -0.88);
    			}
    Still crashes the client and I think it has something to do with player.setRunEnergy((int0 -0.88); but I'm not sure...

    Update: Okay I removed the drain but now I need a way to drain energy if the player is running... without crashing the game.
    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. [hyperion]Running with energy
    By Dylan in forum Snippets
    Replies: 24
    Last Post: 11-16-2012, 09:47 PM
  2. [PI]Simple energy draining/refilling
    By Arithium in forum Snippets
    Replies: 14
    Last Post: 04-26-2011, 12:16 PM
  3. 508/525 Energy & super energy potion
    By Huztler in forum Tutorials
    Replies: 2
    Last Post: 02-17-2011, 03:27 PM
  4. [Hyperion] Prayer Draining
    By PSNB in forum Help
    Replies: 0
    Last Post: 04-15-2010, 06:07 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •