Hey guys! Was making a weapons selection function for my game with two ways to select a weapon; either press 1-4 or click on a dialog button. I can do this fine by making 2 triggers with different events/conditions and duplicate actions, but somehow it seems redundant. I tried to put two events into the same trigger like this:
I realize this doesn't work because when the dialog button used event fires, it can get past the first condition in the 'or' set without actually checking which button was pressed. So, am I better off just using two separate triggers or can it be done in one?
If I'm understanding this correctly, the dialog button needs the (Used Dialog Button) = Riflebutton condition and the button press needs to Currentweapon != 1 condition? What you can do is have one trigger call another trigger. (wording may be off as I'm speaking from memory, not looking at the editor):
This would work assuming "(Used dialog item) == No Dialog Item" returns true when you press "1".
(I can't seem to find "Used Dialog Button", but whatever. I'll assume I'm blind or you used the wrong term, doesn't really matter.)
Multiple events can be used to fire a trigger. The problem with having different event is that, for example, when the dialog used event fire, you trigger will have access to (used dialog item). When the other events fire. You cannot access that function. ( Or it might be a garbage value from other events). Same with some other trigger that does not involve unit, you cant get the value triggering unit. So just go with 2 trigger. You can combine the actual actions in an action definition and call it from both trigger.
There might be a way but i cant find a way to determine which event fire the trigger in the condition yet
Multiple events can be used to fire a trigger. The problem with having different event is that, for example, when the dialog used event fire, you trigger will have access to (used dialog item). When the other events fire. You cannot access that function. ( Or it might be a garbage value from other events). Same with some other trigger that does not involve unit, you cant get the value triggering unit. So just go with 2 trigger. You can combine the actual actions in an action definition and call it from both trigger.
There might be a way but i cant find a way to determine which event fire the trigger in the condition yet
This is where you learn to make functions with parameters. If you want two different events to run the same code you would make two different triggers. That pass the required parameters to an independant FUNCTION.
Rollback Post to RevisionRollBack
Skype
KageNinpo = SN
My Libraries
DialogLeaderboard & TeamSort
My Projects
SPACEWAR Tribute
Infinite TD
Your method works Berrala, but it yells at me when I press 1 :( Says 'EventDialogControl' has no matching event. Note that it doesn't do this when I click the button, only when I press 1.
Hmm, yeah. This can't really be avoided I think since you have to check the condition for something that doesn't exist in one of the event cases.
You're probably better of making two different triggers and use a custom action (or run a third trigger, but that's the "ugly" way to do it from a programmers point of view).
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hey guys! Was making a weapons selection function for my game with two ways to select a weapon; either press 1-4 or click on a dialog button. I can do this fine by making 2 triggers with different events/conditions and duplicate actions, but somehow it seems redundant. I tried to put two events into the same trigger like this:
I realize this doesn't work because when the dialog button used event fires, it can get past the first condition in the 'or' set without actually checking which button was pressed. So, am I better off just using two separate triggers or can it be done in one?
If I'm understanding this correctly, the dialog button needs the (Used Dialog Button) = Riflebutton condition and the button press needs to Currentweapon != 1 condition? What you can do is have one trigger call another trigger. (wording may be off as I'm speaking from memory, not looking at the editor):
This would work assuming "(Used dialog item) == No Dialog Item" returns true when you press "1".
(I can't seem to find "Used Dialog Button", but whatever. I'll assume I'm blind or you used the wrong term, doesn't really matter.)
Multiple events can be used to fire a trigger. The problem with having different event is that, for example, when the dialog used event fire, you trigger will have access to (used dialog item). When the other events fire. You cannot access that function. ( Or it might be a garbage value from other events). Same with some other trigger that does not involve unit, you cant get the value triggering unit. So just go with 2 trigger. You can combine the actual actions in an action definition and call it from both trigger.
There might be a way but i cant find a way to determine which event fire the trigger in the condition yet
This is where you learn to make functions with parameters. If you want two different events to run the same code you would make two different triggers. That pass the required parameters to an independant FUNCTION.
@Berrala: Go
Thanks guys! I will try these out when I get home from work :D
@Berrala: Go
Your method works Berrala, but it yells at me when I press 1 :( Says 'EventDialogControl' has no matching event. Note that it doesn't do this when I click the button, only when I press 1.
Hmm, yeah. This can't really be avoided I think since you have to check the condition for something that doesn't exist in one of the event cases.
You're probably better of making two different triggers and use a custom action (or run a third trigger, but that's the "ugly" way to do it from a programmers point of view).