| 12-07-2008, 07:17 PM | #1 |
Can anyone tell me why this trigger is not working? JASS:function Trig_Level_2_Conditions takes nothing returns boolean return ( GetTriggerUnit() == udg_plr_CHARACTER ) endfunction function Trig_Level_2_Actions takes nothing returns nothing local integer index = 0 call DisableTrigger( GetTriggeringTrigger() ) call SetHeroLevel( udg_plr_CHARACTER, 2, true ) loop exitwhen index == 4 call SetHeroLevel( udg_plr_FOLLOW[index], 2, true ) set index = index + 1 endloop endfunction //=========================================================================== function InitTrig_Level_2 takes nothing returns nothing set gg_trg_Level_2 = CreateTrigger( ) call TriggerRegisterEnterRectSimple( gg_trg_Level_2, gg_rct_Respect_Hint ) call TriggerAddCondition( gg_trg_Level_2, Condition( function Trig_Level_2_Conditions ) ) call TriggerAddAction( gg_trg_Level_2, function Trig_Level_2_Actions ) endfunction The levels of udg_plr_CHARACTER and the udg_plr_FOLLOW array units are completely unaffected. I KNOW that these variables are correctly assigned, and I also KNOW that udg_plr_CHARACTER is entering the rect, since there's another trigger that has that as an event, and that trigger is working fine. Any suggestions? |
| 12-07-2008, 07:49 PM | #2 |
You're disabling the trigger before it does anything bud. JASS:call DisableTrigger( GetTriggeringTrigger() ) Just get rid of that. |
| 12-07-2008, 10:53 PM | #3 |
DisableTrigger() doesn't prevent the current execution of a trigger. I place that at the beginning of many of my triggers, and they all work fine. |
| 12-07-2008, 10:59 PM | #4 |
wait...nvm sorry it looks right to me... add bjmessages see if they show. |
| 12-08-2008, 01:19 AM | #5 |
Hmm, post the part of the code that assigns these please, I think we'd have a better idea of what's going on. I trust that the globals are being assigned, but you never know. Also, disabling a bunch of triggers that you're using and letting them sit there seems a little wasteful to me. You could probably also condense all of these "level" triggers into one script that uses a few formulas / conditions to do just what you want it to do. |
| 12-08-2008, 02:27 AM | #6 |
tell, what this trigger must do, and then tell us what it doing. |
| 12-08-2008, 08:18 AM | #7 | |
Quote:
Anyway, I found the problem. It turns out that SuspendHeroXP() also prevents SetHeroLevel from functioning. Thanks for looking at it. |
