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

    • https://jumpshare.com/share/kIdeKALOhgtMKpBKqxpg Test Equip Armors-> FullPlate, Gloves, Legs, Chest , Boots
    • 黑色星期五 — 为您的流量提供高级福利 仅在11月28日,我们的特别促销码可为您提供13%的商店折扣。 促销码: BLACKFRIDAY (13% 折扣) 您可以通过我们的网站或 Telegram 机器人在商店购物! 有效链接: 数字商品商店(网站): 前往 商店 Telegram 机器人: 前往 – 通过 Telegram Messenger 方便访问商店。 其他服务: 虚拟号码服务: 前往 用于购买 Telegram Stars 的机器人: 前往 – 快速且优惠地在 Telegram 中购买 Stars。 SMM 面板: 前往 – 推广您的社交媒体账户。 我们向您呈现当前的 促销和特惠活动 列表,用于购买我们服务的产品和服务: 1. 您可以在首次购买时使用促销码:SOCNET(15% 折扣) 2. 获取 $1 商店余额或 10–20% 折扣 — 只需在我们网站注册后发送您的用户名,格式如下:“SEND ME BONUS, MY USERNAME IS...” — 您需要在我们的论坛帖子中写下这句话! 3. SMM 面板首次试用可获得 $1:只需在我们的网站(支持)提交主题为“Get Trial Bonus”的工单。 4. 我们的 Telegram 频道和 Stars 购买机器人每周都会举办 Telegram Stars 抽奖活动! 新闻: ➡ Telegram 频道: https://t.me/accsforyou_shop ➡ WhatsApp 频道: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord 服务器: https://discord.gg/y9AStFFsrh 联系方式与支持: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ 邮箱: solomonbog@socnet.store
    • BLACK FRIDAY — PREMIUM BENEFITS FOR YOUR TRAFFIC Only on November 28 our special promo code gives you a 13% discount in the store. PROMO CODE: BLACKFRIDAY (13% Discount) Shop in our store on the website or via the Telegram bot! Active links: Digital goods store (Website): Go Store Telegram bot: Go – convenient access to the store via Telegram messenger. Other services: Virtual numbers service: Go Telegram bot for purchasing Telegram Stars: Go – fast and profitable purchase of stars in Telegram. SMM Panel: Go – promotion of your social media accounts. We want to present you the current list of promotions and special offers for purchasing our service's products and services: 1. You can use a promo code for your first purchase: SOCNET (15% discount) 2. Get $1 to your store balance or a 10–20% discount — just send your username after registering on our website using the following template: "SEND ME BONUS, MY USERNAME IS..." — you need to write this in our forum thread! 3. Get $1 for the first trial start of the SMM Panel: just open a ticket with the subject "Get Trial Bonus" on our website (Support). 4. Weekly Telegram Stars giveaways in our Telegram channel and in our bot for purchasing stars! News: ➡ Telegram channel: https://t.me/accsforyou_shop ➡ WhatsApp channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord server: https://discord.gg/y9AStFFsrh Contacts and Support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Usually, I work alone on my projects, but sometimes the work is much more than I've expected. Could you provide a price list? It would be good if we knew your price before contacting you. 
    • BLACK FRIDAY — PREMIUM BENEFITS FOR YOUR TRAFFIC Only on November 28 our special promo code gives you a 13% discount in the store. PROMO CODE: BLACKFRIDAY (13% Discount) Shop in our store on the website or via the Telegram bot! Active links: Digital goods store (Website): Go Store Telegram bot: Go – convenient access to the store via Telegram messenger. Other services: Virtual numbers service: Go Telegram bot for purchasing Telegram Stars: Go – fast and profitable purchase of stars in Telegram. SMM Panel: Go – promotion of your social media accounts. We want to present you the current list of promotions and special offers for purchasing our service's products and services: 1. You can use a promo code for your first purchase: SOCNET (15% discount) 2. Get $1 to your store balance or a 10–20% discount — just send your username after registering on our website using the following template: "SEND ME BONUS, MY USERNAME IS..." — you need to write this in our forum thread! 3. Get $1 for the first trial start of the SMM Panel: just open a ticket with the subject "Get Trial Bonus" on our website (Support). 4. Weekly Telegram Stars giveaways in our Telegram channel and in our bot for purchasing stars! News: ➡ Telegram channel: https://t.me/accsforyou_shop ➡ WhatsApp channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord server: https://discord.gg/y9AStFFsrh Contacts and Support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
  • Topics

×
×
  • Create New...

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