I'm trying to make it so that whenever an ultralisk dies, player 8 gets 400 minerals and whenever a zergling dies, player 8 gets 2 minerals, but for some reason, whenever any unit dies, player 8 gets 402 minerals.
How do I fix this?
The trigger for an ultralisk dying is the same. I've already checked to make sure that the zerglings being spawned aren't added to the ultralisk unit group.
Unit events such as that take a unit reference. This is either a reference to a unit variable, allowing the referenced unit to change dynamically, or a constant reference to a specific unit. The shown use of unit references above uses the constant reference to a specific unit implementation with the specific unit being returned randomly from the group before map initialization events fire (chances are it is returning null so "any unit").
A reference to null will mean "any unit" unless that behaviour is explicitly disabled with the appropriate native call.
To achieve the behaviour you want you need to use dynamic event binding, a feature only available with pure Galaxy script. You can then create specific event bindings for every unit in the group by creating a unit reference for every unit in the group and generating an event binding to the trigger with it. Since one cannot unbind events you may need to dynamically re-create the trigger from time to time.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm trying to make it so that whenever an ultralisk dies, player 8 gets 400 minerals and whenever a zergling dies, player 8 gets 2 minerals, but for some reason, whenever any unit dies, player 8 gets 402 minerals.
How do I fix this?
The trigger for an ultralisk dying is the same. I've already checked to make sure that the zerglings being spawned aren't added to the ultralisk unit group.
Events can be finicky. I'd advise not using functions when it comes to events.
Instead add a "unit type of unit" condition, and specify ultralisk/zergling.
@MaskedImposter: Go
That fixed it, thanks!
Unit events such as that take a unit reference. This is either a reference to a unit variable, allowing the referenced unit to change dynamically, or a constant reference to a specific unit. The shown use of unit references above uses the constant reference to a specific unit implementation with the specific unit being returned randomly from the group before map initialization events fire (chances are it is returning null so "any unit").
A reference to null will mean "any unit" unless that behaviour is explicitly disabled with the appropriate native call.
To achieve the behaviour you want you need to use dynamic event binding, a feature only available with pure Galaxy script. You can then create specific event bindings for every unit in the group by creating a unit reference for every unit in the group and generating an event binding to the trigger with it. Since one cannot unbind events you may need to dynamically re-create the trigger from time to time.