Всем привет. Просмотрите код. Не пониvаю в чём проблема. Он срабатывает только один раз: всё выводит верно, а повторно просто ничего не происходит.
Code
function Trig_KillText_Conditions takes nothing returns boolean
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true ) ) then
return false
endif
if ( not( Player(12) != GetOwningPlayer(GetKillingUnit()))) then
return false
endif
return true
endfunction
function Trig_KillText_Func002Func001Func001C takes nothing returns boolean
if ( not ( GetEnumPlayer() != GetOwningPlayer(GetKillingUnit()) ) ) then
return false
endif
if ( not ( GetEnumPlayer() != Player(10) ) ) then
return false
endif
if ( not ( GetEnumPlayer() != Player(11) ) ) then
return false
endif
if ( not ( IsPlayerInForce(GetEnumPlayer(), udg_AssistsGroup[GetPlayerId(GetOwningPlayer(GetDyingUnit()))]) == true ) ) then
return false
endif
return true
endfunction
function Trig_KillText_Func002Func001C takes nothing returns boolean
if ( not Trig_KillsShow_Func002Func001Func001C() ) then
return false
endif
return true
endfunction
function Trig_KillText_Func002A takes nothing returns nothing
local multiboarditem mbi
local integer i = GetPlayerId(GetEnumPlayer())
if ( Trig_KillText_Func002Func001C() ) then
set udg_AssistsPl[i] = udg_AssistsPl[i] + 1
set mbi = MultiboardGetItem(udg_Table, udg_TablePlayerRow[i] , 4)
call MultiboardSetItemValue(mbi, I2S(udg_AssistsPl[GetPlayerId(GetEnumPlayer())]))
set udg_AssistString[GetPlayerId(GetOwningPlayer(GetDyingUnit()))] = (udg_AssistString[GetPlayerId(GetOwningPlayer(GetDyingUnit()))] + ( udg_PlayerColor[i] + ( GetPlayerName(GetEnumPlayer()) + ( "|r" + "/" ) ) ) )
call SetPlayerState(GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD) + 100 + 2 * GetHeroLevel(GetDyingUnit()))
endif
call MultiboardReleaseItem(mbi)
set mbi = null
endfunction
function Trig_KillText_Func003C takes nothing returns boolean
if ( not ( udg_AssistString[GetPlayerId(GetOwningPlayer(GetDyingUnit()))] == "Помогли:" ) ) then
return false
endif
return true
endfunction
function Trig_KillText_Actions takes nothing returns nothing
local player plk = GetOwningPlayer(GetKillingUnit())
local player pld = GetOwningPlayer(GetDyingUnit())
local integer ik = GetPlayerId(plk)
local integer id = GetPlayerId(pld)
local force f = CreateForce()
set f = bj_FORCE_ALL_PLAYERS
set udg_AssistString[GetPlayerId(GetOwningPlayer(GetDyingUnit()))] = "Помогли:"
call ForForce( f, function Trig_KillsShow_Func002A )
if ( Trig_KillText_Func003C() ) then
set udg_AssistString[GetPlayerId(GetOwningPlayer(GetDyingUnit()))] = ""
endif
if (IsPlayerInForce(GetLocalPlayer(), f)) then
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, ( udg_PlayerColor[ik]) + ( GetPlayerName(plk) + ( "|r" + ( " убил " + ( udg_PlayerColor[id] + ( ( GetPlayerName(pld) + "|r" ) + ( " и получил " + I2S(195 + 5 * GetHeroLevel(GetDyingUnit())) + " золотых монет. " + udg_AssistString[id] ) ) ) ) ) ))
endif
call SetPlayerState(plk, PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(GetOwningPlayer(GetKillingUnit()), PLAYER_STATE_RESOURCE_GOLD) + 195 + 5 * GetHeroLevel(GetDyingUnit()))
call SetPlayerState(pld, PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(GetOwningPlayer(GetDyingUnit()), PLAYER_STATE_RESOURCE_GOLD) - (195 + 5 * GetHeroLevel(GetDyingUnit())))
call ForceClear(f)
call DestroyForce(f)
set f = null
endfunction
//===========================================================================
function InitTrig_KillText takes nothing returns nothing
local trigger tr = CreateTrigger( )
local integer i
set i = 0
loop
call TriggerRegisterPlayerUnitEvent(tr, Player(i), EVENT_PLAYER_UNIT_DEATH, null)
set i = i + 1
exitwhen i == 9
endloop
call TriggerAddCondition( tr, Condition( function Trig_KillText_Conditions ) )
call TriggerAddAction( tr, function Trig_KillText_Actions )
set tr = null
endfunction