Добавлен megabox911
Для loop я использую локальную переменную i, внутри этого цикла у меня if, где нужно использовать локальную переменную i в качестве индекса. Когда я добавляю в условие функции эту переменную пишет ошибку "неопределенная переменная". Сами условия находятся сверху скрипта, а переменная задается в action.
Как использовать локальную переменную в данных условиях?
Как использовать локальную переменную в данных условиях?
function Trig_BlockA_Conditions takes nothing returns boolean
if ( not ( R2I(GetEventDamage()) > 2 ) ) then
return false
endif
return true
endfunction
function Trig_BlockA_Func005Func002C takes nothing returns boolean
if ( ( udg_BlockChance[1] == 1 ) ) then
return true
endif
if ( ( udg_BlockChance[1] == 3 ) ) then
return true
endif
return false
endfunction
function Trig_BlockA_Func005C takes nothing returns boolean
if ( not Trig_BlockA_Func005Func002C() ) then
return false
endif
return true
endfunction
function Trig_BlockA__Func005Func011Func001C takes nothing returns boolean
if ( not ( IsUnitVisible(GetTriggerUnit(), ConvertedPlayer(GetForLoopIndexA())) == true ) ) then ???????
return false
endif
return true
endfunction
function Trig_BlockA_Actions takes nothing returns nothing
local effect eff = null
local texttag text = null
local integer i = null
set udg_BlockChance[1] = GetRandomInt(1, udg_BlockPmax[1])
if ( Trig_BlockA_Func005C() ) then
call SetUnitInvulnerable( GetTriggerUnit(), true )
call CreateTextTagUnitBJ( "TRIGSTR_305", udg_TheCastHero[1], 0, 12.00, 100.00, 100.00, 100.00, 0.00 )
set text = GetLastCreatedTextTag()
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 3.00 )
call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 3.00 )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 64, 90 )
// !
set i = 1
loop
exitwhen i == 13
if ( Trig_BlockA_Func005Func011Func001C() ) then
call ShowTextTagForceBJ( true, GetLastCreatedTextTag(), udg_PlayerGroup[GetForLoopIndexA()] ) ???
else
call ShowTextTagForceBJ( false, GetLastCreatedTextTag(), udg_PlayerGroup[GetForLoopIndexA()] ) ????
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
// !
call AddSpecialEffectTargetUnitBJ( "hand right", udg_TheCastHero[1], "war3mapImported\\war3eff_077_SilenceAreaBirth.mdx" )
set eff = GetLastCreatedEffectBJ()
call TriggerSleepAction( 0.00 )
call SetUnitInvulnerable( GetTriggerUnit(), false )
call DestroyEffectBJ(eff)
call TriggerSleepAction( 1.50 )
call DestroyTextTagBJ(text)
else
call DoNothing( )
endif
endfunction
//===========================================================================
function InitTrig_BlockAw takes nothing returns nothing
set gg_trg_BlockAw = CreateTrigger( )
call TriggerRegisterUnitEvent( gg_trg_BlockAw, gg_unit_H00C_0015, EVENT_UNIT_DAMAGED )
call TriggerAddCondition( gg_trg_BlockAw, Condition( function Trig_BlockA_Conditions ) )
call TriggerAddAction( gg_trg_BlockAw, function Trig_BlockA_Actions )
endfunction
как заменить этот индекс А на локальную?
Принятый ответ
функцию Trig_BlockA_Func005Func011Func001C() убери нафиг
как и другие функции используемые для ифов и подобной херни
а вообще про это написано во всех статьях про jass
мб стоит прочитать сразу несколько статей а затем задавать сюда вопросы?
как и другие функции используемые для ифов и подобной херни
а вообще про это написано во всех статьях про jass
мб стоит прочитать сразу несколько статей а затем задавать сюда вопросы?
https://xgm.guru/p/wc3/articles
https://xgm.guru/p/wc3/jassintroduction
https://xgm.guru/p/wc3/jass_conditions_and_loops
https://xgm.guru/p/wc3/jassintroduction
https://xgm.guru/p/wc3/jass_conditions_and_loops
правила сайта
смотри пункт 10.3
смотри пункт 10.3
Чтобы оставить комментарий, пожалуйста, войдите на сайт.
Отредактирован nvc123
как и другие функции используемые для ифов и подобной херни
а вообще про это написано во всех статьях про jass
мб стоит прочитать сразу несколько статей а затем задавать сюда вопросы?
https://xgm.guru/p/wc3/jassintroduction
https://xgm.guru/p/wc3/jass_conditions_and_loops
смотри пункт 10.3