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

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

Закрытая тема
 
Ninbous
Jass progress >>>>>35/100
offline
Опыт: 5,674
Активность:
Ошибка в коде
» раскрыть

Код:
lobals
  filterfunc ff = null
  timer array Tm
  unit array U
  unit array UT
  integer hf
  integer ht
endglobals

function H2I takes handle h returns integer
  return h
  return 0
endfunction


function Ends takes nothing returns nothing
  local timer e = GetExpiredTimer()
  local integer he = H2I(e)-0x100000
  local integer hf = H2I(Tm[he])-0x100000
  set U[hf] = null
  set UT[ht] = null
  call DestroyTimer(Tm[he])
  call DestroyTimer(e)
  set Tm[he] = null
  set e = null
endfunction

function SpellDamage takes nothing returns real
    return 1.00*I2R(GetUnitAbilityLevel(U[hf], 'A001'))

function Damage takes nothing returns nothing   //  СИНТАКСИЧЕСКАЯ ОШИБКА
  local integer hf = H2I(GetExpiredTimer())-0x100000
     if GetUnitState(U[hf], UNIT_STATE_MANA) >= 0.00 and GetUnitState(UT[ht], UNIT_STATE_LIFE)>0 then
        call UnitDamageTarget(U[hf], UT[ht], SpellDamage() , true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
     endif
   return false
endfunction

function Actions takes nothing returns nothing
  local timer t 
  local timer te 
  local integer he 
   if GetSpellAbilityId() == 'A001' then
     set t = CreateTimer()
     set te = CreateTimer()
     set he = H2I(te)-0x100000 
     set hf = H2I(t)-0x100000 
     set Tm[he] = t
     set U[hf] = GetTriggerUnit()
     set UT[ht] = GetSpellTargetUnit ()
     call TimerStart(Tm[he],0.05, true, function Damage)
     call TimerStart(te,6.01, false, function Ends)
   endif 
  set t = null 
  set te = null
endfunction

//===========================================================================
function InitTrig_BlackHole takes nothing returns nothing
    set gg_trg_BlackHole = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEvent(gg_trg_BlackHole, Player(0), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
    call TriggerRegisterPlayerUnitEvent(gg_trg_BlackHole, Player(1), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
    call TriggerRegisterPlayerUnitEvent(gg_trg_BlackHole, Player(2), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
    call TriggerRegisterPlayerUnitEvent(gg_trg_BlackHole, Player(3), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
    call TriggerRegisterPlayerUnitEvent(gg_trg_BlackHole, Player(4), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
    call TriggerRegisterPlayerUnitEvent(gg_trg_BlackHole, Player(5), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
    call TriggerRegisterPlayerUnitEvent(gg_trg_BlackHole, Player(6), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
    call TriggerRegisterPlayerUnitEvent(gg_trg_BlackHole, Player(7), EVENT_PLAYER_UNIT_SPELL_EFFECT, null) 
    call TriggerRegisterPlayerUnitEvent(gg_trg_BlackHole, Player(8), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
    call TriggerRegisterPlayerUnitEvent(gg_trg_BlackHole, Player(9), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
    call TriggerRegisterPlayerUnitEvent(gg_trg_BlackHole, Player(10), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
    call TriggerRegisterPlayerUnitEvent(gg_trg_BlackHole, Player(11), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
    call TriggerRegisterPlayerUnitEvent(gg_trg_BlackHole, Player(12), EVENT_PLAYER_UNIT_SPELL_EFFECT, null) 
    call TriggerAddAction( gg_trg_BlackHole, function Actions )
endfunction


В Функции Damage пишет что синтаксчическая ошибка, как исправить? Помогите пожалуйста.

Отредактировано Ninbous, 26.05.2009 в 20:48.
Старый 26.05.2009, 20:31
J
expert
offline
Опыт: 48,447
Активность:
функция не должна ничего возвращать
Старый 26.05.2009, 21:56
Enein
Silenced by ZlaYa1000
offline
Опыт: 43,453
Активность:
Код:
globals
  filterfunc ff = null
  timer array Tm
  unit array U
  unit array UT
  integer hf
  integer ht
endglobals

function H2I takes handle h returns integer
  return h
  return 0
endfunction

function Ends takes nothing returns nothing
  local timer e = GetExpiredTimer()
  local integer he = H2I(e)-0x100000
  local integer hf = H2I(Tm[he])-0x100000
  set U[hf] = null
  set UT[ht] = null
  call DestroyTimer(Tm[he])
  call DestroyTimer(e)
  set Tm[he] = null
  set e = null
endfunction

function SpellDamage takes nothing returns real
    return 1*I2R(GetUnitAbilityLevel(U[hf], 'A001'))
endfunction

function Damage takes nothing returns nothing
    local integer hf = H2I(GetExpiredTimer())-0x100000
    if GetUnitState(U[hf], UNIT_STATE_MANA) >= 0.00 and GetUnitState(UT[ht], UNIT_STATE_LIFE)>0 then
        call UnitDamageTarget(U[hf], UT[ht], SpellDamage() , true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
    endif
endfunction

function Actions takes nothing returns nothing
  local timer t 
  local timer te 
  local integer he 
   if GetSpellAbilityId() == 'A001' then
     set t = CreateTimer()
     set te = CreateTimer()
     set he = H2I(te)-0x100000 
     set hf = H2I(t)-0x100000 
     set Tm[he] = t
     set U[hf] = GetTriggerUnit()
     set UT[ht] = GetSpellTargetUnit ()
     call TimerStart(Tm[he],0.05, true, function Damage)
     call TimerStart(te,6.01, false, function Ends)
   endif 
  set t = null 
  set te = null
endfunction

//===========================================================================
function InitTrig_BlackHole takes nothing returns nothing
    local integer i = 0
    set gg_trg_BlackHole = CreateTrigger()
    loop
        exitwhen i > 12
        call TriggerRegisterPlayerUnitEvent(gg_trg_BlackHole, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
        set i = i + 1
    endloop
    call TriggerAddAction( gg_trg_BlackHole, function Actions )
endfunction


а также в функции перед Damage отсутствует endfunction

Enein добавил:
а вообще код немного кривой и непонятный

Enein добавил:
зачем 2 таймера, если можно было обойтись одним?
Старый 26.05.2009, 22:03
Ninbous
Jass progress >>>>>35/100
offline
Опыт: 5,674
Активность:
Да с нуля как бы нехочется начинать вот я и беру код alexkila, которые он сделал мне ранее по другому спелу, и просто переделываю его под другой спелл... и то что я непонимаю, я пока не удаляю, (например что за функция H2I, я вообще не понимаю, могу только догадыватся что ето функция конверирует ИД какогото обьекта в Integer)

Спасибо Enein
Старый 26.05.2009, 22:21
Enein
Silenced by ZlaYa1000
offline
Опыт: 43,453
Активность:
статьи решают, хотя хз - я ниодной статьи не прочитал по jass, и тем не менее нормально в нем разбираюсь, выучился именно на чужих спеллах. только тебе советовал бы начинать с более простых спеллов
Старый 26.05.2009, 22:25
Ninbous
Jass progress >>>>>35/100
offline
Опыт: 5,674
Активность:
Да эту статью я прочитал, когда я еще вообще ничегно не знал даже о локальных переменных, нада бы теперь перечитать.

Ninbous добавил:
Тему мона закрыть.
Старый 26.05.2009, 23:29
ELDAR
НИИ 4А-ВО кафедра SPELLS
offline
Опыт: 8,394
Активность:
упрощенный вариант
» code
Код:
globals
  unit array U
  unit array UT
  real array Time
  integer array lvl
endglobals

function H2I takes handle h returns integer
  return h
  return 0
endfunction

function Damage takes nothing returns nothing
    local integer hf = H2I(GetExpiredTimer())-0x100000
    if GetUnitState(U[hf], UNIT_STATE_MANA) >= 0.00 and GetUnitState(UT[hf], UNIT_STATE_LIFE)>0 then
        call UnitDamageTarget(U[hf], UT[hf], lvl[hf] , true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
    endif
    set Time[hf] = Time[hf] - 0.05
    if Time[hf] <= 0 then
        call DestroyTimer(GetExpiredTimer())
        set U[hf] = null
        set UT[hf] = null
    endif
endfunction

function Actions takes nothing returns nothing
  local timer t 
   if GetSpellAbilityId() == 'A001' then
     set t = CreateTimer()
     set lvl[H2I(t)-0x100000]=GetUnitAbilityLevel(GetTriggerUnit(), 'A001')
     set Time[H2I(t)-0x100000] = 6
     set U[H2I(t)-0x100000] = GetTriggerUnit()
     set UT[H2I(t)-0x100000] = GetSpellTargetUnit ()
     call TimerStart(t,0.05, true, function Damage)
   endif 
  set t = null 
endfunction

//===========================================================================
function InitTrig_BlackHole takes nothing returns nothing
    local integer i = 0
    set gg_trg_BlackHole = CreateTrigger()
    loop
        exitwhen i > 12
        call TriggerRegisterPlayerUnitEvent(gg_trg_BlackHole, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
        set i = i + 1
    endloop
    call TriggerAddAction( gg_trg_BlackHole, function Actions )
endfunction
Старый 27.05.2009, 06:58
Закрытая тема

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

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

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

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



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