i found out it was a udg_variable wich was bugging the library...
the only thing syntax check didn't notice...
all the other error were actually fake because it work fine.
Is there a way to improve the library?
[Jass=]
library Disease
globals
private group g1=CreateGroup()
private group g2=CreateGroup()
private group g3=CreateGroup()
endglobals
public function Malaria takes nothing returns nothing
local unit u1=null
local unit u2=null
local unit dummy=null
local real x1
local real x2
local real y1
local real y2
local integer res
local integer p
call GroupEnumUnitsInRect(g1, bj_mapInitialPlayableArea, null)
loop
set u1 = FirstOfGroup(g1)
set x1 = GetUnitX(u1)
set y1 = GetUnitY(u1)
exitwhen u1 == null
if GetUnitAbilityLevel(u1, 'B00I') > 0 then
if IsUnitType(u1, UNIT_TYPE_HERO) then
set p = GetPlayerId(GetOwningPlayer(u1)) + 1
set udg_MB_Malaria= "Yes"
call SetPlayerState(Player(p-1), PLAYER_STATE_RESOURCE_LUMBER, GetPlayerState(Player(p-1), PLAYER_STATE_RESOURCE_LUMBER) + 1)
if GetUnitState(udg_Hero_Troll, UNIT_STATE_LIFE) > 3.00 then
call SetUnitState(udg_Hero_Troll, UNIT_STATE_LIFE, (GetUnitState(udg_Hero_Troll, UNIT_STATE_LIFE) - 3.00 ) )
else
call KillUnit(udg_Hero_Troll)
set udg_Die_Diseases = udg_Die_Diseases + 1
endif
if GetUnitAbilityLevel(udg_Hero_Troll, 'B00G') == 0 and GetUnitAbilityLevel(udg_Hero_Troll, 'BUst') == 0 then
call SetUnitState(udg_Hero_Troll, UNIT_STATE_MANA, (GetUnitState(udg_Hero_Troll, UNIT_STATE_MANA) - 3.00 ) )
endif
else
call SetUnitState(u1, UNIT_STATE_LIFE, (GetUnitState(u1, UNIT_STATE_LIFE ) - 3.00 ))
call SetUnitState(u1, UNIT_STATE_MANA, (GetUnitState(u1, UNIT_STATE_MANA ) - 3.00 ))
endif
call GroupEnumUnitsInRange(g2, x1, y1, 300.00, null)
loop
set u2 = FirstOfGroup(g2)
exitwhen u2 == null
if GetUnitAbilityLevel(u2, 'B00I') == 0 then
if IsUnitType(u2, UNIT_TYPE_HERO) then
set res = udg_DiseaseResist[GetPlayerId(GetOwningPlayer(u2)) + 1]
else
set res = 50
endif
if GetRandomInt(1, res) <= 2 then
set x2 = GetUnitX(u2)
set y2 = GetUnitY(u2)
set dummy = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'ndwm', x2, y2, bj_UNIT_FACING)
call UnitAddAbility(dummy, 'ANdh')
call IssueTargetOrder(dummy, "drunkenhaze", u2)
endif
endif
call GroupRemoveUnit(g2, u2)
endloop
else
if IsUnitType(u1, UNIT_TYPE_HERO) then
set p = GetPlayerId(GetOwningPlayer(u1)) + 1
set udg_MB_Malaria= "No"
endif
endif
call GroupRemoveUnit(g1, u1)
endloop
endfunction
public function Plague takes nothing returns nothing
local unit u1=null
local unit u2=null
local unit dummy=null
local real x1
local real x2
local real y1
local real y2
local integer res
local integer p
call GroupEnumUnitsInRect(g1, bj_mapInitialPlayableArea, null)
loop
set u1 = FirstOfGroup(g1)
set x1 = GetUnitX(u1)
set y1 = GetUnitY(u1)
exitwhen u1 == null
if GetUnitAbilityLevel(u1, 'B00H') > 0 then
if IsUnitType(u1, UNIT_TYPE_HERO) then
set p = GetPlayerId(GetOwningPlayer(u1)) + 1
set udg_MB_Plague= "Yes"
if GetUnitState(udg_Hero_Troll, UNIT_STATE_LIFE) > 3.00 then
call SetUnitState(udg_Hero_Troll, UNIT_STATE_LIFE, (GetUnitState(udg_Hero_Troll, UNIT_STATE_LIFE) - 3.00 ) )
else
call KillUnit(udg_Hero_Troll)
set udg_Die_Diseases = udg_Die_Diseases + 1
endif
if GetUnitAbilityLevel(udg_Hero_Troll, 'B00G') == 0 and GetUnitAbilityLevel(udg_Hero_Troll, 'BUst') == 0 then
call SetUnitState(udg_Hero_Troll, UNIT_STATE_MANA, (GetUnitState(udg_Hero_Troll, UNIT_STATE_MANA) - 4.50 ) )
endif
else
call SetUnitState(u1, UNIT_STATE_LIFE, (GetUnitState(u1, UNIT_STATE_LIFE) - 3.00 ))
call SetUnitState(u1, UNIT_STATE_MANA, (GetUnitState(u1, UNIT_STATE_MANA) - 4.50 ))
endif
call GroupEnumUnitsInRange(g2, x1, y1, 300.00, null)
loop
set u2 = FirstOfGroup(g2)
exitwhen u2 == null
if GetUnitAbilityLevel(u2, 'B00H') == 0 then
if IsUnitType(u2, UNIT_TYPE_HERO) then
set res = udg_DiseaseResist[GetPlayerId(GetOwningPlayer(u2)) + 1]
else
set res = 50
endif
if GetRandomInt(1, res) <= 2 then
set x2 = GetUnitX(u2)
set y2 = GetUnitY(u2)
set dummy = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'ndwm', x2, y2, bj_UNIT_FACING)
call UnitAddAbility(dummy, 'ACif')
call IssueTargetOrder(dummy, "innerfire", u2)
endif
endif
call GroupRemoveUnit(g2, u2)
endloop
else
if IsUnitType(u1, UNIT_TYPE_HERO) then
set p = GetPlayerId(GetOwningPlayer(u1)) + 1
set udg_MB_Plague= "No"
endif
endif
call GroupRemoveUnit(g1, u1)
endloop
endfunction
public function Fever takes nothing returns nothing
local unit u1=null
local unit u2=null
local unit u3=null
local unit dummy=null
local real x1
local real x2
local real y1
local real y2
local integer res
local integer p
call GroupEnumUnitsInRect(g1, bj_mapInitialPlayableArea, null)
loop
set u1 = FirstOfGroup(g1)
set x1 = GetUnitX(u1)
set y1 = GetUnitY(u1)
exitwhen u1 == null
if GetUnitAbilityLevel(u1, 'Brej') > 0 then
if IsUnitType(u1, UNIT_TYPE_HERO) then
set p = GetPlayerId( GetOwningPlayer(u1))
set udg_MB_Fever= "Yes"
call SetPlayerState(Player(p-1), PLAYER_STATE_RESOURCE_LUMBER, GetPlayerState(Player(p-1), PLAYER_STATE_RESOURCE_LUMBER) + GetRandomInt(0, 2))
if GetUnitState(udg_Hero_Troll, UNIT_STATE_LIFE) > 1.50 then
call SetUnitState(udg_Hero_Troll, UNIT_STATE_LIFE, (GetUnitState(udg_Hero_Troll, UNIT_STATE_LIFE) - 1.50 ) )
else
call KillUnit(udg_Hero_Troll)
set udg_Die_Diseases = udg_Die_Diseases + 1
endif
if GetUnitAbilityLevel(udg_Hero_Troll, 'B00G') == 0 and GetUnitAbilityLevel(udg_Hero_Troll, 'BUst') == 0 then
call SetUnitState(udg_Hero_Troll, UNIT_STATE_MANA, (GetUnitState(udg_Hero_Troll, UNIT_STATE_MANA) - 6.00 ) )
if GetRandomInt(1, 10) == 1 then
call GroupEnumUnitsInRange(g3, x1, y1, 2000.00, null)
loop
set u3 = FirstOfGroup(g3)
exitwhen u3 == null
if IsUnitType(u3, UNIT_TYPE_HERO) then
call DisplayTimedTextToPlayer(GetOwningPlayer(u3), 0., 0., 6.00, ( "|c0000c400Troll " + (GetPlayerName(GetOwningPlayer(u1)) + ":|r |c00ffff64AAaatcchhoo!|r" ) ) )
call PingMinimapForPlayer(GetOwningPlayer(u3), x1, y1, 3.00 )
endif
call GroupRemoveUnit(g3, u3)
endloop
endif
endif
else
call SetUnitState(u1, UNIT_STATE_LIFE, (GetUnitState(u1, UNIT_STATE_LIFE) - 1.50 ))
call SetUnitState(u1, UNIT_STATE_MANA, (GetUnitState(u1, UNIT_STATE_MANA) - 6.00 ))
endif
call GroupEnumUnitsInRange(g2, x1, y1, 300.00, null)
loop
set u2 = FirstOfGroup(g2)
exitwhen u2 == null
if GetUnitAbilityLevel(u2, 'Brej') == 0 then
if IsUnitType(u2, UNIT_TYPE_HERO) then
set res = udg_DiseaseResist[GetPlayerId(GetOwningPlayer(u2)) + 1]
else
set res = 50
endif
if GetRandomInt(1, res) <= 2 then
set x2 = GetUnitX(u2)
set y2 = GetUnitY(u2)
set dummy = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'ndwm', x2, y2, bj_UNIT_FACING)
call UnitAddAbility(dummy, 'ACff')
call IssueTargetOrder(dummy, "faeriefire", u2)
endif
endif
call GroupRemoveUnit(g2, u2)
endloop
else
if IsUnitType(u1, UNIT_TYPE_HERO) then
set p = GetPlayerId(GetOwningPlayer(u1)) + 1
set udg_MB_Fever= "No"
endif
endif
call GroupRemoveUnit(g1, u1)
endloop
endfunction
endlibrary
[/code]
because as now every 3 sec i do:
call Disease_Malaria()
call Disease_Plague()
call Disease_Fever()
so i each 3 sec take all unit in map (3 times) to check the buff and do the disease damage and spread infection...
i though about doing like this:
pick all unit in map group1
if buff1 then
do group2 (malaria)
if buff2 then
do group2 (plague)
if buff3 then
do group2 (fever)
since the first group do the same thing in all disease (pick all unit in map) i can merge them...
but the problem is if a unit has many buff disease what would happen?
because they are removed from group1 but is it after they are checked in every if then else....
the best would be to pick every unit in 300 of diseased unit only once and then do an infection check for all disease on the unit
EDIT
done, i finally called only 1 time group1 and 1 time group2 for all diseases
thanks for everyone help [Solved]