Now that your targets behave as expected, you can spice things up even more using Verse!
Create a Combo System
In this section, you'll add a combo system to your game that rewards players with a special target worth extra points when they the hit all of the good targets without hitting any bad ones.
Select a Good Target in the viewport.
Press the Alt key, then drag a duplicate target to the back of your shooting gallery. This will be the Combo Target.
In the Details panel, under User Options:
Set the TargetType to Llama.
Set the Score Value to 0. This means that only the Verse code will affect the score.
Set the Start Position to Down.
Set the Reset Time Type to Never.
Set the Pop Up Delay Type to Never.
Set the Hopping Frequency Type to Random. This means the target will move up and down randomly.
Set the Hop Length Type to Random.
Add the following code to
shooting_range_manager_device.verseto:Create a
shooting_range_target_track_devicevariable that stores a reference to the Combo Target.Add an integer variable for its score value.
Add three logic variables to track the combo state.
Verseusing { /Fortnite.com/Devices } 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{} @editableSelect the shooting_range_manager_device in the viewport.
In the Details panel, set ComboTarget to the Llama target.
Add the following code to:
Disable the Combo Target on game start.
Set up the Combo Target hit event subscription.
Score the Combo Target on hit.
Verseusing { /Fortnite.com/Devices } 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{} @editableAdd the following code to:
Set GoodTarget logic variables to true on hit.
Disable the GoodTragets on hit so they don't pop back up.
Add a
CheckCombo()call to each GoodTarget to track its combo state when it is hit.Pop up the ComboTarget when all GoodTargets are hit.
Verseusing { /Fortnite.com/Devices } 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{} @editableWhen using an
ifstatement, you can put conditions on multiple lines, but they all must succeed to execute thethenblock.For example, in
CheckCombo(), there are three statements using the query operator (?) to check whether a logic value is true. If a single one is false, the Combo Target will not be enabled.For more information, see If in Verse and Operators in Verse.
Add the following code to reset the combo when hitting a Bad Target.
Verseusing { /Fortnite.com/Devices } 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{} @editableSelect Verse > Build Verse Code from the Menu Bar.
Playtest your changes in an Edit Session.
Verify GoodTragets stay down when you hit them and only pop back up when hitting a Bad or Combo Target.
Verify the ComboTarget starts down, pops up when you complete the combo, and stays down when you hit it.
Verify the ComboTarget drops when you hit a BadTarget during a full combo.
Verify your score increases when hitting the ComboTarget.