I have something weird happening when I'm trying to do a tint change. (Well, weird for me

)
For some reason, when I do a Random tint, it works, but when applying a specific tint, PER newly created Unit, it does not work.
So, what I'm saying is that:
The below code words, creating a random tint:
Code: Select all
alien_tint1 = { {r=math.random(255), g=math.random(255), b=math.random(255), a=255}, {r=math.random(255), g=math.random(255), b=math.random(255), a=255}, {r=math.random(255), g=math.random(255), b=math.random(255), a=255}, {r=math.random(255), g=math.random(255), b=math.random(255), a=255}, {r=math.random(255), g=math.random(255), b=math.random(255), a=255}}
but the below does not work:
Code: Select all
alien_tint1 = { {r=0, g=0, b=0, a=255}, {r=3, g=0, b=0, a=255}, {r=5, g=0, b=0, a=255}, {r=8, g=0, b=0, a=255}, {r=10, g=0, b=0, a=255}, {r=13, g=0, b=0, a=255}}
The above is just an example, I actually have a 100 iterations. Full code below.
Here is a screenshot of the random tint, vs. the tint that goes from a=0 to a=255:
I've tried to apply the tint in two ways:
Code: Select all
alien_tint1 = { {r=0, g=0, b=0, a=255}, {r=3, g=0, b=0, a=255}, ..... to 100 }
and
Code: Select all
alien_tint1 = {
["alien-army-1"] ={r=0, g=0, b=0, a=255},
["alien-army-2"] = {r=3, g=0, b=0, a=255},
["alien-army-3"] = {r=5, g=0, b=0, a=255},
----
["alien-army-100"] = {r=255, g=0, b=0, a=255}
}
with the same result.
I think the same issue is happening with the collision/selection boxes.
All the other stuff seems to work, Health, Scale, Damage.
Code:
Code: Select all
for i = 1, 100 do
alien_army = table.deepcopy(data.raw.unit["base-alien"])
alien_army.name = "alien-army-" .. i
alien_army.collision_box = v_collision_box[i]
alien_army.selection_box = v_selection_box[i]
alien_army.sticker_box = v_collision_box[i]
alien_army.max_health = health[i]
alien_army.corpse = "alien-corpse-" .. i
alien_army.attack_parameters.ammo_type.action.action_delivery.target_effects.damage = damage_amount[i]
--Option 1:
alien_army.attack_parameters.animation = biterattackanimation(alien_scale[i], alien_tint1[i], alien_tint2[i])
alien_army.run_animation = biterrunanimation(alien_scale[i], alien_tint1[i], alien_tint2[i])
--Option2:
--alien_army.attack_parameters.animation = biterattackanimation(alien_scale[i], alien_tint1["alien-army-" .. i], alien_tint2["alien-army-" .. i])
--alien_army.run_animation = biterrunanimation(alien_scale[i], alien_tint1["alien-army-" .. i], alien_tint2["alien-army-" .. i])
data:extend{alien_army}
end
Code attached.
Thanks.