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

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

Ответ
 
Kain

offline
Опыт: 187
Активность:
Mirana - Jump под 1.24
Пожалуйсто перенести абилку мираны из DotA_Allstars_v6.41_Open_Objects под патч варика 1.24
// Objects used:
// 'A0LN' = Leap (Priestess of the Moon : Mirana Nightshade)
// 'e01R' = Buff Placer
// 'A0LO' = Leap (effect)
// 'Amrf' = Crow Form (Medivh)

// DEBUG Trigger Number : 56
function Leap_Spell takes nothing returns boolean
   return GetSpellAbilityId()=='A0LN'
endfunction

function Leap_ReturnOrder takes unit pfU returns nothing
   local string lf5=H2Tx(pfU)
   local string lpG=GetString(lf5,"OrderType")
   local string lph=OrderId2String(GetInteger(lf5,"OrderId"))
   local real lEv
   local real lEV
   local unit lFB
   local trigger ltt=GetTrigger(lf5,"Trigger_TrackOrder")
   local boolean lpH=not GetBoolean(lf5,"Idle")
   local boolean lpi=GetBoolean(lf5,"SuperOrder")
   call DisableTrigger(ltt)
   call IssueImmediateOrderById(pfU,OrderId("stop"))
   if lpG=="Target"and(lpH or lpi)then
      set lFB=GetUnit(lf5,"OrderTarget")
      call IssueTargetOrder(pfU,lph,lFB)
   elseif lpG=="Point"and(lpH or lpi)then
      set lEv=GetReal(lf5,"OrderPointX")
      set lEV=GetReal(lf5,"OrderPointY")
      call IssuePointOrder(pfU,lph,lEv,lEV)
   elseif(lpH or lpi)then
      call IssueImmediateOrder(pfU,"OrderString")
   endif
   call SetBoolean(lf5,"SuperOrder",false)
   call EnableTrigger(ltt)
endfunction

function Leap_SpeedBonusCheck takes nothing returns boolean
   return IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO) and IsUnitAlly(GetFilterUnit(),GetOwningPlayer(udg_u_DTAX_temp))
endfunction

function Leap_DoSpeedBonus takes nothing returns nothing
   local unit lfU=GetEnumUnit()
   local unit lJV=CreateUnit(GetOwningPlayer(lfU),'e01R',0,0,0)
   call UnitAddAbility(lJV,'A0LO')
   call SetUnitAbilityLevel(lJV,'A0LO',GetUnitAbilityLevel(udg_u_DTAX_temp,'A0LN'))
   call UnitApplyTimedLife(lJV,'BTLF',10)
endfunction

function Leap_EndRoar takes unit pfU returns nothing
   local group lEw=CreateGroup()
   local boolexpr lEW=Condition(function Leap_SpeedBonusCheck)
   set udg_u_DTAX_temp=pfU
   call GroupEnumUnitsInRange(lEw,GetUnitX(pfU),GetUnitY(pfU),800,lEW)
   call ForGroup(lEw,function Leap_DoSpeedBonus)
   call DestroyBoolExpr(lEW)
   call DestroyGroup(lEw)
endfunction

function Leap_JumpMoving takes nothing returns nothing
   local timer ltt=GetExpiredTimer()
   local string lf5=H2Tx(ltt)
   local unit lfU=GetUnit(lf5,"Hero")
   local real lpj=GetReal(lf5,"DistanceRemaining")
   local real lpJ=GetReal(lf5,"OriginalDistance")
   local real lnM=GetReal(lf5,"Angle")
   local real lpC=GetUnitX(lfU)+30*Cos(lnM*bj_DEGTORAD)
   local real lpd=GetUnitY(lfU)+30*Sin(lnM*bj_DEGTORAD)
   local real lpk=200
   local real lpK=(1-lpj/lpJ)*lpk*2
   if lpK>lpk then
      set lpK=lpk*2-lpK
   endif
   call SetUnitFlyHeight(lfU,ReturnMaxReal(lpK,0),0)
   call SetUnitX(lfU,SafeX(lpC))
   call SetUnitY(lfU,SafeY(lpd))
   call SetUnitFacing(lfU,lnM)
   call SetReal(lf5,"DistanceRemaining",lpj-20)
   if lpK<1 and lpj-lpJ!=0 then
      call SetBoolean(H2Tx(lfU),"InAir",false)
      call SetUnitFacing(lfU,lnM)
      call SetUnitAnimation(lfU,"stand")
      call SetUnitPathing(lfU,true)
      call SetUnitInvulnerable(lfU,false)
      call Leap_ReturnOrder(lfU)
      call Leap_EndRoar(lfU)
      call PauseTimer(ltt)
      call FastFlush(lf5)
      call DestroyTimer(ltt)
   endif
endfunction

function Leap_JumpSetting takes nothing returns nothing
   local unit lfU=GetTriggerUnit()
   local integer lmZ=GetUnitAbilityLevel(lfU,'A0LN')
   local real lFc=350+50*lmZ
   local real lnM=GetUnitFacing(lfU)
   local real lFC=GetUnitX(lfU)
   local real lFd=GetUnitY(lfU)
   local real lEv=SafeX(lFC+lFc*Cos(lnM*bj_DEGTORAD))
   local real lEV=SafeY(lFd+lFc*Sin(lnM*bj_DEGTORAD))
   local timer ltt=CreateTimer()
   local string lf5=H2Tx(ltt)
   local trigger lpL=GetTrigger(H2Tx(lfU),"Trigger_TrackOrder")
   set lFc=SquareRoot((lFC-lEv)*(lFC-lEv)+(lFd-lEV)*(lFd-lEV))
   if lFc>100 then
      call UnitAddAbility(lfU,'Amrf')
      call UnitRemoveAbility(lfU,'Amrf')
      call SetUnitPathing(lfU,false)
      call SetUnitInvulnerable(lfU,true)
      call SetUnitAnimationByIndex(lfU,6)
      call DisableTrigger(lpL)
      call IssueImmediateOrderById(lfU,OrderId("stop"))
      call EnableTrigger(lpL)
      call SetReal(lf5,"DistanceRemaining",lFc)
      call SetReal(lf5,"OriginalDistance",lFc)
      call SetReal(lf5,"Angle",lnM)
      call SetHandle(lf5,"Hero",lfU)
      call TimerStart(ltt,.025,true,function Leap_JumpMoving)
      call SetBoolean(H2Tx(lfU),"Leap_InAir",true)
      call SetBoolean(H2Tx(lfU),"SuperOrder",false)
   endif
   call PolledWait(5)
   call SetUnitPathing(lfU,true)
   call SetUnitInvulnerable(lfU,false)
endfunction

function Leap_DoNothing takes nothing returns nothing
endfunction

function Leap_SaveOrders takes nothing returns nothing
   local unit lfU=GetTriggerUnit()
   local string lf5=H2Tx(lfU)
   local boolean lpN=GetBoolean(lf5,"Leap_InAir")
   call SetInteger(lf5,"OrderId",GetIssuedOrderId())
   call SetBoolean(lf5,"Idle",false)
   if GetTriggerEventId()==EVENT_UNIT_ISSUED_TARGET_ORDER then
      call SetString(lf5,"OrderType","Target")
      call SetHandle(lf5,"OrderTarget",GetOrderTarget())
   elseif GetTriggerEventId()==EVENT_UNIT_ISSUED_POINT_ORDER then
      if lpN or GetRange(GetUnitX(lfU),GetUnitY(lfU),GetOrderPointX(),GetOrderPointY())>800 then
         call SetString(lf5,"OrderType","Point")
         call SetReal(lf5,"OrderPointX",GetOrderPointX())
         call SetReal(lf5,"OrderPointY",GetOrderPointY())
      else
         call SetBoolean(lf5,"Idle",true)
      endif
   else
      call SetString(lf5,"OrderType","Instant")
   endif
   if lpN then
      call SetBoolean(lf5,"SuperOrder",true)
   endif
endfunction

function Leap_SpellOrder takes nothing returns boolean
   return OrderId2String(GetIssuedOrderId())!="windwalk"
endfunction

function Leap_IsHeroMoves takes nothing returns nothing
   local unit lfU=GetUnit(H2Tx(GetExpiredTimer()),"Hero")
   local string lf5=H2Tx(lfU)
   local real lxx=GetUnitX(lfU)
   local real lyy=GetUnitY(lfU)
   local string lpG=GetString(lf5,"OrderType")
   if lpG=="Point"and GetRange(GetUnitX(lfU),GetUnitY(lfU),GetReal(lf5,"OrderPointX"),GetReal(lf5,"OrderPoi​ntY"))<100 then
      call SetBoolean(lf5,"Idle",true)
   endif
endfunction

function Leap_TrackOrdersStart takes nothing returns nothing
   local unit lfU=GetTriggerUnit()
   local trigger ltt=CreateTrigger()
   local timer lt2
   call TriggerRegisterUnitEvent(ltt,lfU,EVENT_UNIT_ISSUED_TARGET_ORDER)
   call TriggerRegisterUnitEvent(ltt,lfU,EVENT_UNIT_ISSUED_POINT_ORDER)
   call TriggerRegisterUnitEvent(ltt,lfU,EVENT_UNIT_ISSUED_ORDER)
   call TriggerAddAction(ltt,function Leap_SaveOrders)
   call TriggerAddCondition(ltt,Condition(function Leap_SpellOrder))
   call SetHandle(H2Tx(lfU),"Trigger_TrackOrder",ltt)
   set lt2=CreateTimer()
   call SetHandle(H2Tx(lt2),"Hero",lfU)
   call TimerStart(lt2,.3,true,function Leap_IsHeroMoves)
   call SetHandle(H2Tx(lfU),"Timer_CheckIdle",lt2)
endfunction

function Leap_LearnFirst takes nothing returns nothing
   if GetUnitAbilityLevel(GetTriggerUnit(),'A0LN')==1 then
      call Leap_TrackOrdersStart()
   endif
endfunction

function Leap_Init takes nothing returns nothing
   local trigger ltt=CreateTrigger()
   call TriggerRegisterAnyUnitEventBJ(ltt,EVENT_PLAYER_UNIT_SPELL_EFFECT)
   call TriggerAddCondition(ltt,Condition(function Leap_Spell))
   call TriggerAddAction(ltt,function Leap_JumpSetting)
   set ltt=CreateTrigger()
   call TriggerRegisterAnyUnitEventBJ(ltt,EVENT_PLAYER_UNIT_SPELL_CAST)
   call TriggerAddCondition(ltt,Condition(function Leap_Spell))
   call TriggerAddAction(ltt,function Leap_DoNothing)
   set ltt=CreateTrigger()
   call TriggerRegisterAnyUnitEventBJ(ltt,EVENT_PLAYER_HERO_SKILL)
   call TriggerAddAction(ltt,function Leap_LearnFirst)
endfunction


function InitTrig_Leap takes nothing returns nothing
endfunction

Отредактировано ShadoW DaemoN, 16.12.2009 в 07:09.
Старый 16.12.2009, 03:48
Rewenger
The culprit will not die
offline
Опыт: 35,873
Активность:
Kain, зайди в кастомный код карты (находится выше всех в редакторе триггеров) и измени там код всяких H2I и прочих H2X на новые 1.24-функции. Как я думаю.
А ещё всё эти H2X надо будет скопировать в кастом код своей карты.
Старый 16.12.2009, 05:33
XOR

offline
Опыт: 38,159
Активность:
Замени
function h2i takes handle h returns integer
return GetHandleId(h)
endfunction
function i2h takes integer i returns handle
return ConvertFogState(i)
endfunction
Старый 16.12.2009, 07:48
DragonSpirit
у - уходи
offline
Опыт: 22,625
Активность:
Или ломани последнюю доту,и поищи похожий код(но на хэше)
Старый 16.12.2009, 23:54
Enein
Silenced by ZlaYa1000
offline
Опыт: 43,453
Активность:
как-то так)
function ChkPosCoords takes real x , real y returns boolean
    return x - 50. > GetRectMinX(bj_mapInitialPlayableArea) and y - 50. > GetRectMinY(bj_mapInitialPlayableArea) and x + 50. < GetRectMaxX(bj_mapInitialPlayableArea) and y + 50. < GetRectMaxY(bj_mapInitialPlayableArea)
endfunction
scope Leap initializer Init

  private struct spell
    static spell array data
    static integer count = 0
    static timer timer = CreateTimer()

    real time
    real nowx
    real nowy
    real ang
    unit c
    real dist

    static method onTimer takes nothing returns nothing
        local integer i = 0

        loop
            set spell.data[i].nowx = spell.data[i].nowx + 23. * Cos(spell.data[i].ang*.0174)
            set spell.data[i].nowy = spell.data[i].nowy + 23. * Sin(spell.data[i].ang*.0174)
            if ChkPosCoords(spell.data[i].nowx,spell.data[i].nowy) then
                call SetUnitX(spell.data[i].c,spell.data[i].nowx)
                call SetUnitY(spell.data[i].c,spell.data[i].nowy)
            endif
            call SetUnitAnimationByIndex(spell.data[i].c,5)
            call SetUnitFlyHeight(spell.data[i].c,4*spell.data[i].time*(spell.data[i].dist/2)*(1-spell.data[i].time/s​pell.data[i].dist)/spell.data[i].dist,0.)

            set spell.data[i].time = spell.data[i].time + 23.
            if spell.data[i].time > spell.data[i].dist or IsTerrainPathable(spell.data[i].nowx, spell.data[i].nowy, ConvertPathingType(1)) then
                call spell.data[i].destroy()
                set spell.count = spell.count - 1
                set spell.data[i] = spell.data[spell.count]
                set i = i - 1
                if spell.count == 0 then
                    call PauseTimer(spell.timer)
                endif
            endif

            set i = i + 1
            exitwhen i >= spell.count
        endloop
    endmethod

    static method create takes unit caster returns spell
        local spell s = spell.allocate()
        local real x  = GetUnitX(caster)
        local real y  = GetUnitY(caster)
        local real x2 = x + (250. + 150. * GetUnitAbilityLevel(caster,'A000')) * Cos(.0174*GetUnitFacing(caster))
        local real y2 = y + (250. + 150. * GetUnitAbilityLevel(caster,'A000')) * Sin(.0174*GetUnitFacing(caster))

        if spell.count == 0 then
            call TimerStart(spell.timer,.03, true, function spell.onTimer)
        endif
        set spell.data[spell.count] = s
        set spell.count = spell.count + 1

        call SetUnitPathing(caster,false)
        set s.dist   = 250. + 200. * GetUnitAbilityLevel(caster,'A000')
        set s.time   = 0.
        set s.nowx   = x
        set s.nowy   = y
        set s.ang    = GetUnitFacing(caster)
        set s.c = caster

        return s
    endmethod

    method onDestroy takes nothing returns nothing
        call SetUnitAnimationByIndex(.c,6)
        call SetUnitFlyHeight(.c,0.,0.)
        call SetUnitPathing(.c,true)
        call SetUnitTimeScale(.c,1)
        call IssueImmediateOrderById(.c,851972)
        call SetUnitAnimation(.c,"stand")
        set .c  = null
    endmethod

  endstruct

  private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
  endfunction

  private function Actions takes nothing returns nothing
    call spell.create(GetTriggerUnit())
  endfunction

  private function Init takes nothing returns nothing
    local trigger tr = CreateTrigger()
    call TriggerAddAction(tr, function Actions)
    call TriggerAddCondition(tr, Condition(function Conditions))
    call TriggerRegisterAnyUnitEventBJ(tr, ConvertPlayerUnitEvent(273))
    set tr = null
  endfunction

endscope
впринципе тут все настраиваемо
A000 - рав-код твоей абилки
+ даммикаст дорисуешь сам в методе onDestroy
Enein добавил:
ну и да - тебе понадобится jngp
Старый 17.12.2009, 00:03
Kain

offline
Опыт: 187
Активность:
Знать бы ещё что такое "метод onDestroy"
DragonSpirit вы об этом ?
Прикрепленные файлы
Тип файла: rar war3map.j.rar (214.2 Кбайт, 16 просмотров )
Тип файла: rar war3map.wct.rar (215.4 Кбайт, 13 просмотров )

Отредактировано Kain, 17.12.2009 в 09:51.
Старый 17.12.2009, 09:16
Enein
Silenced by ZlaYa1000
offline
Опыт: 43,453
Активность:
Знать бы ещё что такое "метод onDestroy"
method onDestroy takes nothing returns nothing
         call SetUnitAnimationByIndex(.c,6)
         call SetUnitFlyHeight(.c,0.,0.)
         call SetUnitPathing(.c,true)
         call SetUnitTimeScale(.c,1)
         call IssueImmediateOrderById(.c,851972)
         call SetUnitAnimation(.c,"stand")
         set .c  = null
     endmethod 
Старый 17.12.2009, 10:57
Kain

offline
Опыт: 187
Активность:
Хрень какая-то, есть пустышка у кого ?
[+] замечание от ShadoW DaemoN: 8.1 (прикрепление больших изображений) http://xgm.ru/forum/showthread.php?t=17378

Отредактировано ShadoW DaemoN, 18.12.2009 в 08:06.
Старый 17.12.2009, 11:45
DragonSpirit
у - уходи
offline
Опыт: 22,625
Активность:
Знать бы ещё что такое "метод onDestroy"
это методкоторый вызывается при уничтожении структуры(.destroy)
попробуй это забить
Хрень какая-то, есть пустышка у кого ?
у тя cJass стоит?
если да,то попробуй на время компиляции отключить его,или убрать call
DragonSpirit добавил:
такое походу со всеми функциями,снеси call`ы,если у тя стоит cJass
Старый 17.12.2009, 16:12
Kain

offline
Опыт: 187
Активность:
DragonSpirit: да стоит cJass к JNGP, спасибо за подсказку буду в редакторе попробую...
Старый 18.12.2009, 01:20
Ответ

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

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

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

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



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