Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Problem Getting Create Unit Trig to Fire
Problem Getting Create Unit Trig to Fire
Apr 6 2010, 6:47 am
By: Zirkah  

Apr 6 2010, 6:47 am Zirkah Post #1



The goal: a Trigger that will, spawn units at a location so long as there is a flag, and a building, and at intervals.

Method that isn't working: To make this trigger happen at intervals i've attempted using Countdown timer and causing Countdown timer to reset when it reaches zero. Also, when it reaches 0 I have the units spawn.

Everything is working except this trigger below... (actually this trigger represents about 26 triggers that are all supposed to fire when the countdown timer reaches 0)

EXAMPLE 1
Trigger("Player 1"){
Conditions:
Bring("Player 1", "Flag", "CA 10 o'clock", At least, 1);
Countdown Timer(Exactly, 0);
Bring("Player 4", "Power Generator", "BP 10 o'clock", At least, 1);

Actions:
Create Unit("Player 1", "Terran Marine", 10, "CA 10 o'clock");
Create Unit("Player 1", "Terran SCV", 1, "CA 10 o'clock");
Set Resources("Player 1", Add, 50, ore and gas);
Preserve Trigger();
}
SECOND EXAMPLE
Trigger("Player 1"){
Conditions:
Bring("Player 1", "Flag", "CA 10 o'clock Natural", At least, 1);
Countdown Timer(Exactly, 0);
Bring("Player 4", "Terran Academy", "BP 10 o'clock Natural", At least, 1);

Actions:
Create Unit("Player 1", "Terran Medic", 2, "CA 10 o'clock Natural");
Set Resources("Player 1", Add, 50, ore and gas);
Preserve Trigger();
}

The trigger does not consistently fire, as far as I can tell (and i've been paying close attention) all the conditions are met but it fires only sometimes. For instance, all the conditions are met and the countdown timer reaches 0, marines are produced! Yippe! only when the countdown timer reaches 0 a second time nothing happens.
The Second Example, that spawns medics will sometimes NOT fire when the countdown timer reaches 0 the first time. But then it will fire when the countdown timer reaches 0 from then on... its very very confusing...

The below is the countdown timer reset trigger.
Trigger("All players"){
Conditions:
Countdown Timer(Exactly, 0);
Bring("Player 4", "Protoss Zealot", "A The Start Zone", At least, 1);

Actions:
Comment("TIMER RESET");
Set Countdown Timer(Set To, 30);
Preserve Trigger();

I don't understand whats wrong with these triggers, i've been at it for many long hour over several days.
Tell me if you want anything clarified. Oh and if there is just an easier way to achieve my 'goal' as stated above without messing with these problematic triggers let me now :D



None.

Apr 6 2010, 7:23 am Falkoner Post #2



I'm not really certain on this, logically it all makes sense, but I think it's more of a flaw with SC that's causing the problem. Have you tried using an At Most 1 condition for the timers of the creations, and then having the timer reset at Exactly 0? You'd also need some sort of counter that stops them from spawning multiple times before it reaches 0.

Often StarCraft has problems with countdown timer detection, although it seems odd that it would be a problem in this case if the timer is resetting properly, one other thing is that the countdown timer resetting must be after all the triggers, order-wise, so that could easily be part of the problem, with having the reset timer be for All Players, since you basically have one trigger that resets the timer for each player present.



None.

Apr 6 2010, 7:24 am Kaias Post #3



Show us the map if you don't mind and we can (likely) solve it quickly.



None.

Apr 6 2010, 7:30 am Falkoner Post #4



Now that I think of it, if you have Random Starting Locations or different numbers of players each time you've tested, that could definitely cause a problem with the countdown timer being under All Players, because if it runs before the owner of the trigger for the spawn runs, then that trigger won't run anymore. So my first suggestion would be a possible fix for the problem, another option would be to have a death counter synced with the countdown timer, and use an exact value on the death count as the condition for the spawns, one close, but not actually 0, instead of using the countdown timer itself.



None.

Apr 6 2010, 7:36 am Zirkah Post #5



Interesting. Its not the logic but rather the ordering of the triggers, when they fire, when the countdown timer resets etc.... I also just added Hyper triggers to my map which makes it fire fast but the problem remains...

Now i'm trying to figure out how to get 1 condition to fire 26 seperate triggers only ONCE... and then reseting...

The map I attached is a work in progress, some of the triggers have been slightly modified since my post...

-Kyle



None.

Apr 6 2010, 7:38 am Zirkah Post #6



Whoops, This is the work in progress...

Attachments:
OddEyeTacticsV1.07.scx
Hits: 3 Size: 67.04kb



None.

Apr 6 2010, 7:51 am Falkoner Post #7



Here, let me explain what I mean a little better:

You would continue to have the countdown timer, but for visual purposes only, in fact, if you removed it, that would make your life easier, but no matter.

First thing you do is figure out how many deaths run during the period of your Countdown, so you'd first disable the timer resetting trigger, then add a trigger that adds 1 to a custom scoreboard or to a resource or something else you can see if the countdown timer is at least 1. Using this, you can find out how many DCs pass during the 30 second period.

Next, you take that number, and make a looping Death Count timer with it, counting down from whatever the number was to 0, and resetting back to the number at 0. You would then change the condition for all your creation triggers to fire when the death count is at 1(not 0), rather than the countdown timer.

And if my guess as to why it's messing up is right, that should fix it. ^^



None.

Apr 6 2010, 10:52 pm Lanthanide Post #8



I'm not sure if your problem is directly related to this, but this post may be useful for anyone else who finds your thread and is wondering about similar problems.

It is good that you are using hyper triggers now, that was probably part of your problem - regular triggers only get fired once every 2 seconds, so if the countdown timer was not 0 when the trigger fired, nothing would happen.

The important thing to know is that the countdown timer does not match real time at all. The countdown timer is fixed at 1 second = 16 frames. Unfortunately there isn't actually any Starcraft game speed that matches this: Normal is 15 frames/second and Fast is something like 18 frames/second. This means that the countdown timer will *never* match up with real time naturally. On Fastest the game runs at slightly under 24 frames/second, so the countdown timer actually counts 1 in-game second for every 0.672 real time seconds that pass.

With hyper triggers we get slightly under 12 trigger firings per real time second at fastest. if you mesh this up with the above information, then you will find that for several trigger fires in a row, the countdown timer is going to read the same value, like this:
countdown = 10
trigger fire 1
trigger fire 2
trigger fire 3
trigger fire 4
trigger fire 5
countdown = 9
trigger fire 1
trigger fire 2
trigger fire 3
etc

If you have triggers that says "countdown timer is exactly 10", you will see that this trigger will fire 5 times before the countdown timer has reached 9, in this example.

If what you really wanted is for the triggers to fire *once only* when the countdown timer is 10, you will need to add another condition. Switches are a good option here:
Cond: Switch 1 is set, countdown timer = 10
Action: Do stuff. Clear switch 1

Cond: countdown timer = 9
Action: Set switch 1

Remember that switches are globally applied to all players, so if you have Player 1 and Player 2 that want to fire a trigger @ countdown = 10, if you clear the switch for player 1, player 2 will never be able to execute the trigger. The solution to this is to do all switch operations for player 8 (make P8 your CPU if you have one), or to use DCs instead as they are unique per player.

Hopefully this is enough of a base to work off to come up with a solution for your problem.



None.

Apr 7 2010, 12:14 pm NudeRaider Post #9

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

Yeah, switches make the solution simple to explain, but in your map you should always use death counters instead.




Apr 8 2010, 1:31 am Falkoner Post #10



Quote from Lanthanide
I'm not sure if your problem is directly related to this, but this post may be useful for anyone else who finds your thread and is wondering about similar problems.

It is good that you are using hyper triggers now, that was probably part of your problem - regular triggers only get fired once every 2 seconds, so if the countdown timer was not 0 when the trigger fired, nothing would happen.

The important thing to know is that the countdown timer does not match real time at all. The countdown timer is fixed at 1 second = 16 frames. Unfortunately there isn't actually any Starcraft game speed that matches this: Normal is 15 frames/second and Fast is something like 18 frames/second. This means that the countdown timer will *never* match up with real time naturally. On Fastest the game runs at slightly under 24 frames/second, so the countdown timer actually counts 1 in-game second for every 0.672 real time seconds that pass.

With hyper triggers we get slightly under 12 trigger firings per real time second at fastest. if you mesh this up with the above information, then you will find that for several trigger fires in a row, the countdown timer is going to read the same value, like this:
countdown = 10
trigger fire 1
trigger fire 2
trigger fire 3
trigger fire 4
trigger fire 5
countdown = 9
trigger fire 1
trigger fire 2
trigger fire 3
etc

If you have triggers that says "countdown timer is exactly 10", you will see that this trigger will fire 5 times before the countdown timer has reached 9, in this example.

If what you really wanted is for the triggers to fire *once only* when the countdown timer is 10, you will need to add another condition. Switches are a good option here:
Cond: Switch 1 is set, countdown timer = 10
Action: Do stuff. Clear switch 1

Cond: countdown timer = 9
Action: Set switch 1

Remember that switches are globally applied to all players, so if you have Player 1 and Player 2 that want to fire a trigger @ countdown = 10, if you clear the switch for player 1, player 2 will never be able to execute the trigger. The solution to this is to do all switch operations for player 8 (make P8 your CPU if you have one), or to use DCs instead as they are unique per player.

Hopefully this is enough of a base to work off to come up with a solution for your problem.

One problem: when a timer hits 0, it stays there. In his case, even without hypertriggers, it would never skip over the trigger, if the reset trigger ran, the others also should, assuming they run first, which in this case I'm sure they're not.



None.

Apr 8 2010, 1:46 am Vrael Post #11



You can't detect flags in locations. I know this because when I made my RP's I ran into this same problem.

Bring( Flag, Player, Location); just never works. Or at least, Bring( Any Unit, Player, Location); doesn't work when there's a flag at the location.



None.

Apr 8 2010, 3:28 am Lanthanide Post #12



Quote from Vrael
You can't detect flags in locations. I know this because when I made my RP's I ran into this same problem.

Bring( Flag, Player, Location); just never works. Or at least, Bring( Any Unit, Player, Location); doesn't work when there's a flag at the location.
Ah, one of those issues again.

We really need a page on the wiki that lists different units and their quirks. For example, you can't detect hallucinated units with "brings", but you can center a location on them. Hallucinated units cannot be given to other players. You can't create the extended heroes (Aldaris, Raszagal etc). Gun doodads can't be moved with "move unit" actions, but can be moved by recall. Powerups such as khalis crystal and data disc will not be detected by Bring as [Any unit] but will be detected if you specify the powerup itself - sounds like flags have the same issues.

I'm sure there are lots of other quirky unit behaviours, it'd be good to have a full list of them on the wiki. Could also throw in the unusual hero stats too - like ghosts having shorter range, hero casters not being able to cast spells, aldaris using the same attack as tassadar (so if you change the damage for one, it affects both units).



None.

Apr 8 2010, 5:05 am TiKels Post #13



Quote from Lanthanide
Quote from Vrael
You can't detect flags in locations. I know this because when I made my RP's I ran into this same problem.

Bring( Flag, Player, Location); just never works. Or at least, Bring( Any Unit, Player, Location); doesn't work when there's a flag at the location.
Ah, one of those issues again.

We really need a page on the wiki that lists different units and their quirks. For example, you can't detect hallucinated units with "brings", but you can center a location on them. Hallucinated units cannot be given to other players. You can't create the extended heroes (Aldaris, Raszagal etc). Gun doodads can't be moved with "move unit" actions, but can be moved by recall. Powerups such as khalis crystal and data disc will not be detected by Bring as [Any unit] but will be detected if you specify the powerup itself - sounds like flags have the same issues.

I'm sure there are lots of other quirky unit behaviours, it'd be good to have a full list of them on the wiki. Could also throw in the unusual hero stats too - like ghosts having shorter range, hero casters not being able to cast spells, aldaris using the same attack as tassadar (so if you change the damage for one, it affects both units).
This and the idea of a "starcraft bug and exploits list" would be quite a fun addition to SEN. Though then again, it all sorta goes into the wiki pretty well too...



"If a topic that clearly interest noone needs to be closed to underline the "we don't want this here" message, is up to debate."

-NudeRaider

Apr 8 2010, 7:35 am Kaias Post #14



Quote from TiKels
This and the idea of a "starcraft bug and exploits list" would be quite a fun addition to SEN. Though then again, it all sorta goes into the wiki pretty well too...
I went ahead and started a Wiki article for it, listing a few that I could think up off the top of my head.
Starcraft Quirks and Nuances



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[12:30 am]
ClansAreForGays -- When you join a pub lobby because you see 7/8 players, but then realize host is bating you with computers. :flamer: :flamer:
[2024-10-30. : 11:48 pm]
O)FaRTy1billion[MM] -- :wob:
[2024-10-30. : 6:24 pm]
Ultraviolet -- :wob:
[2024-10-29. : 4:33 pm]
Vrael -- :wob:
[2024-10-29. : 1:32 pm]
Zoan -- :wob:
[2024-10-28. : 5:21 pm]
Ultraviolet -- :wob:
[2024-10-27. : 4:34 pm]
jjf28 -- :wob:
[2024-10-27. : 9:01 am]
Zycorax -- :wob:
[2024-10-27. : 3:31 am]
RIVE -- :wob:
[2024-10-26. : 7:12 pm]
Ultraviolet -- :wob:
Please log in to shout.


Members Online: RIVE