Добавлен
Имеется способность в которой я использую SetUnitVertexColor чтобы сделать юнита прозрачным, но он по какой-то причине не хочет таковым становтся, в чем проблема?
Код
function Nightmare_Timer takes nothing returns nothing
    
endfunction

function Nightmare_Group takes nothing returns nothing
    local unit target = GetFilterUnit()
    local integer count = GetRandomInt(3, 5)
    local real RanRan
    local real RanAng
    local unit u
    
    if IsUnitEnemy(target, GetOwningPlayer(Isazam)) and not IsDead(target) and IsUnitType(target, UNIT_TYPE_HERO) then
        loop
            set RanRan = GetRandomReal(300.0, 500.0)
            set RanAng = GetRandomReal(0.0, 360.0)
            set u = CreateUnit(GetOwningPlayer(Isazam), 'u009', GetUnitX(target) + RanRan + Cos(RanAng), GetUnitY(target) + RanRan + Sin(RanAng), RanAng)
            call SetUnitBaseDamage(u, GetUnitBaseDamage(Isazam))
            call IssueTargetOrder(u, "attack", target)
            call UnitApplyTimedLife(u, 'BTLF', 10.0)
            call SetUnitVertexColor(u, 255, 255, 255, 0)
            set count = count - 1
            exitwhen count == 0
        endloop
    endif
    
    set target = null
    set u = null
endfunction

function Trig_Nightmare_Actions takes nothing returns nothing
    local unit caster = GetTriggerUnit()
    local group g
    
    call PauseUnit(caster, true)
    
    call SetUnitAnimation(caster, "Death")
    
    call TriggerSleepAction(1.5)
    
    if not IsDead(caster) then
        call ShowUnit(caster, false)
        
        set g = CreateGroup()
        call GroupEnumUnitsInRange(g, GetUnitX(Isazam), GetUnitY(Isazam), 99999.0, function Nightmare_Group)
        call DestroyGroup(g)
    endif
    
    set caster = null
    set g = null
endfunction

function Trig_Nightmare_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A00D'
endfunction

//===========================================================================
function InitTrig_Nightmare takes nothing returns nothing
    set gg_trg_Nightmare = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Nightmare, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Nightmare, Condition( function Trig_Nightmare_Conditions ) )
    call TriggerAddAction( gg_trg_Nightmare, function Trig_Nightmare_Actions )
endfunction

Принятый ответ

rsfghd, модель банши брал, сейчас попробую другую взять

Нет, не становится невидимым

Всё. Разобрался. У меня мапхак включён, а для него прозрачность не проблема))
`
ОЖИДАНИЕ РЕКЛАМЫ...
0
19
2 года назад
0
Похожие вопросы:

ответ
Выключай даммику пасинг и переноси в нужную точку.
local unit d
local real x=GetUnitX(u)
local real y=GetUnitY(u)
......
set d=CreateUnit(p,dummy,0,0,0)
call SetUnitPathing(d,false)
call SetUnitX(d,x)
call SetUnitY(d,y)
ответ
quq_CCCP, благодарю, но всё же хотелось бы именно с thistype.next, thistype.prev.
кажется, я сделаль:
struct data
        static timer    period = CreateTimer( )
               thistype prev
               thistype next

               unit     u
               integer  a

        method destroy takes nothing returns nothing
            set this.prev.next = this.next
            set this.next.prev = this.prev

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

            call thistype.deallocate( this )
        endmethod

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

            loop
                exitwhen ( this == 0 )

				set this.a = this.a + 1
				call SetUnitVortexColor( this.u, 255, 255, 255, this.a )

                if ( this.a > 255 ) then
                    call this.destroy( )
                endif

                set this = this.next
            endloop
        endmethod

        static method createUnit takes nothing returns thistype
            local thistype this = thistype.allocate( )

            set this.next = 0
            set this.prev = thistype(0).prev
            set this.next.prev = this
            set this.prev.next = this

			set this.u = CreateUnit(...)
			set this.a = 0
			call SetUnitVortexColor( this.u, 255, 255, 255, this.a )
            
            if ( this.prev == 0 ) then
                call TimerStart( period, 0.03125, true, function thistype.iterate )
            endif

            return this
        endmethod

    endstruct
ответ
исправил некоторые недочёты, и всё же хотелось бы узнать, может еще есть какие-то недоработки тут?
раскрыть
library UnitRecycler requires UnitRevive



    globals

        private  constant  integer         MAX_STOCKED_RAWCODES         =  256
        private  constant  integer         MAX_STOCKED_UNITTYPES        =  1024

        private  constant  group           stock                        =  CreateGroup( )
        private            unit            recycledUnit                 =  null

        private            integer         stockedRawCodesCount         =  0
        private            integer  array  stockedRawCodes

        private            integer  array  stockedUnitCount
        private            unit     array  stockedUnit[ MAX_STOCKED_RAWCODES ] [ MAX_STOCKED_UNITTYPES ]

    endglobals



    private constant function IsUnitAlive takes unit whichUnit returns boolean
        return not ( IsUnitType( whichUnit, UNIT_TYPE_DEAD ) or  ( GetUnitTypeId( whichUnit ) == 0 ) )
    endfunction



    private function RAW2S takes integer value returns string
        local  string   charMap         =  ".................................!.#$%&'()*+,-./0123456789:;<=>.@ABCDEFGHIJKLMNOPQRSTUVWXYZ[.]^_`abcdefghijklmnopqrstuvwxyz{|}~................................................................................................................................."
        local  string   result          =  ""
        local  integer  remainingValue  =  value
        local  integer  byteno          =  0
        local  integer  charValue

        loop
            set charValue = ModuloInteger(remainingValue, 256)
            set remainingValue = remainingValue / 256
            set result = SubString(charMap, charValue, charValue + 1) + result
     
            set byteno = byteno + 1
            exitwhen ( byteno == 4 )
        endloop

        return result
    endfunction



    private function GetUnitFromStock takes integer rawCode returns unit
        local  integer  i  =  0

        loop

            if ( stockedRawCodes[ i ] == rawCode ) and ( stockedUnitCount [ i ] > 0 ) then

                set  stockedUnitCount [ i ]                             =  stockedUnitCount [ i ] - 1
                set  recycledUnit                                       =  stockedUnit [ i ] [ stockedUnitCount [ i ] ]
                set  stockedUnit      [ i ] [ stockedUnitCount [ i ] ]  =  null
                exitwhen true
            endif

            if ( i == stockedRawCodesCount ) then

                debug call BJDebugMsg( "GetUnitFromStock(...) :    '" + RAW2S( rawCode ) + "' unittype stock is emty. New unit has been created." )
                set recycledUnit = CreateUnit( Player( 15 ), rawCode, HIDDEN_X, HIDDEN_Y, 0.0 )
                exitwhen true
            endif

            set i = i + 1
        endloop

        return recycledUnit
    endfunction



    private function AddUnitToStock takes unit whichUnit returns nothing
        local  integer rawCode  =  GetUnitTypeId( whichUnit )
        local  integer i        =  0

        loop
            exitwhen ( stockedRawCodes[ i ] == rawCode )

            if ( i == stockedRawCodesCount ) and ( stockedRawCodesCount < MAX_STOCKED_RAWCODES ) then
                set stockedRawCodes[ i ] = rawCode
                set stockedRawCodesCount = stockedRawCodesCount + 1
                exitwhen true

            elseif ( stockedRawCodesCount == MAX_STOCKED_RAWCODES ) then
                debug call BJDebugMsg( "AddUnitToStock(...) :    Cannot add unit to stock, max rawcode count achieved. Unit has been removed." )
                call KillUnit( whichUnit )
                call ShowUnit( whichUnit, false )
            endif

            set i = i + 1
        endloop

        if ( stockedUnitCount [ i ] < MAX_STOCKED_UNITTYPES ) then
            set stockedUnit      [ i ] [ stockedUnitCount [ i ] ]  =  whichUnit
            set stockedUnitCount [ i ]                             =  stockedUnitCount [ i ] + 1

        else
            debug call BJDebugMsg( "AddUnitToStock(...) :    Cannot add unit to stock, max unittype count achieved. Unit has been removed." )
            call KillUnit( whichUnit )
            call ShowUnit( whichUnit, false )
        endif

    endfunction



    function GetRecycledUnit takes player owner, integer rawCode, real x, real y, real facing returns unit
        if IsHeroUnitId( rawCode ) then
            debug call BJDebugMsg( "GetRecycledUnit(...) :    Attempt to  get recycled hero unit." )

        else
            set recycledUnit = GetUnitFromStock( rawCode )
            call GroupRemoveUnit    ( stock, recycledUnit )
            call PauseUnit          ( recycledUnit, false )
            call SetUnitOwner       ( recycledUnit, owner, true )
            call SetUnitPosition    ( recycledUnit, x, y )
            call SetUnitFacing      ( recycledUnit, facing )
            call SetUnitPathing     ( recycledUnit, true )
            call SetUnitInvulnerable( recycledUnit, false )
            call ShowUnit           ( recycledUnit, true )

            return recycledUnit
        endif

        return null
    endfunction



    function RecycleUnit takes unit whichUnit returns boolean
        if ( whichUnit == null ) then
            debug call BJDebugMsg( "RecycleUnit(...) :    Attempt to recycle a null unit." )
            return false

        elseif IsUnitAlive( whichUnit ) then
            debug call BJDebugMsg( "RecycleUnit(...) :    Attempt to recycle an alive unit." )
            return false

        elseif IsUnitInGroup( whichUnit, stock ) then
            debug call BJDebugMsg( "RecycleUnit(...) :    Attempt to recycle an already recycled unit." )
            return false

        elseif IsHeroUnitId( GetUnitTypeId( whichUnit ) ) then
            debug call BJDebugMsg( "RecycleUnit(...) :    Attempt to recycle a hero unit." )
            return false

        elseif ReviveUnit( whichUnit ) then
            call GroupAddUnit       ( stock, whichUnit )
            call PauseUnit          ( whichUnit, true )
            call SetUnitOwner       ( whichUnit, Player( 15 ), false )
            call SetUnitState       ( whichUnit, UNIT_STATE_LIFE, GetUnitState( whichUnit, UNIT_STATE_MAX_LIFE ) )
            call SetUnitState       ( whichUnit, UNIT_STATE_MANA, GetUnitState( whichUnit, UNIT_STATE_MAX_MANA ) )
            call SetUnitScale       ( whichUnit, 1.0, 0.0, 0.0 )
            call SetUnitVertexColor ( whichUnit, 255, 255, 255, 255 )
            call SetUnitFlyHeight   ( whichUnit, GetUnitDefaultFlyHeight( whichUnit ), 0.0 )
            call SetUnitPathing     ( whichUnit, false )
            call SetUnitInvulnerable( whichUnit, true )
//          call ShowUnit           ( whichUnit, false )
            call SetUnitPosition    ( whichUnit, HIDDEN_X, HIDDEN_Y )
            call AddUnitToStock     ( whichUnit )
            return true

        else
            debug call BJDebugMsg( "RecycleUnit(...) :    Cannot revive this unit." )
            return false
        endif

        return false
    endfunction



endlibrary
ответ
Ну тут вся фитча в канале, тут чаннелинг когда завершится тогда бара переместится + защита от сбивания приказа, т.е снова начинает кастовать скилл. Сам ульт бары основан на канале, смотри его настройки. Мне больше нравился старый вариант, где бара мгновенно кастовал ульт и растворялся в воздухе, после атаковал цель...
ответ
Локейшены нельзя двигать локально, глобальный хендл. Двигай для всех и бери высоту для всех, ибо глобал параметры.

0
27
2 года назад
0
ну некоторые модели даже будь прозрачными не становятся такими, материал такой может быть на текстуре

но если у тебя даже вариковский пехотинец не становится прозрачным, то это другое дело
2 комментария удалено
0
11
2 года назад
0
rsfghd, модель банши брал, сейчас попробую другую взять

Нет, не становится невидимым

Всё. Разобрался. У меня мапхак включён, а для него прозрачность не проблема))
Принятый ответ
Чтобы оставить комментарий, пожалуйста, войдите на сайт.