[Request] Melee Force Multiple NPCs to Attack Player

Hello. I was wondering if anyone had a script or could write one to make NPCs in FiveM not attack you one at a time with melee. The goal is to be able to be swarmed and have to worry about multiple NPCs attacking you with their melee weapons at once. I haven’t found any fixes to the one-at-a-time melee issue, could someone help out?

Moved to #development:scripts

1 Like

Are you looking for multiple NPCs to attack you at all times? Or just when you trigger small events such as steal cars?

I’m looking to have them attack you at all times. Actually, the server I was asking this for has it working now, and well. Sorry for the late reply.

Ah there is a way to do that, I can probs send you a recource with that.

Wait this is actually possible? If you figure out a way to get this working please post how. I’ve been struggling with this issue for awhile, figured it was hard coded.

1 Like

Make a new recource folder and create a recource.lua file, then make a client.lua file and write this

local relationshipTypes = {
  "GANG_1",
  "GANG_2",
  "GANG_9",
  "GANG_10",
  "AMBIENT_GANG_LOST",
  "AMBIENT_GANG_MEXICAN",
  "AMBIENT_GANG_FAMILY",
  "AMBIENT_GANG_BALLAS",
  "AMBIENT_GANG_MARABUNTE",
  "AMBIENT_GANG_CULT",
  "AMBIENT_GANG_SALVA",
  "AMBIENT_GANG_WEICHENG",
  "AMBIENT_GANG_HILLBILLY",
  "DEALER",
  "HATES_PLAYER",
  "NO_RELATIONSHIP",
  "SPECIAL",
  "MISSION2",
  "MISSION3",
  "MISSION4",
  "MISSION5",
  "MISSION6",
  "MISSION7",
  "MISSION8",
} 

Citizen.CreateThread(function()
    while true do
        Wait(50)
        for _, group in ipairs(relationshipTypes) do
              SetRelationshipBetweenGroups(5, GetHashKey('PLAYER'), GetHashKey(group))
              SetRelationshipBetweenGroups(5, GetHashKey(group), GetHashKey('PLAYER'))
        end
    end
end)

5 means agressive, so it will be on all the time and NPCs will attack u always

1 Like

Ah, it seems their has been a misunderstanding. I was referring to this:

Thanks for the response anyway though

Did any of you guys figure this out?