We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch
First of all when you want to run a trigger action over and over, you need
hyper triggers.
Otherwise sc would run the trigger, set the shield, and if conditions are still met set it again the next trigger loop 2 seconds later. During these 2 seconds no triggers are running, so shields wouldn't be modified.
So basically triggers just run ONCE, then the game goes on. The 'preserve trigger' does NOT preserve (run over and over) the actions, it simply states that the trigger will be run again, next trigger loop (instead of be deleted out of sc's memory).
Alright, so with hyper triggers triggers are checked 16 times faster, which is 8 timer per game second.
This is pretty close to executing an action over and over since only a few game frames will pass during each trigger loop.
But when using hyper triggers it is recommended to get rid of waits unless you know exactly what you're doing, or you run into
wait blocks. Use a
death count timer instead.
That being said the solution would look something like this:
Trigger 1: Shield state counterComputer Player
Conditions:Always
Actions:Add 1 death to Cantina of Current Player
Preserve Trigger
Trigger 2: Set shield 1Owner(s) of the unit
Conditions:Computer Player (same as above) has suffered at most 39 deaths of Cantina
Actions:Set shield of <unit type> of Current Player to 100%
Preserve Trigger
Trigger 3: Set shield 2Owner(s) of the unit
Conditions:Computer Player (same as above) has suffered at least 40 deaths of Cantina
Computer Player (same as above) has suffered at most 79 deaths of Cantina
Actions:Set shield of <unit type> of Current Player to 50%
Preserve Trigger
...etc. as many set shield trigger as you need
Then you can use a some more triggers that control the death counter (Cantina) and thus control the shield percentage.
The only remaining problem (and there's no way around it) is if the unit is hit more than once in 1/8th of a second, then the shield isn't replenished in time, rendering the "shield-armor" useless for the follup up hits.
Post has been edited 1 time(s), last time on Dec 28 2008, 1:53 pm by NudeRaider.