Jump to content
  • 0

After Kill Reward Players Which Did Damage


Meikis

Question

Hello, i want to make custom reward for players after killing another player not only when he killed him, but also if he made some damage, for e.g. if he made damage 50% of targets hp+cp, in which method I should add checks for how much damage did player to his target?

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

You have to maintain a Map<objectId, Integer> for each player, and whenever an hitter hits the victim then the map is edited. Be aware than a hitter shouldn't be only a L2PcInstance, but a L2Playable (pets count, otherwise summoners are fucked up in the story).

 

The ratio per hitter is simply the value of the hitter / sum of all values.

 

Once the victim dies, the Map is .clear(). The Map should probably be .clear() after a given timer aswell (1min), but the timer refreshed if the victim is hitten.

Edited by Tryskell
Link to comment
Share on other sites

  • 0

You have to maintain a Map<objectId, Integer> for each player, and whenever an hitter hits the victim then the map is edited. Be aware than a hitter shouldn't be only a L2PcInstance, but a L2Playable (pets count, otherwise summoners are fucked up in the story).

 

The ratio per hitter is simply the value of the hitter / sum of all values.

 

Once the victim dies, the Map is .clear(). The Map should probably be .clear() after a given timer aswell (1min), but the timer refreshed if the victim is hitten.

 

In this case I would go straight to ConcurrentHashMap or HashMap<L2PcInstance, Integer> so I have a direct reference to the players who dealt most of the damage, you don't care if someone's client looses L2PcInstance reference after DC / Restart since theres will be no difference.

Link to comment
Share on other sites

  • 0

You have to maintain a Map<objectId, Integer> for each player, and whenever an hitter hits the victim then the map is edited. Be aware than a hitter shouldn't be only a L2PcInstance, but a L2Playable (pets count, otherwise summoners are fucked up in the story).

 

The ratio per hitter is simply the value of the hitter / sum of all values.

 

Once the victim dies, the Map is .clear(). The Map should probably be .clear() after a given timer aswell (1min), but the timer refreshed if the victim is hitten.

 

 

In this case I would go straight to ConcurrentHashMap or HashMap<L2PcInstance, Integer> so I have a direct reference to the players who dealt most of the damage, you don't care if someone's client looses L2PcInstance reference after DC / Restart since theres will be no difference.

 

Thanks for answers, i like idea with HashMap<L2PcInstance, Integer>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



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