I'm trying to get an entity to scale up when shot (instead of dying). Ideally it should be incremental, with health resetting to its original level after reaching 0. However, it seems as though once health is 0, it stays 0. If I use the following code
Prompt(g_Entity[e]['health'])
if g_Entity[e]['health'] == 0 then
plantscale[e] = plantscale[e] + 10
if plantscale[e] > 200 then
plantscale[e] = 200
end
attackdist[e] = 200
g_Entity[e]['health'] = 100
Scale(e,plantscale[e]);
the prompt reads 0 and the scale jumps straight to 200. With this code
if g_Entity[e]['health'] == 0 then
plantscale[e] = plantscale[e] + 10
if plantscale[e] > 200 then
plantscale[e] = 200
end
attackdist[e] = 200
g_Entity[e]['health'] = 100
Prompt(g_Entity[e]['health'])
Scale(e,plantscale[e]);
the prompt reads 100, but the scale still jumps straight to 200. This code
if g_Entity[e]['health'] < 50 then g_Entity['health'] = 50
seems to do nothing. Is there a way of manually setting entity health (or am I making an obvious error somewhere)?