I seem to have run into a bug of some sort that causes an event to fire twice when it should only fire once. I've managed to narrow down the cause of the problem, so I created a quick example of it. I'll attach it to this post.
As you can see, the trigger should be called only when builder[0] is issued a specific command. However, this trigger will fire twice if I issue that order to builder[0] (feel free to try it). Apparently if I decide to issue that same command that triggered this event to a different unit, the event goes off again even though builder[0] has not been issued any new command. The weird thing is that if I choose to reference builder[0] directly by enabling the event disabled in the screenshot (and disabling the enabled one), the problem disappears. The other weird thing is that if both events are enabled at the same time in that trigger, it still only fires twice (which is surprising considering that the first event alone causes it to fire twice).
Any idea what's going on here? There are obviously a couple easy workarounds to the problem here, but it would actually be harder to fix in the scenario that I'm encountering the problem on my map.
Okay I'm going to attempt to answer this and granted I'm on my phone and can't pull up the editor. Our team has had issues all over the place with unit variables in events. In the advent of a problem like this we do a generic event and get the trigger to run properly via conditions. An example is using any unit uses said your ability and then in conditions use triggering unit= builder[0]. As for the cause I haven't a clue only that I have had similar issues with this kind of event before.
Variables don't work in events.
Its initial value will be used which might be "no unit" in your case.
Events can't have no unit, so it seems to read it as any unit.
OK, thank you both for the information. I see that Events usually don't allow you to use variables unless they are constants, but since this Event did give me the option in the GUI I thought it would work. What both of you said makes total sense now. Thanks again for the help!
OK, thank you both for the information. I see that Events usually don't allow you to use variables unless they are constants, but since this Event did give me the option in the GUI I thought it would work. What both of you said makes total sense now. Thanks again for the help!
Events do take VALUES of variables. You can't pass 'variable' - the left part - as an active memory reference/address. It will take it in snapshot like manner and because events like those are created during compilation it's most likely that variable doesn't have value yet.
It's different with, lets say, unit placed on map because they are saved before compiling.
On other hand you can dynamically add event to trigger during runtime but those functions are only in code form unless you wrap them in GUI actions.
You can view those if you look at your trigger section in code view. They are slightly below the trigger.
I seem to have run into a bug of some sort that causes an event to fire twice when it should only fire once. I've managed to narrow down the cause of the problem, so I created a quick example of it. I'll attach it to this post.
As you can see, the trigger should be called only when builder[0] is issued a specific command. However, this trigger will fire twice if I issue that order to builder[0] (feel free to try it). Apparently if I decide to issue that same command that triggered this event to a different unit, the event goes off again even though builder[0] has not been issued any new command. The weird thing is that if I choose to reference builder[0] directly by enabling the event disabled in the screenshot (and disabling the enabled one), the problem disappears. The other weird thing is that if both events are enabled at the same time in that trigger, it still only fires twice (which is surprising considering that the first event alone causes it to fire twice).
Any idea what's going on here? There are obviously a couple easy workarounds to the problem here, but it would actually be harder to fix in the scenario that I'm encountering the problem on my map.
Okay I'm going to attempt to answer this and granted I'm on my phone and can't pull up the editor. Our team has had issues all over the place with unit variables in events. In the advent of a problem like this we do a generic event and get the trigger to run properly via conditions. An example is using any unit uses said your ability and then in conditions use triggering unit= builder[0]. As for the cause I haven't a clue only that I have had similar issues with this kind of event before.
Variables don't work in events.
Its initial value will be used which might be "no unit" in your case.
Events can't have no unit, so it seems to read it as any unit.
OK, thank you both for the information. I see that Events usually don't allow you to use variables unless they are constants, but since this Event did give me the option in the GUI I thought it would work. What both of you said makes total sense now. Thanks again for the help!
Events do take VALUES of variables. You can't pass 'variable' - the left part - as an active memory reference/address. It will take it in snapshot like manner and because events like those are created during compilation it's most likely that variable doesn't have value yet.
It's different with, lets say, unit placed on map because they are saved before compiling.
On other hand you can dynamically add event to trigger during runtime but those functions are only in code form unless you wrap them in GUI actions.
You can view those if you look at your trigger section in code view. They are slightly below the trigger.