| 06-29-2005, 09:57 PM | #1 |
This is my action trigger, you see I'm replacing a unit, then waiting then replacing the unit with the original unit. It works fine, except for one problem, IT ONLY WORKS IF I TAKE OUT THE WAIT ACTION!! Why is the sleep action messing up my code? Also, does anyone know something I can use instead of wait? Code:
function Trig_CopyHeroSpellTemp_Copy_Actions takes nothing returns nothing
local unit u
local unit u2
set u2 = GetTriggerUnit()
set u = GetSpellTargetUnit()
call ReplaceUnitBJ( u2, GetUnitTypeId(u), bj_UNIT_STATE_METHOD_DEFAULTS )
set u = GetLastReplacedUnitBJ()
if ( Trig_CopyHeroSpellTemp_Copy_Func006C() ) then
call UnitAddAbilityBJ( 'Acsk', GetLastReplacedUnitBJ() )
else
call DoNothing( )
endif
call TriggerSleepAction( 5.00 )
call ReplaceUnitBJ( u, GetUnitTypeId(u2), bj_UNIT_STATE_METHOD_DEFAULTS )
set u=null
set u2=null
endfunction |
| 06-29-2005, 10:12 PM | #2 |
Have you tried using PolledWait() ? |
| 06-29-2005, 11:09 PM | #3 |
Guest | You can also use times, although I'm not really sure how cuz i haven't had time to figure it out yet. I'd try that. |
| 06-30-2005, 11:29 AM | #4 |
You are using the replace unit action, which effectively removes the old unit and creates the new one. Because th old unit is removed, it is cleared from memory, and you can't get it's unit-type anymore after a wait. Just make a unittype variable instead of a unit variable to store the unit type of the unit you replace. |
| 06-30-2005, 11:31 AM | #5 |
and dont call do nothin, just do an if without an else |
| 07-01-2005, 02:00 PM | #6 |
ok, thx guys, that's my issue, the unit var instead of the "unit-type" var :D |
