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_Func002Func001C takes nothing returns boolean
    if ( not ( IsUnitAlly(GetEnumUnit(), GetOwningPlayer(GetSpellAbilityUnit())) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Iscelenie_cast_Func002A takes nothing returns nothing
    if ( Trig_Iscelenie_cast_Func002Func001C() ) then
        local location Loc
        local unit un
        set Loc = GetUnitLoc(GetEnumUnit())
        call CreateNUnitsAtLoc( 1, 'h00L', GetOwningPlayer(GetSpellAbilityUnit()), Loc, bj_UNIT_FACING )
        set un = GetLastCreatedUnit()
        call UnitApplyTimedLife( GetLastCreatedUnit(), 'BTLF', 1.00 )
        call UnitAddAbility( un, 'A042' )
        call SetUnitAbilityLevel( un, 'A042', GetUnitAbilityLevel(GetSpellAbilityUnit(), 'A006' ) )
        call IssueTargetOrder( un, "creepheal", GetEnumUnit() )
        call CreateNUnitsAtLoc( 1, 'h00L', GetOwningPlayer(GetSpellAbilityUnit()), Loc, bj_UNIT_FACING )
        call UnitApplyTimedLife( un, 'BTLF', 1.00 )
        call UnitAddAbility( un, 'A032' )
        call SetUnitAbilityLevelSwapped( 'A032', un, GetUnitAbilityLevelSwapped('A006', GetSpellAbilityUnit()) )
        call IssueTargetOrder( un, "innerfire", GetEnumUnit() )
        call RemoveLocation(Loc)
        set Loc = null
        set un = null
    else
        local location Loc u
        set Loc u = GetUnitLoc(GetEnumUnit())
        call CreateNUnitsAtLoc( 1, 'h00L', GetOwningPlayer(GetSpellAbilityUnit()), Loc u, bj_UNIT_FACING )
        call UnitApplyTimedLifeBJ( 1.00, 'BTLF', GetLastCreatedUnit() )
        call UnitAddAbilityBJ( 'A078', GetLastCreatedUnit() )
        call SetUnitAbilityLevelSwapped( 'A078', GetLastCreatedUnit(), GetUnitAbilityLevelSwapped('A006', GetSpellAbilityUnit()) )
        call IssueTargetOrderBJ( GetLastCreatedUnit(), "fingerofdeath", GetEnumUnit() )
        call RemoveLocation(Loc u)
        set Loc u = null
    endif
endfunction

function Trig_Iscelenie_cast_Actions takes nothing returns nothing
    local location Loc u
    set Loc u = GetSpellTargetLoc()
    call ForGroupBJ( GetUnitsInRectAll(RectFromCenterSizeBJ(Loc u, 600.00, 600.00)), function Trig_Iscelenie_cast_Func002A )
    call RemoveLocation(Loc u)
    set Loc u = null
endfunction

//===========================================================================
function InitTrig_Iscelenie_cast takes nothing returns nothing
    set gg_trg_Iscelenie_cast = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Iscelenie_cast, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Iscelenie_cast, Condition( function Trig_Iscelenie_cast_Conditions ) )
    call TriggerAddAction( gg_trg_Iscelenie_cast, function Trig_Iscelenie_cast_Actions )
endfunction
Проблема с кодом не хочет работать(

Отредактировано Cosonic5, 18.04.2012 в 14:21.
Старый 18.04.2012, 14:06
Klop
Папа римский
offline
Опыт: 13,006
Активность:
((кат Вот это ненадо
function Trig_Iscelenie_cast_Func002Func001C takes nothing returns boolean
    if ( not ( IsUnitAlly(GetEnumUnit(), GetOwningPlayer(GetSpellAbilityUnit())) == true ) ) then
        return false
    endif
    return true
endfunction
))
if IsUnitAlly(GetEnumUnit(), GetOwningPlayer(GetSpellAbilityUnit())) then
Klop добавил:
Cosonic5:
call location Loc u
у тебя компилятор не говрит что это беда,local location Loc_u как бы на пробелы в названиях тоже не говорит
я даже не могу понять что это
Старый 18.04.2012, 14:16
Cosonic5
Моймозггоритогнем
offline
Опыт: 13,584
Активность:
Klop, да ошибка тут) функция вызывается но не правильно это я изменил.
Старый 18.04.2012, 14:17
Klop
Папа римский
offline
Опыт: 13,006
Активность:
Cosonic5:
Local location Loc u
local с маленькой буквы
Loc_u = пробелы не работают,надо подчёркивания ставить
Klop добавил:
call CreateNUnitsAtLoc( 1, 'h00L', GetOwningPlayer(GetSpellAbilityUnit()), Loc, bj_UNIT_FACING )
set un = GetLastCreatedUnit()
а так сделать можно?
set un = CreateUnitsAtLoc(GetOwningPlayer(GetSpellAbilityUnit(),'h00L',Loc,0)
Klop добавил:
если бы мне вместо пойди на кухню возьми сковородку и дай ей по голове коту сказали,пойду в комнату где стоит телек стол холодильник найди там гдето такая круглая кастрюля с ручкой и ударь что то пушистое но не собаку,я бы тоже не работал
Klop добавил:
не пиши код конвертированый от ГУИ
конвертируй сразу а потом пиши все функции ты найдёш в function list JNGP
Старый 18.04.2012, 14:28
Cosonic5
Моймозггоритогнем
offline
Опыт: 13,584
Активность:
Klop, хмм тут гуи очень и очень мало.
Старый 18.04.2012, 14:34
Klop
Папа римский
offline
Опыт: 13,006
Активность:
((кат Вот переписал немного
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)
    if IsUnitAlly(GetEnumUnit(), p) then
        set Loc = GetUnitLoc(GetEnumUnit())
        set un  = CreateUnitsAtLoc( p, 'h00L', Loc, bj_UNIT_FACING )
        call UnitApplyTimedLife( un, 'BTLF', 1.00 )
        call UnitAddAbility( un, 'A042' )
        call SetUnitAbilityLevel( un, 'A042', GetUnitAbilityLevel(u, 'A006' ))
        call IssueTargetOrder( un, "creepheal", GetEnumUnit() )
        set un = CreateUnitsAtLoc( p, 'h00L', Loc, bj_UNIT_FACING )
        call UnitApplyTimedLife( un, 'BTLF', 1.00 )
        call UnitAddAbility( un, 'A032' )
        call SetUnitAbilityLevel( un,'A032',GetUnitAbilityLevel(u,'A006') )
        call IssueTargetOrder( un, "innerfire", GetEnumUnit() )
        call RemoveLocation(Loc)
        set Loc = null
        set un = null
    else
        set Loc = GetUnitLoc(GetEnumUnit())
        set un = CreateUnitsAtLoc( p, 'h00L', Loc, bj_UNIT_FACING )
        call UnitApplyTimedLife( un, 'BTLF', 1.00 )
        call UnitAddAbility( un,'A078')
        call SetUnitAbilityLevel( un,'A078', GetUnitAbilityLevel(u,'A006') )
        call IssueTargetOrderBJ( un, "fingerofdeath", GetEnumUnit() )
        call RemoveLocation(Loc)
        set Loc = null
        set un = null
    endif
    u = null
endfunction

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

//===========================================================================
function InitTrig_Iscelenie_cast takes nothing returns nothing
    set gg_trg_Iscelenie_cast = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Iscelenie_cast, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Iscelenie_cast, Condition( function Trig_Iscelenie_cast_Conditions ) )
    call TriggerAddAction( gg_trg_Iscelenie_cast, function Trig_Iscelenie_cast_Actions )
endfunction
))
Попробуй так
Старый 18.04.2012, 14:42
Cosonic5
Моймозггоритогнем
offline
Опыт: 13,584
Активность:
Klop, не работает
Старый 18.04.2012, 14:47
Klop
Папа римский
offline
Опыт: 13,006
Активность:
Cosonic5:
Klop, не работает
Блять ну напиши что не работает, напиши какие ошибки показывает,слов уже нету,не работает ,я от руки писал не проверяя,щас все спеллы как у тебя буду делать 150 обьектов что б проверить твой код
Старый 18.04.2012, 14:49
DaeDR

offline
Опыт: 8,074
Активность:
Cosonic5, Сделай отладочное сообщение!
DaeDR добавил:
Напрмер в
function Trig_Iscelenie_cast_Func002A takes nothing returns nothing
вставь в конце
BJDebugMsg ("+1")
DaeDR добавил:
Если высветится, то группа выбирается и т.д.
DaeDR добавил:
Потом уже в само условие, где союзник или враг тоже так же.
Методом тыка можно угадать, что конкретно не работает
DaeDR добавил:
Отладочные сообщения - первое, чему необходимо научиться!
Старый 18.04.2012, 14:53
Klop
Папа римский
offline
Опыт: 13,006
Активность:
давай так
компилятор ошибки выдаёт? например если ты укажешь переменную с карявым названием или не созданую выдаст
line Номер: unknown variable Название
Klop добавил:
((кат Вот код на окторый компилятор не ругается и должен работать
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)
    if IsUnitAlly(GetEnumUnit(), p) then
        set Loc = GetUnitLoc(GetEnumUnit())
        set un  = CreateUnitAtLoc( p, 'h00L', Loc, bj_UNIT_FACING )
        call UnitApplyTimedLife( un, 'BTLF', 1.00 )
        call UnitAddAbility( un, 'A042' )
        call SetUnitAbilityLevel( un, 'A042', GetUnitAbilityLevel(u, 'A006' ))
        call IssueTargetOrder( un, "creepheal", GetEnumUnit() )
        set un = CreateUnitAtLoc( p, 'h00L', Loc, bj_UNIT_FACING )
        call UnitApplyTimedLife( un, 'BTLF', 1.00 )
        call UnitAddAbility( un, 'A032' )
        call SetUnitAbilityLevel( un,'A032',GetUnitAbilityLevel(u,'A006') )
        call IssueTargetOrder( un, "innerfire", GetEnumUnit() )
        call RemoveLocation(Loc)
        set Loc = null
        set un = null
    else
        set Loc = GetUnitLoc(GetEnumUnit())
        set un = CreateUnitAtLoc( p, 'h00L', Loc, bj_UNIT_FACING )
        call UnitApplyTimedLife( un, 'BTLF', 1.00 )
        call UnitAddAbility( un,'A078')
        call SetUnitAbilityLevel( un,'A078', GetUnitAbilityLevel(u,'A006') )
        call IssueTargetOrder( un, "fingerofdeath", GetEnumUnit() )
        call RemoveLocation(Loc)
        set Loc = null
        set un = null
    endif
    u = null
endfunction

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

//===========================================================================
function InitTrig_Iscelenie_cast takes nothing returns nothing
    set gg_trg_Iscelenie_cast = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Iscelenie_cast, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Iscelenie_cast, Condition( function Trig_Iscelenie_cast_Conditions ) )
    call TriggerAddAction( gg_trg_Iscelenie_cast, function Trig_Iscelenie_cast_Actions )
endfunction
))
Старый 18.04.2012, 14:57
Cosonic5
Моймозггоритогнем
offline
Опыт: 13,584
Активность:
u = null ошибка 1 где Set?
Старый 18.04.2012, 15:01
Klop
Папа римский
offline
Опыт: 13,006
Активность:
Cosonic5, у меня cJass и set call local не пишутся поэтому и компилируется доставь сам
Старый 18.04.2012, 15:02
Cosonic5
Моймозггоритогнем
offline
Опыт: 13,584
Активность:
Klop, Во после этой ошибки все действительно заработало наконец-то Спасибо!
Cosonic5 добавил:
Klop, аз да слышал что перед удалением отряда его нужно отчищать вроде.
Старый 18.04.2012, 15:09
Klop
Папа римский
offline
Опыт: 13,006
Активность:
Cosonic5:
Klop, аз да слышал что перед удалением отряда его нужно отчищать вроде.
у тебя есть ящик с хламом ты его выкидывать собрался,его нужно сперва очистить а потом выкинуть или всёравно?
хочешь делать лишную операцию пожалуйста
Старый 18.04.2012, 15:12
DaeDR

offline
Опыт: 8,074
Активность:
Cosonic5, Учись сразу работать с координатами. (Выбрось точки из головы)
Вместо bj_UNIT_FACING пиши сразу значения 270.0
Если число real, то в конце ставь точку (можно с нулем). Например: 270. или 270.0 Без точки будет произведена еще одна операция по ее добавлению (при каждом вызове)
Не пиши по несколько раз одно и тоже:
call RemoveLocation(Loc)
set Loc = null
set un = null
У тебя так и так будет создано un! Обнуляй в конце. Если ты создал переменную и ничего ей не присвоил, то все равно обнули! При создании, она не равна null. - утечка!
Еще один важный момент: Это уже мое мнение Любое использование типа строки (например: "fingerofdeath") лучше делать через переменную string (через константу). Так не будет утечки. Не знаю, у кого как, но при проверки на кол-во хэндлов, они резко увеличиваются
Сам код:
» code
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 real x = GetUnitX(GetEnumUnit())
    local real y = GetUnitY(GetEnumUnit())
    local integer lvl = GetUnitAbilityLevel(u, 'A006' )
    local unit un
    local player p = GetOwningPlayer(u)
    if IsUnitAlly(GetEnumUnit(), p) then
        set un  = CreateUnit( p, 'h00L', x, y, 270.0 )
        call UnitApplyTimedLife( un, 'BTLF', 1.00 )
        call UnitAddAbility( un, 'A042' )
        call SetUnitAbilityLevel( un, 'A042', lvl)
        call IssueTargetOrder( un, "creepheal", GetEnumUnit() )
        set un = CreateUnit( p, 'h00L', x, y, 270.0 )
        call UnitApplyTimedLife( un, 'BTLF', 1.00 )
        call UnitAddAbility( un, 'A032' )
        call SetUnitAbilityLevel( un,'A032',lvl )
        call IssueTargetOrder( un, "innerfire", GetEnumUnit() )
    else
        set un = CreateUnit( p, 'h00L', x, y, 270.0 )
        call UnitApplyTimedLife( un, 'BTLF', 1.00 )
        call UnitAddAbility( un,'A078')
        call SetUnitAbilityLevel( un,'A078', lvl )
        call IssueTargetOrder( un, "fingerofdeath", GetEnumUnit() )
    endif
    set u = null
    set un = null
    set p = null
endfunction

function Trig_Iscelenie_cast_Actions takes nothing returns nothing
    local real x = GetSpellTargetX()
    local real y = GetSpellTargetY()
    local group g = CreateGroup()
    call GroupEnumUnitsInRange(g, x, y, 600.0, null)
    call ForGroup( g, function Trig_Iscelenie_cast_Func002A )
    call DestroyGroup(g)
    set g = null
endfunction

//===========================================================================
function InitTrig_Iscelenie_cast takes nothing returns nothing
    set gg_trg_Iscelenie_cast = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Iscelenie_cast, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Iscelenie_cast, Condition( function Trig_Iscelenie_cast_Conditions ) )
    call TriggerAddAction( gg_trg_Iscelenie_cast, function Trig_Iscelenie_cast_Actions )
endfunction
Старый 18.04.2012, 15:12
Klop
Папа римский
offline
Опыт: 13,006
Активность:
DaeDR:
(Выбрось точки из головы)
всунул точки обратно когда начал работать со снарядами ибо GetLocationZ() нужная вещь и полезная вещь
Старый 18.04.2012, 15:14
DaeDR

offline
Опыт: 8,074
Активность:
Klop, ему еще далеко. Да и без точек там можно обойтись
Старый 18.04.2012, 15:17
Cosonic5
Моймозггоритогнем
offline
Опыт: 13,584
Активность:
DaeDR, да нет не далеко у нас будет не мало спелов со снарядами.
но все же по координатам удобней согласен.. Да и не заметил что 2 раза создавался даммик щас все исправил.
Старый 18.04.2012, 15:39
DaeDR

offline
Опыт: 8,074
Активность:
Cosonic5,
да нет не далеко у нас будет не мало спелов со снарядами.
И для чего там точки с Z? Всегда без них обходился
Старый 18.04.2012, 15:41
Klop
Папа римский
offline
Опыт: 13,006
Активность:
DaeDR:
И для чего там точки с Z? Всегда без них обходился
обьясняю
например ты кинул спелл со склона
дамми резко снижает свою высоту
дамми летит в склон ну вместо того что бы взорваться об склон который он спокойно подымается на него,что есть не правильно
Старый 18.04.2012, 15:45
Закрытая тема

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

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

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

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



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