| 10-06-2009, 10:13 PM | #1 |
Okay guys, simple problem: I create some triggers during run time and within the trigger actions/conditions I would like to get the triggering trigger. In fact my trigger actions/conditions are itself public static struct methods - which leads to the problem that GetTriggeringTrigger gives the wrong trigger... Question: How do I get the _real_ triggering trigger, the one that was created by my code? |
| 10-06-2009, 10:36 PM | #2 |
Would setting the trigger to a global work? Then in that specific action you could know which global to reference. |
| 10-06-2009, 10:43 PM | #3 |
As far as I see a global trigger is no alternative cause at compilation time it isn't known how many triggers will be created and used... |
| 10-06-2009, 10:55 PM | #4 |
Just make sure you do not use the function/method above its declaration and it should not compile to a TriggerEvaluate call if I remember it right. Why do you need Dynamic Triggers at all? |
| 10-06-2009, 11:02 PM | #5 | |
Quote:
Why should it lead to the wrong trigger? Since tahts pretty much handled by the engine and not the language, you will always get the right trigger. Maybe it is you who think it might be wrong. |
| 10-07-2009, 03:56 AM | #6 |
Could you post a snippet of the code, so I know what you mean? I can't really tell where you are trying to reference the trigger from. JASS:struct s_name static method onSpellEffectFilter takes nothing returns boolean local trigger t = GetTriggeringTrigger() //* This is how you reference it, it works in both the conditions & actions functions set t = null return true endmethod static method onSpellEffect takes nothing returns nothing local trigger t = GetTriggeringTrigger() set t = null endmethod static method onInit takes nothing returns nothing local trigger t = CreateTrigger() call TriggerRegisterPlayerUnitEvent(t, Player(0), EVENT_PLAYER_UNIT_SPELL_EFFECT, null) call TriggerAddCondition(t, Filter(function s_name.onSpellEffectFilter)) call TriggerAddAction(t, function s_name.onSpellEffect) endmethod endstruct |
| 10-07-2009, 06:28 AM | #7 | |
Quote:
|
| 10-07-2009, 08:17 PM | #8 |
What difference does it make if its TriggerEvaluate or not? You would still be able to reference GetTriggeringTrigger(). |
| 10-07-2009, 08:29 PM | #9 |
@xombie If vJass adds a triggerEvaluate in the middle (should throw compile error imo), it will return the dummy trigger that triggerEvaluate was called on, that the supposed trigger |
