Help for skill spoil please

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
kurtspirit
Posts: 411
Joined: Thu Mar 12, 2009 8:20 pm
Location: Toulouse, France

Help for skill spoil please

Post by kurtspirit »

If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision Number:
L2JDP Revision Number:

Hi all,
On my serv, i would like to activate a message for the spoil :
in basic server , when you spoil a mob, you have a message on chatboard who say : spoil activated.
Me , i want to have a message in game above the mob . A message like : Spoil Activated !! I know it's possible to do that beacause i have see this on another server. Can you help me please ?
I think the modification is here :

Code: Select all

public class Spoil implements ISkillHandler{    private static final L2SkillType[] SKILL_IDS =    {        L2SkillType.SPOIL    };        /**     *      * @see net.sf.l2j.gameserver.handler.ISkillHandler#useSkill(net.sf.l2j.gameserver.model.actor.L2Character, net.sf.l2j.gameserver.model.L2Skill, net.sf.l2j.gameserver.model.L2Object[])     */    public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)    {        if (!(activeChar instanceof L2PcInstance))            return;                if (targets == null)            return;                for (L2Object tgt: targets)        {            if (!(tgt instanceof L2MonsterInstance))                continue;                        L2MonsterInstance target = (L2MonsterInstance) tgt;                        if (target.isSpoil())            {                activeChar.sendPacket(new SystemMessage(SystemMessageId.ALREADY_SPOILED));                continue;            }                        // SPOIL SYSTEM by Lbaldi            boolean spoil = false;            if (target.isDead() == false)            {                spoil = Formulas.calcMagicSuccess(activeChar, (L2Character) tgt, skill);                                if (spoil)                {                    target.setSpoil(true);                    target.setIsSpoiledBy(activeChar.getObjectId());                    activeChar.sendPacket(new SystemMessage(SystemMessageId.SPOIL_SUCCESS));                }                else                {                    SystemMessage sm = new SystemMessage(SystemMessageId.S1_WAS_UNAFFECTED_BY_S2);                    sm.addCharName(target);                    sm.addSkillName(skill);                    activeChar.sendPacket(sm);                }                target.getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, activeChar);            }        }    }        /**     *      * @see net.sf.l2j.gameserver.handler.ISkillHandler#getSkillIds()     */    public L2SkillType[] getSkillIds()    {        return SKILL_IDS;    }}
kurtspirit
Posts: 411
Joined: Thu Mar 12, 2009 8:20 pm
Location: Toulouse, France

Re: Help for skill spoil please

Post by kurtspirit »

Nobody can help me for that ? I think i must add a value here :
target.setIsSpoiledBy(activeChar.getObjectId());
activeChar.sendPacket(new SystemMessage(SystemMessageId.SPOIL_SUCCESS));

but i'm not sure .. Please help me ^^ Thanks
User avatar
Bloodshed
L2j Veteran
L2j Veteran
Posts: 816
Joined: Mon Jun 23, 2008 9:54 am
Location: Dorf Town

Re: Help for skill spoil please

Post by Bloodshed »

i dont know if you modify it here (http://www.l2jdp.com/trac/browser/trunk ... temmsg.txt) if it will change on client :|
taking a break;
User avatar
DrHouse
L2j Inner Circle
L2j Inner Circle
Posts: 912
Joined: Mon Jan 22, 2007 12:14 am
Location: Spain

Re: Help for skill spoil please

Post by DrHouse »

Maybe you need that the mob itself says that message. For that, just broadcast a new CreatureSay packet with the message
Image

Leadership and management are not talk and talk, but talk and do

Proud of being a part of this project
kurtspirit
Posts: 411
Joined: Thu Mar 12, 2009 8:20 pm
Location: Toulouse, France

Re: Help for skill spoil please

Post by kurtspirit »

Bloodshed wrote:i dont know if you modify it here (http://www.l2jdp.com/trac/browser/trunk ... temmsg.txt) if it will change on client :|
i don't think, if i touch this, it's just another message. Me i want to add a message when spoil is activate who say on screen (not on tchat) SPOIL ACTIVATED! . I think it's a simple add on java but i don"t know how write this on java language.. It's just a system message with spoil activate condition (i think..)
Maybe you need that the mob itself says that message. For that, just broadcast a new CreatureSay packet with the message
If the mob say this, it allways be in the tchat no ?
Sorry for my bad english. Thank you for your contribution , if somebody have an idea for my request ^^ Thank

PS : if you want, i can take a screenshot IG with the message.. If that can help for see what i want to do
InShadow
Posts: 12
Joined: Sun Sep 09, 2007 3:49 pm

Re: Help for skill spoil please

Post by InShadow »

You can always send CreatureSay packet only to player who spoiled the mob, so he will be the only one to see the mob say smth in chat. Additionally, you can use ExShowScreenMessage packet and show the message on the screen, again, only to the player who spoiled the mob, or maybe his party, etc...
Examples (not completed):
activeChar.sendPacket(new CreatureSay (...));
activeChar.sendPacket(new ExShowScreenMessage (...));
kurtspirit
Posts: 411
Joined: Thu Mar 12, 2009 8:20 pm
Location: Toulouse, France

Re: Help for skill spoil please

Post by kurtspirit »

InShadow wrote:You can always send CreatureSay packet only to player who spoiled the mob, so he will be the only one to see the mob say smth in chat. Additionally, you can use ExShowScreenMessage packet and show the message on the screen, again, only to the player who spoiled the mob, or maybe his party, etc...
Examples (not completed):
activeChar.sendPacket(new CreatureSay (...));
activeChar.sendPacket(new ExShowScreenMessage (...));
I think it's your second solution ! So il add on script :
activeChar.sendPacket(new ExShowScreenMessage (Spoil.Activated!));

That 's allright? Thank you so much !
kurtspirit
Posts: 411
Joined: Thu Mar 12, 2009 8:20 pm
Location: Toulouse, France

Re: Help for skill spoil please

Post by kurtspirit »

So, i have done the modification but i have 2 errors :
This is the code after modification :

Code: Select all

        for (L2Object tgt: targets)        {            if (!(tgt instanceof L2MonsterInstance))                continue;                        L2MonsterInstance target = (L2MonsterInstance) tgt;                        if (target.isSpoil())            {                activeChar.sendPacket(new ExShowScreenMessage(Spoil_Activated));                activeChar.sendPacket(new SystemMessage(SystemMessageId.ALREADY_SPOILED));                continue;            }


and the errors :

Code: Select all

    1. ERROR in C:\serv new\gameserver\data\scripts\handlers\skillhandlers\Spoil.java (at line 61)        activeChar.sendPacket(new ExShowScreenMessage(Spoil_Activated));                                  ^^^^^^^^^^^^^^^^^^^ExShowScreenMessage cannot be resolved to a type----------2. ERROR in C:\serv new\gameserver\data\scripts\handlers\skillhandlers\Spoil.java (at line 61)        activeChar.sendPacket(new ExShowScreenMessage(Spoil_Activated));                                                      ^^^^^^^^^^^^^^^Spoil_Activated cannot be resolved
I think i don't write correctly .. Can you help me again ? thank you


EDIT :
I resolve the second problem. I just do a modification on SystemMessageID.java , and now i rewrite code like this on Spoil.java :

Code: Select all

            // SPOIL SYSTEM by Lbaldi            boolean spoil = false;            if (target.isDead() == false)            {                spoil = Formulas.calcMagicSuccess(activeChar, (L2Character) tgt, skill);                                if (spoil)                {                    target.setSpoil(true);                    target.setIsSpoiledBy(activeChar.getObjectId());                    activeChar.sendPacket(new ExShowScreenMessage(SystemMessageId.SPOIL_SUCCESS));                }                else                {                    SystemMessage sm = new SystemMessage(SystemMessageId.S1_WAS_UNAFFECTED_BY_S2);                    sm.addCharName(target);                    sm.addSkillName(skill);                    activeChar.sendPacket(sm);
But i have allways the same errors who said ExShowScreenMessage cannot be resolve to a type..
So if you have any idea.. Thank you
User avatar
janiii
L2j Veteran
L2j Veteran
Posts: 4269
Joined: Wed May 28, 2008 3:15 pm
Location: Slovakia

Re: Help for skill spoil please

Post by janiii »

in the head of the file, there are lines that begin with import.
add this line there:

Code: Select all

import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage;
DO NOT EVEN TRY TO MESS WITH ME!
forum flOOder dancing dEVILoper
I don't give private support - PM will be ignored!
kurtspirit
Posts: 411
Joined: Thu Mar 12, 2009 8:20 pm
Location: Toulouse, France

Re: Help for skill spoil please

Post by kurtspirit »

Yes! Thank you ! But now i have one more problem :
1. ERROR in C:\serv new\gameserver\data\scripts\handlers\skillhandlers\Spoil.jav
a (at line 76)
activeChar.sendPacket(new ExShowScreenMessage(SystemMessageId.SPOIL_SUCC
ESS));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^
The constructor ExShowScreenMessage(SystemMessageId) is undefined
----------
1 problem (1 error)The constructor net.sf.l2j.gameserver.network.serverpackets.E
xShowScreenMessage(net.sf.l2j.gameserver.network.SystemMessageId) is undefined
Failed executing script: C:\serv new\gameserver\data\scripts\handlers\MasterHand
ler.java. See MasterHandler.java.error.log for details.
It's really hard to understand this language :/ All the time problems .. I think here , the problem is uncompatibility between ExShowScreenMessage and SystemMessageId right ? Thanks

EDIT :
I try another method . I write code like this :

Code: Select all

    if (spoil)                {                    target.setSpoil(true);                    target.setIsSpoiledBy(activeChar.getObjectId());                    activeChar.sendPacket(new ExShowScreenMessage(Spoil Active));
And i have many error again. I don't understand what's the good syntax for ExShowScreenMessage... Is it someone know that? thank's again
Last edited by kurtspirit on Mon Apr 20, 2009 4:16 pm, edited 1 time in total.
User avatar
janiii
L2j Veteran
L2j Veteran
Posts: 4269
Joined: Wed May 28, 2008 3:15 pm
Location: Slovakia

Re: Help for skill spoil please

Post by janiii »

no, you just can't do anything you want. you can only do what the code has.
DO NOT EVEN TRY TO MESS WITH ME!
forum flOOder dancing dEVILoper
I don't give private support - PM will be ignored!
kurtspirit
Posts: 411
Joined: Thu Mar 12, 2009 8:20 pm
Location: Toulouse, France

Re: Help for skill spoil please

Post by kurtspirit »

janiii wrote:no, you just can't do anything you want. you can only do what the code has.
I have looking on exshowscreenmessage file and i have that :
public class ExShowScreenMessage extends L2GameServerPacket

Code: Select all

{    private int _type;    private int _sysMessageId;    private int _unk1;    private int _unk2;    private int _unk3;    private int _unk4;    private int _size;    private int _position;    private boolean _effect;    private String _text;    private int _time;     public ExShowScreenMessage (String text, int time)    {        _type = 1;        _sysMessageId = -1;        _unk1 = 0;        _unk2 = 0;        _unk3 = 0;        _unk4 = 0;        _position = 0x02;        _text = text;        _time = time;        _size = 0;        _effect = false;    }     public ExShowScreenMessage (int type, int messageId, int position, int unk1, int size, int unk2, int unk3,boolean showEffect, int time,int unk4, String text)    {        _type = type;        _sysMessageId = messageId;        _unk1 = unk1;        _unk2 = unk2;        _unk3 = unk3;        _unk4 = unk4;        _position = position;        _text = text;        _time = time;        _size = size;        _effect = showEffect;    }        @Override    public String getType()    {        return "[S]FE:39 ExShowScreenMessage";    }     @Override    protected void writeImpl()    {        writeC(0xfe);        writeH(0x39);        writeD(_type); // 0 - system messages, 1 - your defined text        writeD(_sysMessageId); // system message id (_type must be 0 otherwise no effect)        writeD(_position); // message position        writeD(_unk1); // ?        writeD(_size); // font size 0 - normal, 1 - small        writeD(_unk2); // ?        writeD(_unk3); // ?         writeD(_effect == true ? 1 : 0); // upper effect (0 - disabled, 1 enabled) - _position must be 2 (center) otherwise no effect        writeD(_time); // time        writeD(_unk4); // ?        writeS(_text); // your text (_type must be 1, otherwise no effect)
I try to understand how i can write a valid screen message but i really understand nothing on .. So have you a good example for that please?
User avatar
janiii
L2j Veteran
L2j Veteran
Posts: 4269
Joined: Wed May 28, 2008 3:15 pm
Location: Slovakia

Re: Help for skill spoil please

Post by janiii »

you can see that one:

Code: Select all

public ExShowScreenMessage (String text, int time)
that means, that if you want to make a ExShowScreenMessage, you need to give him a string (a text between "") and a number which is the time in seconds the message will show up.

so, e.g.:

Code: Select all

activeChar.sendPacket(new ExShowScreenMessage("Spoil activated", 5));
DO NOT EVEN TRY TO MESS WITH ME!
forum flOOder dancing dEVILoper
I don't give private support - PM will be ignored!
kurtspirit
Posts: 411
Joined: Thu Mar 12, 2009 8:20 pm
Location: Toulouse, France

Re: Help for skill spoil please

Post by kurtspirit »

Ok thank you !!! It's working ! only time is really strange, if i write 5 seconds, the message show only 1 second (maybe is the lag of serv??) so i will adjust time, but all is ok now ! Thank you really much ^^
EDIT: Arg! I think it have one more problem :/ Time is not adjustable.. You can write 5 or 100 second, the message on screen stay 1 second max.. I will be crazy !

RE EDIT : It's ok, for a good time , you must write : 500 :) Thank you again
KARAKAN
Posts: 74
Joined: Thu May 04, 2006 11:31 am

Re: Help for skill spoil please

Post by KARAKAN »

kurtspirit can you share your finished code ? :)
Post Reply