Ok. So i'm using these two scripts but it is not tottaly accurate. Sometimes a shot to an unkillable soldier may not count like a miss, and also sometimes a shot that kills a soldier (so it is not a miss) also counts like a miss.
Its is wierd, it's not perfect, but works most of the time so far.
This goes on a common soldier:
-- AI : Soldier Behavior
ai_soldierprueba_combatshoot = require "scriptbank\\ai\\module_combatshoot"
g_KillCount = 0
local misses = 0
local shotFired = false
function ai_soldierprueba_init(e)
ai_soldierprueba_combatshoot.init(e,ai_combattype_regular)
end
function ai_soldierprueba_main(e)
ai_soldierprueba_combatshoot.main(e,ai_combattype_regular,ai_movetype_usespeed,ai_attacktype_canfire)
if g_PlayerGunFired == 1 then
if not shotFired then
shotFired = true
local bx, by, bz, m, t = GetBulletHit()
if m == nil or m ~= 2 then
g_misses = g_misses + 1
end
end
else
shotFired = false
end
end
function module_combatcore.headshot(e)
if string.find(string.lower(g_Entity[e]['limbhit']), "head") ~= nil then
if g_Entity[e]['health'] > 500 then
SetEntityHealth(e,1000)
else
SetEntityHealth(e,d0)
end
ResetLimbHit(e)
end
end
function ai_soldierprueba_exit(e)
g_KillCount = g_KillCount + 1 -- Normal kill - Change to your specs
g_kills = g_kills + 1
CollisionOff(e)
end
This one goes on a barrel always active:
g_misses = 0
function misses_init(e)
end
function misses_main(e)
TextCenterOnXColor(50,95,1,"Misses: "..g_misses,255,255,255)
end