Thread: Yo. Converting to Events.

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1 Yo. Converting to Events. 
    Super Donator

    Batukka's Avatar
    Join Date
    Oct 2011
    Posts
    2,433
    Thanks given
    86
    Thanks received
    342
    Rep Power
    496
    I'm now stuck at Poison system. i can't convert it lol. Cleaning shit thons from process :L
    so i ask now help from you convert this poison to events. [I Don't care what event it's using cause i can convert it to my events lol]

    Poison system in Process
    Code:
    if (System.currentTimeMillis() - lastPoison > 20000 && poisonDamage > 0) {
    			int damage = poisonDamage/2;
    			if (damage > 0) {
    				sendMessage("The poison damages you");
    				if (!getHitUpdateRequired()) {
    					setHitUpdateRequired(true);
    					setHitDiff(damage);
    					updateRequired = true;
    					poisonMask = 1;
    				} else if (!getHitUpdateRequired2()) {
    					setHitUpdateRequired2(true);
    					setHitDiff2(damage);
    					updateRequired = true;
    					poisonMask = 2;
    				}
    				lastPoison = System.currentTimeMillis();
    				poisonDamage--;
    				dealDamage(damage);
    			} else {
    				poisonDamage = -1;
    				sendMessage("You are no longer poisoned.");
    			}	
    		}

    Appendpoison method:

    Code:
    	public void appendPoison(int damage) {
    		if (System.currentTimeMillis() - c.lastPoisonSip > c.poisonImmune) {
    			c.sendMessage("You have been poisoned.");
    			c.poisonDamage = damage;
    		}	
    	}
    Thx. Gonna rep+ & Thank.
    Reply With Quote  
     

  2. #2  
    Super Donator

    Batukka's Avatar
    Join Date
    Oct 2011
    Posts
    2,433
    Thanks given
    86
    Thanks received
    342
    Rep Power
    496
    Bump. Already tryed but happened this: When you're poisoned you're get healed 3k Hp every time when the "poison" makes damage lol.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Smokey's Avatar
    Join Date
    Apr 2011
    Posts
    287
    Thanks given
    124
    Thanks received
    73
    Rep Power
    351
    [email protected]
    do you have teamviewer?
    Spoiler for signature:

    He is richest who is content with the least, for contentment is the wealth of nature. - Socrates
    Attached image
    Reply With Quote  
     

  4. #4  
    Registered Member

    Join Date
    Sep 2008
    Posts
    4,833
    Thanks given
    894
    Thanks received
    1,439
    Rep Power
    2924
    Just made this for CycleEvents, Not sure if itll work.

    For the Event
    Code:
    CycleEventHandler.getSingleton().addEvent(1337, Server.playerHandler.players, new CycleEvent() {
    			@Override
    			public void execute(CycleEventContainer container) {
    			int damage = poisonDamage/2;
    			if (poisonCount == 0) {
    				handlePoisonDamage();
    			}
    			if (poisonCount == 10) {
    				handlePoisonDamage();
    			}
    			if (poisonCount == 25) {
    				handlePoisonDamage();
    			}
    			if (poisonCount == 45) {
    				handlePoisonDamage();
    			}
    			if (poisonCount == 59) {
    				handlePoisonDamage();
    			}
    			
    			if (poisonCount == 60) {
    			container.stop();
    			}
    			poisonCount++;
    			
    			
    			}
    			@Override
    			public void stop() {
    				poisonDamage = -1;
    				sendMessage("You are no longer poisoned.");
    			}
    		}, 1);
    The handlePoison void
    Code:
    public void handlePoisonDamage() {
    		sendMessage("The poison damages you");
    				if (!getHitUpdateRequired()) {
    					setHitUpdateRequired(true);
    					setHitDiff(damage);
    					updateRequired = true;
    					poisonMask = 1;
    				} else if (!getHitUpdateRequired2()) {
    					setHitUpdateRequired2(true);
    					setHitDiff2(damage);
    					updateRequired = true;
    					poisonMask = 2;
    				}
    		}
    "Know thy self, know thy enemy. A thousand battles, a thousand victories." - Sun Tzu
    GitHub: https://github.com/Faris-Mckay
    Reply With Quote  
     

  5. Thankful user:


  6. #5  
    Registered Member

    Join Date
    Sep 2011
    Posts
    1,140
    Thanks given
    385
    Thanks received
    398
    Rep Power
    474
    Quote Originally Posted by Faris View Post
    Just made this for CycleEvents, Not sure if itll work.

    For the Event
    Code:
    CycleEventHandler.getSingleton().addEvent(1337, Server.playerHandler.players, new CycleEvent() {
    			@Override
    			public void execute(CycleEventContainer container) {
    			int damage = poisonDamage/2;
    			if (poisonCount == 0) {
    				handlePoisonDamage();
    			}
    			if (poisonCount == 10) {
    				handlePoisonDamage();
    			}
    			if (poisonCount == 25) {
    				handlePoisonDamage();
    			}
    			if (poisonCount == 45) {
    				handlePoisonDamage();
    			}
    			if (poisonCount == 59) {
    				handlePoisonDamage();
    			}
    			
    			if (poisonCount == 60) {
    			container.stop();
    			}
    			poisonCount++;
    			
    			
    			}
    			@Override
    			public void stop() {
    				poisonDamage = -1;
    				sendMessage("You are no longer poisoned.");
    			}
    		}, 1);
    The handlePoison void
    Code:
    public void handlePoisonDamage() {
    		sendMessage("The poison damages you");
    				if (!getHitUpdateRequired()) {
    					setHitUpdateRequired(true);
    					setHitDiff(damage);
    					updateRequired = true;
    					poisonMask = 1;
    				} else if (!getHitUpdateRequired2()) {
    					setHitUpdateRequired2(true);
    					setHitDiff2(damage);
    					updateRequired = true;
    					poisonMask = 2;
    				}
    		}
    No.
    Reply With Quote  
     

  7. #6  
    Registered Member

    Join Date
    Sep 2008
    Posts
    4,833
    Thanks given
    894
    Thanks received
    1,439
    Rep Power
    2924
    Quote Originally Posted by null View Post
    No.
    Its scrappy, i threw it together in a couple of seconds, but its a base for him to work on ,Whats so bad with that one anyway?
    "Know thy self, know thy enemy. A thousand battles, a thousand victories." - Sun Tzu
    GitHub: https://github.com/Faris-Mckay
    Reply With Quote  
     

  8. #7  
    Super Donator

    Batukka's Avatar
    Join Date
    Oct 2011
    Posts
    2,433
    Thanks given
    86
    Thanks received
    342
    Rep Power
    496
    Quote Originally Posted by Faris View Post
    Just made this for CycleEvents, Not sure if itll work.

    For the Event
    Code:
    CycleEventHandler.getSingleton().addEvent(1337, Server.playerHandler.players, new CycleEvent() {
    			@Override
    			public void execute(CycleEventContainer container) {
    			int damage = poisonDamage/2;
    			if (poisonCount == 0) {
    				handlePoisonDamage();
    			}
    			if (poisonCount == 10) {
    				handlePoisonDamage();
    			}
    			if (poisonCount == 25) {
    				handlePoisonDamage();
    			}
    			if (poisonCount == 45) {
    				handlePoisonDamage();
    			}
    			if (poisonCount == 59) {
    				handlePoisonDamage();
    			}
    			
    			if (poisonCount == 60) {
    			container.stop();
    			}
    			poisonCount++;
    			
    			
    			}
    			@Override
    			public void stop() {
    				poisonDamage = -1;
    				sendMessage("You are no longer poisoned.");
    			}
    		}, 1);
    The handlePoison void
    Code:
    public void handlePoisonDamage() {
    		sendMessage("The poison damages you");
    				if (!getHitUpdateRequired()) {
    					setHitUpdateRequired(true);
    					setHitDiff(damage);
    					updateRequired = true;
    					poisonMask = 1;
    				} else if (!getHitUpdateRequired2()) {
    					setHitUpdateRequired2(true);
    					setHitDiff2(damage);
    					updateRequired = true;
    					poisonMask = 2;
    				}
    		}
    No Doesn't Work. Sorry mate but rep++ for trying help.
    Reply With Quote  
     

  9. Thankful user:


  10. #8  
    Registered Member

    Join Date
    Sep 2011
    Posts
    1,140
    Thanks given
    385
    Thanks received
    398
    Rep Power
    474
    Quote Originally Posted by Faris View Post
    Its scrappy, i threw it together in a couple of seconds, but its a base for him to work on ,Whats so bad with that one anyway?
    Quote Originally Posted by null View Post
    The point of events is to eliminate timers and only execute the code when it is actually needed, rather than every 600 ms (process()), or however long.
    Refer to that post.
    Reply With Quote  
     

  11. #9  
    Super Donator

    Batukka's Avatar
    Join Date
    Oct 2011
    Posts
    2,433
    Thanks given
    86
    Thanks received
    342
    Rep Power
    496
    Bump needing it
    Reply With Quote  
     

  12. #10  
    Super Donator

    Batukka's Avatar
    Join Date
    Oct 2011
    Posts
    2,433
    Thanks given
    86
    Thanks received
    342
    Rep Power
    496
    Bump
    Reply With Quote  
     

Page 1 of 2 12 LastLast

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. Replies: 56
    Last Post: 09-18-2016, 07:19 AM
  2. Converting to Events
    By CrazyPanda in forum Help
    Replies: 4
    Last Post: 11-15-2009, 06:47 PM
  3. New events and more !
    By 'Ramon in forum General
    Replies: 7
    Last Post: 08-18-2009, 06:22 PM
  4. Converting Process() To Events
    By Enjoi in forum Tutorials
    Replies: 35
    Last Post: 07-13-2009, 01:33 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
  •