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

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

Закрытая тема
 
CeDiL
Pinkie <3
offline
Опыт: 2,092
Активность:
Не выходит(
Помогите пожалуста, у меня не выходит(( Почемуто не всё в триггере выполняется
Код:
scope Charge initializer Init

struct Charge 
private unit caster
private unit target

static method onExpire takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local timer t = GetExpiredTimer()
local real casterx = GetUnitX(.caster)
local real castery = GetUnitY(.caster)
local real angle = GetUnitFacing(.caster)
local real newx = casterx - 50*Cos(angle)
local real newy = castery - 50*Sin(angle)
call BJDebugMsg("Warning: onExpire Working!!")
if IsTerrainWalkable(GetUnitX(.target), GetUnitY(.target)) then
call SetUnitPosition(.caster, newx, newy)
endif
if (casterx == GetUnitX(.target)) and (castery == GetUnitY(.target)) then
call ReleaseTimer(t)
endif
endmethod

static method Actions takes nothing returns nothing
local thistype this
local timer t

call SetUnitPathing(.caster, false)
call BJDebugMsg("Warning: Actions Working!!")
call SetUnitTimeScale(.caster, 3)
call SetUnitAnimationByIndex(.caster, 12) 
set t = NewTimer()
call SetTimerData(t, this)
call TimerStart(t, 0.01, true, function thistype.onExpire)
endmethod

static method Conditions takes nothing returns boolean
local thistype this
if GetSpellAbilityId() == 'A00E' then
set this = thistype.allocate()
set .caster = GetTriggerUnit()
set .target = GetSpellTargetUnit()
call BJDebugMsg("Warning: Conditions Working!!")
call this.Actions()
return false
endif
set .caster = null
set .target = null
call this.destroy()
return false
endmethod

endstruct
//===========================================================================
function Init takes nothing returns nothing
    local trigger tr = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( tr, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( tr, Condition( function Charge.Conditions) )
endfunction

endscope
Старый 22.02.2011, 17:23
Doc

offline
Опыт: 63,163
Активность:
Пишу по ходу просмотра кода.
set .caster = null
set .target = null
call this.destroy()
ололо, что ты уничтожаешь после ретурна?
static method Actions takes nothing returns nothing
local thistype this
static? убрать. this передается по дефолту, когда ты вызываешь эту функцию.
Вроде все.
Старый 22.02.2011, 17:38
CeDiL
Pinkie <3
offline
Опыт: 2,092
Активность:
Цитата:
Сообщение от Doc
Пишу по ходу просмотра кода.

""
set .caster = null
set .target = null
call this.destroy()
""
ололо, что ты уничтожаешь после ретурна?


Ретурн там в структуре if-a, а если не этот спелл использовали, то появится баганый stuct(thistype). Вот я и думал его убрать(
Старый 22.02.2011, 17:53
Doc

offline
Опыт: 63,163
Активность:
CeDiL, ничего там не появится. Так убери static и local thistype this в actions и попробуй.
Старый 22.02.2011, 18:00
CeDiL
Pinkie <3
offline
Опыт: 2,092
Активность:
всё убрал) работает, большое спасбо!!
Старый 22.02.2011, 18:06
Закрытая тема

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

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

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

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



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