이 단계에서는 Verse에서 아이템 지급 장치(Item Granter)를 사용하여 콤보 완료 시 플레이어에게 새로운 무기를 제공하는 총격전 스타일 무기 레벨 시스템을 만들게 됩니다.
섬 수정하기
뷰포트 또는 아웃라이너(Outliner) 패널에서 섬 설정(Island Settings) 장치를 선택합니다.
디테일(Details) 패널에서 다음 파라미터를 설정합니다.
예비 탄약 무한(Infinite Reserve Ammo)을 True로 설정합니다.
탄창 탄약 무한(Infinite Magazine Ammo)을 False로 설정합니다. 이 변경에는 플레이어 재장전이 필요합니다. 여러 포트나이트 무기의 핵심적인 요소입니다.
뷰포트 또는 아웃라이너 패널에서 아이템 지급 장치(Item Granter)를 선택합니다.
디테일(Details) 패널에서 다음 파라미터를 설정합니다.
지급 시 동작(On Grant Action)을 인벤토리 비우기(Clear Inventory)로 설정합니다.
지급(Grant)을 현재 아이템(Current Item)으로 설정합니다.
인덱스 목록(Index List)에서 모든 요소를 제거하고, 다음 요소 5개를 추가합니다.
돌격소총 L1
레버 액션 소총 L2
중산탄총 L3
6연발 권총 L4
핸드캐넌 L5
받는 플레이어(Receiving Players)를 모두(All)로 설정합니다.
순환 시 지급(Grant on Cycle)을 True로 설정합니다.
게임 시작 시 지급(Grant on Game Start)을 True로 설정합니다.
아이템 활성화 및 지급(Enable and Grant Item) 함수 바인딩을 제거합니다.
뷰포트 또는 아웃라이너 패널에서 점수 관리 장치(Score Manager)를 선택합니다.
디테일 패널에서 HUD에 점수 업데이트 표시(Display Score Update on HUD)를 True로 설정합니다.
Verse 코드 작성
이 페이지에서는 코드 변경을 단계별로 상세히 안내하지만, 작업물을 확인하고 싶다면 완성된 코드 섹션에서 최종 결과를 검토하세요.
Shooting_range_manager_device.verse파일을 엽니다.다음 변수를 추가해 아이템 지급 장치 레퍼런스를 저장하고 아이템 레벨 프로퍼티를 추적합니다.
Verse@editable ItemGranter:item_granter_device = item_granter_device{} @editable MaxWeaponLevel:int = 5 var CurrentWeaponLevel:int = 1IncreaseWeaponLevel메서드를 추가해 무기 레벨 변수를 증가시키고 다음 아이템으로 전환합니다.Verse# Increases the player's weapon level by one (up to the maximum value). IncreaseWeaponLevel():void= if: # If able to retrieve the first player and current weapon level isn't maxed, then... Player:player = GetPlayspace().GetPlayers()[0] CurrentWeaponLevel < MaxWeaponLevel then: # Increase weapon level and cycle to the next item. set CurrentWeaponLevel += 1 ItemGranter.CycleToNextItem(Player)OnComboTargetHit메서드를 수정해IncreaseWeaponLevel을 호출합니다.Verse# A hit callback that scores the ComboTarget and resets the combo. OnComboTargetHit():void= AdjustScore(ComboTargetScore) <# --- New Code Start --- #> IncreaseWeaponLevel() <# --- New Code End --- #>AdjustScore메서드를 수정해 지급되는 점수에 무기 레벨을 곱합니다.Verse# Adjusts the player's score by the provided value. AdjustScore(Value:int):void= # Start the timer if it hasn't started yet. if (not IsTimerStarted?): StartTimer() <# --- New Code Start --- #> # Sets the score award to the base value of the target multiplied by the current weapon level. ScoreManager.SetScoreAward(Value * CurrentWeaponLevel)Verse 코드를 저장 및 빌드합니다.
완성된 코드
using { /Fortnite.com/Devices }
using { /Verse.org/Random }
using { /Verse.org/Simulation }
# A device that manages shooting range gameplay.
shooting_range_manager_device := class(creative_device):
@editable
ScoreManager:score_manager_device = score_manager_device{}
모두 합치기
뷰포트 또는 아웃라이너(Outliner) 패널에서 shooting_range_manager_device를 선택합니다.
디테일 패널에서 아이템 지급 장치에 ItemGranter를 설정합니다.
변경 사항을 푸시하고 섬을 플레이테스트합니다.
콤보 타깃 적중 후 최대 5회까지 무기가 교체되는지 검증합니다. 5번째 레벨에서는 동일하게 유지됩니다.
받는 점수에 무기 레벨이 곱해지는지 검증합니다.