kenshin.drive_func = function ()
if kenshin.checked then
if kenshin.need_reset then
kenshin.reset_mob_func()
kenshin.need_reset = false
end
return
end
-- local output = {}
--> BoxShape(vec2, vec2, angle)
--> TryDoingMeleeAttack(self, user, skillId, skillLevel, output, lastFinalAttack)
--> OverlapAllFast(CollisionGroup, Shape, output)
local box = BoxShape(Vector2(0.0, 0.0), Vector2(100.0, 100.0), 0) --> i think 0 still god cuzof size
local simulator = _CollisionService:GetSimulator(_UserService.LocalPlayer.WsCharacterData.Entity) --> if not working, lets put map's one
local temp = {}
local output = {}
local output2 = {}
local hit = simulator:OverlapAllFast(CollisionGroups.MapleMob, box, temp)
local count = kenshin.filter_only_live_mobs(hit, temp, output)
if count == 0 then
kenshin.no_mob = true
-- return
else
kenshin.no_mob = false;
end
for i,v in ipairs(output) do
local moveAbility = v.Entity.MobComponent:GetMoveAbility()
if moveAbility == _MoveAbility.Fly then
kenshin.fly_dupe(v.Entity)
elseif moveAbility == _MoveAbility.Jump or moveAbility == _MoveAbility.Walk then
kenshin.jump_dupe(v.Entity)
end
end
kenshin.need_reset = true
end
kenshin.reset_mob_func = function ()
-- local output = {}
--> BoxShape(vec2, vec2, angle)
--> TryDoingMeleeAttack(self, user, skillId, skillLevel, output, lastFinalAttack)
--> OverlapAllFast(CollisionGroup, Shape, output)
local box = BoxShape(Vector2(0.0, 0.0), Vector2(100.0, 100.0), 0) --> i think 0 still god cuzof size
local simulator = _CollisionService:GetSimulator(_UserService.LocalPlayer.WsCharacterData.Entity) --> if not working, lets put map's one
local temp = {}
local output = {}
local output2 = {}
local hit = simulator:OverlapAllFast(CollisionGroups.MapleMob, box, temp)
local count = kenshin.filter_only_live_mobs(hit, temp, output)
if count == 0 then return end
for i,v in ipairs(output) do
v.Entity.MobAIComponent:SetControlling(true)
end
end
kenshin.fly_dupe = function(mob)
local hitByLeft = false
local knockbackType = 1
local kb = mob.MobKnockbackComponent
local ai = mob.MobAIComponent
local rb = mob.MobRigidbodyComponent
local map = mob.CurrentMap
local boundLt, boundRb = map.MapComponent:GetBound()
local minX = boundLt.x + 0.1
local maxX = boundRb.x - 0.1
local mobPos = mob.TransformComponent.WorldPosition:ToVector2()
local sqrt = math.sqrt
local elapse = 0
local knockbackMoveEnd
local interruptedEnd
if (knockbackType == 2) then
knockbackMoveEnd = 0.5
interruptedEnd = 0.7
else
knockbackMoveEnd = 0.1
interruptedEnd = 0.5
end
local timelines = {}
local timelineIndex = 0
local currentX = mobPos.x
local currentY = mobPos.y
local function makeDistance(x1, y1, x2, y2)
return sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1))
end
kb:SetShoeAttr(knockbackType)
local knockbackSpeed = rb.WalkSpeed * _Physics.FlySpeed / 1
---@param destX number
---@param destY number
---@param floating boolean
---@return number
local function makeFlyCommand(cmd, destX, destY, floating)
local distance = makeDistance(currentX, currentY, destX, destY)
currentX = destX
currentY = destY
local duration = distance / knockbackSpeed
timelines[timelineIndex + 1] = {cmd, {destX, destY, duration, floating}, 0}
timelineIndex += 1
return duration
end
local function makeCommand(cmd, value, nextTime)
timelines[timelineIndex + 1] = {cmd, value, nextTime}
timelineIndex += 1
end
local inputX = 1
if (hitByLeft) then
inputX = -1
end
-- makeCommand(_MobActionPartType.HitMotion, 1, 0)
local knockbackDestX = mobPos.x
local delta = knockbackSpeed * knockbackMoveEnd
if (inputX < 0) then
knockbackDestX = math.max(minX, mobPos.x - delta)
else
knockbackDestX = math.min(maxX, _UserService.LocalPlayer.TransformComponent.WorldPosition.x + 0.8)
end
if (mobPos.x ~= knockbackDestX) then
mobPos.y += 0.02
-- makeCommand(_MobActionPartType.KnockbackPos, mobPos, 0)
makeFlyCommand(_MobActionPartType.KnockbackFly, knockbackDestX, _UserService.LocalPlayer.TransformComponent.WorldPosition.y , false)
end
-- makeCommand(_MobActionPartType.HitMotion, 0, interruptedEnd)
if (timelineIndex > 0) then
map.MobAIComponent:ControlCommands(timelines, timelineIndex, true)
end
end
kenshin.jump_dupe = function(mob)
local ai = mob.MobAIComponent
local kb = mob.MobKnockbackComponent
local rb = mob.MobRigidbodyComponent
if (not isvalid(rb)) then
if (isvalid(ai)) then
-- ai:EnableNextControlTimer(0.1)
end
return
end
if (not mob.Visible) then
-- ai:EnableNextControlTimer(0.1)
return
end
local fh = rb.LastFoothold
if (fh == 0) then
--log("last foothold is 0")
-- ai:EnableNextControlTimer(0.1)
return
end
local now = _UtilLogic.ServerElapsedSeconds
-- if (now < ai.NextActionTime) then
-- -- ai:EnableNextControlTimer(math.max(ai.NextActionTime - now, 0) + 0.1)
-- return
-- end
local target = _UserService.LocalPlayer
local nextAction = 0
local newInputX = nil
local mobX = mob.TransformComponent.WorldPosition.x
if (isvalid(target) and ai.LocalUnchaseTick < 7) then
if (ai.AttackWasLast) then
nextAction = _GlobalRand32:RandomIntegerRange(100, 110) / 1000
ai.AttackWasLast = false
else
nextAction = _GlobalRand32:RandomIntegerRange(100, 110) / 1000
end
local targetX = target.TransformComponent.WorldPosition.x
if math.abs(targetX - mobX) > 6 then
if targetX > mobX then
-- newInputX = 3
newInputX = 3
else
-- newInputX = -3
newInputX = -3
end
else
newInputX = math.max(targetX - mobX + 1.2, -3)
end
else
nextAction = (_GlobalRand32:RandomIntegerRange(200, 210) / 1000)
newInputX = _UserService.LocalPlayer.TransformComponent.WorldPosition.x - mobX + 1.2
end
local platforms = mob.CurrentMap.PlatformInfoComponent
local timelines = {}
local timelineIndex = 0
--log("platform left x (fh=%d)", platform.left.x, platform.left.foothold.Id)
--log("platform right x (fh=%d)", platform.right.x, platform.right.foothold.Id)
local lastTimeline = 0
-- local playerFh = _UserService.LocalPlayer.WsUserController.LastFoothold
-- if (playerFh == 0 or platforms.ZMass[playerFh] ~= ai.LocalStartChaseZMass) then
-- ai.LocalUnchaseTick += 1
-- ai:IncUnTick()
-- end
local function makeCommand(cmd, value, timeline, nextActionTime)
timelines[timelineIndex + 1] = {cmd, value, timeline - lastTimeline, nextActionTime}
timelineIndex += 1
lastTimeline = timeline
end
local targetX = _UserService.LocalPlayer.TransformComponent.WorldPosition.x
local targetY = _UserService.LocalPlayer.TransformComponent.WorldPosition.y
local mobY = mob.TransformComponent.WorldPosition.y
local gapX = math.abs(mobX - targetX)
local gapY = math.abs(mobY - targetY)
if gapX > 3 then
makeCommand(_MobActionPartType.Move, newInputX, 0, nextAction)
makeCommand(_MobActionPartType.Jump, 1, 0)
elseif gapY > 1.5 then
makeCommand(_MobActionPartType.Move, newInputX, 0, nextAction)
makeCommand(_MobActionPartType.Jump, -1, 0)
elseif gapX < 1.3 and targetX < mobX then
makeCommand(_MobActionPartType.Move, 0, 0, nextAction)
else
makeCommand(_MobActionPartType.Move, newInputX, 0, nextAction)
end
kb:SetShoeAttr(0)
if (timelineIndex > 0) then
mob.MobAIComponent:ControlCommands(timelines, timelineIndex, false)
end
end
제목 | 작성자 | 작성일 | 조회 | |
---|---|---|---|---|
43803 | 02-25 | 693 | ||
43802 | 02-25 | 311 | ||
43801 | 02-25 | 203 | ||
43800 | 02-25 | 599 | ||
43799 | 02-25 | 301 | ||
43798 | 02-25 | 556 | ||
43797 | 02-25 | 414 | ||
43796 | 02-25 | 234 | ||
43795 | 02-25 | 601 | ||
43794 | 02-25 | 250 | ||
43793 | 02-25 | 336 | ||
43792 | 49 불독 랜계+5 | 02-25 | 367 | |
43791 | 02-25 | 364 | ||
43790 | 02-25 | 187 | ||
43789 | 02-25 | 905 | ||
43788 | 02-25 | 721 | ||
43787 | 02-25 | 1141 | ||
43786 | 02-25 | 216 | ||
43785 | 02-25 | 573 | ||
43784 | 02-25 | 182 |
댓글4
1대1걸면 스크립트로주시나용
이렇게 올려줫는데 스크립트로 달라는건 뭐야?
주냐고물어본건데 천원없어서 ap어떻게 얻는지 물어본너랑 비슷한대
이렇게 줬는데 못하면...그냥 기존꺼 써라 제발 ㅠ