Jump to content
  • 0

custom Script for BlowSound


Question

Posted

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

  • 0
Posted

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
Posted

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
Posted (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 by Tryskell
  • 0
Posted (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-

Edited by etherian
  • 0
Posted (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 by etherian
Guest
This topic is now closed to further replies.


  • Posts

    • https://prnt.sc/Bkkc0ShGXv9m https://prnt.sc/-JFLvZXsn27A
    • Hello guys want to sell adena in L2 Reborn Signature x1  Stock =14kk good price 
    • Hi guys, I have the following problem, I want to set up two servers on the same dedicated server and I can't.   L2jacis 409 Linux Server. The first gameserver has the following configuration: # ================================================================ # Gameserver setting # ================================================================ # This is transmitted to the clients, so it has to be an IP or resolvable hostname. If this ip is resolvable by Login just leave * Hostname = 190.25.103.103 # Bind ip of the gameserver, use * to bind on all available IPs. GameserverHostname = * GameserverPort = 7777 # The Loginserver host and port. LoginHost = 127.0.0.1 LoginPort = 9014 # This is the server id that the gameserver will request. RequestServerID = 1 # If set to true, the login will give an other id to the server (if the requested id is already reserved). AcceptAlternateID = True UseBlowfishCipher = True # ================================================================ # Database informations # ================================================================ URL = jdbc:mariadb://localhost/server1 Login = server1 Password = server1 I configured the second gameserver like this:   # ================================================================ # Gameserver setting # ================================================================ # This is transmitted to the clients, so it has to be an IP or resolvable hostname. If this ip is resolvable by Login just leave * Hostname = 0.0.0.0 # Bind ip of the gameserver, use * to bind on all available IPs. GameserverHostname = * GameserverPort = 7788 # The Loginserver host and port. LoginHost = 127.0.0.1 LoginPort = 9014 # This is the server id that the gameserver will request. RequestServerID = 2 # If set to true, the login will give an other id to the server (if the requested id is already reserved). AcceptAlternateID = True UseBlowfishCipher = True # ================================================================ # Database informations # ================================================================ URL = jdbc:mariadb://localhost/server2 Login = server2 Password = server2 apart from having tested 0.0.0.0 on the second gameserver I also tried 127.0.0.1 In both cases I see the two servers in the login when I log in, but I try to enter the one with the lowest ping and it kicks me out. The other server always appears with ping 9999 and I try to enter but it doesn't do anything and it freezes the login so I have to log in again. The hexids are in their respective folders. For server 1, it has its hexid inside the gameserver config folder, and I checked that the hexid id is the same id, for example id 1 in the gameserver is also id1 for server 1, and hexid 2 has its hexid 2 for server 2. The server ports are open and listening when I turn on both gameservers. I really don't know what could be wrong. If you could give me some help I would appreciate it. Excuse my English.
    • We have both old channels from 2006-2009 with the 3rd verification function enabled, and new ones.   For availability, please contact us below: Link - Telegram Link - Facebook WhatsApp - Click here to go to WhatsApp chat
    • You can contact me on skype: niedziolek50
  • Topics

×
×
  • Create New...