Verse Library verse

02 Device

Implements a triggered trap device that logs activation and prepares explosion logic when activated by a trigger.

verse-library/fortnite-diagnostics-using-log-class/02-device.verse

class RevengeTrapDevice<public>(creative_device):
    # Link this to a Trigger Device in the editor
    TriggerDevice<public>(trigger_device):
    
    # This function runs when the game starts
    OnBegin<override>()<suspends>:void=
        # Log that the trap has initialized
        # Think of this as checking if your trap is "armed"
        Logger := log{Channel := RevengeTrapLog}
        Logger.Print("Revenge Trap: System Armed. Waiting for victims...")
        
        # Wait for the trigger to fire
        if (TriggerDevice.Triggered):
            # Log that someone stepped on it
            Logger.Print("Revenge Trap: Target Acquired! Boom!")
            
            # Here you would add your explosion logic
            # For now, we just log that we *would* explode
            Logger.Print("Revenge Trap: Explosion Logic Executed.")

Comments

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