Kill assists for PvP

Discussion in 'Plugin Development' started by Asdjke, Jul 17, 2012.

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

    Asdjke

    Hey there guys

    Just need some help figuring out how to integrate an assist system. So I'm thinking we will need to have a sort of hashmap that stores who hits who then compares who gets the kill and then sends the other players some xp.

    Any ideas would be greatly appreciated!
     
  2. Offline

    Bmandk

    Maybe you should just get your lazy ass of CoD and start trying to do something! ;)
     
  3. Offline

    Bauer

    Maybe you should mind your own business and not post unless you have something valuable to say.

    I don't think a hash map would be the best idea. Are you thinking of having these assists stored long term? Or at least until disconnect or after a certain time has passed. I'm not great with Bukkit itself so this may not be possible, but I'll give it a shot. Is it possible to actually modify the Player class at all (I know you could extend it, but that would be kind of messy for this application) ? If so, a Hashmap in there would be good. <String, Integer>. Attacker name corresponding to damage dealt.

    I don't know, consider it.
     
  4. Offline

    Bmandk

    I was just joking, I know absolutely nothing about programming, and I was just talking to him on Skype too..
     
  5. Offline

    Bauer

    Ah lol ok.
     
  6. Offline

    Asdjke

    Bauer Yeah just short term even for like 30 seconds. Like if a player where to assist with the kill within 30 seconds of the kill then they can be rewarded. I am not concerned about the amount of damage dealt although that would be cool ;)
     
  7. Suggestion:
    Map<String, Map<String, DamageEntry>>

    The outer map stores the damaged player's name as its key and a collection of players that recently damaged the key.
    The inner map is that collection, with its key being the attacker player names and its value a custom class containing:
    1. when the last damage happened
    2. (if needed) the damage that the player dealt, this should most likely add up with multiple hits
    3. any other funky stuff you want to know (wielded weapon, maybe?)

    Of course, if you only need the first information, you can go with a Map<String, Long> for the inner map as well.


    That's basically the structure I would use for that.
     
  8. Offline

    EnvisionRed

    Ah, I see. So then you can handle a PlayerDeathEvent to get the internal map for the dead player's name as a key. Then iterate through the keys and use a (fair) formula to hand out exp where due based on the damageEntry associated with each key. Good idea
     
  9. Offline

    Bauer

    Didn't know a map as a type parameter was possible. I don't know why I thought that was impossible, because that does seem perfectly acceptable.
     
  10. Offline

    Asdjke

    I got it to work :D!!!! I managed to figure it out. Thanks to some help form DocRedstone ;) Thanks guys
     
Thread Status:
Not open for further replies.

Share This Page