Hostile animals addons

Does anyone know where I can find a script that makes a ped addon attack a player? example a ped bear addon attack

1 Like

txAdmin has some ā€œtroll functionsā€ which spawns a ped and attacks the player, see how txAdmin does it here:

Check the troll actions files.

1 Like

You have two options:

Using natives/resources:

What you would do is spawn the ped, then set the relationship group that has with SetPedRelationshipGroupHash and then use SetRelationshipBetweenGroups to set the relationship between that new group and the player group in a client side resource.

For example, we can look at this calm-ai resource:

SetRelationshipBetweenGroups(1, GetHashKey(ā€œYOUR_PED_GROUP_HEREā€), GetHashKey(ā€˜PLAYERā€™))

And that would set the relationship, and that ped would be aggressive.

Using peds.meta:

if you have a custom ped, open the peds.meta of that ped model, and look for:

<RelationshipGroup>DEER</RelationshipGroup>

You can either make a new group here, or if youā€™re just looking for a flat out aggressive ped that is as aggressive as the mountain lion, just make this relationshipgroup COUGAR.

This will set the ped you are editing to be as aggressive as the world spawn cougars.

If you are using Calm AI resources, they will override these settings, so either make a new group, that isnā€™t modifying cougar behavior or get rid of Calm AI modifications of the COUGAR relationship group.

Players should be careful around wild animals anyways.

Iā€™m going to research a little on how to create this, as Iā€™m new to programming but I really want to learn to put it on my survival server, and yes I want the aggressive ped like the lion, I converted some peds and Iā€™ll see if I can put together the script Is there a model I can follow?

What model are you looking for? For editing peds.meta or through natives?

Iā€™ve already tried to do it with ped.meta but even doing the changes it was still passive, I think Iā€™ll need a native one because I want it to be aggressive like the mountain lion to put it in specific areas, I want it to be used by jacare, bear and the like.

Can you share your peds.meta?

Changing the aggression group wonā€™t make a ped without animations/behaviors attack. You canā€™t make a deer ped attack like a cougar ped.

This is the ped.meta Iā€™m using, is there any error?

I assume youā€™re using the bear from Quadrupeds Animals [Add-On] - GTA5-Mods.com ?

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<CPedModelInfo__InitDataList>
  <InitDatas>
<Item>
      <Name>BrnBear</Name>
      <PropsName>null</PropsName>
      <ClipDictionaryName>creatures@deer@move</ClipDictionaryName>
      <BlendShapeFileName>null</BlendShapeFileName>
      <ExpressionSetName/>
      <ExpressionDictionaryName>A_C_Deer</ExpressionDictionaryName>
      <ExpressionName>A_C_Deer</ExpressionName>
      <Pedtype>Animal</Pedtype>
      <MovementClipSet>DEER</MovementClipSet>
      <MovementClipSets/>
      <StrafeClipSet>MOVE_PED_STRAFING</StrafeClipSet>
      <MovementToStrafeClipSet>MOVE_PED_TO_STRAFE</MovementToStrafeClipSet>
      <InjuredStrafeClipSet>MOVE_STRAFE_INJURED</InjuredStrafeClipSet>
      <FullBodyDamageClipSet>DAM_KO</FullBodyDamageClipSet>
      <AdditiveDamageClipSet>CREATURES@DEER@DAM_AD</AdditiveDamageClipSet>
      <DefaultGestureClipSet>ANIM_GROUP_GESTURE_M_GENERIC</DefaultGestureClipSet>
      <FacialClipsetGroupName>facial_clipset_group_gen_male</FacialClipsetGroupName>
      <DefaultVisemeClipSet>ANIM_GROUP_VISEMES_M_LO</DefaultVisemeClipSet>
      <SidestepClipSet>CLIP_SET_ID_INVALID</SidestepClipSet>
      <PoseMatcherName>DEER</PoseMatcherName>
      <PoseMatcherProneName>null</PoseMatcherProneName>
      <GetupSetHash>NMBS_DEER_GETUPS</GetupSetHash>
      <CreatureMetadataName>null</CreatureMetadataName>
      <DecisionMakerName>WildAnimal</DecisionMakerName>
      <MotionTaskDataSetName>DEER</MotionTaskDataSetName>
      <DefaultTaskDataSetName>Animal</DefaultTaskDataSetName>
      <PedCapsuleName>DEER</PedCapsuleName>
      <PedLayoutName/>
      <PedComponentSetName>Animal</PedComponentSetName>
      <PedComponentClothName/>
      <PedIKSettingsName>NO_IK</PedIKSettingsName>
      <TaskDataName>Animal</TaskDataName>
      <IsStreamedGfx value="false"/>
      <AmbulanceShouldRespondTo value="false"/>
      <CanRideBikeWithNoHelmet value="false"/>
      <CanSpawnInCar value="true"/>
      <IsHeadBlendPed value="false"/>
      <bOnlyBulkyItemVariations value="false"/>
      <RelationshipGroup>DEER</RelationshipGroup>
      <NavCapabilitiesName>WILD_ANIMAL</NavCapabilitiesName>
      <PerceptionInfo>DEFAULT_PERCEPTION</PerceptionInfo>
      <DefaultBrawlingStyle>BS_DEER</DefaultBrawlingStyle>
      <DefaultUnarmedWeapon>WEAPON_DEER</DefaultUnarmedWeapon>
      <Personality>DEER</Personality>
      <CombatInfo>SCARED_ANIMAL</CombatInfo>
      <VfxInfoName>VFXPEDINFO_COW_DEER_GENERIC</VfxInfoName>
      <AmbientClipsForFlee>FLEE</AmbientClipsForFlee>
      <Radio1>RADIO_GENRE_PUNK</Radio1>
      <Radio2>RADIO_GENRE_JAZZ</Radio2>
      <FUpOffset value="0.00000000"/>
      <RUpOffset value="0.00000000"/>
      <FFrontOffset value="0.00000000"/>
      <RFrontOffset value="0.14700000"/>
      <MinActivationImpulse value="20.00000000"/>
      <Stubble value="0.00000000"/>
      <HDDist value="6.00000000"/>
      <TargetingThreatModifier value="1.00000000"/>
      <KilledPerceptionRangeModifer value="-1.00000000"/>
      <Sexiness/>
      <Age value="0"/>
      <MaxPassengersInCar value="0"/>
      <ExternallyDrivenDOFs/>
      <PedVoiceGroup>MALE_BRAVE_PVG</PedVoiceGroup>
      <AnimalAudioObject>ANIMAL_PARAMS_ELK</AnimalAudioObject>
      <AbilityType>SAT_NONE</AbilityType>
      <ThermalBehaviour>TB_COLD</ThermalBehaviour>
      <SuperlodType>SLOD_KEEP_LOWEST</SuperlodType>
      <ScenarioPopStreamingSlot>SCENARIO_POP_STREAMING_NORMAL</ScenarioPopStreamingSlot>
      <DefaultSpawningPreference>DSP_NORMAL</DefaultSpawningPreference>
      <DefaultRemoveRangeMultiplier value="1.00000000"/>
      <AllowCloseSpawning value="false"/>
    </Item>
  </InitDatas>
</CPedModelInfo__InitDataList>

Hereā€™s an example from flight-animals, a popular add-on animals resource.

What Iā€™d do in the above code is change these lines:

      <Personality>DEER</Personality>
      <CombatInfo>SCARED_ANIMAL</CombatInfo>
      <RelationshipGroup>DEER</RelationshipGroup>

to

 <Personality>COUGAR</Personality>
<CombatInfo>COUGAR</CombatInfo>
<RelationshipGroup>COUGAR</RelationshipGroup>

And see what happens.

Iā€™ll do the test now, itā€™ll just take me a while because I donā€™t have a script to spawn them by coordinate

the bear keeps running away even though we make the changes

Youā€™re kind of the bleeding edge/undocumented side of peds.meta editing, which is good for us to learn about replacing stuff and how it works or doesnā€™t!

If youā€™re willing to test it, try taking info from say, the bobcat peds.meta info, and replacing stuff in the BrnBear meta.

Likely, something related to the deer is overriding the aggression. Iā€™m not 100% sure.

I found this in the comments I just donā€™t know where to put it

local AnimalHash = GetHashKey("Animal")

local playerHash = GetHashKey("PLAYER")

local underAttack = false

local dist = GetDistanceBetweenCoords(GetEntityCoords(PlayerPedId()), GetEntityCoords(DeerPed), true)

AddRelationshipGroup("animal", AnimalHash)

Citizen.CreateThread(function()

  while true do

    Wait(1000)

    if dist < 10.0 then

      Attack()

    else

      StopAttack()

    end

  end

end)

function Attack()

  ClearPedTasks(AnimalPed)

  Wait(1)

    if IsEntityAPed(target) then

      TaskCombatPed(AnimalPed, target, 0, 16)

      SetRelationshipBetweenGroups(5, AnimalHash, playerHash)

      SetRelationshipBetweenGroups(5, playerHash, AnimalHash)

      underAttack = true

    end

end

function StopAttack()

  if underAttack then

      SetRelationshipBetweenGroups(1, AnimalHash, playerHash)

      SetRelationshipBetweenGroups(1, playerHash, AnimalHash)

      underAttack = false

  end

end
1 Like

Youā€™d put this in a client script.

I put it on but it didnā€™t work, I saw that itā€™s possible because Iā€™ve already seen it working somewhere, but Iā€™m going to leave the idea aside because Iā€™m not getting it