add hatred||doc135581

September 20, 2022


 AIControl:addHatred(objID, value, hateWay)
  • The class to which the function belongs:AIControl


Added AI aggro targets.


Parameters type Description
objID int objID of the entity
value int hatred
hateWay float The decay of hatred. When it is 1, no attenuation is used, otherwise it is the default attenuation formula: 10% attenuation per second. When the hatred value is less than 1, the target will be removed from the AI's hatred list

Code Samples

local control = entity:getAIControl()
control:addHatred(1,10,0) --Add hatred to the entity with objID 1, hatred value is 10, hatred will decay