A hungerer of forbidden knowledge
So I have a wild idea, and I'm wondering if someone more experienced with the mechanics of SC1 Tiggers can give me a quick answer to this theory before I start testing it.
I want to give a unit a chance to dodge enemy attack by having it briefly turn invulnerable during each trigger cycle. I wont be using hyper triggers as I NEED the wait function for my map to work, so I want to start a trigger cycle with the unit becoming invulnerable and end the trigger cycle with the unit losing invulnerability. How many frames can I expect the unit to be invulnerable for? Will the duration be effected by the number of triggers I have on the map?
None.
The game is effectively frozen when triggers are executed, so turning a unit's invincibility on and off during the same trigger cycle won't achieve anything. You could do the following:
Toggle invincibility for unit
Wait 0
Toggle invincibility for unit
Preserve trigger
This will turn the unit invincible for 2 frames. However you'll run into issues with wait blocks and/or the trigger firing at inconsistent intervals as waits from other players are ran. The latter case also goes for other triggers on preserve without waits.
You'll have a much easier life with hypers and death counters. Waits aren't precise to the millisecond, so you'll incur practically no loss in timing precision unless for some reason you need a delay to be consistent across all game speeds or need it to be exactly 1 frame longer than you'd have with death counters. Both of those cases can be remedied with EUDs, if using those is acceptable to your project.
A hungerer of forbidden knowledge
The game is effectively frozen when triggers are executed
Thanks that's really good to know. I can't use it right now but I'll keep your solution in mind for a future project.
I'm currently running a trigger that makes a very long wait so that the player can trigger an action by pressing the escape key, so wait blocks are certainly an issue.
None.
Find Me On Discord (Brood War UMS Community & Staredit Network)
In my RPG I had an Evasion statistic that did exactly this, turn invulnerability on and then off again after a short period. It used death counters as the timer for the invulnerability.
An artist's depiction of an Extended Unit Death
I wont be using hyper triggers as I NEED the wait function for my map to work, so I want to start a trigger cycle with the unit becoming invulnerable and end the trigger cycle with the unit losing invulnerability.
Could you instead just emulate this wait time? If you need the exact behavior, it'd be something like this (adjusting the timer from 20 to whatever number you deem an appropriate time):
<Players>
Player 8 has suffered exactly 0 deaths of Cantina.
<Other Conditions>
Set Switch 69.
<Actions>
Player 8
Switch 69 is set.
Modify death counts for Player 8: Set to 20 for Cantina.
Clear Switch 69.
Preserve Trigger.
Player 8
Always.
Modify death counts for Player 8: Subtract 1 for Cantina.
Preserve Trigger.
All Players
All Players has suffered exactly 0 deaths of Cave.
Modify death counts for Current Player: set to 1 for Cave.
Wait for 0 milliseconds.
Modify death counts for Current Player: set to 0 for Cave.
Wait for 0 milliseconds.
Preserve trigger.
How many frames can I expect the unit to be invulnerable for?
Without hypers, however many frames cover 2 game seconds per cycle. With hypers, 2 frames per cycle.
Will the duration be effected by the number of triggers I have on the map?
No.
I wont be using hyper triggers as I NEED the wait function for my map to work
I'm curious what you think you need waits for. You may not want to convert your waits over to DC-based hypers, but it's probably what you should do.
I want to start a trigger cycle with the unit becoming invulnerable and end the trigger cycle with the unit losing invulnerability. How many frames can I expect the unit to be invulnerable for?
Zero.
Will the duration be effected by the number of triggers I have on the map?
No, it would stay zero.
If you properly implemented it with waits, the answer is still no. If the map has trigger lag (almost certainly due to other triggers), you may get a longer real (wall clock) time but the same game time, as in number of frames. Triggers to implement this invincibility toggle should not introduce trigger lag.
Post has been edited 1 time(s), last time on Aug 19 2020, 12:12 am by Moose.
I wont be using hyper triggers as I NEED the wait function for my map to work
I'm curious what you think you need waits for. You may not want to convert your waits over to DC-based hypers, but it's probably what you should do.
I wondered this, too. Nobody
needs waits. It's just a lazy solution that creates all sorts of problems, imo.
Find Me On Discord (Brood War UMS Community & Staredit Network)
We can all blame Blizz for making a dumb triggger that can hang the whole game resulting in us having to use DC workarounds.
Issue with giving Invincibility to a unit is that it breaks agro. Depending on how you structure your unit stats, you can easily replace invincibility with giving 255 armor for a while, granted you use EUD. If you don't then you could substitute it with giving units 255 shield upgrades and giving the Protoss unit 100% shields when it has 0 shields.
hey its me