Thread: [Vencillio] Cerberus

Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1 [Vencillio] Cerberus 
    Registered Member
    Join Date
    Dec 2014
    Posts
    435
    Thanks given
    18
    Thanks received
    35
    Rep Power
    11
    No use for this anymore, hope it helps someone else. If you use please thank.

    Create a new file named Cerberus.java and add the below code. You'll have to add your imports.

    Code:
    public class Cerberus extends Mob {
    	
    
    	/**
    	 * Start of Cerberus
    	 * @param player
    	 * @param location
    	 */
    	public Cerberus(Player player, Location location) {
    		super(player, 5862, false, false, false, location);
    		if (getOwner() != null) {
    			getCombat().setAttack(getOwner());
    			getFollowing().setIgnoreDistance(true);
    			getUpdateFlags().faceEntity(getOwner().getIndex());
    		}
    	}
    
    	/**
    	 * Cerberus' GFX
    	 */
    	private List<Mob> ghosts = new ArrayList<>();
    	public static final int CERBERUS = 5862;
    	public static final int SPECIAL_CHANCE = 20;
    	private boolean rocks = false;
    	
    	private boolean spawnGhosts = true;
    	
    	@Override
    	public int getRespawnTime() {
    		return 5;
    	}
    	
    	@Override
    	public void onHit(Entity entity, Hit hit) {
    	if (entity == null) {
    		return;
    	}
    	int random = Utility.random(15);
    	if (random == 1) {
    		initRocks();
    	}
    	}
    	@Override
    	public void hit(Hit hit) {
    	if (getOwner() == null) {
    		return;
    	}
    		if (isDead()) {
    			ghosts.clear();
    			return;
    		}
    		super.hit(hit);
    	}
    	/***
    	 * 
    	 * @param Checks For Damage inside the Location
    	 */
    	public void checkForDamage(Location a) {
    		for (Player player : getCombatants()) {
    			Location b = player.getLocation();
    			player.getLocation();
    			player.getLocation();
    			if ((Math.abs(a.getX() - b.getX()) <= 1) && (Math.abs(a.getY() - b.getY()) <= 1))
    				player.hit(new Hit(Utility.randomNumber(20)));
    		}
    	}
    
    	@Override
    	public void doAliveMobProcessing() {
    		if ((getCombat().getAttacking() != null) && (!rocks) && (Utility.randomNumber(20) == 0)) {
    			rocks = true;
    			initRocks();
    		}
    			if ((getCombat().getAttacking() != null) && (!spawnGhosts) && (Utility.randomNumber(20) == 0)) {
    				spawnGhosts = true;
    				isSpawnGhosts();
    			}
    		}
    	
    	
    	@Override
    	public void onDeath() {
    		setSpawnGhosts(false);
    		for (Mob ghosts : ghosts) {
    			if (!ghosts.isDead()) {
    				ghosts.remove();
    			}
    		}
    		ghosts.clear();
    	}
    	
    	public boolean isSpawnGhosts() {
    	return spawnGhosts;
    	}	
    	
    	public void setSpawnGhosts(boolean spawnGhosts) {
    	this.spawnGhosts = spawnGhosts;
    	}
    	
    	public void spawnGhosts() {
    	setSpawnGhosts(true);
    	for (int index = 0; index < 2; index++) {
    		Mob mob = new Mob(5867, true, new Location(1239, 1256, getOwner().getZ()));
    		Mob mob1 = new Mob(5869, true, new Location(1240, 1256, getOwner().getZ()));
    		Mob mob2 = new Mob(5868, true, new Location(1241, 1256, getOwner().getZ()));
    		mob.getUpdateFlags().faceEntity(getIndex());
    		mob.setFreeze(9999);
    		
    		getUpdateFlags().sendForceMessage("Aaaarrrroooo");
    		
    		TaskQueue.queue(new Task(1) {
    		byte Stage = 0;
    		
    		@Override
    		public void execute() {
    			if (Stage == 0) {
    				if (!mob.isDead()) {
    					ghosts.add(mob);
    					mob.getCombat().setAttack(getOwner());
    					mob1.getAttackType();
    				}
    			} else if (Stage == 1) {
    				if (!mob1.isDead()) {
    					ghosts.add(mob1);
    					mob1.getCombat().setAttack(getOwner());
    					mob1.getAttackType();
    				}
    				
    			} else if (Stage == 1) {
    				if (!mob2.isDead()) {
    					ghosts.add(mob2);
    					mob2.getCombat().setAttack(getOwner());
    					mob2.getAttackType();
    				}
    			}
    			if ((this.Stage = (byte) (Stage + 1)) == 3) {
    				spawnGhosts = false;
    				ghosts.clear();
    				stop();
    			}
    		}
    			@Override
    			public void onStop() {
    			}
    			});
    		}
    	}
    	
    			
    	public void initRocks() {
    		final Location a = new Location(1237, 1253, getOwner().getZ());
    		final Location b = new Location(1243, 1253, getOwner().getZ());
    		final Location c = new Location(1242, 1250, getOwner().getZ());
    		final Location d = new Location(1238, 1250, getOwner().getZ());
    
    		TaskQueue.queue(new Task(1) {
    		byte stage = 0;
    
    		
    		@Override
    		public void execute() {
    			if (stage == 0) {
    				World.sendStillGraphic(1247, 0, a);
    				checkForDamage(a);
    			} else if (stage == 1) {
    				World.sendStillGraphic(1247, 0, b);
    				checkForDamage(b);
    			} else if (stage == 2) {
    				World.sendStillGraphic(1247, 0, c);
    				checkForDamage(c);
    			} else if (stage == 4) {
    				World.sendStillGraphic(1247, 0, d);
    				checkForDamage(d);
    			}
    			if ((this.stage = (byte) (stage + 1)) == 5) {
    				rocks = false;
    				stop();
    			}
    		}
    			@Override
    			public void onStop() {
    			}
    			});
    		}
    }
    Teleport handler spawning
    Code:
    case 250066://Cerb
    			TaskQueue.queue(new Task(5) {
    			@Override
    			public void execute() {
    			Cerberus mob = new Cerberus(player, new Location(1241, 1254, player.getIndex() << 2));
    			mob.face(player);
    			player.face(mob);
    				player.send(new SendMessage("Welcome to Cerberus"));
    				DialogueManager.sendStatement(player, "Welcome to Cerberus");
    				stop();
    			}
    					
    			@Override
    			public void onStop() {
    			}
    		});
    		return true;
    in slayer monsters add this
    Code:
    case "cerberus":
    			lvl = (byte) 91;
    			break;
    then add this in slayer tasks
    Code:
    CERBERUS("Cerberus"),
    Npc Definitions
    Code:
    <NpcDefinition>
    		<id>5862</id>
    		<name>Cerberus</name>
    		<walkAnimation>3183</walkAnimation>
    		<standAnimation>3183</standAnimation>
    		<turn180Animation>65535</turn180Animation>
    		<turn90CWAnimation>65535</turn90CWAnimation>
    		<turn90CCWAnimation>65535</turn90CCWAnimation>
    		<level>318</level>
    		<size>1</size>
    		<attackable>true</attackable>
    	</NpcDefinition>
    Combat Definitions
    Code:
    <NpcCombatDefinition>
    	<!-- Cerberus -->
    		<id>5862</id>
    		<combatType>ALL</combatType>
    		<respawnTime>40</respawnTime>
    		<block>
    			<id>4489</id>
    			<delay>0</delay>
    		</block>
    		<death>
    			<id>4495</id>
    			<delay>0</delay>
    		</death>
    		<skills>
    			<skill>
    				<id>0</id>
    				<level>220</level>
    			</skill>
    			<skill>
    				<id>1</id>
    				<level>220</level>
    			</skill>
    			<skill>
    				<id>3</id>
    				<level>600</level>
    			</skill>
    			<skill>
    				<id>4</id>
    				<level>150</level>
    			</skill>
    			<skill>
    				<id>5</id>
    				<level>250</level>
    			</skill>
    		</skills>
    		<bonuses>
    			<int>75</int>
    			<int>75</int>
    			<int>75</int>
    			<int>40</int>
    			<int>40</int>
    			<int>40</int>
    			<int>40</int>
    			<int>75</int>
    			<int>75</int>
    			<int>75</int>
    			<int>75</int>
    			<int>75</int>
    		</bonuses>
    		<melee>
    			<melee>
    				<attack>
    					<hitDelay>1</hitDelay>
    					<attackDelay>6</attackDelay>
    				</attack>
    				<animation>
    					<id>4491</id>
    					<delay>0</delay>
    				</animation>
    				<max>15</max>
    			</melee>
    		</melee>
    		<magic>
    			<magic>
    				<attack>
    					<hitDelay>3</hitDelay>
    					<attackDelay>6</attackDelay>
    				</attack>
    				<animation>
    					<id>4490</id>
    					<delay>0</delay>
    				</animation>
    				<projectile>
    					<id>1242</id>
    					<size>1</size>
    					<delay>50</delay>
    					<duration>75</duration>
    					<startHeight>43</startHeight>
    					<endHeight>31</endHeight>
    					<curve>16</curve>
    				</projectile>
    				<max>50</max>
    			</magic>
    		</magic>
    		<ranged>
    			<ranged>
    				<attack>
    					<hitDelay>3</hitDelay>
    					<attackDelay>6</attackDelay>
    				</attack>
    				<animation>
    					<id>4490</id>
    					<delay>0</delay>
    				</animation>
    				<projectile>
    					<id>1245</id>
    					<size>1</size>
    					<delay>50</delay>
    					<duration>75</duration>
    					<startHeight>43</startHeight>
    					<endHeight>31</endHeight>
    					<curve>16</curve>
    				</projectile>
    				<max>13</max>
    			</ranged>
    		</ranged>
    	</NpcCombatDefinition>


    OSRS Pure
    Reply With Quote  
     

  2. #2  
    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
    What is this? gj tho surely many will find useful.

    Code:
    	public static final int rocks_A = 1247;
    	public static final int rocks_B = 1247;
    	public static final int rocks_C = 1247;
    	public static final int rocks_D = 1247;


    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Dec 2014
    Posts
    435
    Thanks given
    18
    Thanks received
    35
    Rep Power
    11
    Quote Originally Posted by 01053 View Post
    What is this? gj tho surely many will find useful.

    Code:
    	public static final int rocks_A = 1247;
    	public static final int rocks_B = 1247;
    	public static final int rocks_C = 1247;
    	public static final int rocks_D = 1247;
    For a spawn in the lair.


    OSRS Pure
    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 Audi View Post
    For a spawn in the lair.
    Code:
    	public static final int CERBERUS = 5862;
    	public static final int SPECIAL_CHANCE = 20;
    	public static final int rocks_A = 1247;
    	public static final int rocks_B = 1247;
    	public static final int rocks_C = 1247;
    	public static final int rocks_D = 1247;
    None of those are being used, also you don't need to define the same id 4x ultimately they all do the same thing in whatever you planned on using them for I'm assuming it's a gfx id or something.


    Reply With Quote  
     

  5. Thankful user:


  6. #5  
    Registered Member
    Join Date
    Dec 2014
    Posts
    435
    Thanks given
    18
    Thanks received
    35
    Rep Power
    11
    Quote Originally Posted by 01053 View Post
    Code:
    	public static final int CERBERUS = 5862;
    	public static final int SPECIAL_CHANCE = 20;
    	public static final int rocks_A = 1247;
    	public static final int rocks_B = 1247;
    	public static final int rocks_C = 1247;
    	public static final int rocks_D = 1247;
    None of those are being used, also you don't need to define the same id 4x ultimately they all do the same thing in whatever you planned on using them for I'm assuming it's a gfx id or something.
    Yea its a gfx, and you are right i am not using them i will fix thanks


    OSRS Pure
    Reply With Quote  
     

  7. #6  
    Banned
    Join Date
    Apr 2016
    Posts
    357
    Thanks given
    65
    Thanks received
    16
    Rep Power
    0
    Quote Originally Posted by Audi View Post
    No use for this anymore, hope it helps someone else. If you use please thank.

    Create a new file named Cerberus.java and add the below code. You'll have to add your imports.

    Code:
    public class Cerberus extends Mob {
    	
    
    	/**
    	 * Start of Cerberus
    	 * @param player
    	 * @param location
    	 */
    	public Cerberus(Player player, Location location) {
    		super(player, 5862, false, false, false, location);
    		if (getOwner() != null) {
    			getCombat().setAttack(getOwner());
    			getFollowing().setIgnoreDistance(true);
    			getUpdateFlags().faceEntity(getOwner().getIndex());
    		}
    	}
    
    	/**
    	 * Cerberus' GFX
    	 */
    	private List<Mob> ghosts = new ArrayList<>();
    	public static final int CERBERUS = 5862;
    	public static final int SPECIAL_CHANCE = 20;
    	private boolean rocks = false;
    	
    	private boolean spawnGhosts = true;
    	
    	@Override
    	public int getRespawnTime() {
    		return 5;
    	}
    	
    	@Override
    	public void onHit(Entity entity, Hit hit) {
    	if (entity == null) {
    		return;
    	}
    	int random = Utility.random(15);
    	if (random == 1) {
    		initRocks();
    	}
    	}
    	@Override
    	public void hit(Hit hit) {
    	if (getOwner() == null) {
    		return;
    	}
    		if (isDead()) {
    			ghosts.clear();
    			return;
    		}
    		super.hit(hit);
    	}
    	/***
    	 * 
    	 * @param Checks For Damage inside the Location
    	 */
    	public void checkForDamage(Location a) {
    		for (Player player : getCombatants()) {
    			Location b = player.getLocation();
    			player.getLocation();
    			player.getLocation();
    			if ((Math.abs(a.getX() - b.getX()) <= 1) && (Math.abs(a.getY() - b.getY()) <= 1))
    				player.hit(new Hit(Utility.randomNumber(20)));
    		}
    	}
    
    	@Override
    	public void doAliveMobProcessing() {
    		if ((getCombat().getAttacking() != null) && (!rocks) && (Utility.randomNumber(20) == 0)) {
    			rocks = true;
    			initRocks();
    		}
    			if ((getCombat().getAttacking() != null) && (!spawnGhosts) && (Utility.randomNumber(20) == 0)) {
    				spawnGhosts = true;
    				isSpawnGhosts();
    			}
    		}
    	
    	
    	@Override
    	public void onDeath() {
    		setSpawnGhosts(false);
    		for (Mob ghosts : ghosts) {
    			if (!ghosts.isDead()) {
    				ghosts.remove();
    			}
    		}
    		ghosts.clear();
    	}
    	
    	public boolean isSpawnGhosts() {
    	return spawnGhosts;
    	}	
    	
    	public void setSpawnGhosts(boolean spawnGhosts) {
    	this.spawnGhosts = spawnGhosts;
    	}
    	
    	public void spawnGhosts() {
    	setSpawnGhosts(true);
    	for (int index = 0; index < 2; index++) {
    		Mob mob = new Mob(5867, true, new Location(1239, 1256, getOwner().getZ()));
    		Mob mob1 = new Mob(5869, true, new Location(1240, 1256, getOwner().getZ()));
    		Mob mob2 = new Mob(5868, true, new Location(1241, 1256, getOwner().getZ()));
    		mob.getUpdateFlags().faceEntity(getIndex());
    		mob.setFreeze(9999);
    		
    		getUpdateFlags().sendForceMessage("Aaaarrrroooo");
    		
    		TaskQueue.queue(new Task(1) {
    		byte Stage = 0;
    		
    		@Override
    		public void execute() {
    			if (Stage == 0) {
    				if (!mob.isDead()) {
    					ghosts.add(mob);
    					mob.getCombat().setAttack(getOwner());
    					mob1.getAttackType();
    				}
    			} else if (Stage == 1) {
    				if (!mob1.isDead()) {
    					ghosts.add(mob1);
    					mob1.getCombat().setAttack(getOwner());
    					mob1.getAttackType();
    				}
    				
    			} else if (Stage == 1) {
    				if (!mob2.isDead()) {
    					ghosts.add(mob2);
    					mob2.getCombat().setAttack(getOwner());
    					mob2.getAttackType();
    				}
    			}
    			if ((this.Stage = (byte) (Stage + 1)) == 3) {
    				spawnGhosts = false;
    				ghosts.clear();
    				stop();
    			}
    		}
    			@Override
    			public void onStop() {
    			}
    			});
    		}
    	}
    	
    			
    	public void initRocks() {
    		final Location a = new Location(1237, 1253, getOwner().getZ());
    		final Location b = new Location(1243, 1253, getOwner().getZ());
    		final Location c = new Location(1242, 1250, getOwner().getZ());
    		final Location d = new Location(1238, 1250, getOwner().getZ());
    
    		TaskQueue.queue(new Task(1) {
    		byte stage = 0;
    
    		
    		@Override
    		public void execute() {
    			if (stage == 0) {
    				World.sendStillGraphic(1247, 0, a);
    				checkForDamage(a);
    			} else if (stage == 1) {
    				World.sendStillGraphic(1247, 0, b);
    				checkForDamage(b);
    			} else if (stage == 2) {
    				World.sendStillGraphic(1247, 0, c);
    				checkForDamage(c);
    			} else if (stage == 4) {
    				World.sendStillGraphic(1247, 0, d);
    				checkForDamage(d);
    			}
    			if ((this.stage = (byte) (stage + 1)) == 5) {
    				rocks = false;
    				stop();
    			}
    		}
    			@Override
    			public void onStop() {
    			}
    			});
    		}
    }
    Teleport handler spawning
    Code:
    case 250066://Cerb
    			TaskQueue.queue(new Task(5) {
    			@Override
    			public void execute() {
    			Cerberus mob = new Cerberus(player, new Location(1241, 1254, player.getIndex() << 2));
    			mob.face(player);
    			player.face(mob);
    				player.send(new SendMessage("Welcome to Cerberus"));
    				DialogueManager.sendStatement(player, "Welcome to Cerberus");
    				stop();
    			}
    					
    			@Override
    			public void onStop() {
    			}
    		});
    		return true;
    in slayer monsters add this
    Code:
    case "cerberus":
    			lvl = (byte) 91;
    			break;
    then add this in slayer tasks
    Code:
    CERBERUS("Cerberus"),
    Npc Definitions
    Code:
    <NpcDefinition>
    		<id>5862</id>
    		<name>Cerberus</name>
    		<walkAnimation>3183</walkAnimation>
    		<standAnimation>3183</standAnimation>
    		<turn180Animation>65535</turn180Animation>
    		<turn90CWAnimation>65535</turn90CWAnimation>
    		<turn90CCWAnimation>65535</turn90CCWAnimation>
    		<level>318</level>
    		<size>1</size>
    		<attackable>true</attackable>
    	</NpcDefinition>
    Combat Definitions
    Code:
    <NpcCombatDefinition>
    	<!-- Cerberus -->
    		<id>5862</id>
    		<combatType>ALL</combatType>
    		<respawnTime>40</respawnTime>
    		<block>
    			<id>4489</id>
    			<delay>0</delay>
    		</block>
    		<death>
    			<id>4495</id>
    			<delay>0</delay>
    		</death>
    		<skills>
    			<skill>
    				<id>0</id>
    				<level>220</level>
    			</skill>
    			<skill>
    				<id>1</id>
    				<level>220</level>
    			</skill>
    			<skill>
    				<id>3</id>
    				<level>600</level>
    			</skill>
    			<skill>
    				<id>4</id>
    				<level>150</level>
    			</skill>
    			<skill>
    				<id>5</id>
    				<level>250</level>
    			</skill>
    		</skills>
    		<bonuses>
    			<int>75</int>
    			<int>75</int>
    			<int>75</int>
    			<int>40</int>
    			<int>40</int>
    			<int>40</int>
    			<int>40</int>
    			<int>75</int>
    			<int>75</int>
    			<int>75</int>
    			<int>75</int>
    			<int>75</int>
    		</bonuses>
    		<melee>
    			<melee>
    				<attack>
    					<hitDelay>1</hitDelay>
    					<attackDelay>6</attackDelay>
    				</attack>
    				<animation>
    					<id>4491</id>
    					<delay>0</delay>
    				</animation>
    				<max>15</max>
    			</melee>
    		</melee>
    		<magic>
    			<magic>
    				<attack>
    					<hitDelay>3</hitDelay>
    					<attackDelay>6</attackDelay>
    				</attack>
    				<animation>
    					<id>4490</id>
    					<delay>0</delay>
    				</animation>
    				<projectile>
    					<id>1242</id>
    					<size>1</size>
    					<delay>50</delay>
    					<duration>75</duration>
    					<startHeight>43</startHeight>
    					<endHeight>31</endHeight>
    					<curve>16</curve>
    				</projectile>
    				<max>50</max>
    			</magic>
    		</magic>
    		<ranged>
    			<ranged>
    				<attack>
    					<hitDelay>3</hitDelay>
    					<attackDelay>6</attackDelay>
    				</attack>
    				<animation>
    					<id>4490</id>
    					<delay>0</delay>
    				</animation>
    				<projectile>
    					<id>1245</id>
    					<size>1</size>
    					<delay>50</delay>
    					<duration>75</duration>
    					<startHeight>43</startHeight>
    					<endHeight>31</endHeight>
    					<curve>16</curve>
    				</projectile>
    				<max>13</max>
    			</ranged>
    		</ranged>
    	</NpcCombatDefinition>
    Amazing work but can u tell me how u made the map works properly? Because my cerberus wont spawn on this location. I got the map but the cerberus is invisible only if i spawn npc here with a command will be visible i think its not laoding the map in the client or server side so the npc cannot be spawned here any idea how to fix this please?
    Reply With Quote  
     

  8. #7  
    Banned

    Join Date
    Oct 2012
    Posts
    4,710
    Thanks given
    1,679
    Thanks received
    1,105
    Rep Power
    0
    Thanks for the share.
    Reply With Quote  
     

  9. #8  
    Registered Member LordSlaughter's Avatar
    Join Date
    Aug 2016
    Posts
    141
    Thanks given
    20
    Thanks received
    14
    Rep Power
    13
    Thanks for the contribution.

    Your New Favorite Time Waster!

    "Don't look at the finish line, look at the steps along the way" - Zivik
    Reply With Quote  
     

  10. #9  
    Registered Member
    Join Date
    Sep 2016
    Posts
    18
    Thanks given
    0
    Thanks received
    0
    Rep Power
    9
    what do you mean by imports? can u help me add this one add my skype kingangel641
    Reply With Quote  
     

  11. #10  
    Registered Member

    Join Date
    Feb 2015
    Posts
    830
    Thanks given
    12
    Thanks received
    200
    Rep Power
    118
    Quote Originally Posted by crewlezz View Post
    what do you mean by imports? can u help me add this one add my skype kingangel641

    Change "darklight" to your server package names.

    package com.darklight.rs2.entity.mob.impl;


    import java.util.ArrayList;
    import java.util.List;

    import com.darklight.core.task.Task;
    import com.darklight.core.task.TaskQueue;
    import com.darklight.core.util.Utility;
    import com.darklight.rs2.content.combat.Hit;
    import com.darklight.rs2.entity.Entity;
    import com.darklight.rs2.entity.Location;
    import com.darklight.rs2.entity.World;
    import com.darklight.rs2.entity.mob.Mob;
    import com.darklight.rs2.entity.player.Player;
    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. Vencillio - Who needs a slogan? (We're back)
    By Ashpire in forum Projects
    Replies: 82
    Last Post: 12-28-2018, 08:24 AM
  2. [ Vencillio ] Help adding Cerberus
    By DustinJameson in forum Help
    Replies: 2
    Last Post: 07-29-2016, 12:07 AM
  3. [ Vencillio ] Maps Like Cerberus Caves
    By DustinJameson in forum Help
    Replies: 0
    Last Post: 07-25-2016, 11:40 PM
  4. Replies: 310
    Last Post: 04-30-2016, 07:26 AM
  5. Vencillio - Who needs a slogan?
    By Ashpire in forum Projects
    Replies: 244
    Last Post: 06-25-2015, 10:08 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
  •