Verse Library verse

02 Removing Extra Pizzas

Moves objective markers, activates player UI pulses, and removes collected items from inventory.

extracted-snippets/documentation/en-us/fortnite/pizza-pursuit-5-improving-feedback-and-player-experience-for-time-trial-in-verse/02-removing-extra-pizzas.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/pizza-pursuit-5-improving-feedback-and-player-experience-for-time-trial-in-verse
# Local doc:  epic-docs/documentation/en-us/fortnite/pizza-pursuit-5-improving-feedback-and-player-experience-for-time-trial-in-verse.md
# Section:    Removing Extra Pizzas
loop:
if (PickupZone : base_zone = PickupZones[PickupLevel].SelectNext[]):
PickupZone.ActivateZone()
Sleep(0.0)
PickupMarker.MoveMarker(PickupZone.GetTransform(), ?OverTime := 0.0)
if (ValidPlayer := MaybePlayer?):
PickupMarker.MapIndicator.ActivateObjectivePulse(ValidPlayer)
<# This is the only defer we need for any PickupZone we activate. It will either deactivate the first PickupZone at the end of each outer loop,
or it'll deactivate any later PickupZone. That's because the expression is evaluated at the end, when the PickupZone variable has been bound to a newer zone. #>
defer:
PickupZone.DeactivateZone()
PickupZone.ZoneCompletedEvent.Await()
Logger.Print("Picked up", ?Level := log_level.Normal)
<# We remove pizzas pickups from the player inventory to avoid stacking them and having them drop to the ground once the stack is full. #>
if (RemovingPlayer := MaybePlayer?):
PizzaRemover.Remove(RemovingPlayer)
# After the first pickup we can enable the delivery zone.
# Update the pickup level and ScoreManager.
if (PickupLevel < MaxPickupLevel):
set PickupLevel += 1
else:
Logger.Print("Can't find next PickupZone to select.", ?Level := log_level.Error)
return # Error out of the PickupDeliveryLoop

Comments

    Sign in to vote, comment, or suggest an edit. Sign in