要件
- ボタンの仕掛けを2つ設置する(A, B)
- ボタンAは3回押すとボタンAが無効になる
- ボタンBは2回起動するとボタンBが無効になる
- ボリュームの仕掛けを設置する
- ドア付きの壁をフォートナイトのギャラリーから見つけて設置する
- ドアにくっ付くようにロックの仕掛けを設置する
- ロックの仕掛けの中央部分が青く光ればドアとロックの仕掛けが紐づいている証拠!
- 「ボタンAを3回押した」かつ「ボタンBを2回押した」場合のみボリュームに入るとロックが解除される
必要なモノ
- ボタンの仕掛け(x2)
- ボリュームの仕掛け(x1)
- ドア付きの壁(x1)
- ロックの仕掛け(x1)
ヒント
今回は工程が多いので、上から順番に進めてみましょう。まずは、ボタンを3回押したら無効にさせるには…?
また、Print機能を活用して、現在の押した回数や、どこで処理が失敗しているか確認しながら進めるのもおすすめです!
回答
回答を見る
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
conditional_lock_device := class(creative_device):
@editable
ButtonDeviceA:button_device = button_device{}
@editable
ButtonDeviceB:button_device = button_device{}
@editable
VolumeDevice:volume_device = volume_device{}
@editable
LockDevice:lock_device = lock_device{}
var ButtonAPressCount:int = 0
var ButtonBPressCount:int = 0
OnBegin<override>()<suspends>:void=
ButtonDeviceA.InteractedWithEvent.Subscribe(OnInteractA)
ButtonDeviceB.InteractedWithEvent.Subscribe(OnInteractB)
VolumeDevice.AgentEntersEvent.Subscribe(OnEnter)
OnInteractA(Agent:agent):void=
set ButtonAPressCount += 1
if(ButtonAPressCount = 3):
ButtonDeviceA.Disable()
OnInteractB(Agent:agent):void=
set ButtonBPressCount += 1
if(ButtonBPressCount = 2):
ButtonDeviceB.Disable()
OnEnter(Agent:agent):void=
if(ButtonAPressCount = 3, ButtonBPressCount = 2):
LockDevice.Unlock(Agent)