Как в редакторе карт заставить выбранного унитаз прыгнуть?
И отдельно можете объяснить, как заставить его прыгнуть на какое-то место в сторону, куда смотрит герой.
Я видел, как в некоторых картах, когда юнит бил другого, то его отбрасывало на определённон расстояние, как это сделать?
Буду очень рад вашим ответам.

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

Примитивный прыжок в любую точку, чем дальше - тем выше прыгает.
Мини библиотека
library Jump

    globals
        private hashtable h    = InitHashtable()
        private real jumpSpeed = 400.00
    endglobals
    
    
    private function JumpMove takes nothing returns nothing
    
        local timer t         = GetExpiredTimer()
        local unit u          = LoadUnitHandle(  h, GetHandleId( t ), StringHash("unit")  )
        local location uLoc   = LoadLocationHandle(  h, GetHandleId( t ), StringHash("point")  )
        local real length     = LoadReal(  h, GetHandleId( t ), StringHash("length")  )
        local real angle      = LoadReal(  h, GetHandleId( t ), StringHash("angle")  )
        local location finish = LoadLocationHandle(  h, GetHandleId( t ), StringHash("finish")  )
        local real newX       = GetLocationX(uLoc) + jumpSpeed*0.03 * Cos(angle * bj_DEGTORAD)
        local real newY       = GetLocationY(uLoc) + jumpSpeed*0.03 * Sin(angle * bj_DEGTORAD)
        local real dx         = GetLocationX(finish) - GetLocationX(uLoc)
        local real dy         = GetLocationY(finish) - GetLocationY(uLoc)
        local real distance   = SquareRoot(dx * dx + dy * dy)
        local real time       = LoadReal(  h, GetHandleId( t ), StringHash("time")  )
        
        set time = time - 0.03
        call SaveReal(  h, GetHandleId( t ), StringHash("time"), time  )
        call MoveLocation(  uLoc, newX, newY  )
        call SetUnitPositionLoc(  u, uLoc  )
        call SetUnitFacing(  u, angle  )
        if(  length - distance <= length/2  ) then
            call SetUnitFlyHeight(  u, length - distance, 0.00  )
        else
            call SetUnitFlyHeight(  u, distance, 0.00  )
        endif
        if(  time <= 0.00  ) then
            call DestroyEffect( AddSpecialEffectLoc("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl", uLoc) )
            call SetUnitFlyHeight(  u, 0.00, 0.00  )
            call UnitRemoveAbility(  u, 'Amrf'  )
            call SetUnitInvulnerable(  u, false  )
            call PauseUnit(  u, false  )
            call FlushChildHashtable(  h, GetHandleId( t )  )
            call DestroyTimer( t )
            call RemoveLocation( uLoc )
            call RemoveLocation( finish )
        endif
        
        set t        = null
        set u        = null
        set uLoc     = null
        set length   = 0
        set angle    = 0
        set finish   = null
        set newX     = 0
        set newY     = 0
        set dx       = 0
        set dy       = 0
        set distance = 0
        set time     = 0
        
    endfunction
    
    function Jump takes unit ForUnit, location loc returns nothing
    
        local timer t    = CreateTimer()
        local location p = GetUnitLoc( ForUnit )
        local real dx    = GetLocationX( loc ) - GetLocationX( p )
        local real dy    = GetLocationY( loc ) - GetLocationY( p )
        
        call IssueImmediateOrder(  ForUnit, "stop"  )
        call UnitAddAbility(  ForUnit, 'Amrf'  )
        call SaveLocationHandle(  h, GetHandleId( t ), StringHash("finish"), loc  )
        call SaveLocationHandle(  h, GetHandleId( t ), StringHash("point"), p  )
        call SaveReal(  h, GetHandleId( t ), StringHash("length"), SquareRoot( dx * dx + dy * dy )  )
        call SaveReal(  h, GetHandleId( t ), StringHash("angle"), bj_RADTODEG * Atan2(GetLocationY(loc) - GetLocationY(p), GetLocationX(loc) - GetLocationX(p))  )
        call SaveReal(  h, GetHandleId( t ), StringHash("time"), LoadReal( h, GetHandleId( t ), StringHash("length") )/jumpSpeed  )
        call SaveUnitHandle(  h, GetHandleId( t ), StringHash("unit"), ForUnit  )
        call SetUnitInvulnerable(  ForUnit, true  )
        call PauseUnit(  ForUnit, true  )
        
        call TimerStart(  t, 0.03, true, function JumpMove  )
        
        set t  = null
        set p  = null
        set dx = 0
        set dy = 0
        
    endfunction
    
    
endlibrary
Ну и карта пример с прыгающим мк
Если пошаманить, то можно настроить даже под пинок, там просто надо в функцию передать юнита и точку куда он полетит
Загруженные файлы
`
ОЖИДАНИЕ РЕКЛАМЫ...

Показан только небольшой набор комментариев вокруг указанного. Перейти к актуальным.
2
32
6 лет назад
2
жирно же. у человека т9 сработал, а тут такое.
Стас Орлов:
Я не знаю язык (
погугли наработки. на хгм можно найти big pack (большой пак наработок) - там может быть прыжок.
2
18
6 лет назад
2
Примитивный прыжок в любую точку, чем дальше - тем выше прыгает.
Мини библиотека
library Jump

    globals
        private hashtable h    = InitHashtable()
        private real jumpSpeed = 400.00
    endglobals
    
    
    private function JumpMove takes nothing returns nothing
    
        local timer t         = GetExpiredTimer()
        local unit u          = LoadUnitHandle(  h, GetHandleId( t ), StringHash("unit")  )
        local location uLoc   = LoadLocationHandle(  h, GetHandleId( t ), StringHash("point")  )
        local real length     = LoadReal(  h, GetHandleId( t ), StringHash("length")  )
        local real angle      = LoadReal(  h, GetHandleId( t ), StringHash("angle")  )
        local location finish = LoadLocationHandle(  h, GetHandleId( t ), StringHash("finish")  )
        local real newX       = GetLocationX(uLoc) + jumpSpeed*0.03 * Cos(angle * bj_DEGTORAD)
        local real newY       = GetLocationY(uLoc) + jumpSpeed*0.03 * Sin(angle * bj_DEGTORAD)
        local real dx         = GetLocationX(finish) - GetLocationX(uLoc)
        local real dy         = GetLocationY(finish) - GetLocationY(uLoc)
        local real distance   = SquareRoot(dx * dx + dy * dy)
        local real time       = LoadReal(  h, GetHandleId( t ), StringHash("time")  )
        
        set time = time - 0.03
        call SaveReal(  h, GetHandleId( t ), StringHash("time"), time  )
        call MoveLocation(  uLoc, newX, newY  )
        call SetUnitPositionLoc(  u, uLoc  )
        call SetUnitFacing(  u, angle  )
        if(  length - distance <= length/2  ) then
            call SetUnitFlyHeight(  u, length - distance, 0.00  )
        else
            call SetUnitFlyHeight(  u, distance, 0.00  )
        endif
        if(  time <= 0.00  ) then
            call DestroyEffect( AddSpecialEffectLoc("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl", uLoc) )
            call SetUnitFlyHeight(  u, 0.00, 0.00  )
            call UnitRemoveAbility(  u, 'Amrf'  )
            call SetUnitInvulnerable(  u, false  )
            call PauseUnit(  u, false  )
            call FlushChildHashtable(  h, GetHandleId( t )  )
            call DestroyTimer( t )
            call RemoveLocation( uLoc )
            call RemoveLocation( finish )
        endif
        
        set t        = null
        set u        = null
        set uLoc     = null
        set length   = 0
        set angle    = 0
        set finish   = null
        set newX     = 0
        set newY     = 0
        set dx       = 0
        set dy       = 0
        set distance = 0
        set time     = 0
        
    endfunction
    
    function Jump takes unit ForUnit, location loc returns nothing
    
        local timer t    = CreateTimer()
        local location p = GetUnitLoc( ForUnit )
        local real dx    = GetLocationX( loc ) - GetLocationX( p )
        local real dy    = GetLocationY( loc ) - GetLocationY( p )
        
        call IssueImmediateOrder(  ForUnit, "stop"  )
        call UnitAddAbility(  ForUnit, 'Amrf'  )
        call SaveLocationHandle(  h, GetHandleId( t ), StringHash("finish"), loc  )
        call SaveLocationHandle(  h, GetHandleId( t ), StringHash("point"), p  )
        call SaveReal(  h, GetHandleId( t ), StringHash("length"), SquareRoot( dx * dx + dy * dy )  )
        call SaveReal(  h, GetHandleId( t ), StringHash("angle"), bj_RADTODEG * Atan2(GetLocationY(loc) - GetLocationY(p), GetLocationX(loc) - GetLocationX(p))  )
        call SaveReal(  h, GetHandleId( t ), StringHash("time"), LoadReal( h, GetHandleId( t ), StringHash("length") )/jumpSpeed  )
        call SaveUnitHandle(  h, GetHandleId( t ), StringHash("unit"), ForUnit  )
        call SetUnitInvulnerable(  ForUnit, true  )
        call PauseUnit(  ForUnit, true  )
        
        call TimerStart(  t, 0.03, true, function JumpMove  )
        
        set t  = null
        set p  = null
        set dx = 0
        set dy = 0
        
    endfunction
    
    
endlibrary
Ну и карта пример с прыгающим мк
Если пошаманить, то можно настроить даже под пинок, там просто надо в функцию передать юнита и точку куда он полетит
Загруженные файлы
Принятый ответ
2
21
6 лет назад
2
nvc123, колотил смех три минуты
1
15
6 лет назад
1
Унитаз? В варике даже самого примитивного туалета вроде нет...
0
21
6 лет назад
0
Sylvanas, как же нужду справляют?
4
15
6 лет назад
4
ClotPh, В песочек или в ратушу) Иногда в казармах гадят...
Показан только небольшой набор комментариев вокруг указанного. Перейти к актуальным.
Чтобы оставить комментарий, пожалуйста, войдите на сайт.