by milkc0de
ガードスポナーで湧いたガードに fort_leashable を付けて、行動範囲の中心を「特定プレイヤー(agent)」に設定する方法です。
これを使うと、ガードが指定プレイヤーの周囲から大きく離れにくくなります。
重要ポイント(仕様)
SetLeashAgent(Agent, InnerRadius, OuterRadius)の半径は センチメートル です。- 例:50m = 5000cm、100m = 10000cm
OuterRadiusはInnerRadius以上にする必要があります。- プレイヤーが一人である前提です。
実装(スポーン時点の先頭プレイヤーを中心にする)
- 一番シンプルで安定する形です。
- チームごとに変える、最寄りにする等はあとで拡張できます。
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Playspaces }
using { /Verse.org/Simulation }
guard_movement_device := class(creative_device):
@editable
GuardSpawner: guard_spawner_device = guard_spawner_device{}
# 50m / 100m(cm)
const InnerRadiusCm:float = 5000.0
const OuterRadiusCm:float = 10000.0
OnBegin<override>()<suspends>:void =
GuardSpawner.SpawnedEvent.Subscribe(OnSpawnGuard)
OnSpawnGuard(SpawnedGuard:agent):void =
if (Chara := SpawnedGuard.GetFortCharacter[]):
if (Leashable := Chara.GetFortLeashable[]):
Players := GetPlayspace().GetPlayers()
if (Players.Length <= 0):
return
# 先頭プレイヤーを中心にする(プレイヤーは agent でもあります)
CenterAgent:agent = Players[0]
Leashable.SetLeashAgent(CenterAgent, InnerRadiusCm, OuterRadiusCm)
