전략게시판

전략게시판 [스튜디오]
명중 시 피격 대상 앞으로 이동하는 스크립트
2021.02.12 19:10 조회 : 1953
Lv. 52익스트림버니합 CosyClimbing 작성자 게시물 더보기
function Game.Rule:OnTakeDamage(victim, attacker, damage, weapontype, hitbox)
if (attacker ~= nil and victim:IsMonster()) then
local X = (attacker.position.x - victim.position.x)
local Y = (attacker.position.y - victim.position.y)
local XY = math.abs(X)/(math.abs(X)+math.abs(Y))
local YX = math.abs(Y)/(math.abs(X)+math.abs(Y))
X = math.ceilN((math.abs(X*2) / math.nan(X)) * XY)
Y = math.ceilN((math.abs(Y*2) / math.nan(Y)) * YX)
attacker.position = {x=victim.position.x+X, y=victim.position.y+Y, z=victim.position.z+1}
end
end

function math.ceilN(x)
if x > 0 then
return math.ceil(x)
else
return math.floor(x)
end
end

function math.nan(x)
if x >= 0 then
return x-0.1
elseif x < 0 then
return x+0.1
end
end
추천 : 2
댓글을 남기시려면 로그인 해주세요
댓글 : 1
  • 잘못해서 버린 캐쉬 55,000원을 복구하는 슨크립트는 없나요? ㅜㅜ 급해요 Lv. 12OH미창련 2021.02.12