Jump to content
  • 0

Making A New Clan Manager (Can't Add Skills; Acis)


Question

Posted

Hi guys, i'm reworking some old's clan managers; I got a problem making the scripts give full clan skills; 

 

If u clan is lvl 0-1-2-3-4-5-6-7 make it 8; give u 10.000k Rep (This work FINE) ; But can't make it give skills too.

 

Any help guys?

int[] clanSkills =
       {
               370,
               371,
               372,
               373,
               374,
               375,
               376,
               377,
               378,
               379,
               380,
               381,
               382,
               383,
               384,
               385,
               386,
               387,
               388,
               389,
               390,
               391
       };
if (((player.getClan().getLevel() <= 1) || (player.getClan().getLevel() == 2) || (player.getClan().getLevel() == 3) || (player.getClan().getLevel() == 4) || (player.getClan().getLevel() == 5) || (player.getClan().getLevel() == 6) || (player.getClan().getLevel() == 7)))
                {
                    if (st.getQuestItemsCount(clanLevelItemsId[2]) >= clanLevelItemsCount[2])
                    {
                        st.takeItems(clanLevelItemsId[2], clanLevelItemsCount[2]);
                        player.getClan().changeLevel(8);
                        player.getClan().addReputationScore(100000);
                        player.getClan().addNewSkill(clanSkill);
                        player.getClan().broadcastClanStatus();
                        player.sendMessage("Your clan is now level " + player.getClan().getLevel() + ".");
                        player.sendMessage("Your reputation score is now " + player.getClan().getReputationScore() + ".");
                        player.sendMessage("Your clan has learned all clan skills.");
                        player.setTarget(player);
                        player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));
                        
                        return "ClanLevelUp.htm";
                    }
                    return "ClanLevelUp-NoItems.htm";
                }
                
                player.getClan().broadcastClanStatus();
                return "ClanLevelUp.htm";
        	}

Recommended Posts

  • 0
Posted (edited)

You have to make a for loop.

 

Edit 1:

 

if (((player.getClan().getLevel() <= 1) || (player.getClan().getLevel() == 2) || (player.getClan().getLevel() == 3) || (player.getClan().getLevel() == 4) || (player.getClan().getLevel() == 5) || (player.getClan().getLevel() == 6) || (player.getClan().getLevel() == 7)))

 

change to

 

if (player.getClan().getLevel() > 1 && player.getClan().getLevel() < 8 )

 

Edit 2:

 

About skills add the following codes:

 

http://pastebin.com/z9V28JyU

Edited by Devlin
  • 0
Posted (edited)

Even better, change this

if (((player.getClan().getLevel() <= 1) || (player.getClan().getLevel() == 2) || (player.getClan().getLevel() == 3) || (player.getClan().getLevel() == 4) || (player.getClan().getLevel() == 5) || (player.getClan().getLevel() == 6) || (player.getClan().getLevel() == 7)))

to

if (player.getClan().getLevel() < 8 )

About skills, if you want to load it inside core, then do it properly (no offense Devlin) :P

Index: java/net/sf/l2j/gameserver/datatables/SkillTable.java

+    private static final L2Skill[] _clanSkills = new L2Skill[22];
+    private static final int[] _clanSkillsId =
+    {
+        370,371,372,373,374,375,376,377,378,379,
+        380,381,382,383,384,385,386,387,388,389,
+        390,391
+    };
+    
     private static final L2Skill[] _nobleSkills = new L2Skill[8];
@@ -99,6 +107,9 @@
         for (int i = 0; i < _heroSkillsId.length; i++)
             _heroSkills[i] = getInfo(_heroSkillsId[i], 1);
         
+        for (int i = 0; i < _clanSkillsId.length; i++)
+            _clanSkills[i] = getInfo(_clanSkillsId[i], 1);
+        
         for (int i = 0; i < _nobleSkills.length; i++)

     }

@@ -175,6 +186,11 @@
+    public static L2Skill[] getClanSkills()
+    {
+        return _clanSkills;
+    }

and then call this method inside your bypass to give the clan skills

for (L2Skill cs : SkillTable.getClanSkills())
   player.getClan().addNewSkill(cs);
Edited by SweeTs
  • 0
Posted (edited)

Yup :D

 

Else, if you want to call it from script, then do like Devlin did inside this clan manager http://pastebin.com/n4kY3kbJ . As you can see, you miss the for loop and such. Compare.

 

 

@Devlin

if (!(sk == null))

Why not simply sk != null :D

Edited by SweeTs
  • 0
Posted

Yup :D

 

Else, if you want to call it from script, then do like Devlin did inside this clan manager http://pastebin.com/n4kY3kbJ . As you can see, you miss the for loop and such. Compare.

 

 

@Devlin

if (!(sk == null))

Why not simply sk != null :D

2014 stuff :p

  • 0
Posted

Don't use Vector (which is synchronized), but ArrayList (or even L2Skill[])

 

-----------

 

Writing style

 if (!(sk == null))

>

if (sk != null)

----------------

 

You probably can use directly

if (player.getClan().getLevel() < 8)

because I doubt it works for academy, knight and etc. Otherwise use (for 0 to 7)

if (player.getClan().getLevel() >= 0 && player.getClan().getLevel() <= 7) 
  • 0
Posted

Hi guys, thanks for helping me;

 

I got 2 errors; Maybe i put it wrong on java script;

 else if (event.equals("levelUpClan"))
			for (L2Skill cs : SkillTable.getClanSkills())
        {
        	if (player.getClan() == null)
            {
            	return "ClanLevelUp-NoClan.htm";
            }
        	else if (!player.isClanLeader())
        	{
        		return "ClanLevelUp-NoLeader.htm";
        	}
        	else
        	{
				
				if (player.getClan().getLevel() < 8 )
				{
					if (st.getQuestItemsCount(clanLevelItemsId[2]) >= clanLevelItemsCount[2])
					{
						st.takeItems(clanLevelItemsId[2], clanLevelItemsCount[2]);
						player.getClan().changeLevel(8);
						player.getClan().addReputationScore(100000);
						player.getClan().addNewSkill(cs);
						player.getClan().broadcastClanStatus();
						player.sendMessage("Your clan is now level " + player.getClan().getLevel() + ".");
						player.sendMessage("Your reputation score is now " + player.getClan().getReputationScore() + ".");
						player.sendMessage("Your clan has learned all clan skills.");
				        player.setTarget(player);
				        player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));
				        
				        return "ClanLevelUp.htm";
					}
					return "ClanLevelUp-NoItems.htm";
				}
				
				player.getClan().broadcastClanStatus();
				return "ClanLevelUp.htm";
        	}
        }

1449081065_error%20consola.png

  • 0
Posted (edited)

The code is a mess.. fix it

else if (event.equals("levelUpClan"))
            for (L2Skill cs : SkillTable.getClanSkills())

wuut.. wrong place. You have everything you need in this topic. Check the pastebin above..

Edited by SweeTs
  • 0
Posted

@Sweets ; 

 

Yeah, i see the pastebin;  But i wanna 

if (event.equals("levelUpClan"))

Make clan lvl 8 ; give reputation score and skills, is posible give skills to, or i need make another event? 

  • 0
Posted

Ofc it's possible, you only put the "execute" part. Just.. you have to use it properly. Atm, it's one big mess.

  • 0
Posted

Ofc it's possible, you only put the "execute" part. Just.. you have to use it properly. Atm, it's one big mess.

 

I do it too;

Index: java/net/sf/l2j/gameserver/datatables/SkillTable.java

+    private static final L2Skill[] _clanSkills = new L2Skill[22];
+    private static final int[] _clanSkillsId =
+    {
+        370,371,372,373,374,375,376,377,378,379,
+        380,381,382,383,384,385,386,387,388,389,
+        390,391
+    };
+    
     private static final L2Skill[] _nobleSkills = new L2Skill[8];
@@ -99,6 +107,9 @@
         for (int i = 0; i < _heroSkillsId.length; i++)
             _heroSkills[i] = getInfo(_heroSkillsId[i], 1);
         
+        for (int i = 0; i < _clanSkillsId.length; i++)
+            _clanSkills[i] = getInfo(_clanSkillsId[i], 1);
+        
         for (int i = 0; i < _nobleSkills.length; i++)

     }

@@ -175,6 +186,11 @@
+    public static L2Skill[] getClanSkills()
+    {
+        return _clanSkills;
+    }

I think i missing the part on .java , to "call" the skills, right ?

  • 0
Posted (edited)

I think i missing the part on .java , to "call" the skills, right ?

Nop, you already call it on your script. But while you cay this, you have no idea what you have c/p there and so, you have no idea why its not working.. :P

Edited by SweeTs
  • 0
Posted

I dont say it, but is my first time with "code part"; on the past  just use custom packs, with tons of this shits; 

Yep i download it and copy paste to make it to my need. I can't move on so, i ask for help . I dont wanna any make it for me; i wanna someone say to me, wath i doing wrong... So i can learn.

 

So... u have time, to be my mentor on this script? :) Thanks

  • 0
Posted (edited)

I showed you 2 posts before.

        else if (event.equals("levelUpClan"))
        {
            if (player.getClan() == null)
                return "ClanLevelUp-NoClan.htm";
            else if (!player.isClanLeader())
                return "ClanLevelUp-NoLeader.htm";
            else if (player.getClan().getLevel() == 8)
                return "ClanLevelUp-Limit.htm"; // CREATE THIS FILE, IF YOU DON'T HAVE IT
            else if (st.getQuestItemsCount(clanLevelItemsId[2]) < clanLevelItemsCount[2])
                return "ClanLevelUp-NoItems.htm";
            else
            {
                    st.takeItems(clanLevelItemsId[2], clanLevelItemsCount[2]);
                    player.getClan().changeLevel(8);
                    player.getClan().addReputationScore(100000);
                    for (L2Skill cs : SkillTable.getClanSkills())
                        player.getClan().addNewSkill(cs);
                    player.getClan().broadcastClanStatus();
                    player.sendMessage("Your clan is now level " + player.getClan().getLevel() + ".");
                    player.sendMessage("Your reputation score is now " + player.getClan().getReputationScore() + ".");
                    player.sendMessage("Your clan has learned all clan skills.");
                    player.broadcastPacket(new MagicSkillUse(player, player, 5103, 1, 1000, 0));
                    
                    return "ClanLevelUp.htm";    
            }
        }

Your code, if you compare, is messy, don't follow the order. Notably the for loop :D

Edited by SweeTs
Guest
This topic is now closed to further replies.


×
×
  • 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