| 02-13-2008, 09:42 PM | #1 |
Is there anyway I can use variable length on events? I tried using this: JASS:call TriggerRegisterTimerEvent(CreateTowers, HowOften, true) call TriggerAddAction( CreateTowers, function NewTower) |
| 02-13-2008, 09:54 PM | #2 |
That's because the event is created with the current value of the variable, not linked to the variable. However the variable changes afterwards, the event will remain the same. You can not do what you want without destroying the trigger and remaking it when you change the value of the variable. |
| 02-13-2008, 10:04 PM | #3 |
The easiest way would probably be to just use a timer. |
| 02-14-2008, 12:35 AM | #4 |
yes use self launching timer like that JASS:globals real tmr_period=0.025 string tmr_res_func="InitialTimerStart" timer tmt_tmr=CreateTimer() endglobals function tmr_action_restart takes nothing returns nothing // ...your actions set tmr_period=GetRandonReal(0.01,0.05) // change the period randomly every time. // // at the function end you will restart the timer with the currect period call ExecuteFunc(tmr_res_func) endfunction function InitialTimerStart takes nothing returns nothing call TimerStart(tmr_tmr,tmr_period,false,function tmr_action_restart) endfunction well it must work =) you can also use TriggerEvaluate. but ExecuteFunc is simpler for the begin ;) |
