Staredit Network > Forums > SC2 Assistance > Topic: Point doesn't move
Point doesn't move
Dec 24 2010, 10:36 pm
By: Ryan  

Dec 24 2010, 10:36 pm Ryan Post #1



Hello.

Quote
Events
-Unit - Critter - Dog [x, y] Leaves within 3.0 of Point 001

Actions
-General - Repeat [Actions] forever
--Actions
---Point - Move Point 001 to (Position of (Triggering unit))

Quote
Trigger Error in 'gt_Movement_Func':
Execution took too long.

Help.


Post has been edited 1 time(s), last time on Dec 26 2010, 4:31 am by Ryan.



None.

Dec 24 2010, 10:44 pm Roy Post #2

An artist's depiction of an Extended Unit Death

Looks like an infinite loop. You should try storing the triggering unit into a variable if you need to keep tabs on it.




Dec 25 2010, 12:28 am Ryan Post #3



I'm fairly new to triggering of this type. As such, I don't know how I would store the triggering unit into a variable, what I should do with the trigger after I've stored it in a variable, and what good it would do to store the triggering unit in a variable.



None.

Dec 25 2010, 12:31 am doite Post #4



That trigger is wierd.. What your saying is that if a unit leaves a point (with a ofset of.. who cares) you do a action forever. Even when the point is reached. Now if u want this just put a wait action after for "0" seconds. Else just move the unit..



None.

Dec 25 2010, 12:34 am Ryan Post #5



So triggering is different now in that Repeat Forever doesn't work like Preserve Trigger? For example, if a unit left a location, you would have a trigger that detects the unit left the location, move the location above the unit, and wouldn't run again until the unit left the location again. I was under the impression that it would work the same with the new triggers.



None.

Dec 25 2010, 1:18 am Ahli Post #6

I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.

Mistake #1 - Infinite Loop without sleep/wait
Infinite loop without sleep/wait = program death...
Your trigger will "theoretically" use the whole CPU to move a point onto a unit over and over again forever (nothing else will run, your computer shall freeze until you turn off the energy).

If you ever HAVE to use that loop, you should use waits to avoid that execution time error. If a trigger hits an inbuilt execution time limit, the trigger will be aborted.
You can even hit that execution limit with loops that will end after a while (I'm experiencing that problem atm). With waits the trigger will be paused for the given time and the execution time will be reset.

The difference to Starcraft 1
Starcraft 1's "Preserve Trigger" is not equal to this. Starcraft 1's trigger system is basically a long list of "if ... then ..." that will be checked every 2 seconds. These 2 seconds act like a "wait/sleep".
In Starcraft 2 this aspect of triggering is closer to the real code implementation.

more important Mistake #2 - Design Mistake
I'm guessing you want to track the last position of the path of a unit with a point.
What your code does: Create an infinite loop theoretically freezing your system. After the execution time limit was hit, the centering stops and the unit can move again. The event will start the trigger again, if the unit moves far enough away (if starcraft2 doesn't disable your trigger, I'm not sure atm).

The mistake you did is that loop. You won't need a loop, if you want to do what I think you want to do (move point to unit's position whenever it moves far away).
Events will fire whenever that Event is true.

I'm not sure what you intended to do with that trigger. It's part of a system that may can be done better in another way.

Anyway, I hope you understand why the trigger causes an error and why it is bad to (ever) use ininite loops.




Dec 25 2010, 1:24 am doite Post #7



... Dude.. Ok first of all never put a unit into the event. What your saying is that a specific unit leaves a location, then u refer the unit as "triggering unit" (not so specified) in actions. I understand your idea beihind it.. But have
Event: If any unit leaves -> the specific point (as u have now)
Condition: Unit type of triggering unit == Critter dog
Actions: Move point to triggering unit

What this will do is every time the dog leaves the point .. with your offset chosen.. it will move the point to the location of the dogs current position and stop the trigger. Now if the dogs do this again, it will repeat itself. What "Repeat actions forever" means is just that. Its not a unlogic action. It repeats if forever and your overloading the trigger. What the error is is probably becouse it tries to move the trigger ALL the time to the "triggering units position" which is WHO after the first move.

So what i wrote works.. gn



None.

Dec 26 2010, 4:27 am Ryan Post #8



I've taken the suggestions I've been given and I've tested them both. Here are the two triggers I've attempted:

Quote
Events
-Unit - Any Unit Leaves within 1.0 of Point 001

Conditions
-(Unit type of (Triggering unit)) == Zergling

Actions
-Point - Move Point 001 To (Position of (Triggering unit))
-Ping - Ping the minimap at Point 001 for (All players) over 2.0 seconds, using the color (100%, 0%, 0%)
Quote
Events
-Unit - Zergling [x, y] Leaves within 1.0 of Point 001

Actions
-Point - Move Point 001 To (Position of Triggering unit))
-Ping - Ping the minimap at Point 001 for (All players) over 2.0 seconds, using the color (100%, 0%, 0%)

Now from what I've gathered, both of these triggers should've worked. With both triggers, the point only moved once. What you all may or may not know is that I want the point to move every time the unit moves away from the point. I had expected that it would run every time the Event was true (that the unit had left within 1.0 of Point 001), but it did not, and this is why I tried using the Repeat Forever action. Nothing I've done has worked. I want the point to move every time the unit leaves a specified vicinity, but it does not. If someone could show me some coding that works the way I want it to, that would be greatly appreciated.

Update:
I've got a Ping action in the trigger so I can test to see if the trigger is running. Every time my unit runs through the point and away from it again, the trigger fires and I see another ping. So the trigger does indeed run more than once, but the problem now is that the point simply isn't moving.


Post has been edited 1 time(s), last time on Dec 26 2010, 4:40 am by Ryan.



None.

Dec 26 2010, 3:26 pm Ahli Post #9

I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.

The event reads the position of the point only once and doesn't update the information, if the point was moved.
It could even be the case that the editor just copies the point's coordinates for the event, when you save.

But it works with regions. So use a region instead of the point.




Dec 26 2010, 4:31 pm NicholasBeige Post #10



Yes. Starcraft 2 doesn't actually 'update' the location of a point like you would think it does.

I just tested this out:

Unit - Zergling [x,y] Leaves within 10.0 of Point 1
Move Point 1 to (Position of (Zergling [x,y]))
Ping the Minimap at Point 1

It looks like 'Leave within X of Point' creates a Region. So it's a circular region with radius 10.0 centred at Point 1. Whenever my Zergling left this 'circle' the minimap was pinged at the point where the Zergling left the circle (where it moved Point 1 to), but the centre (Point 1) of the circle region remained where it was placed in the editor.

Sometimes it's nice to know what you are trying to achieve with your trigger - because there are 101 ways to do something in the Galaxy Editor (and most programming languages) some are more efficient than others, and some might never cross your mind.

For the mean-time, use a Region.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[01:56 am]
Oh_Man -- cool bit of history, spellsword creator talking about the history of EUD ^
[09:24 pm]
Moose -- denis
[05:00 pm]
lil-Inferno -- benis
[10:41 am]
v9bettel -- Nice
[2024-4-19. : 1:39 am]
Ultraviolet -- no u elky skeleton guy, I'll use em better
[2024-4-18. : 10:50 pm]
Vrael -- Ultraviolet
Ultraviolet shouted: How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
hey cut it out I'm getting all the minerals
[2024-4-18. : 10:11 pm]
Ultraviolet -- :P
[2024-4-18. : 10:11 pm]
Ultraviolet -- How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
[2024-4-17. : 11:50 pm]
O)FaRTy1billion[MM] -- nice, now i have more than enough
Please log in to shout.


Members Online: Zycorax, jun3hong, Oh_Man, Ultraviolet