Fix RLS crates not dropping for grouped players

xp.VAR_TOP_GROUP stores the GROUP object ID when the top attacker is in
a group, not an individual player. The isPlayer() guard in addRareLoot()
was then failing immediately, preventing any RLS chest from spawning
whenever players were grouped.

Pick a random member of the group as the RLS recipient, consistent with
how other group loot mechanics work in the codebase.

Fixes #343
This commit is contained in:
nick
2026-05-17 03:06:28 -05:00
parent adabbb8842
commit ffe807b980
@@ -2491,6 +2491,14 @@ public class loot extends script.base_script
// get the attacker who did the most damage.
obj_id player = getObjIdObjVar(target, xp.VAR_TOP_GROUP);
// VAR_TOP_GROUP stores a group object when the top damage dealer is grouped.
// Pick a random member of that group to receive the RLS chest.
if (group.isGroupObject(player)) {
obj_id[] members = utils.getLocalGroupMemberIds(player);
if (members == null || members.length == 0) return false;
player = members[rand(0, members.length - 1)];
}
// make sure the attacker is a player.
if(!isValidId(player) || !isPlayer(player)){
return false;