Verse Library verse

01 Comparison

Declares float variables, applies arithmetic mutation, and conditionally caps health values.

extracted-snippets/documentation/en-us/uefn/float-in-verse/01-comparison.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/uefn/float-in-verse
# Local doc:  epic-docs/documentation/en-us/uefn/float-in-verse.md
# Section:    Comparison
# Set up the parameters that describe the situation
DamageInflicted : float = 10.0
LifeDrainMultiplier : float = 0.125
var CurrentAttackerHealth : float = 99.0
MaxAttackerHealth : float = 100.0
	
# Increase current health based on damage inflicted.
set CurrentAttackerHealth += DamageInflicted * HealingMultiplier
	
# Ensure that the attacker does not heal beyond their maximum health
if (CurrentAttackerHealth > MaxAttackerHealth):
    # Too high! Reduce to the maximum value.
    set CurrentAttackerHealth = MaxAttackerHealth
	
# CurrentAttackerHealth is now 100.0.
Copy full snippet

Comments

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