• 'AddEntityRelationship' (a nil value)? What did I do wrong?
    0 replies, posted
[</DLib>] addons/myaddon/lua/autorun/ddl_npc_health_manager.lua:375: attempt to call method 'AddEntityRelationship' (a nil value)   1. tdHandleRelationships - addons/myaddon/lua/autorun/ddl_npc_health_manager.lua:375    2. nextevent - addons/myaddon/lua/autorun/ddl_npc_health_manager.lua:338     3. unknown - lua/dlib/modules/hook.lua:749 ^ It's blue local relation = {} function tdHandleRelationships(t,dmg) if CLIENT then return end local attacker = dmg:GetAttacker() local tIndex = t:EntIndex() local aIndex = attacker:EntIndex() if not (t:IsPlayer() or t:IsNPC()) then return end if not (attacker:IsPlayer() or attacker:IsNPC()) then return end if not relation[tIndex] then relation[tIndex] = 0 end relation[tIndex] = relation[tIndex] + 1 local cFeels = t:Disposition(attacker) local cAnger = relation[tIndex] if cAnger > 8 then t:AddEntityRelationship( attacker, D_HT, cAnger-8 ) attacker:AddEntityRelationship( t, D_HT, cAnger-8 ) end end The thing is, it's working. I shoot a citizen 9 times and the citizen gets mad at me. That's the only way I've tested it so far.
Sorry, you need to Log In to post a reply to this thread.