Verse Library verse

01 Fragment

Sorts active devices by priority when a player enters a zone and automatically enables the highest priority camera.

verse-library/how-to-use-priorities/01-fragment.verse

# This is pseudo-code to show how the engine thinks about priorities
# We don't write this, the engine does it for us!

function OnPlayerEnterZone(player, zone):
    # The engine checks all active devices
    active_devices = GetActiveDevices(player)
    
    # It sorts them by Priority (Highest to Lowest)
    sorted_devices = SortByPriority(active_devices, DESCENDING)
    
    # The first device in the list wins control
    winner = sorted_devices[0]
    
    if winner == Cam_Inside:
        # Disable Cam_Outside automatically
        Disable(Cam_Outside)
        Enable(Cam_Inside)
        
    if winner == Cam_Outside:
        # Disable Cam_Inside automatically
        Disable(Cam_Inside)
        Enable(Cam_Outside)

Comments

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