I asked a question earlier about being able to choose the respawn location, but when I tried to write the code, I got an error, so I’d like to know if you can help me.
code
using { /Fortnite.com/Devices }
using { /Fortnite.com/Teams }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/UI }
# スポーンシステムを管理するデバイス
spawn_manager_device := class(creative_device):
# 編集可能なデバイス参照
@editable var TeamASpawnPoint : player_spawn_device = player_spawn_device{}
@editable var TeamBSpawnPoint : player_spawn_device = player_spawn_device{}
@editable var CapturePoints : []capture_area_device = array{}
# エリアの所有状態を追跡
var CaptureAreaStates : [string]team = map{}
var SpawnWidget : widget_message = widget_message{}
# デバイスが開始された時の処理
OnBegin<override>():void =
# キャプチャエリアの監視を開始
for (CapturePoint : CapturePoints):
CapturePoint.AreaCapturedEvent.Subscribe(OnAreaCaptured)
# プレイヤーが倒された時の処理
OnPlayerEliminated(Agent : agent):void =
if (Player := player[Agent]):
ShowSpawnUI(Player)
# スポーンUIの表示
ShowSpawnUI(Player : player):void =
if (PlayerUI := GetPlayerUI[Player]):
# プレイヤーのチームを取得
CurrentTeam := GetPlayerTeam(Player)
# スポーン選択用のメッセージウィジェットを作成
set SpawnWidget.Title = "スポーン地点を選択"
# チーム基地のスポーンボタン
BaseSpawnButton := message_button{"チーム基地にスポーン",
OnSpawnPointSelected{Player, GetTeamSpawnPoint(CurrentTeam)}}
# キャプチャエリアのスポーンボタン作成
var SpawnButtons : []message_button = array{BaseSpawnButton}
for (AreaID -> OwnerTeam : CaptureAreaStates):
if (OwnerTeam = CurrentTeam):
if (Area := CapturePoints[AreaID]):
set SpawnButtons = SpawnButtons + array{message_button{"{AreaID}にスポーン",
OnSpawnPointSelected{Player, Area.GetSpawnPoint()}}}
set SpawnWidget.Buttons = SpawnButtons
PlayerUI.ShowWidget(SpawnWidget)
# プレイヤーのチームを判定
GetPlayerTeam(Player : player):team =
return Player.GetTeam()
# チームに応じたスポーン地点を取得
GetTeamSpawnPoint(CurrentTeam : team):player_spawn_device =
if (CurrentTeam = team1):
return TeamASpawnPoint
else:
return TeamBSpawnPoint
# エリアが占領された時の処理
OnAreaCaptured(Area : capture_area_device, Team : team):void =
# エリアの所有権を更新
if (set CaptureAreaStates[Area.GetName()] = Team) {}
# プレイヤーのスポーン処理
SpawnPlayer(Player : player, SpawnPoint : player_spawn_device):void =
SpawnPoint.Spawn(Player)
# スポーン地点が選択された時の処理
OnSpawnPointSelected(Player : player, SpawnPoint : player_spawn_device):void =
if (PlayerUI := GetPlayerUI[Player]):
PlayerUI.HideWidget(SpawnWidget)
SpawnPlayer(Player, SpawnPoint)
error code
C:/Users/tora/Documents/Fortnite Projects/test1/Plugins/test1/Content/WorldSetting.verse(47,38, 47,38) : Script error 3100: vErr:S66: Use 'set' before "+=" to update variables