return function(self, mob)
if zz_y7.use_momo then
local ai = mob.MobAIComponent
local kb = mob.MobKnockbackComponent
local rb = mob.MobRigidbodyComponent
if not (isvalid(rb) and isvalid(kb) and isvalid(ai)) then
local hasAI = ai ~= nil and 1 or 0
local hasKnockback = kb ~= nil and 1 or 0
local hasRigid = rb ~= nil and 1 or 0
log_warning(string.format("hasAI: %d hasKnockback: %d hasRigid: %d", hasAI, hasKnockback, hasRigid))
return
end
local mobPos = mob.TransformComponent.WorldPosition
local mobX = mobPos.x
local mobY = mobPos.y
-- Define the gathering point coordinates
local gatherTargetX = 100
local gatherTargetY = 200
-- Check if the monster is alone on the map
local aloneOnMap = true
for _, otherMob in pairs(_MonsterManager.MonsterList) do
if otherMob.Id ~= mob.Id then
local otherPos = otherMob.TransformComponent.WorldPosition
local distance = math.sqrt((otherPos.x - mobX)^2 + (otherPos.y - mobY)^2)
if distance < 10 then -- Adjust the distance threshold as needed
aloneOnMap = false
break
end
end
end
if aloneOnMap then
-- Calculate the direction towards the gathering point
local dirVecX, dirVecY = gatherTargetX - mobPos.x, gatherTargetY - mobPos.y
dirVecX = dirVecX * 1
dirVecY = dirVecY * 1
local targetX = mobPos.x + dirVecX
local targetY = mobPos.y + dirVecY
kb:SetShoeAttr(0)
-- Make the monster fly towards the gathering point
ai:RequestFly(targetX, targetY, 1.0, "Npc")
end
endend
gatherTargetX 0.8
gatherTargetY 0.2
좌표 수정해도 몬스터가 안모여유 ㅠㅠ
| 제목 | 작성자 | 작성일 | 조회 | |
|---|---|---|---|---|
| 19398 | 01-27 | 1005 | ||
| 19397 | 01-27 | 806 | ||
| 19396 | 01-27 | 154 | ||
| 19395 | 01-27 | 271 | ||
| 19394 | 01-27 | 333 | ||
| 19393 | 01-27 | 749 | ||
| 19392 | 01-27 | 392 | ||
| 19391 | 01-27 | 260 | ||
| 19390 | 01-27 | 160 | ||
| 19389 | 01-27 | 433 | ||
| 19388 | 01-27 | 184 | ||
| 19387 | 01-27 | 346 | ||
| 19386 | 01-27 | 313 | ||
| 19385 | 01-27 | 470 | ||
| 19384 | 01-27 | 282 | ||
| 19383 | 01-27 | 178 | ||
| 19382 | 01-27 | 176 | ||
| 19381 | 01-27 | 117 | ||
| 19380 | 01-27 | 134 | ||
| 19379 | 듀프삽니다+2 | 01-27 | 126 |
댓글2
?
와 개어렵네