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

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

Ответ
 
AlexKARASb
Learning cpp
offline
Опыт: 22,103
Активность:
Скопировать заклинание/советы
Добрый вечер
Пытался сделать способность "копирование способности врага"
Мало что вышло. В барахолке нашел наработку одного пользователя
В ней он использует принцип:
» code наработки Hell_oy
function Trig_Steal_Spells_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A009' ) ) then
return false
endif
return true
endfunction

function Trig_Steal_Spells_Func001Func014C takes nothing returns boolean
if ( ( GetUnitTypeId(GetSpellTargetUnit()) == 'Obla' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetSpellTargetUnit()) == 'Nbbc' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetSpellTargetUnit()) == 'Opgh' ) ) then
return true
endif
return false
endfunction

function Trig_Steal_Spells_Func001C takes nothing returns boolean
if ( not Trig_Steal_Spells_Func001Func014C() ) then
return false
endif
return true
endfunction

function Trig_Steal_Spells_Func002C takes nothing returns boolean
if ( not ( GetUnitTypeId(GetSpellTargetUnit()) == 'Ofar' ) ) then
return false
endif
return true
endfunction

function Trig_Steal_Spells_Func003C takes nothing returns boolean
if ( not ( GetUnitTypeId(GetSpellTargetUnit()) == 'Otch' ) ) then
return false
endif
return true
endfunction

function Trig_Steal_Spells_Func004C takes nothing returns boolean
if ( not ( GetUnitTypeId(GetSpellTargetUnit()) == 'Udre' ) ) then
return false
endif
return true
endfunction

function Trig_Steal_Spells_Actions takes nothing returns nothing
if ( Trig_Steal_Spells_Func001C() ) then
call UnitAddAbilityBJ( 'AOwk', GetSpellAbilityUnit() )
call SetUnitAbilityLevelSwapped( 'AOwk', GetSpellAbilityUnit(), GetUnitAbilityLevelSwapped('A009', GetSpellAbilityUnit()) )
call UnitAddAbilityBJ( 'AOmi', GetSpellAbilityUnit() )
call SetUnitAbilityLevelSwapped( 'AOmi', GetSpellAbilityUnit(), GetUnitAbilityLevelSwapped('A009', GetSpellAbilityUnit()) )
call UnitAddAbilityBJ( 'AOcr', GetSpellAbilityUnit() )
call SetUnitAbilityLevelSwapped( 'AOcr', GetSpellAbilityUnit(), GetUnitAbilityLevelSwapped('A009', GetSpellAbilityUnit()) )
call UnitAddAbilityBJ( 'AOww', GetSpellAbilityUnit() )
call SetUnitAbilityLevelSwapped( 'AOww', GetSpellAbilityUnit(), GetUnitAbilityLevelSwapped('A009', GetSpellAbilityUnit()) )
call TriggerSleepAction( 30.00 )
call UnitRemoveAbilityBJ( 'AOwk', GetTriggerUnit() )
call UnitRemoveAbilityBJ( 'AOcr', GetTriggerUnit() )
call UnitRemoveAbilityBJ( 'AOww', GetTriggerUnit() )
call UnitRemoveAbilityBJ( 'AOmi', GetTriggerUnit() )
else
endif
if ( Trig_Steal_Spells_Func002C() ) then
call UnitAddAbilityBJ( 'AOcl', GetSpellAbilityUnit() )
call SetUnitAbilityLevelSwapped( 'AOcl', GetSpellAbilityUnit(), GetUnitAbilityLevelSwapped('A009', GetSpellAbilityUnit()) )
call UnitAddAbilityBJ( 'ACs7', GetSpellAbilityUnit() )
call SetUnitAbilityLevelSwapped( 'ACs7', GetSpellAbilityUnit(), GetUnitAbilityLevelSwapped('A009', GetSpellAbilityUnit()) )
call UnitAddAbilityBJ( 'AOfs', GetSpellAbilityUnit() )
call SetUnitAbilityLevelSwapped( 'AOfs', GetSpellAbilityUnit(), GetUnitAbilityLevelSwapped('A009', GetSpellAbilityUnit()) )
call UnitAddAbilityBJ( 'AOeq', GetSpellAbilityUnit() )
call SetUnitAbilityLevelSwapped( 'AOeq', GetSpellAbilityUnit(), GetUnitAbilityLevelSwapped('A009', GetSpellAbilityUnit()) )
call TriggerSleepAction( 30.00 )
call UnitRemoveAbilityBJ( 'AOcl', GetTriggerUnit() )
call UnitRemoveAbilityBJ( 'AOeq', GetTriggerUnit() )
call UnitRemoveAbilityBJ( 'ACs7', GetTriggerUnit() )
call UnitRemoveAbilityBJ( 'AOfs', GetTriggerUnit() )
else
endif
if ( Trig_Steal_Spells_Func003C() ) then
call UnitAddAbilityBJ( 'AOsh', GetSpellAbilityUnit() )
call SetUnitAbilityLevelSwapped( 'AOsh', GetSpellAbilityUnit(), GetUnitAbilityLevelSwapped('A009', GetSpellAbilityUnit()) )
call UnitAddAbilityBJ( 'AOw2', GetSpellAbilityUnit() )
call SetUnitAbilityLevelSwapped( 'AOw2', GetSpellAbilityUnit(), GetUnitAbilityLevelSwapped('A009', GetSpellAbilityUnit()) )
call UnitAddAbilityBJ( 'AOae', GetSpellAbilityUnit() )
call SetUnitAbilityLevelSwapped( 'AOae', GetSpellAbilityUnit(), GetUnitAbilityLevelSwapped('A009', GetSpellAbilityUnit()) )
call UnitAddAbilityBJ( 'ANr2', GetSpellAbilityUnit() )
call SetUnitAbilityLevelSwapped( 'ANr2', GetSpellAbilityUnit(), GetUnitAbilityLevelSwapped('A009', GetSpellAbilityUnit()) )
call TriggerSleepAction( 30.00 )
call UnitRemoveAbilityBJ( 'AOsh', GetTriggerUnit() )
call UnitRemoveAbilityBJ( 'AOw2', GetTriggerUnit() )
call UnitRemoveAbilityBJ( 'AOae', GetTriggerUnit() )
call UnitRemoveAbilityBJ( 'ANr2', GetTriggerUnit() )
else
endif
if ( Trig_Steal_Spells_Func004C() ) then
call UnitAddAbilityBJ( 'AUcs', GetSpellAbilityUnit() )
call SetUnitAbilityLevelSwapped( 'AUcs', GetSpellAbilityUnit(), GetUnitAbilityLevelSwapped('A009', GetSpellAbilityUnit()) )
call UnitAddAbilityBJ( 'AUsl', GetSpellAbilityUnit() )
call SetUnitAbilityLevelSwapped( 'AUsl', GetSpellAbilityUnit(), GetUnitAbilityLevelSwapped('A009', GetSpellAbilityUnit()) )
call UnitAddAbilityBJ( 'AUav', GetSpellAbilityUnit() )
call SetUnitAbilityLevelSwapped( 'AUav', GetSpellAbilityUnit(), GetUnitAbilityLevelSwapped('A009', GetSpellAbilityUnit()) )
call UnitAddAbilityBJ( 'AUin', GetSpellAbilityUnit() )
call SetUnitAbilityLevelSwapped( 'AUin', GetSpellAbilityUnit(), GetUnitAbilityLevelSwapped('A009', GetSpellAbilityUnit()) )
call TriggerSleepAction( 30.00 )
call UnitRemoveAbilityBJ( 'AUcs', GetTriggerUnit() )
call UnitRemoveAbilityBJ( 'AUsl', GetTriggerUnit() )
call UnitRemoveAbilityBJ( 'AUav', GetTriggerUnit() )
call UnitRemoveAbilityBJ( 'AUin', GetTriggerUnit() )
else
endif
endfunction

Осматривает тип цели, если такой-то то перечисляет спелы, сравнивает с уровнем своего заклинания, затем добавляет на время заклинания кастеру.
Принцып ужастный. Хочу у вас узнать как правильно составить код, чтобы не перечислять все скилы у цели(если в карте всего 200 спелов эт что за код получится О,О).
Старый 25.01.2010, 00:05
Ответ

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

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

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

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



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