Thread: [PI] Ashes not disappearing

Results 1 to 6 of 6
  1. #1 [PI] Ashes not disappearing 
    Hello World
    Kennstro's Avatar
    Join Date
    Dec 2012
    Posts
    459
    Thanks given
    56
    Thanks received
    24
    Rep Power
    4
    UPDATE: Fires are not showing for everyone not sure if its an issue with how the object is displaying since its like c.getPA() then builds the object i tried many different methods to switch around code and i'm having on luck

    FIXED!Not sure why my ashes are not disappearing after X amount of time.

    Code:
    public class Firemaking {
    
    	public static final int TINDERBOX_ID = 590;
    
    	public enum Fire {
    		NORMAL(1511, 40, 1, 5249, 30), OAK(1521, 60, 15, 5249, 45), WILLOW(1519, 90, 30, 5249, 60), MAPLE(1517, 135, 45,
    				5249, 85), YEW(1515, 200, 60, 5249, 110), MAGIC(1513, 300, 75, 5249, 135), RED(7404, 50, 1, 11404,
    						30), GREEN(7405, 50, 1, 11405, 30), BLUE(7406, 50, 1, 11406, 30), PURPLE(10329, 50, 1, 20001,
    								30), WHITE(10328, 50, 1, 20000, 30);
    
    		int logID, xp, levelReq, obj, last;
    
    		private Fire(int logID, int xp, int levelReq, int obj, int last) {
    			this.logID = logID;
    			this.xp = xp;
    			this.levelReq = levelReq;
    			this.obj = obj;
    			this.last = last;
    		}
    	}
    
    	public static Fire forLog(int id) {
    		for (Fire f : Fire.values()) {
    			if (f.logID == id) {
    				return f;
    			}
    		}
    		return null;
    	}
    
    	public static boolean isLog(int id) {
    		return forLog(id) != null;
    	}
    
    	public static boolean isTinderbox(int id){
    		if (id == 590 || id == 2946 || id == 7156 || id == 10497){ //All tinderbox Id's 2946 is a golden tinderbox :D
    			return true;
    		} else {
    			return false;
    		}
    	}
    
    	public static void lightFire(final Client c, int logID, int fromSlot) {
    
    		Fire f = forLog(logID);
    
    		final int x = c.getX();
    		final int y = c.getY();
    		final int last = f.last + Misc.random(5);
    		final int logid = f.logID;
    
    		if (f != null) {
    			if (System.currentTimeMillis() - c.lastLight > 1800) {
    				if (c.getLevel()[11] >= f.levelReq) {
    					if (c.getItems().playerHasItem(590) && c.getItems().playerHasItem(f.logID)) {
    						c.lastLight = System.currentTimeMillis();
    						c.getItems().deleteItem(f.logID, fromSlot, 1);
    						c.getPA().addSkillXP(f.xp, 11);
    						c.getPA().object(f.obj, c.getX(), c.getY(), 0, 10);
    
    						CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    							int timer = last;
    
    							@Override
    							public void execute(CycleEventContainer container) {
    								if (timer == 0 && timer != -1) {
    									container.stop();
    								}
    
    								if (timer > 0 && c != null) {
    									timer--;
    								}
    							}
    
    							@Override
    							public void stop() {
    								c.getPA().object(-1, x, y, 1, 10);
    								c.getItems().createGroundItem(592, x, y, 1);
    								c.sendMessage("turned = " + logid + "into ashes");
    								c.getItems().removeGroundItem(592, x, y, 1);
    							}
    						}, 1);
    
    						c.turnPlayerTo(c.getX() + 1, c.getY());
    						if (Region.getClipping(c.getX() - 1, c.getY(), c.heightLevel, -1, 0)) {
    							c.getPA().walkTo(-1, 0);
    						} else if (Region.getClipping(c.getX() + 1, c.getY(), c.heightLevel, 1, 0)) {
    							c.getPA().walkTo(1, 0);
    						} else if (Region.getClipping(c.getX(), c.getY() - 1, c.heightLevel, 0, -1)) {
    							c.getPA().walkTo(0, -1);
    						} else if (Region.getClipping(c.getX(), c.getY() + 1, c.heightLevel, 0, 1)) {
    							c.getPA().walkTo(0, 1);
    						}
    					}
    				} else {
    					c.sendMessage("You need a firemaking level of at least " + f.levelReq + " to burn this log.");
    				}
    			}
    This is my Signature
    Reply With Quote  
     

  2. #2  
    Renown Programmer
    Greg's Avatar
    Join Date
    Jun 2010
    Posts
    1,179
    Thanks given
    260
    Thanks received
    1,012
    Rep Power
    2003
    Quote Originally Posted by Kennstro View Post
    Not sure why my ashes are not disappearing after X amount of time.

    Code:
    public class Firemaking {
    
    	public static final int TINDERBOX_ID = 590;
    
    	public enum Fire {
    		NORMAL(1511, 40, 1, 5249, 30), OAK(1521, 60, 15, 5249, 45), WILLOW(1519, 90, 30, 5249, 60), MAPLE(1517, 135, 45,
    				5249, 85), YEW(1515, 200, 60, 5249, 110), MAGIC(1513, 300, 75, 5249, 135), RED(7404, 50, 1, 11404,
    						30), GREEN(7405, 50, 1, 11405, 30), BLUE(7406, 50, 1, 11406, 30), PURPLE(10329, 50, 1, 20001,
    								30), WHITE(10328, 50, 1, 20000, 30);
    
    		int logID, xp, levelReq, obj, last;
    
    		private Fire(int logID, int xp, int levelReq, int obj, int last) {
    			this.logID = logID;
    			this.xp = xp;
    			this.levelReq = levelReq;
    			this.obj = obj;
    			this.last = last;
    		}
    	}
    
    	public static Fire forLog(int id) {
    		for (Fire f : Fire.values()) {
    			if (f.logID == id) {
    				return f;
    			}
    		}
    		return null;
    	}
    
    	public static boolean isLog(int id) {
    		return forLog(id) != null;
    	}
    
    	public static boolean isTinderbox(int id){
    		if (id == 590 || id == 2946 || id == 7156 || id == 10497){ //All tinderbox Id's 2946 is a golden tinderbox :D
    			return true;
    		} else {
    			return false;
    		}
    	}
    
    	public static void lightFire(final Client c, int logID, int fromSlot) {
    
    		Fire f = forLog(logID);
    
    		final int x = c.getX();
    		final int y = c.getY();
    		final int last = f.last + Misc.random(5);
    		final int logid = f.logID;
    
    		if (f != null) {
    			if (System.currentTimeMillis() - c.lastLight > 1800) {
    				if (c.getLevel()[11] >= f.levelReq) {
    					if (c.getItems().playerHasItem(590) && c.getItems().playerHasItem(f.logID)) {
    						c.lastLight = System.currentTimeMillis();
    						c.getItems().deleteItem(f.logID, fromSlot, 1);
    						c.getPA().addSkillXP(f.xp, 11);
    						c.getPA().object(f.obj, c.getX(), c.getY(), 0, 10);
    
    						CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    							int timer = last;
    
    							@Override
    							public void execute(CycleEventContainer container) {
    								if (timer == 0 && timer != -1) {
    									container.stop();
    								}
    
    								if (timer > 0 && c != null) {
    									timer--;
    								}
    							}
    
    							@Override
    							public void stop() {
    								c.getPA().object(-1, x, y, 1, 10);
    								c.getItems().createGroundItem(592, x, y, 1);
    								c.sendMessage("turned = " + logid + "into ashes");
    								c.getItems().removeGroundItem(592, x, y, 1);
    							}
    						}, 1);
    
    						c.turnPlayerTo(c.getX() + 1, c.getY());
    						if (Region.getClipping(c.getX() - 1, c.getY(), c.heightLevel, -1, 0)) {
    							c.getPA().walkTo(-1, 0);
    						} else if (Region.getClipping(c.getX() + 1, c.getY(), c.heightLevel, 1, 0)) {
    							c.getPA().walkTo(1, 0);
    						} else if (Region.getClipping(c.getX(), c.getY() - 1, c.heightLevel, 0, -1)) {
    							c.getPA().walkTo(0, -1);
    						} else if (Region.getClipping(c.getX(), c.getY() + 1, c.heightLevel, 0, 1)) {
    							c.getPA().walkTo(0, 1);
    						}
    					}
    				} else {
    					c.sendMessage("You need a firemaking level of at least " + f.levelReq + " to burn this log.");
    				}
    			}
    Can't tell without more code however the floor item deletion will be in ground manager.
    Code:
    createGroundItem(592, x, y, 1);
    what does the 1 stand for? I can't tell without seeing the createGroundItem method.
    Attached imageAttached image
    Reply With Quote  
     

  3. #3  
    H_E_N_T_A_I_H_E_A_V_E_N_
    Tatsumi's Avatar
    Join Date
    May 2013
    Posts
    1,779
    Thanks given
    537
    Thanks received
    269
    Rep Power
    337
    Use a timer. I used this for my firemaking.java
    Code:
    						CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    							int timer = last;
    							
    						@Override
    						public void execute(CycleEventContainer container) {
    						if (timer == 0 && timer != -1) {
    							container.stop();
    							}
    							
    						if (timer > 0 && c != null) {					
    						timer--;
    							}
    						}
    
    						@Override
    						public void stop() {
    								c.getPA().object(-1, x, y, 1, 10);
    								c.getItems().createGroundItem(592, x, y, 1);	
    							}
    						}, 1);
    Reply With Quote  
     

  4. #4  
    The One And Only

    01053's Avatar
    Join Date
    Apr 2011
    Age
    28
    Posts
    2,887
    Thanks given
    417
    Thanks received
    885
    Rep Power
    856
    Quote Originally Posted by Toumou View Post
    Use a timer. I used this for my firemaking.java
    Code:
    						CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    							int timer = last;
    							
    						@Override
    						public void execute(CycleEventContainer container) {
    						if (timer == 0 && timer != -1) {
    							container.stop();
    							}
    							
    						if (timer > 0 && c != null) {					
    						timer--;
    							}
    						}
    
    						@Override
    						public void stop() {
    								c.getPA().object(-1, x, y, 1, 10);
    								c.getItems().createGroundItem(592, x, y, 1);	
    							}
    						}, 1);
    That's a bad way of doing it and all that does is get rid of the fire and add the ashes nothing to do with ashes dissapearing..

    OT: When you drop items or have other items on the floor do they disappear after a certain amount of time?

    EDIT:

    Try changing it to this, If you don't have this method (you should if you're using PI) let me know or if you get any errors let me know.

    Code:
    Server.itemHandler.createGroundItem(c, 592, x, y, 1, c.getId());


    Reply With Quote  
     

  5. #5  
    H_E_N_T_A_I_H_E_A_V_E_N_
    Tatsumi's Avatar
    Join Date
    May 2013
    Posts
    1,779
    Thanks given
    537
    Thanks received
    269
    Rep Power
    337
    Quote Originally Posted by 01053 View Post
    That's a bad way of doing it and all that does is get rid of the fire and add the ashes nothing to do with ashes dissapearing..

    OT: When you drop items or have other items on the floor do they disappear after a certain amount of time?
    Oh my bad, im still sleepy. didnt see
    Reply With Quote  
     

  6. #6  
    Hello World
    Kennstro's Avatar
    Join Date
    Dec 2012
    Posts
    459
    Thanks given
    56
    Thanks received
    24
    Rep Power
    4
    Quote Originally Posted by 01053 View Post
    That's a bad way of doing it and all that does is get rid of the fire and add the ashes nothing to do with ashes dissapearing..

    OT: When you drop items or have other items on the floor do they disappear after a certain amount of time?

    EDIT:

    Try changing it to this, If you don't have this method (you should if you're using PI) let me know or if you get any errors let me know.

    Code:
    Server.itemHandler.createGroundItem(c, 592, x, y, 1, c.getId());
    yeah i noticed i had a 1 in it i changed the whole line to what you provided ( before reading this it works proper now ) HOWever the fire only shows for the user who is lighting the fires and no one else can see them

    Quote Originally Posted by Toumou View Post
    Oh my bad, im still sleepy. didnt see
    Its fine now the only issue is the fire not showing up for everyone just the player who lights it
    This is my Signature
    Reply With Quote  
     

  7. Thankful user:



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. Followers not disappearing PI
    By Echos in forum Help
    Replies: 13
    Last Post: 01-26-2014, 05:16 PM
  2. Replies: 9
    Last Post: 10-31-2010, 03:07 AM
  3. [PI] Commands Not Working
    By Q Destiny Q in forum Help
    Replies: 1
    Last Post: 08-27-2010, 07:21 AM
  4. Replies: 3
    Last Post: 08-19-2010, 02:15 PM
  5. [PI] Items not deleting
    By jameskmonger in forum Help
    Replies: 3
    Last Post: 07-22-2010, 11:03 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
  •