Привет! Делаю всякое разное на циклах, но иногда он срабатывает не от 1 до 5, к примеру, а от 1 до 2-х. Если пересохранить карту, то от 1 до другого рандом числа, мб 1, а мб 5. В чем дело может быть? Хелп!
PS: если не пересохранять, то число всегда одно, к примеру от 1 до 3-х будет всегда, пока не пересохраню карту отдельной версией (другим файлом с другим названием)
PS2: это происходит, когда цикл А используется в переменных с Array. Мб дело в Array?
function Trig_IceStar_Copy_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A011' ) ) then
        return false
    endif
    return true
endfunction

function Trig_IceStar_Copy_Func004Func001C takes nothing returns boolean
    if ( not ( udg_IceStarEffBool[GetForLoopIndexA()] == false ) ) then
        return false
    endif
    return true
endfunction

function Trig_IceStar_Copy_Func006Func003Func001Func001C takes nothing returns boolean
    if ( ( GetForLoopIndexA() == 4 ) ) then
        return true
    endif
    if ( ( GetForLoopIndexA() == 5 ) ) then
        return true
    endif
    return false
endfunction

function Trig_IceStar_Copy_Func006Func003Func001Func005003001001003001 takes nothing returns boolean
    return ( IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(udg_IceStarCaster)) == true )
endfunction

function Trig_IceStar_Copy_Func006Func003Func001Func005003001001003002 takes nothing returns boolean
    return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction

function Trig_IceStar_Copy_Func006Func003Func001Func005003001001003 takes nothing returns boolean
    return GetBooleanAnd( Trig_IceStar_Copy_Func006Func003Func001Func005003001001003001(), Trig_IceStar_Copy_Func006Func003Func001Func005003001001003002() )
endfunction

function Trig_IceStar_Copy_Func006Func003Func001C takes nothing returns boolean
    if ( not Trig_IceStar_Copy_Func006Func003Func001Func001C() ) then
        return false
    endif
    return true
endfunction

function Trig_IceStar_Copy_Func006Func003Func002C takes nothing returns boolean
    if ( ( GetForLoopIndexA() == 1 ) ) then
        return true
    endif
    if ( ( GetForLoopIndexA() == 2 ) ) then
        return true
    endif
    if ( ( GetForLoopIndexA() == 3 ) ) then
        return true
    endif
    return false
endfunction

function Trig_IceStar_Copy_Func006Func003Func005003001001003001 takes nothing returns boolean
    return ( IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(udg_IceStarCaster)) == true )
endfunction

function Trig_IceStar_Copy_Func006Func003Func005003001001003002 takes nothing returns boolean
    return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction

function Trig_IceStar_Copy_Func006Func003Func005003001001003 takes nothing returns boolean
    return GetBooleanAnd( Trig_IceStar_Copy_Func006Func003Func005003001001003001(), Trig_IceStar_Copy_Func006Func003Func005003001001003002() )
endfunction

function Trig_IceStar_Copy_Func006Func003C takes nothing returns boolean
    if ( not Trig_IceStar_Copy_Func006Func003Func002C() ) then
        return false
    endif
    return true
endfunction

function Trig_IceStar_Copy_Actions takes nothing returns nothing
    call EnableTrigger( gg_trg_IceStarMove )
    call EnableTrigger( gg_trg_IceStarEffKill )
    set udg_IceStarCaster = GetTriggerUnit()
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 5
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        if ( Trig_IceStar_Copy_Func004Func001C() ) then
            set udg_IceStarEffBool[GetForLoopIndexA()] = true
            call CreateNUnitsAtLoc( 1, udg_IceStarDammi[GetForLoopIndexA()], GetOwningPlayer(GetTriggerUnit()), GetUnitLoc(GetTriggerUnit()), bj_UNIT_FACING )
            set udg_IceStarEff[GetForLoopIndexA()] = GetLastCreatedUnit()
        else
            call DoNothing(  )
        endif
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    call TriggerSleepAction( 0.00 )
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 5
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call TriggerSleepAction( 2.30 )
        call KillUnit( udg_IceStarEff[GetForLoopIndexA()] )
        if ( Trig_IceStar_Copy_Func006Func003C() ) then
            call CreateNUnitsAtLoc( 1, udg_IceStarDammi[GetForLoopIndexA()], Player(8), PolarProjectionBJ(GetUnitLoc(GetTriggerUnit()), 100.00, ( GetUnitFacing(GetTriggerUnit()) + udg_IceStarAng[GetForLoopIndexA()] )), bj_UNIT_FACING )
            call UnitApplyTimedLifeBJ( 2.00, 'BTLF', GetLastCreatedUnit() )
            call IssuePointOrderLocBJ( GetLastCreatedUnit(), "clusterrockets", GetUnitLoc(GroupPickRandomUnit(GetUnitsInRangeOfLocMatching(2000.00, GetUnitLoc(udg_IceStarCaster), Condition(function Trig_IceStar_Copy_Func006Func003Func005003001001003)))) )
        else
            if ( Trig_IceStar_Copy_Func006Func003Func001C() ) then
                call CreateNUnitsAtLoc( 1, udg_IceStarDammi[GetForLoopIndexA()], Player(8), PolarProjectionBJ(GetUnitLoc(GetTriggerUnit()), 100.00, ( GetUnitFacing(GetTriggerUnit()) - udg_IceStarAng[GetForLoopIndexA()] )), bj_UNIT_FACING )
                call UnitApplyTimedLifeBJ( 2.00, 'BTLF', GetLastCreatedUnit() )
                call IssuePointOrderLocBJ( GetLastCreatedUnit(), "clusterrockets", GetUnitLoc(GroupPickRandomUnit(GetUnitsInRangeOfLocMatching(2000.00, GetUnitLoc(udg_IceStarCaster), Condition(function Trig_IceStar_Copy_Func006Func003Func001Func005003001001003)))) )
            else
                call DoNothing(  )
            endif
        endif
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    call TriggerSleepAction( 12.00 )
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 5
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call KillUnit( udg_IceStarEff[GetForLoopIndexA()] )
        set udg_IceStarEffBool[GetForLoopIndexA()] = false
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    call DisableTrigger( gg_trg_IceStarMove )
    call DisableTrigger( gg_trg_IceStarEffKill )
endfunction

//===========================================================================
function InitTrig_IceStar_Copy takes nothing returns nothing
    set gg_trg_IceStar_Copy = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_IceStar_Copy, Player(8), EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_IceStar_Copy, Condition( function Trig_IceStar_Copy_Conditions ) )
    call TriggerAddAction( gg_trg_IceStar_Copy, function Trig_IceStar_Copy_Actions )
endfunction

Принятый ответ

Nemezid, Скорее всего фиксированный случайный рандом влияет на это
`
ОЖИДАНИЕ РЕКЛАМЫ...
0
13
4 года назад
Отредактирован Nelloy
0
Дело в недостатке вашего понимая. Выложите кусок кода или скриншот с проблемной частью триггера, тогда можно будет поговорить предметно.
0
15
4 года назад
0
Nelloy, думаю, дело не в коде. Имею ввиду - почему пересохранение карты в другой файл меняет количество циклов?
0
32
4 года назад
0
Nemezid, Скорее всего фиксированный случайный рандом влияет на это
Принятый ответ
0
15
4 года назад
0
Bergi_Bear, я тоже так подумал. Но если это про тот, который в настройках редактора, то нет. Возможно в рефордже он чутка сломан, но это не точно
Чтобы оставить комментарий, пожалуйста, войдите на сайт.