Jump to content
  • 0

After Kill Reward Players Which Did Damage


Question

Posted

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?

6 answers to this question

Recommended Posts

  • 0
Posted (edited)

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
  • 0
Posted

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.

  • 0
Posted

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>

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...