| 05-08-2007, 08:32 AM | #1 |
I have this in a trigger that runs on map initialization: JASS:set udg_BlueFlagUnit = CreateUnit(Player(6),'n00W',bx,by,bj_UNIT_FACING) Then my second trigger : JASS:function Trig_Flag_Radius_l_BLUE_Actions takes nothing returns nothing call BJDebugMsg("running actions") endfunction //=========================================================================== function InitTrig_Flag_Radius_l_BLUE takes nothing returns nothing set gg_trg_Flag_Radius_l_BLUE = CreateTrigger( ) call TriggerRegisterUnitInRange(gg_trg_Flag_Radius_l_BLUE,udg_BlueFlagUnit,300,null) call TriggerAddAction( gg_trg_Flag_Radius_l_BLUE, function Trig_Flag_Radius_l_BLUE_Actions ) endfunction Now, the unit is created (i can see it) but the second trigger doesnt work. I think the problem is that the second trigger is being initialized before udg_BlueFlagUnit is given a value. I assume this because when I used the vJass method of declaring the global it told me that BlueFlagUnit wasnt initialized. And yes, the first trigger is above the second.. I even tried putting the createunit line in a function in the map header. |
| 05-08-2007, 08:43 AM | #2 |
If you're using vJass, use a library with an initializer. JASS:library mylib initializer myfunc function myfunc takes nothing returns nothing //init variables here endfunction endlibrary initializers are called before InitTrig_* functions. |
| 05-08-2007, 08:59 AM | #3 |
putting JASS:set udg_BlueFlagUnit = CreateUnit(Player(6),'n00W',bx,by,bj_UNIT_FACING) JASS:function InitTrig_Flag_Radius_l_BLUE takes nothing returns nothing |
| 05-08-2007, 09:21 AM | #4 | |
Quote:
Oh wow, I didnt even think to do that. Well, both methods work, thanks guys! |
