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>

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


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