Hello, i don't really know how to mod but the ai helps me. Except, this one is even more complicated.
Ideea is simple, i try to add HP regeneration to heli (i play rampant, bob enemies, so on, heli, tank, spider have larger hp, and the tank and heli have in build hp regeneration since it Triggers my OCD when, the nemies manege to reduce my shield to 0, do a small little damage, and then the bot goes out to repair (because i honestly forgot to turn personal roboport off) and gets destroyed) and (aside from the hp regen) to add logistic request for the heli. Since that would be amazing to ensure the heli is always topped up.
However, while i had no issues adding hp regeneration to the tank, the heli keeps giving me issues and i start to assume i am using the wrong terms. If anyone can help. And again, i have no it or modding knowlage, so it's really just telling me what terms to use/give to the AI. Here is a copy paste from what the ai gave me, the 1st was the 1st solution and the second was as a fix. None worked. Also this to be added and the very bottom of control.lua:
-- Helicopter auto-heal (25 HP/sec, runs every tick)
script.on_event(defines.events.on_tick, function(event)
local heal_per_tick = 250/ 60
for , surface in pairs(game.surfaces) do
local helis = surface.find_entities_filtered{name = "heli-entity--"}
for _, heli in pairs(helis) do
if heli.valid and heli.health < heli.prototype.max_health then
heli.health = math.min(heli.health + heal_per_tick, heli.prototype.max_health)
end
end
end
end)
-- Helicopter auto-heal (≈25 HP per second)
script.on_event(defines.events.on_tick, function()
local heal = 25 / 60
for , surface in pairs(game.surfaces) do
for , name in pairs({"heli-entity--", "heli-body-entity--", "heli-placement-entity--"}) do
for , heli in pairs(surface.find_entities_filtered{name = name}) do
if heli.valid and heli.health < heli.prototype.max_health then
heli.health = math.min(heli.health + heal, heli.prototype.max_health)
end
end
end
end
end)