Thread: (RUSE) Need help making tree choppable. (AFK Tree)

Results 1 to 10 of 10
  1. #1 (RUSE) Need help making tree choppable. (AFK Tree) 
    Registered Member
    Join Date
    Apr 2018
    Posts
    27
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    trying to add an AFK tree to my server. I have poured over the woodcutting skill and woodcutting data files, added the data where i thought i needed too, and still nothing. The game registers nothing on click. Any help w I have defined the object in objectdefs:
    Code:
            if (definition.type == 9263) {
                definition.name = "AFK Tree";
                definition.actions = new String[] {"Cut", null, null, null, null};
            }
    I also added this to Woodcuttingdata.jar which is imported to the woodcutting skill:
    Code:
    public static enum Trees {
    		NORMAL(1, 25, 1511, new int[] { 1276, 1277, 1278, 1279, 1280, 1282, 1283, 1284, 1285, 1286, 1289, 1290, 1291, 1315, 1316, 1318, 1319, 1330, 1331, 1332, 1365, 1383, 1384, 3033, 3034, 3035, 3036, 3881, 3882, 3883, 5902, 5903, 5904 }, 4, false),
    		ACHEY(1, 25, 2862, new int[] { 2023 }, 4, false),
    		OAK(15, 38, 1521, new int[] { 1281, 3037 }, 5, true),
    		WILLOW(30, 68, 1519, new int[] { 1308, 5551, 5552, 5553 }, 6, true),
    		TEAK(35, 85, 6333, new int[] { 9036 }, 7, true),
    		DRAMEN(36, 25, 771, new int[] { 1292 }, 7, true),
    		MAPLE(45, 100, 1517, new int[] { 1307, 4677, 4674 }, 7, true),
    		MAHOGANY(50, 125, 22060, new int[] { 9034 }, 7, true),
    		YEW(60, 175, 1515, new int[] { 1309 }, 14, true),
    		MAGIC(75, 250, 1513, new int[] { 1306 }, 20, true),
    		AFK(1, 0, 995, new int[] { 9263 }, 20, true); // THIS IS CUSTOM TREE
    And i have done a bit of testing in my woodcutting.java file- this is what it looks like currently:

    Code:
    package com.ruse.world.content.skill.impl.woodcutting;
    
    import com.ruse.engine.task.Task;
    import com.ruse.engine.task.TaskManager;
    import com.ruse.model.Animation;
    import com.ruse.model.GameObject;
    import com.ruse.model.Skill;
    import com.ruse.model.container.impl.Equipment;
    import com.ruse.util.Misc;
    import com.ruse.world.content.Achievements;
    import com.ruse.world.content.Achievements.AchievementData;
    import com.ruse.world.content.CustomObjects;
    import com.ruse.world.content.Sounds;
    import com.ruse.world.content.Sounds.Sound;
    import com.ruse.world.content.randomevents.EvilTree;
    import com.ruse.world.content.randomevents.EvilTree.EvilTreeDef;
    import com.ruse.world.content.skill.impl.firemaking.Logdata;
    import com.ruse.world.content.skill.impl.firemaking.Logdata.logData;
    import com.ruse.world.content.skill.impl.woodcutting.WoodcuttingData.Hatchet;
    import com.ruse.world.content.skill.impl.woodcutting.WoodcuttingData.Trees;
    import com.ruse.world.entity.impl.player.Player;
    
    public class Woodcutting {
    
    	public static void cutWood(final Player player, final GameObject object, boolean restarting) {
    		if(!restarting)
    			player.getSkillManager().stopSkilling();
    		if(player.getInventory().getFreeSlots() == 0) {
    			player.getPacketSender().sendMessage("You don't have enough free inventory space.");
    			return;
    		}
    		player.setPositionToFace(object.getPosition());
    		final int objId = object.getId();
    		final Hatchet h = Hatchet.forId(WoodcuttingData.getHatchet(player));
    		if (h != null) {
    			if (player.getSkillManager().getCurrentLevel(Skill.WOODCUTTING) >= h.getRequiredLevel()) {
    				final Trees t = Trees.forId(objId);
    				final EvilTreeDef t2 = EvilTreeDef.forId(objId);
    				final boolean isEvilTree = t2 != null;
    				
    				if (isEvilTree) {
    					//player.getPacketSender().sendMessage("Evil tree method.");
    					EvilTree.handleCutWood(player, object, h, t2);
    					return;
    				}
    				
    				if (t != null) {
    					player.setEntityInteraction(object);
    					if (player.getSkillManager().getCurrentLevel(Skill.WOODCUTTING) >= (isEvilTree ? t2.getWoodcuttingLevel() : t.getReq())) {
    						player.performAnimation(new Animation(h.getAnim()));
    						int delay = Misc.getRandom(t.getTicks() - WoodcuttingData.getChopTimer(player, h)) +1;
    						player.setCurrentTask(new Task(1, player, false) {
    							int cycle = 0, reqCycle = delay >= 2 ? delay : Misc.getRandom(1) + 1;
    							@Override
    							public void execute() {
    								player.getPacketSender().sendMessage("Object ID is:" + object + " or maybe objID:" + objId); // THIS IS FOR TESTING
    								if(player.getInventory().getFreeSlots() == 0) {
    									player.performAnimation(new Animation(65535));
    									player.getPacketSender().sendMessage("You don't have enough free inventory space.");
    									this.stop();
    									return;
    								}
    								if (cycle != reqCycle) {
    									cycle++;
    									player.performAnimation(new Animation(h.getAnim()));
    									if (objId == 1276) {
    										player.getPacketSender().sendMessage("About to be AFK Time BOOIIII");  //THIS IS FOR TESTING
    									}
    								} else if (cycle >= reqCycle) {
    									int xp = isEvilTree ? t2.getWoodcuttingXp() : t.getXp();
    									if(lumberJack(player))
    										xp *= 1.5;
    									player.getSkillManager().addExperience(Skill.WOODCUTTING, (int) (xp));
    									cycle = 0;
    									BirdNests.dropNest(player);
    									this.stop();
    									int cutDownRandom = Misc.getRandom(100);
    								//	player.getPacketSender().sendMessage("Random: " + cutDownRandom);
    									if (!isEvilTree && (!t.isMulti() || (player.getSkillManager().skillCape(Skill.WOODCUTTING) && cutDownRandom >= 88) || (!player.getSkillManager().skillCape(Skill.WOODCUTTING) && cutDownRandom >= 82))) {//82
    										//player.getPacketSender().sendMessage("You rolled a: "+cutDownRandom);
    										player.getInventory().add(isEvilTree ? t2.getLog() : t.getReward(), 1);
    										treeRespawn(player, object);
    										player.getPacketSender().sendMessage("You've chopped the tree down.");
    										player.performAnimation(new Animation(65535));
    									} else { //if they didn't cut down the tree
    										cutWood(player, object, true);
    										if(player.getSkillManager().skillCape(Skill.WOODCUTTING) && cutDownRandom >= 82 && cutDownRandom < 87) {
    											player.getPacketSender().sendMessage("Your cape helps keep the tree alive a little longer.");
    										}
    										if(infernoAdze(player)) { //if they do not have an adze equipped
    											if(Misc.getRandom(10) <= 6) {
    												logData fmLog = Logdata.getLogData(player, isEvilTree ? t2.getLog() : t.getReward());
    												if(fmLog != null) { //if their their logdata is not null...
    													player.getSkillManager().addExperience(Skill.FIREMAKING, fmLog.getXp());
    													player.getPacketSender().sendMessage("You chop a log, and your Inferno Adze burns it into ash.");
    													if(fmLog == Logdata.logData.OAK) {
    														Achievements.finishAchievement(player, AchievementData.BURN_AN_OAK_LOG);
    													} else if(fmLog == Logdata.logData.MAGIC) {
    														Achievements.doProgress(player, AchievementData.BURN_100_MAGIC_LOGS);
    														Achievements.doProgress(player, AchievementData.BURN_2500_MAGIC_LOGS);
    													}
    												} else { //if the fmLog data is null
    													player.getPacketSender().sendMessage("<col=b40404>The game thinks you have an adze, but are burning nothing.").sendMessage("<col=b40404>Please contact Bam and report this bug.");
    												}
    											} else {
    												player.getInventory().add(t.getReward(), 1);
    												player.getPacketSender().sendMessage("You get some logs...");
    											}
    										} else { //if they player doesn't have an adze, do this.
    											player.getInventory().add(t.getReward(), 1);
    											player.getPacketSender().sendMessage("You get some logs...");
    										}
    									}
    									Sounds.sendSound(player, Sound.WOODCUT);
    									if(t != null && t == Trees.OAK) {
    										Achievements.finishAchievement(player, AchievementData.CUT_AN_OAK_TREE);
    									} else if(t != null && t == Trees.MAGIC) {
    										Achievements.doProgress(player, AchievementData.CUT_100_MAGIC_LOGS);
    										Achievements.doProgress(player, AchievementData.CUT_5000_MAGIC_LOGS);
    									}
    								}
    							}
    						});
    						TaskManager.submit(player.getCurrentTask());
    					} else {
    						player.getPacketSender().sendMessage("You need a Woodcutting level of at least "+t.getReq()+" to cut this tree.");
    					}
    				}
    			} else {
    				player.getPacketSender().sendMessage("You do not have a hatchet which you have the required Woodcutting level to use.");
    			}
    		} else {
    			player.getPacketSender().sendMessage("You do not have a hatchet that you can use.");
    		}
    	}

    The tree was added via the cache in index4 and packed. It is visible in the server. Perhaps i need to add something to ObjectActionPacketListener.java ? I am at a loss here boys, any help would be greatly appriciated. Seriously thought i would figure this out no problem but nothing i do registers with the server as far as clicks go. Perhaps I have the click menu incorrect, ugh...
    Reply With Quote  
     

  2. #2  
    Community Veteran


    Arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,950
    Thanks given
    210
    Thanks received
    349
    Rep Power
    1376
    Check if your method 'cutWood' is being trigged. If it is not than I assume that it is in your object click it do not check for that tree id to trigger the method.


    "A fail act is something you do regular, but a dumb act is something you can learn from"
    Spoiler for Problem?:
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Apr 2018
    Posts
    27
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by arch337 View Post
    Check if your method 'cutWood' is being trigged. If it is not than I assume that it is in your object click it do not check for that tree id to trigger the method.
    I dont think the game is recognizing it as a tree, not sure where I need to define it, i assumed putting it into woodcuttingdata would have done it. But i cant get anything in the woodcutting method to trigger when the tree is clicked.
    Reply With Quote  
     

  4. #4  
    Community Veteran


    Arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,950
    Thanks given
    210
    Thanks received
    349
    Rep Power
    1376
    Quote Originally Posted by Slashx123 View Post
    I dont think the game is recognizing it as a tree, not sure where I need to define it, i assumed putting it into woodcuttingdata would have done it. But i cant get anything in the woodcutting method to trigger when the tree is clicked.
    where you got your click object packet is within your server files.


    "A fail act is something you do regular, but a dumb act is something you can learn from"
    Spoiler for Problem?:
    Reply With Quote  
     

  5. #5  
    Perplexity owner

    Join Date
    Feb 2011
    Posts
    171
    Thanks given
    32
    Thanks received
    15
    Rep Power
    0
    you would need to set it as a tree in CustomObjects.java
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Apr 2018
    Posts
    27
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    OK turns out i was an idiot. We added the object through the cache, and so the server also have to have the map cache files, I had just forgotten to put the new cache files into the server folder. All is well now, thanks to everyone who offered a solution.
    Reply With Quote  
     

  7. #7  
    Perplexity owner

    Join Date
    Feb 2011
    Posts
    171
    Thanks given
    32
    Thanks received
    15
    Rep Power
    0
    Quote Originally Posted by Slashx123 View Post
    OK turns out i was an idiot. We added the object through the cache, and so the server also have to have the map cache files, I had just forgotten to put the new cache files into the server folder. All is well now, thanks to everyone who offered a solution.
    you put cache files into your server folder? that's a new one to me

    anyway with any custom object, or any object that is not in it's original location to get it to work you have to add it to customObjects.java like so -

    Code:
    	//Only adds clips to these objects, they are spawned clientsided
    	//NOTE: You must add to the client's customobjects array to make them spawn, this is just clipping!
    	private static final int[][] CLIENT_OBJECTS = {
    	/*** Kourend home area oof ***/
    			
    			{-1, 1615, 3662, 0, 0}, //delete
    			{-1, 1611, 3671, 0, 0}, //delete
    			{-1, 1611, 3668, 0, 0}, //delete
    			{-1, 1611, 3675, 0, 0}, //delete
    			{-1, 1611, 3679, 0, 0}, //delete
    			{-1, 1648, 3683, 0, 0}, //delete
    			{409,2504,2503,0,1},
    			{411,2524,2503,0,1},
    			{9221, 2503, 2514, 0, 0}, //AFK Tree
    			{9221, 2530, 2507, 0, 0}, //AFK Tree
    			{9221, 2531, 2533, 0, 0}, //AFK Tree
    			{884, 2513, 2524, 0, 0}, //Well Of Good Will
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    Apr 2018
    Posts
    27
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Perplexity View Post
    you put cache files into your server folder? that's a new one to me

    anyway with any custom object, or any object that is not in it's original location to get it to work you have to add it to customObjects.java like so -

    Code:
    	//Only adds clips to these objects, they are spawned clientsided
    	//NOTE: You must add to the client's customobjects array to make them spawn, this is just clipping!
    	private static final int[][] CLIENT_OBJECTS = {
    	/*** Kourend home area oof ***/
    			
    			{-1, 1615, 3662, 0, 0}, //delete
    			{-1, 1611, 3671, 0, 0}, //delete
    			{-1, 1611, 3668, 0, 0}, //delete
    			{-1, 1611, 3675, 0, 0}, //delete
    			{-1, 1611, 3679, 0, 0}, //delete
    			{-1, 1648, 3683, 0, 0}, //delete
    			{409,2504,2503,0,1},
    			{411,2524,2503,0,1},
    			{9221, 2503, 2514, 0, 0}, //AFK Tree
    			{9221, 2530, 2507, 0, 0}, //AFK Tree
    			{9221, 2531, 2533, 0, 0}, //AFK Tree
    			{884, 2513, 2524, 0, 0}, //Well Of Good Will
    For instance, the gz map files have to be packed into index4 and then they will be visible on the client, however for them to be recognized serverside, this source requires the .gz files to also be added to: \Server\data\clipping\maps
    Reply With Quote  
     

  9. #9  
    Registered Member
    Join Date
    May 2021
    Posts
    2
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Quote Originally Posted by Slashx123 View Post
    For instance, the gz map files have to be packed into index4 and then they will be visible on the client, however for them to be recognized serverside, this source requires the .gz files to also be added to: \Server\data\clipping\maps
    Basically either way is correct but adding custom objects through customobjects.java file is more code that is not needed, The way you overridden the server gz files would be the more proper way in my opinion, Just because adding them via customobjects would be a bit more time consuming, And if the map is edited it may be best to replaced the server gz files for any pathing issues.
    Reply With Quote  
     

  10. #10  
    Perplexity owner

    Join Date
    Feb 2011
    Posts
    171
    Thanks given
    32
    Thanks received
    15
    Rep Power
    0
    Quote Originally Posted by Phenomenal_ View Post
    Basically either way is correct but adding custom objects through customobjects.java file is more code that is not needed, The way you overridden the server gz files would be the more proper way in my opinion, Just because adding them via customobjects would be a bit more time consuming, And if the map is edited it may be best to replaced the server gz files for any pathing issues.

    Yeah since realised he was on about maps, I was on mobile in work and thought he was just on about an object, and for sure had never heard of adding models to server side haha
    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. need help making character files
    By android in forum Help
    Replies: 3
    Last Post: 09-20-2009, 09:01 AM
  2. need help making character files
    By android in forum Help
    Replies: 2
    Last Post: 09-20-2009, 04:09 AM
  3. Need help making mapback one sprite
    By Crash in forum Help
    Replies: 0
    Last Post: 08-03-2009, 08:11 AM
  4. need help making multi zone
    By i owns u i in forum Help
    Replies: 6
    Last Post: 05-31-2009, 09:42 PM
  5. Need help making a search for my website.
    By David in forum Application Development
    Replies: 3
    Last Post: 01-25-2009, 02:09 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
  •