[Help] Exp for kitpvp server

Discussion in 'Plugin Development' started by Hypsiz, Apr 12, 2014.

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

    Hypsiz

    Hello,
    I want to do exp system, all the killing player the killer gets exp, but I do not know exactly how to calculate it would be difficult and challenging, please help me with calculations.
    And sorry if my english is bad, I know it.
    Thanks for help.
     
  2. Offline

    Glumpz

    Hypsiz So you want the killer to get all of the exp from the killed player?
     
  3. PlayerDeathEvent, get killer and give them some exp?
     
  4. Offline

    ButterSquidz

    driver-e Glumpz I guess he wants to give the killer all the XP that the player had.

    Just listen for the PlayerDeathEvent, get the xp of the player and pass it on to the killer
     
  5. Offline

    yupie_123

    Code:java
    1. @EventHandler
    2. public void onPlayerDeath(PlayerDeathEvent e){
    3. if(!(e.getEntity().getKiller() instanceof Player)) return;
    4. Player killer = e.getEntity().getKiller();
    5. killer.setLevel(killer.getLevel() + 1);
    6. }

    Something like this?
    This basically adds one level to the xp bar of the killer.
     
  6. Offline

    Hypsiz

  7. Offline

    Glumpz

  8. Offline

    Hypsiz

    Glumpz
    I need help with calculations, not how to do it.
     
  9. Hypsiz How do you want the calculations exactly? What do you mean? How much exp do you want to give to the killer?
     
  10. Offline

    Zach_1919

    driver-e I think he wants all of the people who contributed to damaging the player to get a proportionate amount of experience. For example, I took 2.5 hearts, you took 7.5, I get 25% of the experience, and you get 75%.
     
  11. Offline

    Hypsiz

  12. Hypsiz A easier way would maybe be getting exp when hitting a player, but that's maybe not what you want.
     
  13. Offline

    Hypsiz

    driver-e
    I want something challenging and difficult, it is not easy server.
     
  14. Offline

    TheHandfish

    We need to know exactly which calculations you need us to help you with. ;)
     
  15. Offline

    Hypsiz

    TheHandfish
    I want the killer will receive 25% EXP amount of HP he took the player.
    It would be good for testing.
     
  16. Offline

    TheHandfish

    So, I guess, in your EntityDamageByEntity event, do something like:

    Code:
    attacker.addXp(victim.getHealth() / 4);
    Don't copy that, though. Use the right methods. I haven't checked if those are real methods, LOL.
     
Thread Status:
Not open for further replies.

Share This Page