Thread: Ranging animation Bug

Results 1 to 6 of 6
  1. #1 Ranging animation Bug 
    Donator

    Defiled RSPS's Avatar
    Join Date
    Oct 2013
    Posts
    465
    Thanks given
    32
    Thanks received
    30
    Rep Power
    94
    Hey everyone this bug has been in my server for a while and i really just don't know how to fix it. I've checked the animation and gfx id's for all of these ranging weapons and they are correct, yet they still fire like this.

    if anyone can help with this my skype = tekkit20

    if anyone can even steer me in the correct direction that'd be awesome.

    Attached image
    Attached image
    https://gyazo.com/eadbccbd7090da727211c61b74b0b885

    Attached image
    Attached image
    https://gyazo.com/f6f5155ba185484f1441d6bbdbbe746a

    EDIT : this is my rangedata class.

    Code:
    package ab.model.players.combat.range;
    
    import ab.model.npcs.NPCHandler;
    import ab.model.players.Player;
    import ab.model.players.PlayerHandler;
    
    public class RangeData {
    
    	public static void fireProjectileNpc(Player c) {
    		if (c.oldNpcIndex > 0) {
    			if (NPCHandler.npcs[c.oldNpcIndex] != null) {
    				c.projectileStage = 2;
    				int pX = c.getX();
    				int pY = c.getY();
    				int nX = NPCHandler.npcs[c.oldNpcIndex].getX();
    				int nY = NPCHandler.npcs[c.oldNpcIndex].getY();
    				int offX = (pY - nY) * -1;
    				int offY = (pX - nX) * -1;
    				if (c.lastWeaponUsed == 12926) {
    					c.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, c.getCombat().getProjectileSpeed(),
    							c.getCombat().getRangeProjectileGFX(), 25, 10, c.oldNpcIndex + 1, 45);
    				} else {
    					c.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, c.getCombat().getProjectileSpeed(),
    							c.getCombat().getRangeProjectileGFX(), 43, 31, c.oldNpcIndex + 1, c.getCombat().getProjectileShowDelay());
    				}
    				if (c.getCombat().usingDbow())
    					c.getPA().createPlayersProjectile2(pX, pY, offX, offY, 50, c.getCombat().getProjectileSpeed(),
    							c.getCombat().getRangeProjectileGFX(), 60, 31, c.oldNpcIndex + 1, c.getCombat().getStartDelay(), 35);
    			}
    		}
    	}
    
    	public static void fireProjectilePlayer(Player c) {
    		if (c.oldPlayerIndex > 0) {
    			if (PlayerHandler.players[c.oldPlayerIndex] != null) {
    				c.projectileStage = 2;
    				int pX = c.getX();
    				int pY = c.getY();
    				int oX = PlayerHandler.players[c.oldPlayerIndex].getX();
    				int oY = PlayerHandler.players[c.oldPlayerIndex].getY();
    				int offX = (pY - oY) * -1;
    				int offY = (pX - oX) * -1;
    				if (!c.msbSpec && c.lastWeaponUsed != 12926) {
    					c.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, c.getCombat().getProjectileSpeed(),
    							c.getCombat().getRangeProjectileGFX(), 43, 31, -c.oldPlayerIndex - 1, c.getCombat().getStartDelay());
    				} else if (c.lastWeaponUsed == 12926) {
    					c.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, c.getCombat().getProjectileSpeed(),
    							c.getCombat().getRangeProjectileGFX(), 25, 10, c.oldNpcIndex + 1, 45);
    				} else if (c.msbSpec) {
    					c.getPA().createPlayersProjectile2(pX, pY, offX, offY, 50, c.getCombat().getProjectileSpeed(),
    							c.getCombat().getRangeProjectileGFX(), 43, 31, -c.oldPlayerIndex - 1, c.getCombat().getStartDelay(), 10);
    					c.msbSpec = false;
    				}
    				if (c.getCombat().usingDbow())
    					c.getPA().createProjectile3(pY, pX, offY, offX, c.getCombat().getRangeProjectileGFX(), 53, 31, 100, -c.oldPlayerIndex - 1);
    
    			}
    		}
    	}
    
    	public static int getRangeStr(int i) {
    		int str = 0;
    		int[][] data = { { 877, 10 }, { 9140, 46 }, { 9145, 36 }, { 9141, 64 }, { 9142, 82 }, { 9143, 100 }, { 9144, 115 }, { 9236, 14 },
    				{ 9237, 30 }, { 9238, 48 }, { 9239, 66 }, { 9240, 83 }, { 9241, 85 }, { 9242, 95 }, { 9243, 105 }, { 9244, 117 }, { 9245, 120 },
    				{ 882, 7 }, { 884, 10 }, { 886, 16 }, { 888, 22 }, { 890, 31 }, { 892, 45 }, { 4740, 44 }, { 11212, 60 }, { 806, 1 }, { 807, 3 },
    				{ 808, 4 }, { 809, 7 }, { 810, 10 }, { 811, 14 }, { 11230, 18 }, { 864, 3 }, { 863, 4 }, { 865, 7 }, { 866, 10 }, { 867, 14 },
    				{ 868, 24 }, { 825, 6 }, { 826, 10 }, { 827, 12 }, { 828, 18 }, { 829, 28 }, { 830, 42 }, { 800, 5 }, { 801, 7 }, { 802, 11 },
    				{ 803, 16 }, { 804, 23 }, { 805, 36 }, { 9976, 0 }, { 9977, 15 }, { 4212, 70 }, { 4214, 70 }, { 4215, 70 }, { 4216, 70 },
    				{ 4217, 70 }, { 4218, 70 }, { 4219, 70 }, { 4220, 70 }, { 4221, 70 }, { 4222, 70 }, { 4223, 70 }, { 6522, 49 }, { 10034, 15 },
    				{ 12926, 48 }, {19481, 90 }, {19484, 185 } };
    		for (int l = 0; l < data.length; l++) {
    			if (i == data[l][0]) {
    				str = data[l][1];
    			}
    		}
    		return str;
    	}
    
    	public static int getRangeStartGFX(Player c) {
    		int str = -1;
    		int[][] data = {
    				// KNIFES
    				{ 863, 220 }, { 864, 219 }, { 865, 221 }, { 866, 223 }, { 867, 224 }, { 868, 225 }, { 869, 222 },
    
    				// DARTS
    				{ 806, 232 }, { 807, 233 }, { 808, 234 }, { 809, 235 }, { 810, 236 }, { 811, 237 }, { 11230, 1242 },
    
    				// JAVELIN
    				{ 825, 206 }, { 826, 207 }, { 827, 208 }, { 828, 209 }, { 829, 210 }, { 830, 211 }, {19484, 1300},
    
    				// AXES
    				{ 800, 42 }, { 801, 43 }, { 802, 44 }, { 803, 45 }, { 804, 46 }, { 805, 48 },
    
    				// ARROWS
    				{ 882, 19 }, { 884, 18 }, { 886, 20 }, { 888, 21 }, { 890, 22 }, { 892, 24 },
    
    				// CRYSTAL_BOW
    				{ 4212, 250 }, { 4214, 250 }, { 4215, 250 }, { 4216, 250 }, { 4217, 250 }, { 4218, 250 }, { 4219, 250 }, { 4220, 250 }, { 4221, 250 },
    				{ 4222, 250 }, { 4223, 250 }, };
    		for (int l = 0; l < data.length; l++) {
    			if (c.rangeItemUsed == data[l][0]) {
    				str = data[l][1];
    			}
    		}
    		if (c.playerEquipment[3] == 11235 || c.playerEquipment[3] == 12765 || c.playerEquipment[3] == 12766 || c.playerEquipment[3] == 12767
    				|| c.playerEquipment[3] == 12768) {
    			int[][] moreD = { { 882, 1104 }, { 884, 1105 }, { 886, 1106 }, { 888, 1107 }, { 890, 1108 }, { 892, 1109 }, { 11212, 1111 }, };
    			for (int l = 0; l < moreD.length; l++) {
    				if (c.playerEquipment[c.playerArrows] == moreD[l][0]) {
    					str = moreD[l][1];
    				}
    			}
    		}
    		return str;
    	}
    
    	public static int getRangeProjectileGFX(Player c) {
    		if (c.getItems().isWearingItem(12926)) {
    			final int[][] DARTS = { { 806, 226 }, { 807, 227 }, { 808, 228 }, { 809, 229 }, { 810, 230 }, { 811, 231 }, { 11230, 1123 } };
    			for (int index = 0; index < DARTS.length; index++) {
    				if (DARTS[index][0] == c.getToxicBlowpipeAmmo()) {
    					return DARTS[index][1];
    				}
    			}
    		}
    		if (c.dbowSpec) {
    			return c.playerEquipment[c.playerArrows] == 11212 ? 1099 : 1101;
    		}
    		if (c.acbSpec) {
    			return 301;
    		}
    		if (c.bowSpecShot > 0) {
    			switch (c.rangeItemUsed) {
    			default:
    				return 249;
    			}
    		}
    		boolean castingMagic = (c.usingMagic || c.mageFollow || c.autocasting || c.spellId > 0);
    		if (castingMagic) {
    			return -1;
    		}
    		if (c.playerEquipment[c.playerWeapon] == 9185 || c.playerEquipment[c.playerWeapon] == 11785)
    			return 27;
    		int str = -1;
    		int[][] data = {
    				// KNIFES
    				{ 863, 213 }, { 864, 212 }, { 865, 214 }, { 866, 216 }, { 867, 217 }, { 868, 218 }, { 869, 215 },
    
    				// DARTS
    				{ 806, 226 }, { 807, 227 }, { 808, 228 }, { 809, 229 }, { 810, 230 }, { 811, 231 },
    
    				// JAVELINS
    				{ 825, 200 }, { 826, 201 }, { 827, 202 }, { 828, 203 }, { 829, 204 }, { 830, 205 }, { 19484, 1301 },
    
    				// AXES
    				{ 800, 36 }, { 801, 35 }, { 802, 37 }, { 803, 38 }, { 804, 39 }, { 805, 40 },
    
    				// ARROWS
    				{ 882, 10 }, { 884, 9 }, { 886, 11 }, { 888, 12 }, { 890, 13 }, { 892, 15 }, { 11212, 1120 },
    
    				// CHINCHOMPA
    				{ 10033, 908 }, { 10034, 909 },
    
    				// OTHERS
    				{ 6522, 442 }, { 4740, 27 }, { 4212, 249 }, { 4214, 249 }, { 4215, 249 }, { 4216, 249 }, { 4217, 249 }, { 4218, 249 }, { 4219, 249 },
    				{ 4220, 249 }, { 4221, 249 }, { 4222, 249 }, { 4223, 249 }, };
    		for (int l = 0; l < data.length; l++) {
    			if (c.rangeItemUsed == data[l][0]) {
    				str = data[l][1];
    			}
    		}
    		return str;
    	}
    
    	public static int getRangeEndGFX(Player c) {
    		int str = -1;
    		int gfx = 0;
    		int[][] data = { { 10033, 157, 100 }, { 10034, 157, 100 }, };
    		for (int l = 0; l < data.length; l++) {
    			if (c.playerEquipment[c.playerWeapon] == data[l][0]) {
    				str = data[l][1];
    				gfx = data[l][2];
    			}
    		}
    		if (gfx == 100) {
    			c.rangeEndGFXHeight = true;
    		}
    		return str;
    	}
    
    	public static int correctBowAndArrows(Player c) {
    		if (c.getCombat().properBolts())
    			return -1;
    		switch (c.playerEquipment[c.playerWeapon]) {
    
    		case 839:
    		case 841:
    			return 884;
    		case 19481:
    	return 19484;
    
    		case 843:
    		case 845:
    			return 884;
    
    		case 847:
    		case 849:
    			return 886;
    
    		case 851:
    		case 853:
    			return 888;
    
    		case 855:
    		case 857:
    			return 890;
    	
    
    		case 859:
    		case 861:
    		case 12424:
    		case 12788:
    		case 4212:
    		case 4213:
    		case 4214:
    		case 4215:
    		case 4216:
    		case 4217:
    		case 4218:
    		case 4219:
    		case 4220:
    		case 4221:
    		case 4222:
    		case 4223:
    		case 4224:
    
    			return 892;
    		case 4734:
    		case 4935:
    		case 4936:
    		case 4937:
    			return 4740;
    
    		case 11235:
    		case 12765:
    		case 20997:
    		case 12766:
    		case 12767:
    		case 12768:
    			return 11212;
    		}
    		return -1;
    	}
    
    	public static int getProjectileSpeed(Player c) {
    		if (c.dbowSpec || c.acbSpec) 
    			return 100;
    		switch (c.playerEquipment[3]) {
    		case 10033:
    		case 10034:
    			return 60;
    		}
    		return 70;
    	}
    
    	public static int getProjectileShowDelay(Player c) {
    		int[] data = { 806, 806, 808, 809, 810, 811, 10033, 10034, 11230, };
    		int str = 53;
    		for (int i = 0; i < data.length; i++) {
    			if (c.playerEquipment[c.playerWeapon] == data[i]) {
    				str = 32;
    			}
    			switch (c.playerEquipment[c.playerWeapon]) {
    			case 19484:
    				return 15;
    			default:
    				return 5;
    			}
    		}
    		return str;
    	}
    }
    Attached image
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Apr 2017
    Posts
    13
    Thanks given
    0
    Thanks received
    0
    Rep Power
    1
    It appears, that your animation data client sided (the files stored in your cache) are either damage or old school animations. Try using newer animations like 377 or 474 animations.
    Reply With Quote  
     

  3. #3  
    Banned

    Join Date
    Oct 2012
    Posts
    4,710
    Thanks given
    1,679
    Thanks received
    1,105
    Rep Power
    0
    Why are you making a new thread??? https://www.rune-server.ee/runescape...3-deleted.html

    Answers where given, ignorance is never an excuse once again.
    Reply With Quote  
     

  4. #4  
    Extreme Donator


    Join Date
    Oct 2010
    Posts
    2,853
    Thanks given
    1,213
    Thanks received
    1,622
    Rep Power
    5000
    Feel free to use this modified class by lare96 for projectiles:

    Code:
    package com.elvarg.game.model;
    
    import com.elvarg.game.World;
    import com.elvarg.game.entity.Entity;
    import com.elvarg.game.entity.impl.player.Player;
    import com.elvarg.game.task.Task;
    import com.elvarg.game.task.TaskManager;
    
    /**
     * A graphic propelled through the air by some sort of spell, weapon, or other
     * miscellaneous force.
     * 
     * @author lare96
     */
    public final class Projectile {
    
        /** The starting position of the projectile. */
        private final Position start;
    
        /** The offset position of the projectile. */
        private final Position offset;
    
        /** The speed of the projectile. */
        private final int speed;
    
        /** The id of the projectile. */
        private final int projectileId;
    
        /** The starting height of the projectile. */
        private final int startHeight;
    
        /** The ending height of the projectile. */
        private final int endHeight;
    
        /** The lock on value of the projectile. */
        private final int lockon;
    
        /** The delay of the projectile. */
        private final int delay;
    
        /** The curve angle of the projectile. */
        private final int curve;
    
        /**
         * Create a new {@link Projectile}.
         * 
         * @param start
         *            the starting position of the projectile.
         * @param end
         *            the ending position of the projectile.
         * @param lockon
         *            the lock on value of the projectile.
         * @param projectileId
         *            the id of the projectile.
         * @param speed
         *            the speed of the projectile.
         * @param delay
         *            the delay of the projectile.
         * @param startHeight
         *            the starting height of the projectile.
         * @param endHeight
         *            the ending height of the projectile.
         * @param curve
         *            the curve angle of the projectile.
         */
        public Projectile(Position start, Position end, int lockon,
            int projectileId, int speed, int delay, int startHeight, int endHeight,
            int curve) {
            this.start = start;
            this.offset = new Position((end.getX() - start.getX()),
                (end.getY() - start.getY()));
            this.lockon = lockon;
            this.projectileId = projectileId;
            this.delay = delay;
            this.speed = speed;
            this.startHeight = startHeight;
            this.endHeight = endHeight;
            this.curve = curve;
        }
    
        /**
         * Create a new {@link Projectile}.
         * 
         * @param source
         *            the entity that is firing this projectile.
         * @param victim
         *            the victim that this projectile is being fired at.
         * @param projectileId
         *            the id of the projectile.
         * @param speed
         *            the speed of the projectile.
         * @param delay
         *            the delay of the projectile.
         * @param startHeight
         *            the starting height of the projectile.
         * @param endHeight
         *            the ending height of the projectile.
         * @param curve
         *            the curve angle of the projectile.
         */
        public Projectile(Entity source, Entity victim, int projectileId,
            int delay, int speed, int startHeight, int endHeight, int curve) {
            this(source.getPosition(), victim.getPosition(),
                (victim.isPlayer() ? -victim.getIndex() - 1
                    : victim.getIndex() + 1), projectileId, speed, delay,
                startHeight, endHeight, curve);
        }
    
        /**
         * Sends one projectiles using the values set when the {@link Projectile}
         * was constructed.
         */
        public void sendProjectile() {
            for (Player player : World.getPlayers()) {
                if (player == null) {
                    continue;
                }
    
                if (start.isViewableFrom(player.getPosition())) {
                    player.getPacketSender().sendProjectile(start, offset, 0,
                        speed, projectileId, startHeight, endHeight, lockon, delay);
    
                }
            }
        }
    
        /**
         * Sends <code>count</code> projectiles using the values set when the
         * {@link Projectile} was constructed.
         * 
         * @param count
         *            the amount of projectiles to send.
         */
        public void sendProjectiles(int count) {
            for (int i = 0; i < count; i++) {
                TaskManager.submit(new Task(1, false) {
                    @Override
                    public void execute() {
                        sendProjectile();
                        this.stop();
                    }
                });
            }
        }
    
        /**
         * Gets the starting position of the projectile.
         * 
         * @return the starting position of the projectile.
         */
        public Position getStart() {
            return start;
        }
    
        /**
         * Gets the offset position of the projectile.
         * 
         * @return the offset position of the projectile.
         */
        public Position getOffset() {
            return offset;
        }
    
        /**
         * Gets the speed of the projectile.
         * 
         * @return the speed of the projectile.
         */
        public int getSpeed() {
            return speed;
        }
    
        /**
         * Gets the id of the projectile.
         * 
         * @return the id of the projectile.
         */
        public int getProjectileId() {
            return projectileId;
        }
    
        /**
         * Gets the starting height of the projectile.
         * 
         * @return the starting height of the projectile.
         */
        public int getStartHeight() {
            return startHeight;
        }
    
        /**
         * Gets the ending height of the projectile.
         * 
         * @return the ending height of the projectile
         */
        public int getEndHeight() {
            return endHeight;
        }
    
        /**
         * Gets the lock on value of the projectile.
         * 
         * @return the lock on value of the projectile.
         */
        public int getLockon() {
            return lockon;
        }
    
        /**
         * Gets the delay of the projectile.
         * 
         * @return the delay of the projectile.
         */
        public int getDelay() {
            return delay;
        }
    
        /**
         * Gets the curve angle of the projectile.
         * 
         * @return the curve angle of the projectile.
         */
        public int getCurve() {
            return curve;
        }
    }
    You will have to modify it slightly to make it work with your server.
    When it comes to Ranged, you can use my configurations:

    Code:
    		int projectileId = ammo.getProjectileId();
    		int delay = 40;
    		int speed = 60;
    		int heightEnd = 31;
    		int heightStart = 43;
    		int curve = 0;
    
    		if (weapon.getType() == RangedWeaponType.CROSSBOW) {
    			delay = 46;
    			speed = 62;
    			heightStart = 44;
    			heightEnd = 35;
    			curve = 3;
    		} else if (weapon.getType() == RangedWeaponType.DARK_BOW) {
    			speed = 70;
    		} else if (weapon.getType() == RangedWeaponType.BLOWPIPE) {
    			speed = 60;
    			heightStart = 40;
    			heightEnd = 35;
    			curve = 5;
    		}
    
    		if (ammo == AmmunitionData.TOKTZ_XIL_UL) {
    			delay = 30;
    			speed = 55;
    		}
    
    		// Fire projectile
    		new Projectile(character, target, projectileId, delay, speed, heightStart, heightEnd, curve).sendProjectile();
    
    		// Dark bow fires two arrows.
    		if (weapon == RangedWeaponData.DARK_BOW) {
    			new Projectile(character, target, ammo.getProjectileId(), delay - 7, speed + 4, heightStart + 5, heightEnd, curve).sendProjectile();
                    }
    }
    They're pretty much identical to OSRS in terms of delays/speeds. Done a lot of testing.
    [Today 01:29 AM] RSTrials: Nice 0.97 Win/Loss Ratio luke. That's pretty bad.
    [Today 01:30 AM] Luke132: Ok u fucking moron i forgot i could influence misc.random
    Reply With Quote  
     

  5. Thankful users:


  6. #5  
    Banned

    Join Date
    Oct 2012
    Posts
    4,710
    Thanks given
    1,679
    Thanks received
    1,105
    Rep Power
    0
    Quote Originally Posted by Professor Oak View Post
    Feel free to use this modified class by lare96 for projectiles:

    Code:
    package com.elvarg.game.model;
    
    import com.elvarg.game.World;
    import com.elvarg.game.entity.Entity;
    import com.elvarg.game.entity.impl.player.Player;
    import com.elvarg.game.task.Task;
    import com.elvarg.game.task.TaskManager;
    
    /**
     * A graphic propelled through the air by some sort of spell, weapon, or other
     * miscellaneous force.
     * 
     * @author lare96
     */
    public final class Projectile {
    
        /** The starting position of the projectile. */
        private final Position start;
    
        /** The offset position of the projectile. */
        private final Position offset;
    
        /** The speed of the projectile. */
        private final int speed;
    
        /** The id of the projectile. */
        private final int projectileId;
    
        /** The starting height of the projectile. */
        private final int startHeight;
    
        /** The ending height of the projectile. */
        private final int endHeight;
    
        /** The lock on value of the projectile. */
        private final int lockon;
    
        /** The delay of the projectile. */
        private final int delay;
    
        /** The curve angle of the projectile. */
        private final int curve;
    
        /**
         * Create a new {@link Projectile}.
         * 
         * @param start
         *            the starting position of the projectile.
         * @param end
         *            the ending position of the projectile.
         * @param lockon
         *            the lock on value of the projectile.
         * @param projectileId
         *            the id of the projectile.
         * @param speed
         *            the speed of the projectile.
         * @param delay
         *            the delay of the projectile.
         * @param startHeight
         *            the starting height of the projectile.
         * @param endHeight
         *            the ending height of the projectile.
         * @param curve
         *            the curve angle of the projectile.
         */
        public Projectile(Position start, Position end, int lockon,
            int projectileId, int speed, int delay, int startHeight, int endHeight,
            int curve) {
            this.start = start;
            this.offset = new Position((end.getX() - start.getX()),
                (end.getY() - start.getY()));
            this.lockon = lockon;
            this.projectileId = projectileId;
            this.delay = delay;
            this.speed = speed;
            this.startHeight = startHeight;
            this.endHeight = endHeight;
            this.curve = curve;
        }
    
        /**
         * Create a new {@link Projectile}.
         * 
         * @param source
         *            the entity that is firing this projectile.
         * @param victim
         *            the victim that this projectile is being fired at.
         * @param projectileId
         *            the id of the projectile.
         * @param speed
         *            the speed of the projectile.
         * @param delay
         *            the delay of the projectile.
         * @param startHeight
         *            the starting height of the projectile.
         * @param endHeight
         *            the ending height of the projectile.
         * @param curve
         *            the curve angle of the projectile.
         */
        public Projectile(Entity source, Entity victim, int projectileId,
            int delay, int speed, int startHeight, int endHeight, int curve) {
            this(source.getPosition(), victim.getPosition(),
                (victim.isPlayer() ? -victim.getIndex() - 1
                    : victim.getIndex() + 1), projectileId, speed, delay,
                startHeight, endHeight, curve);
        }
    
        /**
         * Sends one projectiles using the values set when the {@link Projectile}
         * was constructed.
         */
        public void sendProjectile() {
            for (Player player : World.getPlayers()) {
                if (player == null) {
                    continue;
                }
    
                if (start.isViewableFrom(player.getPosition())) {
                    player.getPacketSender().sendProjectile(start, offset, 0,
                        speed, projectileId, startHeight, endHeight, lockon, delay);
    
                }
            }
        }
    
        /**
         * Sends <code>count</code> projectiles using the values set when the
         * {@link Projectile} was constructed.
         * 
         * @param count
         *            the amount of projectiles to send.
         */
        public void sendProjectiles(int count) {
            for (int i = 0; i < count; i++) {
                TaskManager.submit(new Task(1, false) {
                    @Override
                    public void execute() {
                        sendProjectile();
                        this.stop();
                    }
                });
            }
        }
    
        /**
         * Gets the starting position of the projectile.
         * 
         * @return the starting position of the projectile.
         */
        public Position getStart() {
            return start;
        }
    
        /**
         * Gets the offset position of the projectile.
         * 
         * @return the offset position of the projectile.
         */
        public Position getOffset() {
            return offset;
        }
    
        /**
         * Gets the speed of the projectile.
         * 
         * @return the speed of the projectile.
         */
        public int getSpeed() {
            return speed;
        }
    
        /**
         * Gets the id of the projectile.
         * 
         * @return the id of the projectile.
         */
        public int getProjectileId() {
            return projectileId;
        }
    
        /**
         * Gets the starting height of the projectile.
         * 
         * @return the starting height of the projectile.
         */
        public int getStartHeight() {
            return startHeight;
        }
    
        /**
         * Gets the ending height of the projectile.
         * 
         * @return the ending height of the projectile
         */
        public int getEndHeight() {
            return endHeight;
        }
    
        /**
         * Gets the lock on value of the projectile.
         * 
         * @return the lock on value of the projectile.
         */
        public int getLockon() {
            return lockon;
        }
    
        /**
         * Gets the delay of the projectile.
         * 
         * @return the delay of the projectile.
         */
        public int getDelay() {
            return delay;
        }
    
        /**
         * Gets the curve angle of the projectile.
         * 
         * @return the curve angle of the projectile.
         */
        public int getCurve() {
            return curve;
        }
    }
    You will have to modify it slightly to make it work with your server.
    When it comes to Ranged, you can use my configurations:

    Code:
    		int projectileId = ammo.getProjectileId();
    		int delay = 40;
    		int speed = 60;
    		int heightEnd = 31;
    		int heightStart = 43;
    		int curve = 0;
    
    		if (weapon.getType() == RangedWeaponType.CROSSBOW) {
    			delay = 46;
    			speed = 62;
    			heightStart = 44;
    			heightEnd = 35;
    			curve = 3;
    		} else if (weapon.getType() == RangedWeaponType.DARK_BOW) {
    			speed = 70;
    		} else if (weapon.getType() == RangedWeaponType.BLOWPIPE) {
    			speed = 60;
    			heightStart = 40;
    			heightEnd = 35;
    			curve = 5;
    		}
    
    		if (ammo == AmmunitionData.TOKTZ_XIL_UL) {
    			delay = 30;
    			speed = 55;
    		}
    
    		// Fire projectile
    		new Projectile(character, target, projectileId, delay, speed, heightStart, heightEnd, curve).sendProjectile();
    
    		// Dark bow fires two arrows.
    		if (weapon == RangedWeaponData.DARK_BOW) {
    			new Projectile(character, target, ammo.getProjectileId(), delay - 7, speed + 4, heightStart + 5, heightEnd, curve).sendProjectile();
                    }
    }
    They're pretty much identical to OSRS in terms of delays/speeds. Done a lot of testing.
    Thanks man gonna use this data.

    Edit: You must spread some Reputation around before giving it to Professor Oak again.
    Reply With Quote  
     

  7. #6  
    Donator

    Defiled RSPS's Avatar
    Join Date
    Oct 2013
    Posts
    465
    Thanks given
    32
    Thanks received
    30
    Rep Power
    94
    Quote Originally Posted by Professor Oak View Post
    Feel free to use this modified class by lare96 for projectiles:

    Code:
    package com.elvarg.game.model;
    
    import com.elvarg.game.World;
    import com.elvarg.game.entity.Entity;
    import com.elvarg.game.entity.impl.player.Player;
    import com.elvarg.game.task.Task;
    import com.elvarg.game.task.TaskManager;
    
    /**
     * A graphic propelled through the air by some sort of spell, weapon, or other
     * miscellaneous force.
     * 
     * @author lare96
     */
    public final class Projectile {
    
        /** The starting position of the projectile. */
        private final Position start;
    
        /** The offset position of the projectile. */
        private final Position offset;
    
        /** The speed of the projectile. */
        private final int speed;
    
        /** The id of the projectile. */
        private final int projectileId;
    
        /** The starting height of the projectile. */
        private final int startHeight;
    
        /** The ending height of the projectile. */
        private final int endHeight;
    
        /** The lock on value of the projectile. */
        private final int lockon;
    
        /** The delay of the projectile. */
        private final int delay;
    
        /** The curve angle of the projectile. */
        private final int curve;
    
        /**
         * Create a new {@link Projectile}.
         * 
         * @param start
         *            the starting position of the projectile.
         * @param end
         *            the ending position of the projectile.
         * @param lockon
         *            the lock on value of the projectile.
         * @param projectileId
         *            the id of the projectile.
         * @param speed
         *            the speed of the projectile.
         * @param delay
         *            the delay of the projectile.
         * @param startHeight
         *            the starting height of the projectile.
         * @param endHeight
         *            the ending height of the projectile.
         * @param curve
         *            the curve angle of the projectile.
         */
        public Projectile(Position start, Position end, int lockon,
            int projectileId, int speed, int delay, int startHeight, int endHeight,
            int curve) {
            this.start = start;
            this.offset = new Position((end.getX() - start.getX()),
                (end.getY() - start.getY()));
            this.lockon = lockon;
            this.projectileId = projectileId;
            this.delay = delay;
            this.speed = speed;
            this.startHeight = startHeight;
            this.endHeight = endHeight;
            this.curve = curve;
        }
    
        /**
         * Create a new {@link Projectile}.
         * 
         * @param source
         *            the entity that is firing this projectile.
         * @param victim
         *            the victim that this projectile is being fired at.
         * @param projectileId
         *            the id of the projectile.
         * @param speed
         *            the speed of the projectile.
         * @param delay
         *            the delay of the projectile.
         * @param startHeight
         *            the starting height of the projectile.
         * @param endHeight
         *            the ending height of the projectile.
         * @param curve
         *            the curve angle of the projectile.
         */
        public Projectile(Entity source, Entity victim, int projectileId,
            int delay, int speed, int startHeight, int endHeight, int curve) {
            this(source.getPosition(), victim.getPosition(),
                (victim.isPlayer() ? -victim.getIndex() - 1
                    : victim.getIndex() + 1), projectileId, speed, delay,
                startHeight, endHeight, curve);
        }
    
        /**
         * Sends one projectiles using the values set when the {@link Projectile}
         * was constructed.
         */
        public void sendProjectile() {
            for (Player player : World.getPlayers()) {
                if (player == null) {
                    continue;
                }
    
                if (start.isViewableFrom(player.getPosition())) {
                    player.getPacketSender().sendProjectile(start, offset, 0,
                        speed, projectileId, startHeight, endHeight, lockon, delay);
    
                }
            }
        }
    
        /**
         * Sends <code>count</code> projectiles using the values set when the
         * {@link Projectile} was constructed.
         * 
         * @param count
         *            the amount of projectiles to send.
         */
        public void sendProjectiles(int count) {
            for (int i = 0; i < count; i++) {
                TaskManager.submit(new Task(1, false) {
                    @Override
                    public void execute() {
                        sendProjectile();
                        this.stop();
                    }
                });
            }
        }
    
        /**
         * Gets the starting position of the projectile.
         * 
         * @return the starting position of the projectile.
         */
        public Position getStart() {
            return start;
        }
    
        /**
         * Gets the offset position of the projectile.
         * 
         * @return the offset position of the projectile.
         */
        public Position getOffset() {
            return offset;
        }
    
        /**
         * Gets the speed of the projectile.
         * 
         * @return the speed of the projectile.
         */
        public int getSpeed() {
            return speed;
        }
    
        /**
         * Gets the id of the projectile.
         * 
         * @return the id of the projectile.
         */
        public int getProjectileId() {
            return projectileId;
        }
    
        /**
         * Gets the starting height of the projectile.
         * 
         * @return the starting height of the projectile.
         */
        public int getStartHeight() {
            return startHeight;
        }
    
        /**
         * Gets the ending height of the projectile.
         * 
         * @return the ending height of the projectile
         */
        public int getEndHeight() {
            return endHeight;
        }
    
        /**
         * Gets the lock on value of the projectile.
         * 
         * @return the lock on value of the projectile.
         */
        public int getLockon() {
            return lockon;
        }
    
        /**
         * Gets the delay of the projectile.
         * 
         * @return the delay of the projectile.
         */
        public int getDelay() {
            return delay;
        }
    
        /**
         * Gets the curve angle of the projectile.
         * 
         * @return the curve angle of the projectile.
         */
        public int getCurve() {
            return curve;
        }
    }
    You will have to modify it slightly to make it work with your server.
    When it comes to Ranged, you can use my configurations:

    Code:
    		int projectileId = ammo.getProjectileId();
    		int delay = 40;
    		int speed = 60;
    		int heightEnd = 31;
    		int heightStart = 43;
    		int curve = 0;
    
    		if (weapon.getType() == RangedWeaponType.CROSSBOW) {
    			delay = 46;
    			speed = 62;
    			heightStart = 44;
    			heightEnd = 35;
    			curve = 3;
    		} else if (weapon.getType() == RangedWeaponType.DARK_BOW) {
    			speed = 70;
    		} else if (weapon.getType() == RangedWeaponType.BLOWPIPE) {
    			speed = 60;
    			heightStart = 40;
    			heightEnd = 35;
    			curve = 5;
    		}
    
    		if (ammo == AmmunitionData.TOKTZ_XIL_UL) {
    			delay = 30;
    			speed = 55;
    		}
    
    		// Fire projectile
    		new Projectile(character, target, projectileId, delay, speed, heightStart, heightEnd, curve).sendProjectile();
    
    		// Dark bow fires two arrows.
    		if (weapon == RangedWeaponData.DARK_BOW) {
    			new Projectile(character, target, ammo.getProjectileId(), delay - 7, speed + 4, heightStart + 5, heightEnd, curve).sendProjectile();
                    }
    }
    They're pretty much identical to OSRS in terms of delays/speeds. Done a lot of testing.

    thanks heaps mate I've repped you & Thanked =)
    Attached image
    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. Animation bugs Troubleshooting!
    By Dust R I P in forum Snippets
    Replies: 19
    Last Post: 03-16-2011, 02:30 AM
  2. 602 animation bugs
    By Golden Hero in forum Help
    Replies: 4
    Last Post: 02-09-2011, 06:30 AM
  3. 602 Animation Bugs
    By Renew in forum Help
    Replies: 18
    Last Post: 11-10-2010, 03:38 AM
  4. [DELTA] Range PvP BUGGED? [DELTA]
    By G3rvase in forum Help
    Replies: 1
    Last Post: 12-29-2009, 02:59 AM
  5. [508] Ranging/mage bugged..
    By Proffesor Oak in forum Help
    Replies: 14
    Last Post: 05-04-2009, 02:10 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
  •