I’d like to have a good way of detecting who’s hit a boss so that they can be rewarded when it dies.
The thing is, there’s a bunch of powers/things that can hit the boss, and I don’t want to have it insert a value into the boss for each attack - that’d be a pain.
I honestly don’t have a clue as to what would be the most efficient way to detect such things.
Please let me know some good methods I could use to do this, thanks!
I’m not to experienced with damage system’s but I would recommend using remote events with the player name as a variable. :FireServer() from when the keycode is pressed.
There will be a module somewhere in a script service that manages the NPCs and player damage
The module will also create a new table to each NPC
The player will require the module when they do damage
The module will deal damage to the NPC and insert the player into that NPCs table
When the NPC dies, retrieve the corresponding table
This might seem hard to do, and yes, it is if you just started using frameworks, but, once you get the hang of it, this is probably one of the most efficient ways to do these kinds of tasks.
Make a folder inside the boss. Then check when the player does damage to the boss. Get that player name and store it in a boolvalue. Put this inside the folder and maybe call it “PlayersWhoDamagedBoss”. After that, loop through the values in the folder, and give the rewards to the players.
I don’t know what you mean as I don’t know how your system works. All I can say is use a RemoteEvent. You can just set up another one to make it more simple if needed.
I’m trying to do it without having to put values inside of the boss when the player attacks, as I’d have to do that for each attack - and there’s quite a lot of attacks.
Don’t do it for each attack. Just check when the player has damaged the boss, and then check if they are in the folder or not. If they are not, then add them. It will have a table of all the players who damaged the boss.
add a string value to the player upon playeradded. Then each time something damages the player have it also edit the string value with the name of the attacker
i.e. Last = nil
player takes 10 dmg from Nogalo
Last = Nogalo