Ohhh, I was thinking that each time the trigger ran the variables would be reset back to zero. I didn't realize they kept their value.
They don't keep their value after the trigger finishes. Every variable resets for each run through (or it would work very poorly with different players using different bunkers). I'm using local variables, not global. But the bunker does keep the units, and that's what I check.
I think you misunderstood my trigger. It does add the tint, sort of. I pick each unit in the bunker that loaded a unit and then calculate the color. It does not matter in which order you load the units... or unload for that matter.
I'll set up a test map so you can see what I mean and copy that if you want. And no, it would not make the map lag (why would you run the trigger every second?). Triggers are low overhead. Animating a single marine is probably worse (very rough estimate).
Now the only problem left as far as I see it is finding colors that work well (if you want more than 4). I used red, green, blue and gray. It's hard to find other usable colors. Yellow... blue + yellow = green, bad.. etc.
I'd take a slightly different approach. Any time you load or unload a unit, check all cargo units and set the color appropriately. I'm in a bit of a rush, but using this as a base you should be able to get the desired effect. When the bunker is empty, it's pitch black (of course). Maybe check the current color of the player and set it to that or something if it's empty. Also, the numbers make it a bit dark at the moment. Maybe just set red / blue to a fixed number if X are in the bunker. I just found it a bit cool that the bunker got "redder" with more marines inside.
Edit 2:
Another way to do it would be to simply check "if marine" "if marine marauder" "if marauder" "if empty" (using a few more variables in the switch), and then set the colors to exactly what you want in another switch... depending, of course, on how many different unit combinations are possible in your map.
I can give you an example in code later if you want. Gotta run now.
They don't keep their value after the trigger finishes. Every variable resets for each run through (or it would work very poorly with different players using different bunkers). I'm using local variables, not global. But the bunker does keep the units, and that's what I check.
I think you misunderstood my trigger. It does add the tint, sort of. I pick each unit in the bunker that loaded a unit and then calculate the color. It does not matter in which order you load the units... or unload for that matter.
I'll set up a test map so you can see what I mean and copy that if you want. And no, it would not make the map lag (why would you run the trigger every second?). Triggers are low overhead. Animating a single marine is probably worse (very rough estimate).
Now the only problem left as far as I see it is finding colors that work well (if you want more than 4). I used red, green, blue and gray. It's hard to find other usable colors. Yellow... blue + yellow = green, bad.. etc.
I'd take a slightly different approach. Any time you load or unload a unit, check all cargo units and set the color appropriately. I'm in a bit of a rush, but using this as a base you should be able to get the desired effect. When the bunker is empty, it's pitch black (of course). Maybe check the current color of the player and set it to that or something if it's empty. Also, the numbers make it a bit dark at the moment. Maybe just set red / blue to a fixed number if X are in the bunker. I just found it a bit cool that the bunker got "redder" with more marines inside.
Edit:
Changed from "if then" to a "switch".
Edit 2:
Another way to do it would be to simply check "if marine" "if marine marauder" "if marauder" "if empty" (using a few more variables in the switch), and then set the colors to exactly what you want in another switch... depending, of course, on how many different unit combinations are possible in your map.
I can give you an example in code later if you want. Gotta run now.