Hi
1- Backup your
ai_soldier.lua file.
2- Replace it with the
ai_soldier.lua file posted below.
-- AI : Soldier Behavior
ai_soldier_combatshoot = require "scriptbank\\ai\\module_combatshoot"
function ai_soldier_init(e)
isDied[e] = 0
ai_soldier_combatshoot.init(e,ai_combattype_regular)
end
function ai_soldier_main(e)
if plrhealth == nil or plrhealth == 0 then plrhealth = g_PlayerHealth end
ai_soldier_combatshoot.main(e,ai_combattype_regular,ai_movetype_usespeed,ai_attacktype_canfire)
end
function ai_soldier_exit(e)
isDied[e] = 1
module_combatcore.releasecover(e)
end
3- Place any dynamic entity on the map, ie: a barrel, and attach it the
lifebonus.lua file posted below, as well.
isDied = {} -- this var control when an soldier died
plrhealth = nil or 0 -- hold the player start health.
bonus = 350 -- put here 15 or whatever you want to fit your needs.
function lifebonus_init(e)
isDied[e] = 0
end
function lifebonus_main(e)
for i = 1, g_EntityElementMax, 1 do
if g_PlayerHealth > plrhealth then SetPlayerHealth(plrhealth) end
if g_Entity[i] ~= nil then
if isDied[i] == 1 then
if g_PlayerHealth < plrhealth then
SetPlayerHealth(g_PlayerHealth + bonus)
end --g_PlayerHealth
isDied[i] = 0
end --isDied[i] == 1
end --g_Entity[i] ~= nil
end --for
end --main
hth
Basically all soldiers pass a value when they die, to the
isDied var.
when this happens then player health is so happy.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz
OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4