Добавлен Стас Орлов
Как в редакторе карт заставить выбранного унитаз прыгнуть?
И отдельно можете объяснить, как заставить его прыгнуть на какое-то место в сторону, куда смотрит герой.
Я видел, как в некоторых картах, когда юнит бил другого, то его отбрасывало на определённон расстояние, как это сделать?
Буду очень рад вашим ответам.
И отдельно можете объяснить, как заставить его прыгнуть на какое-то место в сторону, куда смотрит герой.
Я видел, как в некоторых картах, когда юнит бил другого, то его отбрасывало на определённон расстояние, как это сделать?
Буду очень рад вашим ответам.
Принятый ответ
Примитивный прыжок в любую точку, чем дальше - тем выше прыгает.
Мини библиотека
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
Ну и карта пример с прыгающим мк
Если пошаманить, то можно настроить даже под пинок, там просто надо в функцию передать юнита и точку куда он полетит
Загруженные файлы
`
ОЖИДАНИЕ РЕКЛАМЫ...
Чтобы оставить комментарий, пожалуйста, войдите на сайт.
Стас Орлов: погугли наработки. на хгм можно найти big pack (большой пак наработок) - там может быть прыжок.