I create a unit with this snippet of code, assign it to a variable, and add it to a unit group:
Then I have an event in another trigger that looks like this:
Why is this event never called when the unit walks over other units? I have other events similar to that for other units and unit types that work just fine. Is it possible there's a property in the Data Editor for that unit type that makes the event not function?
Try using debug statements to see if the trigger is running, or if something is wrong with the create unit part. This shouldn't matter, but it could be that you have the create unit acting for "triggering player" when the event is actually a "triggering unit" so you'd have to change it to "owner of unit" and then "triggering unit". I don't think that's the issue though. It could also be that there's no unit 1 in that unit group.
No, that is not how events work.
You need to specify a unit that is already on the map, or (Any Unit).
You cannot use (Unit 1 from GrenadeGroup), or a variable or anything similar.
Something like this:
Any Unit Enters a distance of 1.25 from (Any Unit),
than in conditions you have to check if (Triggering Unit) == <your specific unit>
It isn't running. I've tried both debug statements and the test document Trigger Debugging tool. The unit is created just fine and carries out its tasks, it's just that the event shown in a separate trigger doesn't fire based upon what the unit does post-creation.
While I thought this, this code works for a different unit type on a unit that is created post-initialization:
None of these units shown (Worm) exist when the map starts, they're added in later (one per player), and yet this event fires just fine. Attempting to copy this exact chain of events while swapping just the unit type doesn't work, the newly modified event never fires.
Also, I have previously tried the method you described:
With an absurdly large radius just to make sure I'm not messing up in-game, and even without any conditions, that event never fires either.
I've also triple-checked at runtime with debugging triggers to see if the trigger itself is still turned on and listening for events, and it is.
EDIT: Here's some proof from the Trigger Debugging window showing the Worm trigger being called correctly:
The Marine unit is detected when it gets within range of the Worm unit, but the opposite direction doesn't happen. Both triggers should be called right now but only one is being called.
This map isn't written in Galaxy and I'm not entirely familiar with it myself (I know enough to read, not to write or implement).
Is there an easy GUI conversion for this? I see the "Trigger - Register Events" action but it doesn't allow me to target a trigger outside of the one currently running.
While implementing that I also found this page which really helped me understand what was going on, and if anyone else has a similar issue that page will probably be able to help them too.
Thanks willuwontu! I still don't understand why the original event worked when this new one didn't, but either way, after two days of grinding against this bug I can finally get back to productive work.
Its important to understand that events are not dynamic, in other words, the events get defined at map initialization, once. Therefore, if you variable is not set before the event gets initialized, it wont work properly or yield unexpected results. For example, a unit variable which defaults to a NULL value will count as ANY UNIT for some events, causing it to fire more often than necessary.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm being driven absolutely mad by this.
I create a unit with this snippet of code, assign it to a variable, and add it to a unit group: Then I have an event in another trigger that looks like this:
Why is this event never called when the unit walks over other units? I have other events similar to that for other units and unit types that work just fine. Is it possible there's a property in the Data Editor for that unit type that makes the event not function?
Try using debug statements to see if the trigger is running, or if something is wrong with the create unit part. This shouldn't matter, but it could be that you have the create unit acting for "triggering player" when the event is actually a "triggering unit" so you'd have to change it to "owner of unit" and then "triggering unit". I don't think that's the issue though. It could also be that there's no unit 1 in that unit group.
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here
No, that is not how events work.
You need to specify a unit that is already on the map, or (Any Unit).
You cannot use (Unit 1 from GrenadeGroup), or a variable or anything similar.
Something like this: Any Unit Enters a distance of 1.25 from (Any Unit),
than in conditions you have to check if (Triggering Unit) == <your specific unit>
@fishy77: Go
It isn't running. I've tried both debug statements and the test document Trigger Debugging tool. The unit is created just fine and carries out its tasks, it's just that the event shown in a separate trigger doesn't fire based upon what the unit does post-creation.
@maticpl: Go
While I thought this, this code works for a different unit type on a unit that is created post-initialization:
None of these units shown (Worm) exist when the map starts, they're added in later (one per player), and yet this event fires just fine. Attempting to copy this exact chain of events while swapping just the unit type doesn't work, the newly modified event never fires.
Also, I have previously tried the method you described:
With an absurdly large radius just to make sure I'm not messing up in-game, and even without any conditions, that event never fires either.
I've also triple-checked at runtime with debugging triggers to see if the trigger itself is still turned on and listening for events, and it is.
EDIT: Here's some proof from the Trigger Debugging window showing the Worm trigger being called correctly:
The Marine unit is detected when it gets within range of the Worm unit, but the opposite direction doesn't happen. Both triggers should be called right now but only one is being called.
One thing I realized is that some events have problems with variables that aren't constant.
@OutsiderXE: Go
Which does make sense, but it doesn't explain why
works when
doesn't. There has to be something outside of this event causing it to not work, my assumption is something with the data editor but I'm not sure.
Dynamically create the event after game start.
and use this to convert the unitref into a unit var
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
@willuwontu: Go
This map isn't written in Galaxy and I'm not entirely familiar with it myself (I know enough to read, not to write or implement).
Is there an easy GUI conversion for this? I see the "Trigger - Register Events" action but it doesn't allow me to target a trigger outside of the one currently running.
Create a custom action with these params
You can then use the custom script action (General action) to reference these params within the code
As long as you made the params with those names, you can just copy paste the above line into the custom script action and it'll work for you.
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
You're amazing!
While implementing that I also found this page which really helped me understand what was going on, and if anyone else has a similar issue that page will probably be able to help them too.
Thanks willuwontu! I still don't understand why the original event worked when this new one didn't, but either way, after two days of grinding against this bug I can finally get back to productive work.
Its important to understand that events are not dynamic, in other words, the events get defined at map initialization, once. Therefore, if you variable is not set before the event gets initialized, it wont work properly or yield unexpected results. For example, a unit variable which defaults to a NULL value will count as ANY UNIT for some events, causing it to fire more often than necessary.