Thread: Another multi threaded tut

Results 1 to 6 of 6
  1. #1 cut scenes with player actions...u add the camera angle methods 
    life is hopeless
    Guest
    cut scenes with player actions...u add the camera angle methods


    look at my coding and find out how to make cutscenes with the player actually doing stuff...here is an example without the camera angles

    make a new file called Dragon2HChest.java.

    add this

    Code:
    class Dragon2HChest implements Runnable {
    	Thread t;
    	int playerID;
    	
    	Dragon2HChest(int playerID) {
    	this.playerID = playerID;
    	t = new Thread(this, "Dragon 2h Chest");
    	t.start();
    	}
    	
    	public void run() {
        		client player = (client) server.playerHandler.players[playerID];
        		player.sendMessage("You start to dig...");
        		player.setEmote(831);
        		try {
        		Thread.sleep(3500);
        		} catch (InterruptedException e) {
        		System.out.println("Interrupted Dragon2h Chest Thread!!!");
        		}
        		player.resetEmote();
        		player.sendMessage("and you dig up a chest!");
        		player.sendGFX(189, player.absX, player.absY + 1);
        		try {
        		Thread.sleep(1000);
        		} catch (InterruptedException e) {
        		System.out.println("Interrupted Dragon2h Chest Thread!!!");
        		}	
        		player.replaceObject(player.absX, player.absY + 1, 4111, 2, 10);
        		//player.TurnPlayerTo(player.absX, player.absY + 1);
        		try {
        		Thread.sleep(750);
        		} catch (InterruptedException e) {
        		System.out.println("Interrupted Dragon2h Chest Thread!!!");
        		}
        		player.sendMessage("You brush the dirt off the chest....");
        		player.setEmote(881);
        		try {
        		Thread.sleep(1500);
        		} catch (InterruptedException e) {
        		System.out.println("Interrupted Dragon2h Chest Thread!!!");
        		}
        		player.sendMessage("and accidently break of the lock, opening the chest!");
        		player.resetEmote();
        		player.isDigging = false;
        		player.replaceObject(player.absX, player.absY + 1, 4118, -2, 10);
     	}
    }

    make sure all this **** is in player.java

    Code:
    	public boolean clickedInterface = false;
    	public int headIcon;
    	public int miningShield;
    	public boolean isWalking = false;
    	public boolean isDigging = false;
    	public int pStandEmote;
    	public int pAttack;
    	public int weapSpeed;
    	public int pETimer;
    	public int weaponStrength;
    	public final int playerEmote = 0x328;
    	public int pEmote = playerEmote;
    	public boolean hitDummy = false;
        	public boolean isTeleporting = false;
        	public boolean isMining = false;
    in client.java add this command

    Code:
    		else if (command.startsWith("dragon"))
    		{
    			isDigging = true;
    			new Dragon2HChest(playerId);
    		}

    under case 98://walk on packet add this

    Code:
    				if (isDigging) break;
    methods u might need in client.java

    Code:
    	public boolean withinDistance(int absX, int absY, int pointX, int pointY) {
    	int x = 0, y = 0;
    	if (poimiY == currentY && poimiX == currentX) {
    		if (pointX > absX) x = pointX - absX;
    		if (pointX < absX) x = absX - pointX;
    		if (pointY > absY) y = pointY - absY;
    		if (pointY < absY) y = absY - pointY;
    		if (x > 1 || y > 1 || x+y > 2) return false;
    		if (x == 1 || y == 0 || x + y == 1)
    			return true;
    	}
    	    return false;
    	}
    		
    	/**
    * Return true if distance between two points is less than or equal to
    * argument 'maxDistance"
    * @param x1,y1= the location of the first point
    * @param x2,y2= the location of the second point
    * @param maxDistance= the max distance the points can be apart 
    */
    /*
    	public boolean withinDistance(int x1, int y1, int x2, int y2, int maxDistance) {
    
    	double distanceBetweenPoints = Math.sqrt( (x1 -x2)^2 +(y1-y2)^2 );
    	return (maxDistance - distanceBetweenPoints)<=0;
    	}
    */
    
    
    	public void sendChatFrame(int Frame) {
    		outStream.createFrame(164);
    		outStream.writeWordBigEndian_dup(Frame);
    		flushOutStream();
    	}
    
    	public void sendFrame35(int i1, int i2, int i3, int i4){ /*Earthquake*/
    		outStream.createFrame(35);
    		outStream.writeByte(i1);
    		outStream.writeByte(i2);
    		outStream.writeByte(i3);
    		outStream.writeByte(i4);
    		updateRequired = true;
    		appearanceUpdateRequired = true;
    	}
    	
    	public void showInterface(int interfaceid){
                    resetEmote();
    		outStream.createFrame(97);
    		outStream.writeWord(interfaceid);
    		flushOutStream();
    	}
    	
    	public void removeAllWindows() {
    		outStream.createFrame(219);
    		flushOutStream();
    	}
    	
    	public void replaceObject(int x, int y, int typeID, int orientation, int tileObjectType){ //Makes Global objects
    	try{
    		for (Player p : server.playerHandler.players){ // creds to fedexer
    			if(p != null){
    				client person = (client)p;
    			if((person.playerName != null && person.playerName != "null")){
    					person.setObject(x, y, typeID, orientation, tileObjectType);
    
    				}
    			}
    		}
    		} catch (NullPointerException e) {}
    	}
    	
    	public void setObject(int objectX, int objectY, int NewObjectID, int Face, int ObjectType) {
    
    		outStream.createFrame(85);
    		outStream.writeByteC(objectY - (mapRegionY * 8));
    		outStream.writeByteC(objectX - (mapRegionX * 8));
    
    		outStream.createFrame(101);
    		outStream.writeByteC((ObjectType<<2) + (Face&3));
    		outStream.writeByte(0);
    
    		if (NewObjectID != -1) {
    			outStream.createFrame(151);
    			outStream.writeByteS(0);
    			outStream.writeWordBigEndian(NewObjectID);
    			outStream.writeByteS((ObjectType<<2) + (Face&3));
    			//FACE: 0= WEST | -1 = NORTH | -2 = EAST | -3 = SOUTH
    			//ObjectType: 0-3 wall objects, 4-8 wall decoration, 9: diag. walls, 10-11 world objects, 12-21: roofs, 22: floor decoration
    		}
    	}
    	
    	public void sendFrame246(int MainFrame, int SubFrame, int SubFrame2){
    		outStream.createFrame(246);
    		outStream.writeWordBigEndian(MainFrame);
    		outStream.writeWord(SubFrame);
    		outStream.writeWord(SubFrame2);
    		flushOutStream();
    	}
    	
    	public void sendWeapon(int Weapon) {
    		setSidebarInterface(0, 2423); //chop, slash, lunge, block
    		setImage(2424, 200, Weapon);
    		setLine(" "+weaponName, 2426);
    	}
    
    
    	public void sendGFX(int id, int X, int Y) //ANIMATIONS AT GROUND HEIGHT
    	{
    		outStream.createFrame(85);
    		outStream.writeByteC(Y - (mapRegionY * 8));
    		outStream.writeByteC(X - (mapRegionX * 8));
    		outStream.createFrame(4);
    		outStream.writeByte(0);//Tiles away (X >> 4 + Y & 7)
    		outStream.writeWord(id);//Graphic id
    		outStream.writeByte(0);//height of the spell above it's basic place, i think it's written in  pixels 100 pixels high
    		outStream.writeWord(0);//Time before casting the graphic
    	}
    	
    	
    	public void placeObject(int objectX, int objectY, int NewObjectID, int Face, int ObjectType) {
    		outStream.createFrame(85);
    		outStream.writeByteC(objectY - (mapRegionY * 8));
    		outStream.writeByteC(objectX - (mapRegionX * 8));
    
    		if (NewObjectID != -1) {
    			outStream.createFrame(151);
    			outStream.writeByteS(0);
    			outStream.writeWordBigEndian(NewObjectID);
    			outStream.writeByteS((ObjectType<<2) + (Face&3));
    		}
    	}
    	
    	public void setImage(int MainFrame, int SubFrame, int SubFrame2) {
    		outStream.createFrame(246);
    		outStream.writeWordBigEndian(MainFrame);
    		outStream.writeWord(SubFrame);
    		outStream.writeWord(SubFrame2);
    		flushOutStream();
    	}
    	
    	public void flashIcon(int iconID)
    	{
    		outStream.createFrame(24);
    		outStream.writeByteA(-iconID);
    	}
    	
    	public void sendMusic(int i1) // MUSIC by Xero!
    	{
    		outStream.createFrame(74);
    		outStream.writeWordBigEndian(i1);
    	}
    
    	public void sendSound(int i1) // Sound Effects By MissSilabSoft
    	{
    		outStream.createFrame(76);
    		outStream.writeWordBigEndian(i1);
    	}
    
    	public void setMiniMap(int i1) // makes minimap nonclickable etc. 0 = unlock  2 = black above 2 = locked - xerozcheez 
    	{ 
    		outStream.createFrame(99); 
    		outStream.writeByte(i1); 
    		sendMessage("Mini-map setting changed."); 
    		updateRequired = true; 
    	}
    
    	public void setLine(String lineContent, int lineID) {
    		outStream.createFrameVarSizeWord(126);
    		outStream.writeString(lineContent);
    		outStream.writeWordA(lineID);
    		outStream.endFrameVarSizeWord();
    		flushOutStream();
    	}
    Last edited by life is hopeless; 08-24-2007 at 02:44 AM. Reason: Double posting is not allowed!
     

  2. #2  
    Highclass Donator
    henry's Avatar
    Join Date
    Jul 2006
    Posts
    438
    Thanks given
    0
    Thanks received
    3
    Rep Power
    4
    Hmmm I never thought about doing the entire sleep, emote, sleep, emote thing. Very nicely done Byron

    Nobody, is looking in this thread though because of how you titled it, they don't give a **** about threading lol!!!
    Ex-Rune-Server Mod
    Ex-Vet (wtf?) (c)
     

  3. #3  
    Registered Member Amaran's Avatar
    Join Date
    Jun 2007
    Age
    28
    Posts
    67
    Thanks given
    0
    Thanks received
    0
    Rep Power
    23
    Ehh..picture would be nice
    ^
    Credits go to Wafflez
     

  4. #4  
    life is hopeless
    Guest
    Quote Originally Posted by Amaran View Post
    Ehh..picture would be nice
    how bout a vid?

    http://www.youtube.com/v/To-npUg8TJE
     

  5. #5  
    Highclass Donator
    henry's Avatar
    Join Date
    Jul 2006
    Posts
    438
    Thanks given
    0
    Thanks received
    3
    Rep Power
    4
    Dude I love your teleporting lol, its sooooo ****ing creative!
    Ex-Rune-Server Mod
    Ex-Vet (wtf?) (c)
     

  6. #6  
    life is hopeless
    Guest
    Quote Originally Posted by henry View Post
    Dude I love your teleporting lol, its sooooo ****ing creative!
    ill release that too
     


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. Replies: 30
    Last Post: 12-04-2010, 05:49 PM
  2. [C#] Multi-threaded event system
    By Synthesized Insanity in forum Snippets
    Replies: 8
    Last Post: 03-02-2010, 10:27 PM
  3. Multi threaded event system
    By Maxi in forum Snippets
    Replies: 19
    Last Post: 02-14-2010, 04:35 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
  •