Question Inventory Slots

Discussion in 'General Help' started by FruXo, Sep 11, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    FruXo

    Allright so, ive been looking all over the internet for a solution for this but i cannot find anything. And i know its possible as ive seen it before but i just dont know how. So, a players inventory looks like this:
    [​IMG]

    So now i need to find a way to make a player able to place an item in these slot and it will be considered worn or equipped. So for an example we'll take the slots 9 and 10. So if a player has an Diamond_Sword (Or whatever item) it will be equppied as if it was in a armor slot if the player places the item in the slot 9 or 10. But, if the player places it in another slot like 18 it will not count as worn and will not be equpped.

    So, my question: Does anyone know how i can make this possible? And if so, how? Is there a plugin that does this?

    Best Regards,

    FruXo
     
  2. Online

    timtower Administrator Administrator Moderator

    @FruXo And how about changing inventory slots?
    Putting it in the offhand: possible, but that can all be changed.
     
  3. Offline

    FruXo

    I dont really understand what you mean, do you mean like if they should be able to move the items?
     
  4. Online

    timtower Administrator Administrator Moderator

    @FruXo No, that is not what I mean.
    Equipement is based on the offhand slot and the hotbar slot.
    Why do you want to override that?
     
  5. Offline

    FruXo

    As im making an RPG server i want my players to be able to equip jewelry that adds health/damage and so on so i want them to able to equip additonal items in these slots.
     
  6. Offline

    oceantheskatr

    So when dealing damage or receiving damage check those slots for your certain items that give bonuses.

    Unless I'm reading the question wrong?
     
  7. Offline

    FruXo

    Yes exactly
     
  8. @FruXo So for loop through slots you want to check and do what you want there?
     
  9. Offline

    FruXo

    Yes
     
  10. @FruXo So what's your problem. You haven't posted any code and specifically said the problem.
     
  11. Offline

    FruXo

    My problem is that i want to find a way to make this possible, making it able to check every outcomming or incomming attack for these slot that gives bonuses as @oceantheskatr said.
     
  12. Offline

    oceantheskatr

    I may not be 100% right (I'm probably not) but I'll try and give you an idea of how it'd work:

    Use EntityDamageByEntityEvent, when an entity is damaged, check if the damager is a player, if so, check their 9th and 10th slots to see if they have any damage boost items, and if so, set a multiplier variable to a number based on the item, then apply that multiplier to their current damage e.setDamage(event.getDamage() * multiplier). You do practically the same for receiving damage, you check if the damaged entity is a player, and if so check their 9th and 10th slots for health/armour boost items, do the multiplier thing I said above and change the damager's damage accordingly.

    There could be a better way to do this and I'm sure there is, but hopefully I'm not too wrong and I'm getting you on the right track to implementing this.
     
Thread Status:
Not open for further replies.

Share This Page