etherian Posted March 22, 2019 Posted March 22, 2019 if someone is interested i was thinking to test this but im not sure if it can be outside FatalBlow.Java i created BlowSound.Java data\scripts\custom but i know im missing something it stills gives errors everyone is welcome to workaround with this i used the example of pirama to begin package custom; import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.serverpackets.PlaySound; public final class BlowSound { if (activeChar.isPlayer()) { L2PcInstance activePlayer = activeChar.getActingPlayer(); activePlayer.sendDamageMessage(target, (int) damage, false, crit, false); activeChar.sendPacket(new PlaySound("skillsound.critical_hit_02")); } } } laters
0 Tryskell Posted March 22, 2019 Posted March 22, 2019 http://www.l2jserver.com/forum/viewtopic.php?f=90&t=23583 Point 3.
0 etherian Posted March 22, 2019 Author Posted March 22, 2019 so is different of what im trying to do my ideas was to add in the skill mortal blow <for> <effect name="FatalBlow" /> <effect name="BlowSound" /> </for> and then call the sound in BlowSound.java as custom script later i was wondering if it can be done like if critical hit PlaySound("skillsound.critical_hit_02")); i dont get why they did it as MagicSkillUse well perhaps im trying to do this in High Five JLisvus implemented it but is for C4 and it works will keep looking how to solve it thnx for the info Tryskell
0 etherian Posted March 22, 2019 Author Posted March 22, 2019 for example JFrozen have done the fix inside the core Formulas.calcLethalHit(activeChar, target, skill); PlaySound PlaySound = new PlaySound("skillsound.critical_hit_02"); activeChar.sendPacket(PlaySound); now im dizzy it is a bad way to redone this by custom script isnt it ? will be calling a lag each time the script is executed? i tryed to make something like this in the high five pack of l2devs but still import com.l2jserver.gameserver.network.serverpackets.PlaySound; if (activeChar.isPlayer()) { L2PcInstance activePlayer = activeChar.getActingPlayer(); activePlayer.sendDamageMessage(target, (int) damage, false, crit, false); PlaySound playSound = new PlaySound("skillsound.critical_hit_02"); activeChar.sendPacket(playSound); } ERROR in C:\L2JDevs\game\data\scripts\handlers\effecthandlers\instant\FatalBlow.java (at line 113) PlaySound playSound = new PlaySound("skillsound.critical_hit_02"); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The constructor PlaySound(String) is not visible no matter how much i change the ways there is always a error regarding playsound i also compiled from Jserver git repo a fresh build but it happens the same
0 Tryskell Posted March 22, 2019 Posted March 22, 2019 (edited) Using PlaySound is bad, with a script (or adding a new effect for it) is simply overkill. It got nothing to do with lag/performance (even if you save ressources simply tagging a boolean to true instead of creating new effects), it's simply ugly. One packet (which is already sent, btw) is supposed to do the job - that's how NCSoft decided to do it, no really need to argue about it, that's what the client understands - simply put the boolean to true to get a sound. The constructor you try to use is now private, check PlaySound packet uses to see the correct writting style (not sure why they used static approach, since a new PlaySound is anyway generated). Since the amount of skills is really low, you can simply hardcode it. Past in the time, I figured out than some skills launched status as 0, 1, 2 - so it can't be resolved by a simply boolean, and L2JFrozen fix isn't even complete (so it is both clunky AND incomplete). Edited March 22, 2019 by Tryskell
0 etherian Posted March 23, 2019 Author Posted March 23, 2019 (edited) public final class MagicSkillUse extends L2GameServerPacket { private final int _skillId; private final int _skillLevel; private final int _hitTime; private final int _reuseDelay; private final L2Character _activeChar; private final L2Character _target; // private final List<Integer> _unknown = Collections.emptyList(); private boolean _success = false; private final List<Location> _groundLocations; public MagicSkillUse(L2Character cha, L2Character target, int skillId, int skillLevel, int hitTime, int reuseDelay, boolean crit) { this(cha, target, skillId, skillLevel, hitTime, reuseDelay); _success = crit; } public MagicSkillUse(L2Character cha, L2Character target, int skillId, int skillLevel, int hitTime, int reuseDelay) { _activeChar = cha; _target = target; _skillId = skillId; _skillLevel = skillLevel; _hitTime = hitTime; _reuseDelay = reuseDelay; _groundLocations = cha.isPlayer() && (cha.getActingPlayer().getCurrentSkillWorldPosition() != null) ? Arrays.asList(cha.getActingPlayer().getCurrentSkillWorldPosition()) : Collections.<Location> emptyList(); } public MagicSkillUse(L2Character cha, int skillId, int skillLevel, int hitTime, int reuseDelay) { this(cha, cha, skillId, skillLevel, hitTime, reuseDelay); } @Override protected final void writeImpl() { writeC(0x48); writeD(_activeChar.getObjectId()); writeD(_target.getObjectId()); writeD(_skillId); writeD(_skillLevel); writeD(_hitTime); writeD(_reuseDelay); writeLoc(_activeChar); // writeH(_unknown.size()); // TODO: Implement me! // for (int unknown : _unknown) // { // writeH(unknown); // } if (_success) { writeD(0x01); writeH(0x00); } else { writeD(0x00); } writeH(_groundLocations.size()); for (IPositionable target : _groundLocations) { writeLoc(target); } writeLoc(_target); } } ShinichiYao posted this code in l2jserver bitbucket so i guess must start looking to make with this then perhaps in the same post Sdw- https://bitbucket.org/l2jserver/l2j_server/src/775bcf917d84c47c3a13073df122204a463a8527/src/main/java/com/l2jserver/gameserver/network/serverpackets/MagicSkillUse.java?at=develop&fileviewer=file-view-default#MagicSkillUse.java-71 if crit, set 2 here https://bitbucket.org/l2jserver/l2j_server/src/775bcf917d84c47c3a13073df122204a463a8527/src/main/java/com/l2jserver/gameserver/network/serverpackets/MagicSkillUse.java?at=develop&fileviewer=file-view-default#MagicSkillUse.java-74 change value to 0, it never changes You're done. Edited March 23, 2019 by etherian
0 etherian Posted May 10, 2019 Author Posted May 10, 2019 (edited) can close topic resolved in a dirty way modification if (crit) { damage *= 2; } effector.doAttack(damage, effected, skill, false, false, true, false); effector.sendPacket(new PlaySound("skillsound.critical_hit_02")); } } original file https://bitbucket.org/MobiusDev/l2j_mobius/src/master/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/FatalBlow.java laters ppl Edited May 10, 2019 by etherian
Question
etherian
if someone is interested
i was thinking to test this
but im not sure if it can be outside FatalBlow.Java
i created BlowSound.Java
data\scripts\custom
but i know im missing something
it stills gives errors
everyone is welcome to workaround with this
i used the example of pirama to begin
package custom;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.PlaySound;
public final class BlowSound
{
if (activeChar.isPlayer())
{
L2PcInstance activePlayer = activeChar.getActingPlayer();
activePlayer.sendDamageMessage(target, (int) damage, false, crit, false);
activeChar.sendPacket(new PlaySound("skillsound.critical_hit_02"));
}
}
}
laters
7 answers to this question
Recommended Posts