21

» WarCraft 3 / Как сделать, чтобы большие юниты рассталкивали маленьких

Предложил бы такой вариант: создаёте базу данных со всеми физическими размерами всех юнитов (можно мемхак), а затем через периодический таймер выбираете всех воинов на карте и воинов, которые стоят рядом с ним, и отталкиваете их от первого, если физ. размер меньше, если больше, то отталкиваете уже первого. А если размер одинаковый, то - call DoNothing( ). :-)
21

» WarCraft 3 / Невыделяемость на время

nvc123, cпасибо, вроде всё прочитал.
Изменение высоты выбора или шкалы выбора не подходят. Я буду делать это всё не на обычном юните, а на иллюзиях. Морф тоже не подходит, х.з., в кого нужно морфить иллюзию.) А на багах далеко не уйдёшь, думаю самый подходящий вариант предложил PyCCKuu_4eJl:
Не очень тупое - сделать 2 одинаковых юнита, одному дав способность москиты, и на время меняя их местами
21

» WarCraft 3 / Невыделяемость на время

nvc123, cпасибо, работает. Но только после подобных манипуляций, юнита не получается выбрать через один клик мыши, а приходится выбирать через прямоугольную рамку. Можно это тоже исправить?
21

» WarCraft 3 / Создание триггерных иллюзий

UrsaBoss, да, действительно. Только что сам это выяснил и хотел написать, а Вы уже написали ответ. )

Cобсна, конечный код:
раскрыть
library IllusionSystem requires Table


    struct illusion
        private  static  timer     period               =  null
        private          thistype  prev
        private          thistype  next
        
        private  static  trigger   trig                 =  null
        private  static  unit      summoner             =  null
        private  static  unit      tempUnit             =  null
        private  static  unit      lastCreatedIllusion  =  null
        private  static  group     illusions            =  null
        private  static  table     data                 =  table( 0 )

        readonly         unit      unit
        readonly         real      damage
        readonly         real      defense
        readonly         real      duration


        private static method iterate takes nothing returns nothing
            local  thistype  this  =  thistype( 0 ).next

            loop
                exitwhen ( this == 0 )

                set  this.duration  =  this.duration - 0.03125

                if ( this.duration <= 0.0 ) then
                    call KillUnit( this.unit )
                endif

                set  this  =  this.next
            endloop
        endmethod


        static method create takes player whichPlayer, integer unitId, real x, real y, real face, real damage, real defense, real duration returns thistype
            local  thistype  this  =  illusion( 0 )

            set  thistype.tempUnit  =  CreateUnit( Player( PLAYER_NEUTRAL_PASSIVE ), unitId, x, y, face )

            call SetUnitPathing     ( thistype.tempUnit, false )
            call SetUnitInvulnerable( thistype.tempUnit, true   )
            call UnitRemoveAbility  ( thistype.tempUnit, 'Amov' )
            call UnitShareVision    ( thistype.tempUnit, whichPlayer, true )

            call SetUnitX           ( thistype.summoner, x )
            call SetUnitY           ( thistype.summoner, y )

            if ( thistype.tempUnit == null ) then
                debug call BJDebugMsg( "CreateIllusion( ) :    не удалось cоздать временного воина." )

            elseif IssueTargetOrderById( thistype.summoner, 852274, thistype.tempUnit ) then
                set  this                                       =  thistype.allocate( )
                set  this.next                                  =  thistype( 0 )
                set  this.prev                                  =  thistype( 0 ).prev
                set  this.next.prev                             =  this
                set  this.prev.next                             =  this

                set  this.unit                                  =  thistype.lastCreatedIllusion
                set  this.damage                                =  damage
                set  this.defense                               =  defense
                set  this.duration                              =  duration
                set  thistype.data[ GetHandleId( this.unit ) ]  =  integer( this )

                if IsUnitType( this.unit, UNIT_TYPE_STRUCTURE ) then
                    call SetUnitPosition( this.unit, x, y )

                else
                    call SetUnitX( this.unit, x )
                    call SetUnitX( this.unit, y )
                endif

                call SetUnitFacing     ( this.unit, face               )
                call SetUnitOwner      ( this.unit, whichPlayer, true  )
                call GroupAddUnit      ( thistype.illusions, this.unit )

                if ( this.prev == 0 ) then
                    call TimerStart( thistype.period, 0.03125, true, function thistype.iterate )
                endif

            else
                debug call BJDebugMsg( "CreateIllusion( ) :    не удалось применить способность, создающую иллюзию." )
            endif

            call UnitShareVision( thistype.tempUnit, whichPlayer, false )
            call RemoveUnit     ( thistype.tempUnit )
            set  thistype.tempUnit  =  null

            call SetUnitX       ( thistype.summoner, HIDDEN_X )
            call SetUnitY       ( thistype.summoner, HIDDEN_Y )
            call SetUnitOwner   ( thistype.summoner, Player( PLAYER_NEUTRAL_PASSIVE ), false )

            return this
        endmethod


        private static method onIllusionSummon takes nothing returns nothing
            set thistype.lastCreatedIllusion  =  GetSummonedUnit( )
        endmethod


        private static method onUnitDamaged takes nothing returns nothing
            if IsUnitInGroup( GetEventDamageSource( ), thistype.illusions ) then
                call SetEventDamage( GetEventDamage( ) * thistype( data[ GetHandleId( GetEventDamageSource( ) ) ] ).damage )
            endif

            if IsUnitInGroup( GetTriggerUnit( ), thistype.illusions ) then
                call SetEventDamage( GetEventDamage( ) * thistype( data[ GetHandleId( GetTriggerUnit( ) ) ] ).defense )
            endif
        endmethod


        private static method onIllusionDeath takes nothing returns nothing
            if IsUnitInGroup( GetDyingUnit( ), thistype.illusions ) then
                call GroupRemoveUnit( thistype.illusions, GetDyingUnit( ) )

                set  thistype( data[ GetHandleId( GetDyingUnit( ) ) ] ).prev.next  =  thistype( data[ GetHandleId( GetDyingUnit( ) ) ] ).next
                set  thistype( data[ GetHandleId( GetDyingUnit( ) ) ] ).next.prev  =  thistype( data[ GetHandleId( GetDyingUnit( ) ) ] ).prev

                if ( thistype( 0 ).next == 0 ) then
                    call PauseTimer( thistype.period )
                endif

                call thistype.deallocate( thistype( data[ GetHandleId( GetDyingUnit( ) ) ] ) )
            endif
        endmethod


        private static method onInit takes nothing returns nothing
            set  thistype.data       =  table.create( )
            set  thistype.period     =  CreateTimer( )
            set  thistype.trig       =  CreateTrigger( )
            set  thistype.illusions  =  CreateGroup( )
            set  thistype.summoner   =  CreateUnit( Player( PLAYER_NEUTRAL_PASSIVE ), DUMMY_UNIT_ID, HIDDEN_X, HIDDEN_Y, bj_UNIT_FACING )

            call UnitAddAbility     ( thistype.summoner, 'Aloc' )
            call SetUnitInvulnerable( thistype.summoner, true   )
            call UnitAddAbility     ( thistype.summoner, 'A00A' )
            call SetUnitPathing     ( thistype.summoner, false  )
            call UnitRemoveAbility  ( thistype.summoner, 'Amov' )

            call TriggerRegisterUnitEvent( thistype.trig, thistype.summoner, EVENT_UNIT_SUMMON )
            call TriggerAddAction        ( thistype.trig, function thistype.onIllusionSummon   )
        endmethod


    endstruct


endlibrary
21

» WarCraft 3 / Создание триггерных иллюзий

quq_CCCP, а почему у первой иллюзии владелец - Player( PLAYER_NEUTRAL_PASSIVE )? Несмотря на то что, в функции есть SetUnitOwner( ).
quq_CCCP:
Где UnitShareVision - если что даммик нихрена не видит после того как создан, он либо должен иметь точно такие же координаты как и цель либо у него должна быть расшарена видимость над целью.
Это да, но в карте открыта видимость, так что проблема была не в этом.
21

» WarCraft 3 / Убивать вне радиуса области относительно юнита - триггерно

Если воинов может быть несколько и каждый привязан к определенному зданию, то можно заносить их в двусвязный список и через таймер циклом проходить по каждой сохранённой ячейке. Лучше использовать структуру, так как там есть уже готовые на халяву функции create() и destroy().
21

» WarCraft 3 / Создание триггерных иллюзий

UrsaBoss, спасибо, не заметил.) Но проблема с созданием иллюзий с этим не связана.
21

» WarCraft 3 / Создание триггерных иллюзий

pro100master, почему используй предметный на создание клон, тогда есть способность использует напрямую.
21

» WarCraft 3 / Есть ли такая стандартная способность

Freezeeee, хз, баг, наверное. Пассивка Повелителя Огня тоже не работает, если создать её копию.
21

» WarCraft 3 / Прыжок на гуи

Вот готовая система, которая не позволяет кому-либо покидать игровую территорию.

Или вместо функций SetUnitX/Y( ) использовать SetUnitPosition( ). Эта функция не переносит на непроходимые точки.
21

» WarCraft 3 / Требование маны у пассивн способности

Способность "Перерождение" можно настроить так, чтобы она требовала ману.
21

» WarCraft 3 / Повторы слов в war3mapSkin\war3mapMisc

Смею предположить, что это текст для каждой кнопки, которая встречается в редакторе.
21

» WarCraft 3 / По какому пути находиться Хроносфера войда?

quq_CCCP, раньше у войда, вроде, была моделька Власти Порчи Обсидиановой статуи, а потом поменяли на импортированную какую-то.
21

» WarCraft 3 / Отлов исцеления

Я делал так:
function UnitHealTarget takes unit whichUnit, unit target, real amount returns nothing
    local  real    maxLife      =  GetUnitState( target, UNIT_STATE_MAX_LIFE )
    local  real    currentLife  =  GetUnitState( target, UNIT_STATE_LIFE )

    if ( ( currentLife + amount ) > maxLife ) then
        set amount  =  maxLife - currentLife
    endif

    call SetWidgetLife( target, GetWidgetLife( target ) + amount )

    call SetScoreboardHeal( GetOwningPlayer( whichUnit ), GetScoreboardHeal( GetOwningPlayer( whichUnit ) ) + amount )
endfunction
То есть весь хил на карте должен быть триггерным.