| 03-15-2008, 11:18 PM | #1 |
Does ForceUIKey not work if you've just added the ability to the unit? For example: JASS:function ThisFunctionIsCalledAfter takes nothing returns nothing local unit U = GetTriggerUnit() //Already has the ability from the function below this one //... if GetLocalPlayer() == P then call ForceUIKey(Flare_NextPointHotkey()) //Works just fine endif endfunction function ThisFunctionIsCalledFirst takes nothing returns nothing local unit U = GetTriggerUnit() //... call UnitAddAbility(U, Flare_NextPointAbilityId()) if GetLocalPlayer() == P then call ForceUIKey(Flare_NextPointHotkey()) //Does not work, but if I manually press the hotkey it will work endif endfunction Edit: I've also tried using ExecuteFunc to execute the ForceUIKey in another thread and that didn't work. Edit again: Well, I can use a timer with a callback >= 0.02 and it will work... JASS:function NewForceUIKey takes nothing returns nothing if GetLocalPlayer() == bj_groupEnumOwningPlayer then call ForceUIKey(Flare_NextPointHotkey()) endif endfunction function ThisFunctionIsCalledFirst takes nothing returns nothing local unit U = GetTriggerUnit() //... call UnitAddAbility(U, Flare_NextPointAbilityId()) set bj_groupEnumOwningPlayer = P call TimerStart(CreateTimer(), 0.02, false, function NewForceUIKey) //Works, but not if the timeout is < 0.02 endfunction |
| 03-16-2008, 12:45 AM | #2 |
lol it's also called 1 frame ? =) war3 must recreate the UI so the ForceUIKey can work actuacly... (nothing special) btw thats why units in TcX some times jumping self ^^ (due to low frame rate + pressing left mouse button.) so the 0.02 per will not work every time ^^ and there is no way to detect the frame rate of war3 how i know anyway it would be async so... |
| 03-16-2008, 03:35 AM | #3 |
I am pretty sure 0.02 will work every time, I have encountered the need for this particular number before and I have never seen it backfire when used on bnet. |
| 03-16-2008, 04:56 AM | #4 |
0.02 is iffy for me on my computer locally... so I dunno; I used 0.025 |
| 03-16-2008, 10:32 AM | #5 |
nm, I was thinking of >0.01, which is the exact amount of time it takes a unit to load or unload. |
