Thread: Need Help Looping Zulrah Through Specific Spawns In Order [Vencillio Base]

Results 1 to 2 of 2
  1. #1 Need Help Looping Zulrah Through Specific Spawns In Order [Vencillio Base] 
    Registered Member
    Join Date
    Nov 2016
    Posts
    1
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    I need help getting Zulrah to loop through 9+ spawn locations in order. At the moment, it just spawns randomly between 3 different coordinates.
    I don't mind the tedious process of messing with the coordinates until I get them right myself, but I just can't get it to cycle through each set of coordinates in order.

    This is the array used to store the coordinates (found in Zulrah.java)

    Code:
             /**
    	 * Zulrah's spawn locations
    	 */
    	private Location[] LOCATIONS = { new Location(2266, 3072, getOwner().getZ()), new Location(2276, 3074, getOwner().getZ()), new Location(2273, 3064, getOwner().getZ()) };
    This is the method that handles spawning around the map (found in Zulrah.java)
    I've pointed to the specific "teleport" method used to move Zulrah with a comment
    The Utility.randomElement uses the "LOCATIONS" array mentioned above

    Code:
            /**
    	 * Handles Zulrah moving around the map
    	 **/
    	private void move() {
    		setCanAttack(false);
    		getOwner().setHitZulrah(false);
    		getOwner().getCombat().reset();
    		TaskQueue.queue(new Task(1) {
    			@Override
    			public void execute() {
    				getUpdateFlags().sendAnimation(new Animation(5072));
    				getOwner().send(new SendMessage("Zulrah dives into the swamp..."));
    				getUpdateFlags().isUpdateRequired();
    				stop();
    			}
    			@Override
    			public void onStop() {
    			}
    		});		
    		TaskQueue.queue(new Task(3) {
    			@Override
    			public void execute() {
    				transform(getNextForm());
    				teleport(Utility.randomElement(LOCATIONS));  // ********* <---- I am struggling trying to get this method to loop through the coordinates instead of using Utility.randomElement()
    				getUpdateFlags().isUpdateRequired();
    				getUpdateFlags().sendAnimation(new Animation(5071));
    				getUpdateFlags().faceEntity(getOwner().getIndex());
    				getUpdateFlags().isUpdateRequired();
    				stop();
    			}
    			@Override
    			public void onStop() {
    				getCombat().setAttack(getOwner());
    				setCanAttack(true);
    				getOwner().setHitZulrah(true);
    			}
    		});			
    	}
    This is the teleport method that's called from Mob.java

    Code:
             /**
    	 * Teleports the mob to a new location
    	 * 
    	 * @param p
    	 *            The location to teleport the mob too
    	 */
    	public void teleport(Location p) {
    		Walking.setNpcOnTile(this, false);
    		getMovementHandler().getLastLocation().setAs(new Location(p.getX(), p.getY() + 1));
    		getLocation().setAs(p);
    		Walking.setNpcOnTile(this, true);
    		placement = true;
    		getMovementHandler().resetMoveDirections();
    	}
    This is less important than getting the spawns locations to cycle, but I was also wondering if there's a similar way to loop through specific attack styles in order "e.g. Spawn 1 is range zulrah, Spawn 2 is melee, Spawn 3 is mage, etc."

    This is the method used to set Zulrah's attack style (found in Zulrah.java)

    Code:
    private int getNextForm() {
    		List<Integer> possible = new ArrayList<>();
    		possible.addAll(Arrays.asList(2042, 2043, 2044));
    		possible.remove(Integer.valueOf(getId()));
    		return Utility.randomElement(possible); // <-- This part returns a random attack style 
    	   }
    2042 = Green Zulrah
    2043 = Red Zulrah
    2044 = Blue Zulrah

    I really don't care about having it change between 4 different rotations like it does in OSRS or even having it restart the same rotation. I don't mind restarting the fight each time or editing the code to create a new rotation; this is really just for personal use.
    However this might be helpful for anyone trying to customize Zulrah rotations for his/her server.

    I'm pretty embarrassed to admit that I've been struggling with this for hours, so I'd really appreciate any help you guys could give me.
    Thanks in advance!
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Jul 2015
    Posts
    150
    Thanks given
    0
    Thanks received
    7
    Rep Power
    0
    Example Code:

    Code:
    package com.main;
    
    public class Fish {
    	
            /** A Array. **/
    	private static String[] fish = {"Cod", "Trout", "Salmon"};
    	
    	/** The read position in the array. **/
    	private static int fishIndex = 0;
    	
    	/** Really?... **/
    	public static void main(String[] args) {
    		
    		/** Just for demonstration purposes. **/
    		while(true) {
    			
    			/** If the end of the array has been reached already reset it to the beginning. **/
    			if(fishIndex == fish.length)
    				
    			/** The break is just for demonstration purposes remove it and uncomment. **/
    				break; //fishIndex = 0; //Reset
    			
    			/** Just for demonstration purposes. **/
    			System.out.println(fish[fishIndex]);
    			
    			/** Moving one position forward in preparation for the next read. **/
    			fishIndex++;
    			
    		}
    	}
    }
    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 Fixing Switches on 614 Spawn Server
    By harmony in forum Tutorials
    Replies: 6
    Last Post: 10-02-2013, 09:42 PM
  2. Replies: 0
    Last Post: 07-06-2013, 07:18 PM
  3. need help will pay through paypal
    By alien4055 in forum Help
    Replies: 3
    Last Post: 03-30-2013, 02:19 AM
  4. Replies: 10
    Last Post: 11-18-2009, 12:39 AM
Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •