using { /Fortnite.com/Devices } using { /Fortnite.com/Characters } using { /Fortnite.com/Game } using { /Verse.org/Simulation } RevengeTrap := class(creative_device_base): @editable DamageAmount: float = 10.0 @editable LaunchForce: float = 2000.0 @editable Trigger: trigger_device = trigger_device{} # This is our "already used" switch. # var means it can be changed after the game starts. # It starts as true: the trap is armed. var IsArmed: logic = true OnBegin(): void = Trigger.TriggeredEvent.Subscribe(OnPlayerStep) OnPlayerStep(Agent: ?agent): void = # Check the switch. If IsArmed is false, do nothing. if (IsArmed?): # Disarm FIRST so a second player can't trigger it # while we're still running this code. set IsArmed = false if (ValidAgent := Agent?): if (Character := ValidAgent.GetFortCharacter[]): Character.Damage(DamageAmount) LaunchVector := vector3{X := 0.0, Y := 0.0, Z := LaunchForce} Character.ApplyImpulse(LaunchVector)