Very odd, that code has not changed in client.lua, is self contained, and it is getting called when > 0 and its pretty standard, but I dont see any hostile peds either anymore. Itâs essentially the same code from a fivem member that posted it on the forums.
Weird, not sure what is going on. I dont have any other mods that change relationships, and afaik, did not add any relationship code that would affect this. the code below gets called every 50 milliseconds as well, so should override other code.
local relationshipTypes = {
"PLAYER",
"CIVMALE",
"CIVFEMALE",
"COP",
"SECURITY_GUARD",
"PRIVATE_SECURITY",
"FIREMAN",
"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",
--"HEN",
--"WILD_ANIMAL",
--"SHARK",
--"COUGAR",
"NO_RELATIONSHIP",
"SPECIAL",
"MISSION2",
"MISSION3",
"MISSION4",
"MISSION5",
"MISSION6",
"MISSION7",
"MISSION8",
"ARMY",
--"GUARD_DOG",
"AGGRESSIVE_INVESTIGATE",
"MEDIC",
--"CAT",
}
local RELATIONSHIP_HATE = 5
local RELATIONSHIP_COMPANION = 0
Citizen.CreateThread(function()
while true do
Wait(50)
if Config.HostileAmbientPeds and Config.HostileAmbientPeds > 0 then
for _, group in ipairs(relationshipTypes) do
-- not sure about argument order, players don't have AI so only one of these should be needed
--SetRelationshipBetweenGroups(RELATIONSHIP_HATE, GetHashKey('PLAYER'), GetHashKey(group))
SetRelationshipBetweenGroups(RELATIONSHIP_HATE, GetHashKey(group), GetHashKey('PLAYER'))
SetRelationshipBetweenGroups(RELATIONSHIP_COMPANION, GetHashKey(group), GetHashKey(group))
--try to minimize infighting on the whole:
if Config.HostileAmbientPeds == 1 then
SetRelationshipBetweenGroups(RELATIONSHIP_COMPANION, GetHashKey('CIVMALE'), GetHashKey('CIVFEMALE'))
SetRelationshipBetweenGroups(RELATIONSHIP_COMPANION, GetHashKey('CIVFEMALE'), GetHashKey('CIVMALE'))
SetRelationshipBetweenGroups(RELATIONSHIP_COMPANION, GetHashKey('CIVMALE'), GetHashKey("HATES_PLAYER"))
SetRelationshipBetweenGroups(RELATIONSHIP_COMPANION, GetHashKey('CIVFEMALE'), GetHashKey("HATES_PLAYER"))
SetRelationshipBetweenGroups(RELATIONSHIP_COMPANION, GetHashKey('CIVMALE'), GetHashKey('TRUENEUTRAL'))
SetRelationshipBetweenGroups(RELATIONSHIP_COMPANION, GetHashKey('CIVFEMALE'), GetHashKey('TRUENEUTRAL'))
elseif Config.HostileAmbientPeds == 3 then --riot mode, virtually all ambient peds hate each other.
SetRelationshipBetweenGroups(RELATIONSHIP_HATE, GetHashKey('CIVMALE'), GetHashKey('CIVFEMALE'))
SetRelationshipBetweenGroups(RELATIONSHIP_HATE, GetHashKey('CIVFEMALE'), GetHashKey('CIVMALE'))
SetRelationshipBetweenGroups(RELATIONSHIP_HATE, GetHashKey('CIVMALE'), GetHashKey('CIVMALE'))
SetRelationshipBetweenGroups(RELATIONSHIP_HATE, GetHashKey('CIVFEMALE'), GetHashKey('CIVFEMALE'))
end
end
end
end
end)