Jump to content
  • 0

Help With Enterworld Add Skill


GameBlonD

Question

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) ??????

Link to comment
Share on other sites

Recommended Posts

  • 0

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);
                }
            }
        }  

Link to comment
Share on other sites

  • 0


       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
Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

  • 0

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:

Link to comment
Share on other sites

  • 0

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
Link to comment
Share on other sites

  • 0

 

 

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
Link to comment
Share on other sites

  • 0

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);
 
 
Link to comment
Share on other sites

  • 0

This better than above shit..

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

Edited by SweeTs
Link to comment
Share on other sites

  • 0

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'
Link to comment
Share on other sites

  • 0

- 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
Link to comment
Share on other sites

  • 0

 

- 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
Link to comment
Share on other sites

  • 0

 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
Link to comment
Share on other sites

  • 0

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.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...