• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Brood War StarEdit Wait Trigger Problem (~solved)

Status
Not open for further replies.

deepstrasz

Map Reviewer
Level 69
Joined
Jun 4, 2009
Messages
18,828
So, every time I load the game the units that are supposed to be created after the Wait trigger, spawn immediately (after I load the map).
By loading the map, I mean saving the game first when I start the map and then using the load game option.

Does anybody have ideas on how to avoid/fix this issue?
 

deepstrasz

Map Reviewer
Level 69
Joined
Jun 4, 2009
Messages
18,828
I haven't found an actual solution to the Wait trigger but there are some decent workarounds as I've read on the net and tested (some new ideas) meself.



They're only useful if the condition is Countdown Timer=exactly 0 seconds. It seems that some things might not happen during other seconds of said timer (some create units triggers just didn't want to run).
It's a good idea to use a timer that ends and then start another one if you want consequent events happening. For instance:

Trigger A
-Player 1
->Always
=>Set Countdown Timer to 30 seconds
Create 3 Zergling for Player 1 at Location
Wait 1 millisecond
Set Switch 2

Trigger B
-Player 1
->Switch 2 is Set
Countdown Timer=exactly 0 seconds
=>Set Countdown Timer to 30 seconds
Create 3 Zergling for Player 1 at Location
Wait 1 millisecond
Set Switch 3

For recurrent events:

Trigger A
-Player 1
->Always
=>Clear Switch 1

Trigger B
-Player 1
->Switch 1 is Cleared
=>Set Countdown Timer to 30 seconds
Wait 1 millisecond
Set Switch 1
Wait 1 millisecond
Preserve Trigger

Trigger C
-Player 1
->Switch 1 is Set
Countdown Timer=exactly 0 seconds
=>Create 3 Zergling for Player 1 at Location
Wait 1 millisecond
Clear Switch 1
Wait 1 millisecond
Preserve Trigger

Now the thing is that you can't use more than one countdown timer at a time. So, this won't work on those levels where you want to defend a base or destroy something in a limited time.




You can calculate time judging by how many units die or are killed. This, however, is not an accurate estimation of time but is useful (maybe, one of the few workarounds during a countdown timer).

Trigger A
-Player 1
->Player 1 suffered 10 deaths of unit/Player 1 kills=10
=>Create 3 Zergling for Player 1 at Location

The problem is that you can't use Preserve Trigger on this one because the death/kill number is always specific and does not reset.




This is more reliable than the kills/deaths count because it can be used with Preserve Trigger.

Trigger A
-Player 1
->Player 1 commands (exactly/at least/at most) 0 units
=>Create 3 Zergling for Player 1 at Location
Wait 1 millisecond
Set Switch 1

Trigger B
-Player 1
->Player 1 commands 0 units
=>Create 3 units for Player 1 at Location
Wait 1 millisecond
Set Switch 2

You need to set switches and insert a wait trigger before setting them otherwise both triggers will run at the same time due to their identical conditions.

For recurrence:

Trigger A
-Player 1
->Player 1 commands 0 units (could be any unit type you need)
=>Create 3 Zergling for Player 1 at Location
Preserve Trigger

The issue with this trigger is that it won't accurately help with events happening at a desired time in a map with an overall countdown timer. Subsequent timers could be used but, would obviously confuse the player.


I hope this is helpful. It sure is for me.
 
Last edited:

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,195
Does anybody have ideas on how to avoid/fix this issue?
What issue? What happens currently?

If StarCraft 1 is anything like WC3 (which also uses JASS) then threads suspended for a wait (TriggerSleepAction?) will be lost during a save/load cycle. I believe timers of some sort is the only work around as they do survive a save/load cycle. In WC3 there is a bug that periodic timers will become one shot after a save/load or pause/unpause cycle which may or may not be present in StarCraft 1.
 

deepstrasz

Map Reviewer
Level 69
Joined
Jun 4, 2009
Messages
18,828
What issue? What happens currently?
Well, I used the wait trigger in most of my Brood War campaign maps. I had no actual idea that the wait trigger's time wasn't stored when saving the game. Now, after four years, I've realized it while retesting my maps. Then, I used to beat the maps in one go but now that they somewhat feel new, I had to load multiple times and hence the realization of the major gameplay bugs. There are a lot of levels where I used the create units at location trigger and I used wait between them, heh.
If StarCraft 1 is anything like WC3 (which also uses JASS) then threads suspended for a wait (TriggerSleepAction?) will be lost during a save/load cycle.
What!? Warcraft III has that too? I have to test it for I surely did not notice it.
I don't know if Brood War is based on JASS but it's a possibility seeing how the trigger editor is structured (well, might just be usual programming?). What I do remember is, that the first StarCraft was based on the Warcraft II engine.
In WC3 there is a bug that periodic timers will become one shot after a save/load or pause/unpause cycle
Even with the Run Trigger action? Or, are you saying they're basically just aesthetics after a load and that the programming doesn't realize when a timer reaches 0 or said time frame?
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,195
I don't know if Brood War is based on JASS but it's a possibility seeing how the trigger editor is structured (well, might just be usual programming?). What I do remember is, that the first StarCraft was based on the Warcraft II engine.
StarCraft 1 uses JASS as far as I am aware, Warcraft III uses JASS2 but everyone just calls it JASS.

Even with the Run Trigger action? Or, are you saying they're basically just aesthetics after a load and that the programming doesn't realize when a timer reaches 0 or said time frame?
The periodic flag for the timer is lost. So it will expire once but will not restart even if the timer was originally started as periodic. Periodic means repeating, a periodic timer set to 1 seconds should expire every second after the time it is started.
 

deepstrasz

Map Reviewer
Level 69
Joined
Jun 4, 2009
Messages
18,828
The periodic flag for the timer is lost. So it will expire once but will not restart even if the timer was originally started as periodic. Periodic means repeating, a periodic timer set to 1 seconds should expire every second after the time it is started.
I understood that the first time. I've asked you if the actions (+their conditions) based on that one-shot turned timer would still work on 0 or a specific time frame on load? Are the actions related to it lost too?
Oh, so if only the repeating timer has issues, then wouldn't run trigger work to make a one-shot timer repeat?
 
Last edited:

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,195
I've asked you if the actions (+their conditions) based on that one-shot turned timer would still work on 0 or a specific time frame on load?
If SC1 is like WC3 then it should still run when it was scheduled to after load, just that if it was meant to run periodically, it will only run a final time.

This does not apply to periodic events in WC3. Only timers that are started as periodic/repeating.
Are the actions related to it lost too?
In SC1 is like WC3 then no the triggers should be unchanged. In WC3 I even believe the function callback for timers works after load (a feature only usable with JASS directly).

Oh, so if only the repeating timer has issues, then wouldn't run trigger work to make a one-shot timer repeat?
In response to timer expiry one can restart the timer with the same timeout as before. This creates a periodic timer that is save/load safe.
 
Status
Not open for further replies.
Top