Jump to content
  • 0

Help With Enterworld Add Skill


Question

Posted

Hello , i am trying to make a code in order if a player has one Item in inventory to get one active/passive skill without equip the item.


What i should put in enterworld?

if (activeChar.getInventory().getItemByItemId(example) ??????

Recommended Posts

  • 0
Posted

Kanw mia dokimh me ayto ala den kserw pos na to kano to !=null na diabazei oti ean uparxei 1 tetio item sto inventory

 

       if (activeChar.getInventory().getItemByItemId(9819) != null)
        {
            L2Skill skill = SkillTable.getInstance().getInfo(294, 1);
            if (skill != null && activeChar.getSkillLevel(294) == 1)
            {
                if (GameTimeController.getInstance().isNowNight())
                {
                    SystemMessage sm = new SystemMessage(SystemMessageId.NIGHT_EFFECT_S1_APPLIES);
                    sm.addSkillName(294);
                    sendPacket(sm);
                }
                else
                {
                    SystemMessage sm = new SystemMessage(SystemMessageId.DAY_EFFECT_S1_DISAPPEARS);
                    sm.addSkillName(294);
                    sendPacket(sm);
                }
            }
        }  

  • 0
Posted (edited)


       if (activeChar.getInventory().getItemByItemId(9819) != null)

        {

            final L2Skill skill = SkillTable.getInstance().getInfo(294, 1);

            if (skill != null && activeChar.getSkillLevel(294) == 1)

            {

                if (GameTimeController.getInstance().isNowNight())

                {

                    final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.NIGHT_EFFECT_APPLIES);

                    sm.addSkillName(294);

                    sendPacket(sm);

                }

                else

                {

                    final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.DAY_EFFECT_DISAPPEARS);

                    sm.addSkillName(294);

                    sendPacket(sm);

                }

            }

        

 

Edited by ⏇Melron⏇℠Abs
  • 0
Posted

And where is the add skill logic? You only check of you have item and skill atm, if item and skill found, send msg.

  • 0
Posted

And where is the add skill logic? You only check of you have item and skill atm, if item and skill found, send msg.

he just want to take buff in enter not add skill  :happyforever:

  • 0
Posted (edited)

he just want to take buff in enter not add skill   :happyforever:

 

if a player has one Item in inventory to get one active/passive skill

And topic title "add skill", so he should make up him minds.

 

The code above first check for item, then check for skill level (why the heck check for level..). If skill found -> send msg as I said before. There is nothing about add/give/take skill/buff. That's my point.

Edited by SweeTs
  • 0
Posted (edited)

 

 

And topic title "add skill", so he should make up him minds.

 

The code above first check for item, then check for skill level (why the heck check for level..). If skill found -> send msg as I said before. There is nothing about add/give/take skill/buff. That's my point.

 

Yeah u right. i think he just wanna find how to do the check for the item ...

 

cause he saw a few lines before :

 

if (activeChar.getRace().ordinal() == 2)
{
final L2Skill skill = SkillTable.getInstance().getInfo(294, 1);
if (skill != null && activeChar.getSkillLevel(294) == 1)
{
if (GameTimeController.getInstance().isNowNight())
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.NIGHT_EFFECT_APPLIES);
sm.addSkillName(294);
sendPacket(sm);
}
else
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.DAY_EFFECT_DISAPPEARS);
sm.addSkillName(294);
sendPacket(sm);
}
}
Edited by ⏇Melron⏇℠Abs
  • 0
Posted

This better than above shit.

http://pastebin.com/RT2bJr58 Add your night/day check.

 

This for EnterWorld.java

CustomItemSkill Item = new CustomItemSkill();
Item.CustomItem(activeChar);
 
If you need Buff and not a skill
L2Skill noblesse = SkillTable.getInstance().getInfo(1323, 1);
 
 
  • 0
Posted (edited)

This better than above shit..

Sorry, but nop. Also the logic/code is bad  :dat:

Edited by SweeTs
  • 0
Posted (edited)

Sorry, but nop. :dat:

Why not?

because I have new file? it is not 2 lines code. He need race check as I see. Like: if (activeChar.getRace().ordinal() == 2

and Night/Day check.

 

or this is better?

sm.addSkillName(294);  :dat: 

The code will be more than "2 lines" like you said.

Edited by 'Baggos'
  • 0
Posted (edited)

- It's not the code he want to add, it's just an code example he found inside EnterWorld, which could be reduced to 2 lines, btw.

- Yeah, there is no point for new file, since it's like 5 lines code, with brackets. If you want 'external' method, simply create new method inside the class, but not new file, lol.

if (activeChar.getInventory().getItemByItemId(57) != null)
{
     activeChar.addSkill(SkillTable.getInstance().getInfo(1323, 1), false);
     activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(1323));
}
Edited by SweeTs
  • 0
Posted (edited)

 

- It's not the code he want to add, it's just an code example he found inside EnterWorld, which could be reduced to 2 lines, btw.

- Yeah, there is no point for new file, since it's like 5 lines code, with brackets. If you want 'external' method, simply create new method inside the class, but not new file, lol.

if (activeChar.getInventory().getItemByItemId(57) != null)
{
     activeChar.addSkill(SkillTable.getInstance().getInfo(1323, 1), false);
     activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(1323));
}

Thanks dude that was excactly what i wanted!

 

One Question in add skill  ,false=?  what false does?

Edited by GameBlonD
  • 0
Posted (edited)

 in add skill  ,false=?  what false does?

 

Also

I want to add some additions

I tried to send the message in party chat  but with this code the message goes

 

 String name = activeChar.getName();

activeChar.sendPacket(new CreatureSay(0, Say2.PARTY, name, "Skill Enabled"));
Player name: Skill Enabled

How it can be like this:
System: Skill Enabled
 

Edited by GameBlonD
  • 0
Posted

false means the skill is NOT gonna be saved to the database. Skill is gone when you restart. Add activeChar.sendMessage("System: Skill enabled."); else you can use CreatureSay as in your example.

Guest
This topic is now closed to further replies.
  • Posts

    • You should buy it then I’ll make a discount  
    • Hi everyone,   In 2014, I completely stepped away from developing L2 servers and doing L2J-related work. Since then, I’ve only opened this server about once a year and helped a few servers and individuals for free. I haven’t taken on any paid L2J work since then.   LINEAGE2.GOLD is a project that has reached about Season 6. The first season launched at the end of 2020 and was a fully rebuilt Gold-style server on the Classic client (protocol 110). It featured many custom systems and enhancements. After several seasons, I decided to abandon the Mobius-based project and move to Lucera, as my goal was to get as close as possible to Interlude PTS behavior while still staying on the L2J platform.   The current project was once again completely rebuilt, this time on the Essence client (protocol 306), and is based on Lucera. Because of that, acquiring a license from Deazer is required.   My Lucera extender includes, but is not limited to: Formulas.java Basic anti-bot detection, which proved quite effective, we caught most Adrenaline users using relatively simple server-side logic, logged them, and took staff action. Simple admin account lookup commands based on IP, HWID, and similar identifiers. In-game Captcha via https://lineage2.gold/code, protected by Cloudflare, including admin commands for blacklisting based on aggression levels and whitelisting. Additional admin tools such as Auto-Play status checks, Enchanted Hero Weapon live sync, force add/remove clans from castle sieges, item listeners for live item monitoring, and more. A fully rewritten Auto-Play system with support for ExAutoPlaySetting, while still using the Auto-Play UI wheel, featuring: Debuff Efficiency Party Leader Assist Respectful Hunting Healer AI Target Mode Range Mode Summoner buff support Dwarf mechanics Reworked EffectDispelEffects to restore buffs after Cancellation. Raid Bomb item support. Reworked CronZoneSwitcher. Prime Time Raid Respawn Service. Community Board features such as Top rankings and RB/Epic status. Custom systems for Noblesse, Subclasses, support-class rewards, and much more.   Depending on the deal, the project can include: The lineage2.gold domain The website built on the Laravel PHP framework The server’s Discord Client Interface source Server files and extender source The server database (excluding private data such as emails and passwords)   I’m primarily looking for a serious team to continue the project, as it would be a shame to see this work abandoned. This is not cheap. You can DM me with offers. If you’re wondering why I’m doing this: I’ve felt a clear lack of appreciation from the L2 community, and I’m not interested in doing charity work for people who don’t deserve it. I’m simply not someone who tolerates BS. Server Info: https://lineage2.gold/info Server for test: https://lineage2.gold/download Over 110 videos YouTube playlist: https://www.youtube.com/watch?v=HO7BZaxUv2U&list=PLD9WZ0Nj-zstZaYeWxAxTKbX7ia2M_DUu&index=113
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock