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.
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