Thread: Help Implementing DClaw Spec/Soul Split Sounds

Results 1 to 4 of 4
  1. #1 Help Implementing DClaw Spec/Soul Split Sounds 
    Registered Member
    Ebp90's Avatar
    Join Date
    Apr 2018
    Posts
    238
    Thanks given
    18
    Thanks received
    158
    Rep Power
    878
    Hi there, I am newer to coding and while I was able to figure out how to get NPCs/Items/Player to play a single sound, I cannot figure out what to do for things that have multiple sounds. I know many people probably don't care about sound effects, but I am just trying to make my own realistic 667 for personal nostalgic use. In this case, it's Soul Split and D Claw special attack. Soul Split has 3 sound files (8113, 8112, 8119) and Claws have 4 for each hit in the spec (7464, 7465, 7466, 7467)


    I have figured out where to put the Claw sound IDs, but in this case it only plays the first sound.

    Code:
    case 14484: // d claws
    			case 23695: // d claws
    				player.setNextAnimation(new Animation(10961));
    				player.setNextGraphics(new Graphics(1950));
    				int hit1 = getRandomMaxHit(player, weaponId, attackStyle,
    						false, true, 1.0, true); soundId = 7464; soundId = 7465; soundId = 7466; soundId = 7467;
    				int hit2 =  hit1 == 0 ? getRandomMaxHit(player, weaponId,
    						attackStyle,  false, true, 1.0, true) : hit1; 
    				if (hit1 == 0 && hit2 == 0) {
    					int hit3 = getRandomMaxHit(player, weaponId, attackStyle,
    							false, true, 1.0, true); 
    					if (hit3 == 0) {
    						int hit4 = getRandomMaxHit(player, weaponId,
    								attackStyle, false, true, 1.0, true); 
    						if (hit4 == 0) {
    							delayNormalHit(weaponId, attackStyle,
    									getMeleeHit(player, hit1),
    									getMeleeHit(player, hit2));
    							delayHit(1, weaponId, attackStyle,
    									getMeleeHit(player, hit3),
    									getMeleeHit(player, 1));
    						} else {
    							delayNormalHit(weaponId, attackStyle,
    									getMeleeHit(player, hit1),
    									getMeleeHit(player, hit2));
    							delayHit(1, weaponId, attackStyle,
    									getMeleeHit(player, hit3),
    									getMeleeHit(player, (int) (hit4 * 1.5)));
    						}
    					} else {
    						delayNormalHit(weaponId, attackStyle,
    								getMeleeHit(player, hit1),
    								getMeleeHit(player, hit2));
    						delayHit(1, weaponId, attackStyle,
    								getMeleeHit(player, hit3),
    								getMeleeHit(player, hit3));
    					}
    				} else {
    					delayNormalHit(weaponId, attackStyle,
    							getMeleeHit(player, hit1),
    							getMeleeHit(player, hit1 == 0 ? hit2 : hit2 / 2));
    					delayHit(
    							1,
    							weaponId,
    							attackStyle,
    							getMeleeHit(player, hit1 == 0 ? hit2 / 2 : hit2 / 4),
    							getMeleeHit(player, hit2 / 4));
    				}
    				break;  //a
    As for Soul Split, I am unsure exactly where to put the sound Id and how to make it play multiple sounds.

    I think it could be here in Player.java

    Code:
    }
    
    	public void sendSoulSplit(final Hit hit, final Entity user) {
    		final Player target = this;
    		if (hit.getDamage() > 0)
    			World.sendProjectile(user, this, 2263, 11, 11, 20, 5, 0, 0);
    		user.heal(hit.getDamage() / 5);
    		prayer.drainPrayer(hit.getDamage() / 5);
    		WorldTasksManager.schedule(new WorldTask() {
    			@Override
    			public void run() {
    				setNextGraphics(new Graphics(2264));
    				if (hit.getDamage() > 0)
    					World.sendProjectile(target, user, 2263, 11, 11, 20, 5, 0, 0);
    			}
    		}, 0);
    	}
    or here further down in Player.java


    Code:
    } else {
    					if (p2.prayer.usingPrayer(1, 18))
    						sendSoulSplit(hit, p2);
    					if (hit.getDamage() == 0)
    						return;

    Any help would be appreciated. Normally I can figure things out through trial and error, but in this case I am stumped.
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    May 2012
    Posts
    286
    Thanks given
    7
    Thanks received
    49
    Rep Power
    25
    Quote Originally Posted by GeneralReposti View Post
    soundId = 7464; soundId = 7465; soundId = 7466; soundId = 7467;
    You are setting the same soundId variable over and over again so the only id that will remain is 7467

    You'll need to do
    Code:
     playSound(soundId, player, target);
    for each hit, by default the PlayerCombat only plays one sound after it has sent the hit. You'll also need to delay the sounds so that they match up with the hits. For that there is a delay variable in the sendSound method in WorldPacketsEncoder
    Open Source 667 Divergent667
    Reply With Quote  
     

  3. #3  
    Registered Member
    Ebp90's Avatar
    Join Date
    Apr 2018
    Posts
    238
    Thanks given
    18
    Thanks received
    158
    Rep Power
    878
    Quote Originally Posted by juuuuu View Post
    You are setting the same soundId variable over and over again so the only id that will remain is 7467

    You'll need to do
    Code:
     playSound(soundId, player, target);
    for each hit, by default the PlayerCombat only plays one sound after it has sent the hit. You'll also need to delay the sounds so that they match up with the hits. For that there is a delay variable in the sendSound method in WorldPacketsEncoder
    Code:
     case 23695: // d claws
    				player.setNextAnimation(new Animation(10961));
    				player.setNextGraphics(new Graphics(1950));
    				int hit1 = getRandomMaxHit(player, weaponId, attackStyle,
    						false, true, 1.0, true);  playSound(7464, player, target); playSound(7465, player, target); playSound(7466, player, target); playSound(7467, player, target);		
    				int hit2 =  hit1 == 0 ? getRandomMaxHit(player, weaponId,
    						attackStyle,  false, true, 1.0, true)  : hit1;  
    				if (hit1 == 0 && hit2 == 0) {
    					int hit3 = getRandomMaxHit(player, weaponId, attackStyle,
    							false, true, 1.0, true); 
    					if (hit3 == 0) { 
    						int hit4 = getRandomMaxHit(player, weaponId,
    								attackStyle, false, true, 1.0, true); 
    						if (hit4 == 0) {
    							delayNormalHit(weaponId, attackStyle,
    									getMeleeHit(player, hit1),
    									getMeleeHit(player, hit2));
    							delayHit(1, weaponId, attackStyle,
    									getMeleeHit(player, hit3),
    									getMeleeHit(player, 1));
    						} else {
    							delayNormalHit(weaponId, attackStyle,
    									getMeleeHit(player, hit1),
    									getMeleeHit(player, hit2));
    							delayHit(1, weaponId, attackStyle,
    									getMeleeHit(player, hit3),
    									getMeleeHit(player, (int) (hit4 * 1.5)));
    						}
    					} else {
    						delayNormalHit(weaponId, attackStyle,
    								getMeleeHit(player, hit1),
    								getMeleeHit(player, hit2));
    						delayHit(1, weaponId, attackStyle,
    								getMeleeHit(player, hit3),
    								getMeleeHit(player, hit3));
    					}
    				} else {
    					delayNormalHit(weaponId, attackStyle,
    							getMeleeHit(player, hit1),
    							getMeleeHit(player, hit1 == 0 ? hit2 : hit2 / 2));
    					delayHit(
    							1,
    							weaponId,
    							attackStyle,
    							getMeleeHit(player, hit1 == 0 ? hit2 / 2 : hit2 / 4),
    							getMeleeHit(player, hit2 / 4));
    				}
    This is what the code looks like now, this plays the first and 2nd hit so I assume they are overlapping.

    As for things related to sound in WorldPacketsEncoder,

    Code:
     public void sendSound(int id, int delay, int effectType) {
    		if (effectType == 1)
    			sendIndex14Sound(id, delay);
    		else if (effectType == 2)
    			sendIndex15Sound(id, delay);
    
    	}
    
    	public void sendVoice(int id) {
    		resetSounds();
    		sendSound(id, 0, 2);
    	}
    
    	public void resetSounds() {
    		OutputStream stream = new OutputStream(1);
    		stream.writePacket(142);
    		session.write(stream);
    	}
    
    	public void sendIndex14Sound(int id, int delay) {
    		OutputStream stream = new OutputStream(9);
    		stream.writePacket(106);
    		stream.writeShort(id);
    		stream.writeByte(1);
    		stream.writeShort(delay);
    		stream.writeByte(255);
    		stream.writeShort(256);
    		session.write(stream);
    	}
    
    	public void sendIndex15Sound(int id, int delay) {
    		OutputStream stream = new OutputStream(7);
    		stream.writePacket(121);
    		stream.writeShort(id);
    		stream.writeByte(1); // amt of times it repeats
    		stream.writeShort(delay);
    		stream.writeByte(255); // volume
    		session.write(stream);
    	}
    I am unsure which one is the delay variable or where to identify the sound files I want to delay
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    May 2012
    Posts
    286
    Thanks given
    7
    Thanks received
    49
    Rep Power
    25
    Quote Originally Posted by GeneralReposti View Post
    Code:
     case 23695: // d claws
    				player.setNextAnimation(new Animation(10961));
    				player.setNextGraphics(new Graphics(1950));
    				int hit1 = getRandomMaxHit(player, weaponId, attackStyle,
    						false, true, 1.0, true);  playSound(7464, player, target); playSound(7465, player, target); playSound(7466, player, target); playSound(7467, player, target);		
    				int hit2 =  hit1 == 0 ? getRandomMaxHit(player, weaponId,
    						attackStyle,  false, true, 1.0, true)  : hit1;  
    				if (hit1 == 0 && hit2 == 0) {
    					int hit3 = getRandomMaxHit(player, weaponId, attackStyle,
    							false, true, 1.0, true); 
    					if (hit3 == 0) { 
    						int hit4 = getRandomMaxHit(player, weaponId,
    								attackStyle, false, true, 1.0, true); 
    						if (hit4 == 0) {
    							delayNormalHit(weaponId, attackStyle,
    									getMeleeHit(player, hit1),
    									getMeleeHit(player, hit2));
    							delayHit(1, weaponId, attackStyle,
    									getMeleeHit(player, hit3),
    									getMeleeHit(player, 1));
    						} else {
    							delayNormalHit(weaponId, attackStyle,
    									getMeleeHit(player, hit1),
    									getMeleeHit(player, hit2));
    							delayHit(1, weaponId, attackStyle,
    									getMeleeHit(player, hit3),
    									getMeleeHit(player, (int) (hit4 * 1.5)));
    						}
    					} else {
    						delayNormalHit(weaponId, attackStyle,
    								getMeleeHit(player, hit1),
    								getMeleeHit(player, hit2));
    						delayHit(1, weaponId, attackStyle,
    								getMeleeHit(player, hit3),
    								getMeleeHit(player, hit3));
    					}
    				} else {
    					delayNormalHit(weaponId, attackStyle,
    							getMeleeHit(player, hit1),
    							getMeleeHit(player, hit1 == 0 ? hit2 : hit2 / 2));
    					delayHit(
    							1,
    							weaponId,
    							attackStyle,
    							getMeleeHit(player, hit1 == 0 ? hit2 / 2 : hit2 / 4),
    							getMeleeHit(player, hit2 / 4));
    				}
    This is what the code looks like now, this plays the first and 2nd hit so I assume they are overlapping.

    As for things related to sound in WorldPacketsEncoder,

    Code:
     public void sendSound(int id, int delay, int effectType) {
    		if (effectType == 1)
    			sendIndex14Sound(id, delay);
    		else if (effectType == 2)
    			sendIndex15Sound(id, delay);
    
    	}
    
    	public void sendVoice(int id) {
    		resetSounds();
    		sendSound(id, 0, 2);
    	}
    
    	public void resetSounds() {
    		OutputStream stream = new OutputStream(1);
    		stream.writePacket(142);
    		session.write(stream);
    	}
    
    	public void sendIndex14Sound(int id, int delay) {
    		OutputStream stream = new OutputStream(9);
    		stream.writePacket(106);
    		stream.writeShort(id);
    		stream.writeByte(1);
    		stream.writeShort(delay);
    		stream.writeByte(255);
    		stream.writeShort(256);
    		session.write(stream);
    	}
    
    	public void sendIndex15Sound(int id, int delay) {
    		OutputStream stream = new OutputStream(7);
    		stream.writePacket(121);
    		stream.writeShort(id);
    		stream.writeByte(1); // amt of times it repeats
    		stream.writeShort(delay);
    		stream.writeByte(255); // volume
    		session.write(stream);
    	}
    I am unsure which one is the delay variable or where to identify the sound files I want to delay
    If you look at the playSound method in your PlayerCombat class you can see the delay there, the 2nd variable that is currently zero. You can write an alternative method that takes the delay as a parameter and replace the zero with that parameter
    Open Source 667 Divergent667
    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. Help please with dclaws spec
    By phonesout123 in forum Help
    Replies: 3
    Last Post: 04-18-2012, 01:46 PM
  2. Soul split HELP
    By Kissy in forum Help
    Replies: 4
    Last Post: 11-20-2011, 06:37 PM
  3. Replies: 4
    Last Post: 03-13-2011, 04:06 AM
  4. Hybrid PvP v2 Soul Split help
    By Defiled-X in forum Help
    Replies: 2
    Last Post: 03-05-2011, 12:30 AM
  5. Soul Split Help - [PI] [10$]
    By HiImRusty in forum Help
    Replies: 14
    Last Post: 01-23-2011, 04:38 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
  •