Добавлен Nelloy
Ловлю фатал, не знаю что делать... abilid и cd внутри корректные, pStartAbilityCD pReserverdIntArg1 ненулевые
function StartAbilityCD takes unit u, integer abilid returns nothing
local integer pAbility = GetUnitAbility(u,abilid)
local real cd = GetAbilityCD(abilid, GetPlayerId(GetOwningPlayer(u))+1)
call WMem(mR2I(cd), pReserverdIntArg1)
call CallThisCallWith2Args(pStartAbilityCD, pAbility, pReserverdIntArg1)
endfunction
local real cd = GetAbilityCD(abilid, GetPlayerId(GetOwningPlayer(u))+1)
call WMem(mR2I(cd), pReserverdIntArg1)
call CallThisCallWith2Args(pStartAbilityCD, pAbility, pReserverdIntArg1)
endfunction
Нужно для того, чтобы при использовании одного навыка, другой тоже начинал свою перезарядку
Вот второй вариант на основе SetAbilityCurrentCooldown, не фаталит (спс WMem), но и результата не дает
Вот второй вариант на основе SetAbilityCurrentCooldown, не фаталит (спс WMem), но и результата не дает
function StartAbilityCD takes unit u, integer id returns nothing
local integer a = GetUnitAbility(u,id)
local real seconds = GetAbilityCD(id, GetPlayerId(GetOwningPlayer(u))+1)
local integer pData = RMem( a + 0xDC )
if pData > 0 then
call WMem( pData + 4, mR2I( seconds + mI2R( RMem( pData + 4 ) ) ) )
endif
endfunction
local real seconds = GetAbilityCD(id, GetPlayerId(GetOwningPlayer(u))+1)
local integer pData = RMem( a + 0xDC )
if pData > 0 then
call WMem( pData + 4, mR2I( seconds + mI2R( RMem( pData + 4 ) ) ) )
endif
endfunction
Принятый ответ
Возможно "канал" так же имеет отличную от остальных абилок структуру
Рабочий вариант
function StartAbilityCD takes unit whichUnit, integer abilityId returns boolean
local integer pAbility = 0
local real cd = GetAbilityCD(abilityId, GetPlayerId(GetOwningPlayer(whichUnit))+1)
if whichUnit == null or GetUnitAbilityLevel( whichUnit, abilityId ) < 1 or cd == 0.00 then
return false
endif
set pAbility = GetUnitAbility(whichUnit, abilityId)
if pAbility < 1 then
return false
else
if RMem(pAbility+0x134)==-1 and RMem(pAbility+0x138)==-1 then
call WMem(pAbility+0x134,0)
call WMem(pAbility+0x138,0)
endif
set Memory[pReserverdIntArg1 / 4] = mR2I(cd)
call CallThisCallWith2Args( pStartAbilityCD, pAbility, pReserverdIntArg1 )
return IsAbilityOnCooldown( pAbility )
endif
return false
endfunction
local integer pAbility = 0
local real cd = GetAbilityCD(abilityId, GetPlayerId(GetOwningPlayer(whichUnit))+1)
if whichUnit == null or GetUnitAbilityLevel( whichUnit, abilityId ) < 1 or cd == 0.00 then
return false
endif
set pAbility = GetUnitAbility(whichUnit, abilityId)
if pAbility < 1 then
return false
else
if RMem(pAbility+0x134)==-1 and RMem(pAbility+0x138)==-1 then
call WMem(pAbility+0x134,0)
call WMem(pAbility+0x138,0)
endif
set Memory[pReserverdIntArg1 / 4] = mR2I(cd)
call CallThisCallWith2Args( pStartAbilityCD, pAbility, pReserverdIntArg1 )
return IsAbilityOnCooldown( pAbility )
endif
return false
endfunction
Чтобы оставить комментарий, пожалуйста, войдите на сайт.
Я пока ингейм в итоговых версиях не юзаю, только на тесткартах.
local integer pAbility = 0
local real cd = GetAbilityCD(abilityId, GetPlayerId(GetOwningPlayer(whichUnit))+1)
if whichUnit == null or GetUnitAbilityLevel( whichUnit, abilityId ) < 1 or cd == 0.00 then
return false
endif
set pAbility = GetUnitAbility(whichUnit, abilityId)
if pAbility < 1 then
return false
else
if RMem(pAbility+0x134)==-1 and RMem(pAbility+0x138)==-1 then
call WMem(pAbility+0x134,0)
call WMem(pAbility+0x138,0)
endif
set Memory[pReserverdIntArg1 / 4] = mR2I(cd)
call CallThisCallWith2Args( pStartAbilityCD, pAbility, pReserverdIntArg1 )
return IsAbilityOnCooldown( pAbility )
endif
return false
endfunction
Там проверки на == -1, а нужно заменить на != 0