XGM Forum
Сайт - Статьи - Проекты - Ресурсы - Блоги

Форуме в режиме ТОЛЬКО ЧТЕНИЕ. Вы можете задать вопросы в Q/A на сайте, либо создать свой проект или ресурс.
Вернуться   XGM Forum > Warcraft> Академия: форум для вопросов> Jass
Ник
Пароль
Войти через VK в один клик
Сайт использует только имя.

Закрытая тема
 
Cosonic5
Моймозггоритогнем
offline
Опыт: 13,584
Активность:
как правильно поставить условие?
function Trig_Iscelenie_cast_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A006' 
endfunction

function Trig_Iscelenie_cast_Func002A takes nothing returns nothing
        local unit u = GetTriggerUnit()
        local location Loc
        local unit un
        local player p = GetOwningPlayer(u)
        set Loc = GetSpellTargetLoc()
        set un  = CreateUnitAtLoc( p, 'h00L', Loc, bj_UNIT_FACING )
        call UnitApplyTimedLife( un, 'BTLF', 2.00 )
        call UnitAddAbility( un, 'A032' )
        call SetUnitAbilityLevel( un,'A032',GetUnitAbilityLevel(u,'A006') )
  if IsUnitAlly(GetEnumUnit(), p) then
    if GetUnitState(GetEnumUnit(), UNIT_STATE_LIFE) > 0.0 then
        call UnitDamageTargetBJ( u, GetEnumUnit(), ( -80.00 * I2R(GetUnitAbilityLevel( u, 'A006' ) ) ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
        call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl", GetEnumUnit(), "origin" ) )
        call IssueTargetOrder( un, "innerfire", GetEnumUnit() )
        call RemoveLocation(Loc)
        set Loc = null
        set un = null
    else
        call UnitDamageTargetBJ( u, GetEnumUnit(), ( 40.00 * I2R(GetUnitAbilityLevel( u, 'A006' ) ) ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
        call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl", GetEnumUnit(), "origin" ) )
        call RemoveLocation(Loc)
        set Loc = null
        set un = null
    endif
    set u = null
    endif
endfunction

function Trig_Iscelenie_cast_Actions takes nothing returns nothing
    local location Locs = GetSpellTargetLoc()
    local group g = CreateGroup()
    call GroupEnumUnitsInRangeOfLoc(g,Locs,300,null)
    call ForGroup( g, function Trig_Iscelenie_cast_Func002A )
    call DestroyGroup(g)
    call RemoveLocation(Locs)
    set g = null
    set Locs = null
endfunction

//===========================================================================
function InitTrig_Iscelenie_cast_Gui takes nothing returns nothing
    set gg_trg_Iscelenie_cast_Gui = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Iscelenie_cast_Gui, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Iscelenie_cast_Gui, Condition( function Trig_Iscelenie_cast_Conditions ) )
    call TriggerAddAction( gg_trg_Iscelenie_cast_Gui, function Trig_Iscelenie_cast_Actions )
endfunction
Вообщем нужно добавить такое условие, если выбранный юнит союзник и его жизни больше 0, то произвести действия, а если враг и жизней тоже больше 0, то нанести урон. Помогите запутался в условиях.
Старый 20.04.2012, 10:53
Hanabishi
COOL STATUS
offline
Опыт: отключен
Поменяй местами IsUnitAlly(GetEnumUnit(), p) и GetUnitState(GetEnumUnit(), UNIT_STATE_LIFE) > 0.0
Старый 20.04.2012, 10:58
quq_CCCP
Я белый и пушистый!
offline
Опыт: 93,279
Активность:
((код jass
function IsAllyAliveOrEnemy takes unit u, player pl returns boolean
if(GetUnitState(u, UNIT_STATE_LIFE) > 0.0 and IsUnitAlly(u, pl) )then
return true
elseif(GetUnitState(u, UNIT_STATE_LIFE) > 0.0 and not IsUnitAlly(u, pl))then
return false
endif
return false
endfunction
))
Старый 20.04.2012, 11:00
Cosonic5
Моймозггоритогнем
offline
Опыт: 13,584
Активность:
Hanabishi, точно спс.
quq_CCCP, зачем отдельная функция если можно сразу добавить в цикл.
Старый 20.04.2012, 11:02
Закрытая тема

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск

Ваши права в разделе
Вы не можете создавать темы
Вы не можете отвечать на сообщения
Вы не можете прикреплять файлы
Вы можете скачивать файлы

BB-коды Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход



Часовой пояс GMT +3, время: 22:49.