- Joined
- Mar 2, 2010
- Messages
- 3,069
there is a problem in the jass code that cause all players except the host to drop. please check it out and upload a correct code.
function IncreaseResources takes nothing returns boolean
local unit u
local integer array i
local integer p
call GroupEnumUnitsInRect(bj_lastCreatedGroup, bj_mapInitialPlayableArea, null)
loop
set u = FirstOfGroup(bj_lastCreatedGroup)
exitwhen u == null
if GetUnitTypeId(u) == 'h078' or GetUnitTypeId(u) == 'h07A' or GetUnitTypeId(u) == 'h07B' or GetUnitTypeId(u) == 'h079' or GetUnitTypeId(u) == 'n01P' or GetUnitTypeId(u) == 'n01N' or GetUnitTypeId(u) == 'n01Q' or GetUnitTypeId(u) == 'n01O' or GetUnitTypeId(u) == 'n01K' or GetUnitTypeId(u) == 'n01J' or GetUnitTypeId(u) == 'n01M' or GetUnitTypeId(u) == 'n01L' then
if GetUnitState(u, UNIT_STATE_LIFE) > 0 then
call SetPlayerState(GetOwningPlayer(u), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(GetOwningPlayer(u), PLAYER_STATE_RESOURCE_GOLD) + udg_Gold)
set i[GetPlayerId(GetOwningPlayer(u))] = i[GetPlayerId(GetOwningPlayer(u))] + udg_Gold
endif
endif
call GroupRemoveUnit(bj_lastCreatedGroup, u)
endloop
call GroupEnumUnitsInRect(bj_lastCreatedGroup, bj_mapInitialPlayableArea, null)
loop
set u = FirstOfGroup(bj_lastCreatedGroup)
exitwhen u == null
if GetUnitTypeId(u) == 'h073' or GetUnitTypeId(u) == 'h072' then
set p = 0
loop
exitwhen p > 7
if GetLocalPlayer() == Player(p) then
set udg_Temp_Point = GetUnitLoc(u)
call CreateTextTagLocBJ( "Income: +" + I2S(i), udg_Temp_Point, 0, 10, 0.00, 50.00, 0.00, 0 )
call SetTextTagVelocityBJ( bj_lastCreatedTextTag, 60.00, 90 )
call SetTextTagPermanentBJ( bj_lastCreatedTextTag, false )
call SetTextTagLifespanBJ( bj_lastCreatedTextTag, 2.50 )
call SetTextTagFadepointBJ( bj_lastCreatedTextTag, 2.00 )
call ShowTextTagForceBJ( true, bj_lastCreatedTextTag, GetForceOfPlayer(Player(p)) )
call RemoveLocation (udg_Temp_Point)
endif
set p = p + 1
endloop
endif
call GroupRemoveUnit(bj_lastCreatedGroup, u)
endloop
return false
endfunction
function InitTrig_Floating_Text takes nothing returns nothing
local trigger T = CreateTrigger()
call TriggerRegisterTimerEvent(T, udg_Interval, true)
call TriggerAddCondition( T, Condition( function IncreaseResources) )
set T = null
endfunction
function IncreaseResources takes nothing returns boolean
local unit u
local integer array i
local integer p
call GroupEnumUnitsInRect(bj_lastCreatedGroup, bj_mapInitialPlayableArea, null)
loop
set u = FirstOfGroup(bj_lastCreatedGroup)
exitwhen u == null
if GetUnitTypeId(u) == 'h078' or GetUnitTypeId(u) == 'h07A' or GetUnitTypeId(u) == 'h07B' or GetUnitTypeId(u) == 'h079' or GetUnitTypeId(u) == 'n01P' or GetUnitTypeId(u) == 'n01N' or GetUnitTypeId(u) == 'n01Q' or GetUnitTypeId(u) == 'n01O' or GetUnitTypeId(u) == 'n01K' or GetUnitTypeId(u) == 'n01J' or GetUnitTypeId(u) == 'n01M' or GetUnitTypeId(u) == 'n01L' then
if GetUnitState(u, UNIT_STATE_LIFE) > 0 then
call SetPlayerState(GetOwningPlayer(u), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(GetOwningPlayer(u), PLAYER_STATE_RESOURCE_GOLD) + udg_Gold)
set i[GetPlayerId(GetOwningPlayer(u))] = i[GetPlayerId(GetOwningPlayer(u))] + udg_Gold
endif
endif
call GroupRemoveUnit(bj_lastCreatedGroup, u)
endloop
call GroupEnumUnitsInRect(bj_lastCreatedGroup, bj_mapInitialPlayableArea, null)
loop
set u = FirstOfGroup(bj_lastCreatedGroup)
exitwhen u == null
if GetUnitTypeId(u) == 'h073' or GetUnitTypeId(u) == 'h072' then
set p = 0
loop
exitwhen p > 7
if GetLocalPlayer() == Player(p) then
set udg_Temp_Point = GetUnitLoc(u)
call CreateTextTagLocBJ( "Income: +" + I2S(i), udg_Temp_Point, 0, 10, 0.00, 50.00, 0.00, 0 )
call SetTextTagVelocityBJ( bj_lastCreatedTextTag, 60.00, 90 )
call SetTextTagPermanentBJ( bj_lastCreatedTextTag, false )
call SetTextTagLifespanBJ( bj_lastCreatedTextTag, 2.50 )
call SetTextTagFadepointBJ( bj_lastCreatedTextTag, 2.00 )
call ShowTextTagForceBJ( true, bj_lastCreatedTextTag, GetForceOfPlayer(Player(p)) )
call RemoveLocation (udg_Temp_Point)
endif
set p = p + 1
endloop
endif
call GroupRemoveUnit(bj_lastCreatedGroup, u)
endloop
return false
endfunction
function InitTrig_Floating_Text takes nothing returns nothing
local trigger T = CreateTrigger()
call TriggerRegisterTimerEvent(T, udg_Interval, true)
call TriggerAddCondition( T, Condition( function IncreaseResources) )
set T = null
endfunction