Exclusive Enemy Tag/Loot Rights best method?

Community Brainstorming for this one (really wish I had a partner or two sometimes!).

So I plan to include a physical item drop on enemy death because well… who doesn’t prefer to see loot explode on the screen instead of just magically appear in your inventory?
While deciding how to handle this event and prevent item theft it occurs to me that kill-stealing is just as much of an annoyance (Blox Fruits anyone). By giving the first attacking player exclusive rights to the XP, Quest Progression, and Loot it’s a win win.

My question is in the roblox setting what do you think would be the “best” method of handling this either in ease of coding or performance script wise? I am very new here and it’s entirely possible I simply overlooked an option or have yet to read thru that page in the massive Hub Documentation listings.

My first thought was to use the same TagEnemy feature most people do for quests, maybe use the datastore to pull the player userID and generate a random tagid then have the XP reward and item lootable only if =playerID & has tag x then leave the tag lingering for enough to for the player to loot before clearing.
It feels messy though and may leave some extra scripts running that could have ended sooner if I handled it better.

Second thought was similar with a twist, I could have each player generate a unique tagID upon entering the server and have the monster upon first loss of HP be “tagged” with that ID and either pass it along for use when time to loot or release/end if hp returns to full.
This adds a tiny complication for cooperative play id have to add a small “group button” to generate another tag to be shared perhaps? If it wasn’t for the performance limitations here this would be a bonus - I could set the npc chase target to the player with the unique tag that just hit it, sadly I dont see that working well from the module handling the targeting/pathfinding of dozens at a time.

Final thought… I could forget the uniqueID requirement for xp / quest / ground loot by granting rewards on first hit to the person/group but leaving them pending until mobdeath and the cloned faux items on the ground, basically just animation at this point, are touched by a player (any player) and vanish. It would still look the same from the player perspective. No idea if it saves any script performance or code work lol. Thought toward the future, PvP might one day be added but it’s not a guarantee this method in particular may leave issues for future me and that guy already doesn’t like me.

thinking Well that’s where I am at the moment just pondering my options before I start coding them in. Open to suggestions, comments, advice, or even feel free to plug some random modules that may handle this. This was one issue that was quite difficult to search for - too many unrelated results on basic tagging just for kill credit.

also thinking Is this an approved use of scripting support? I am technically asking about scripting methods but rather than “its broken fix it” or “I cant figure it out” I am looking for advice on which of the 10 ways I can do something that may be more optimized or some feature in roblox I completely overlooked, hmm.

1 Like

I would put a tag, maybe a number value in the enemy that shows how much one player has done damage to that mob, and then get a percentage by dividing the max health and the damage dealt, and give exp/loot according to that percentage.

I am no performance expert, but see a different issue already. Assuming everyone attacks and kills the same NPCs, one might just touch-attack them (e.g. just a bullet) to “claim” all NPCs and let others finish the rest. When you really want to make sure there’s no item theft, you won’t get around either making NPCs tied to a player (boring) or making sure the one with the most damage gets the loot. That will be more complicated though as you’d need to keep track of who hit an NPC how often and with how many damage - which indeed can influence performance. However, I think both first hit and last hit won’t solve this dilemma as both can be seen as unfair. One alternative approach could be, depending on how you program the NPC, that a player is selected as the receiver if the player 1) attacked the NPC and 2) is targeted/attacked/followed by the NPC assuming the player “risked his life” more than others :sweat_smile:

1 Like

:laughing:

That’s a good one. As for the tag once and run I had planned to negate it by having the tag removed if the mobs HP regen to full, which will happen while the mob runs being ignored by the thief or when the player runs X distance away as it’s set to regen full HP with no living player in it’s aggro range. Also several of the rare/boss monsters than can outrun players :shushing_face:.

Unless performance is seriously an issue down the line there will honestly be plenty of mobs in any given level range for the tiny amount of players most servers seem to handle. The only reason I see someone attacking the same mob is to be a [Redacted] or in the case of boss type rare spawns which can be handled by the damage done/reward scale since they are not not common, constant, or cloned. Hell I might even make those exclusive and set a cooldown timer in the player scripts that prevents you from tagging the same rare mob in the next 24hrs or something to give others a shot.

To be honest, this would be very hard to script I think, because most humanoids have their health regening. And… This is hard to explain, but like, If humanoid was hit by players and it went to almost 0 (health), but it regens to 100, then How would we control the players that hit the humanoid?