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
좌표 수정해도 몬스터가 안모여유 ㅠㅠ
| 제목 | 작성자 | 작성일 | 조회 | |
|---|---|---|---|---|
| 공지 | 게시판 이용 안내+156 | 10-20 | 22387 | |
| 61793 | 12-30 | 201 | ||
| 61792 | 12-28 | 471 | ||
| 61791 | 12-28 | 518 | ||
| 61790 | 12-26 | 752 | ||
| 61789 | 12-25 | 900 | ||
| 61788 | 12-25 | 845 | ||
| 61787 | 12-24 | 1134 | ||
| 61786 | 12-23 | 1493 | ||
| 61785 | 12-22 | 1487 | ||
| 61784 | 12-22 | 1645 | ||
| 61783 | 12-22 | 1445 | ||
| 61782 | 12-21 | 1509 | ||
| 61781 | 12-21 | 1687 | ||
| 61780 | 12-21 | 1601 | ||
| 61779 | 12-19 | 1789 | ||
| 61778 | 12-18 | 1879 | ||
| 61777 | 12-18 | 2523 | ||
| 61776 | 12-16 | 2398 | ||
| 61775 | 12-14 | 2484 |
댓글2
?
와 개어렵네