Thread: help with pking sets!

Results 1 to 2 of 2
  1. #1 help with pking sets! 
    Registered Member
    Join Date
    Apr 2019
    Posts
    17
    Thanks given
    1
    Thanks received
    1
    Rep Power
    2
    so im atm making a pking set but if u have armor on it will remove your armor and delete it how do i make it where that armor goes into your bank?

    this is my code atm


    this is ruse base


    Code:
         if (command[0].contains("126melee")) {
     
            if(player.getInventory().getFreeSlots() < 28) {
                player.getPacketSender().sendMessage("You need at least 28 free inventory slots to buy this set.");
                return;
            }
                    if (player.getLocation() == Location.DUNGEONEERING || player.getLocation() == Location.FIGHT_PITS
                        || player.getLocation() == Location.FIGHT_CAVES || player.getLocation() == Location.DUEL_ARENA
                        || player.getLocation() == Location.RECIPE_FOR_DISASTER
                        || player.getLocation() == Location.WILDERNESS) {
                    player.getPacketSender().sendMessage("You can not use this command here");
                    return;
                        }
                   
                int[][] data = new int[][] { { Equipment.HEAD_SLOT, 1153 }, { Equipment.CAPE_SLOT, 10499 },
                        { Equipment.AMULET_SLOT, 1725 }, { Equipment.WEAPON_SLOT, 4587 }, { Equipment.BODY_SLOT, 1129 },
                        { Equipment.SHIELD_SLOT, 1540 }, { Equipment.LEG_SLOT, 2497 }, { Equipment.HANDS_SLOT, 7459 },
                        { Equipment.FEET_SLOT, 3105 }, { Equipment.RING_SLOT, 2550 }, { Equipment.AMMUNITION_SLOT, 9244 } };
                for (int i = 0; i < data.length; i++) {
                    int slot = data[i][0], id = data[i][1];
                    player.getEquipment().setItem(slot, new Item(id, id == 9244 ? 500 : 1));
                }
                       
                BonusManager.update(player);
                WeaponInterfaces.assign(player, player.getEquipment().get(Equipment.WEAPON_SLOT));
                WeaponAnimations.assign(player, player.getEquipment().get(Equipment.WEAPON_SLOT));
                player.getEquipment().refreshItems();
                player.getUpdateFlag().flag(Flag.APPEARANCE);
                player.getInventory().resetItems();
     
                player.getInventory().add(2442, 1).add(2436, 1).add(2440, 1).add(3024, 4).add(6685, 1);
                player.getSkillManager().newSkillManager();
                player.getSkillManager().setMaxLevel(Skill.ATTACK, 99).setMaxLevel(Skill.STRENGTH, 99)
                        .setMaxLevel(Skill.RANGED, 99).setMaxLevel(Skill.MAGIC, 99).setMaxLevel(Skill.DEFENCE, 99).setMaxLevel(Skill.PRAYER, 990)
                        .setMaxLevel(Skill.CONSTITUTION, 990);
                for (Skill skill : Skill.values()) {
                    player.getSkillManager().setCurrentLevel(skill, player.getSkillManager().getMaxLevel(skill))
                            .setExperience(skill,
                                    SkillManager.getExperienceForLevel(player.getSkillManager().getMaxLevel(skill)));
                }
            }
    anyone?
    Reply With Quote  
     

  2. #2  
    Registered Member
    TheChosenOne's Avatar
    Join Date
    Jan 2013
    Posts
    973
    Thanks given
    47
    Thanks received
    158
    Rep Power
    365
    The first issue I want to address has nothing to do with your question: the location restriction.
    Are you sure this is correct? The '==' operator compares objects (the address in memory). I doubt this is what you want.

    Anyway... The for loop you have where it sets the item needs a small addition before setting the item:
    Check if you have an item on the given slot.
    If you don't have any there, continue with your code.
    If you do have an item there. Check if you have space in your bank for the item.

    If you do have space in your bank, move it there and continue.
    If you don't have space in your bank, either place it in your inventory, drop the item or simply refuse to continue.

    Best is to do this seperate from the actual swapping of items. This way you can prevent the set being delivered partially.
    My informative threads:
    [Only registered and activated users can see links. ]
    [Only registered and activated users can see links. ]
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Help with Difficulty Setting
    By igagei in forum Help
    Replies: 3
    Last Post: 12-08-2012, 08:30 AM
  2. Help with NPC setting levels
    By SavageNerdz in forum Help
    Replies: 0
    Last Post: 11-20-2011, 03:12 AM
  3. need help with pking skull 'will rep'
    By Kenaboy in forum Help
    Replies: 0
    Last Post: 09-27-2010, 02:52 PM
  4. Need help with vb? Set-up?
    By Valerian in forum Help
    Replies: 3
    Last Post: 02-21-2010, 12:59 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •