LogicUsing Events
Player Start/Stop Sprinting
Triggers actions when a player starts or stops sprinting.
These two events allow you to create logic based on a player's sprinting state.
Player Start Sprinting
Triggers the moment a player begins sprinting.
- Action Values:
Player - Use Cases:
- Consuming a custom "stamina" property while a player sprints.
- Applying a temporary speed boost at the start of a sprint.
- Playing a "charge" sound effect when a player starts to run.
Player Stop Sprinting
Triggers when a player stops sprinting (either by releasing the key or running out of hunger).
- Action Values:
Player - Use Cases:
- Stopping the consumption of a "stamina" property.
- Applying a temporary slowness effect after a long sprint to simulate exhaustion.
- Starting stamina regeneration.
Example: A Stamina System
- Properties:
Player NumberpropertyStamina, default100.Player BooleanpropertyisTired, defaultfalse.
- Start Sprint Event:
- In a
Player Start Sprintingevent, add aConditionalaction that checks ifisTiredisfalse. - If Actions: Start a
While Loop(repeating every 20 ticks) that continues as long as the player is sprinting and theirStamina > 0.- Inside the loop,
Subtract 5from the player'sStaminaproperty.
- Inside the loop,
- In a
- Stop Sprint Event:
- In a
Player Stop Sprintingevent, you can add logic to start regenerating stamina over time using another timed function.
- In a