Loot Share System

I want to create a Loot Share system.

How should it work?

Every time a Player / NPC Takes damage they Count the Damage they did.
After the NPC / Player died the Basic Rewards get spread with everyone above 10% Damage and everyone with Higher Damage has a Higher Reward of Gaining a Good Drop.

If the Player / NPC gets out of Combat (30 Seconds without being attacked) the Table Resets

Where is the Question?

I want to get a Method that can Check if the Player Took Damage and from who?

I thought about doing a Module that i use everytime i want to deal damage to a Player/ NPC that adds the Name to a Configuration inside the Charachter and Counts for each person that did Damage.

I feel like this isnt the best option to use that is why i am asking for Help.

Code Snippets would be nice since i can cleary see what you mean but not nessesary?

1 Like

Im having issues understanding the mechanic. Its: The more damage I inflict to a Player/NPC the greater reward I get from killing it?

And divided between all players that inflected damage?

Yes. And if you dont Inflict enough damage you dont get anything

Then I β€œhit” a character model, Im allowed to inflict damage, using my UserId and the damage value I did, store it in a module table as [CharacterTarget] = {[Attacker.UserId] = 20}. In which character target is the character that were attacked, updating that key, adding the new damage, sum previous and new damage done.

When that character fires a dying event, read the module table key of that character, iterate the table which contains all players that dealed damage to the character and how much, decide based on those what to reward players in table or not.


If you store values instances inside the character model, and that model gets destroyed, you will have no access to the damageData of the character, thats why using a table in the module will be better than using values in character or config instance to track the data.

Specially for NPC, which doesnt have a Player instance where you could hold the config file or values folder, a player instance inside Players will persist, but the character model wont for NPCs

Im pretty sure its like an assist system.

How would you do that in code. Since im having trouble figuring out how i should put the Players into the Table