using /Fortnite.com/Devices using /UnrealEngine.com/Temporary/Diagnostics # This is our "Mood Ring" script! mood_ring_device := class(creative_device): # Wire your VFX Creator Device to this property in the UEFN editor. @editable VFX_Device : vfx_creator_device = vfx_creator_device{} # 1. Define the colors we want to use. # We call these "constants" because they don't change. # Think of them as fixed crayons in a box. Red_Crayon : color = color{R:=1.0, G:=0.0, B:=0.0, A:=1.0} Blue_Crayon : color = color{R:=0.0, G:=0.0, B:=1.0, A:=1.0} Green_Crayon : color = color{R:=0.0, G:=1.0, B:=0.0, A:=1.0} # 2. Create a list of our colors. # This is like a tray holding all our crayons. Our_Palette : []color = array{} # 3. This function runs when the game starts. OnBegin() : void = # Build our palette list from the crayon constants. Palette := array{Red_Crayon, Blue_Crayon, Green_Crayon} # Pick a random crayon from the tray. # We use a random index to choose one. Random_Index := GetRandomInt(0, Palette.Length - 1) if (Chosen_Color := Palette[Random_Index]): # 4. Change the device's color! # This sets the main color of the sparkles. VFX_Device.SetNiagaraVariableLinearColor("User.Color", Chosen_Color) # note: vfx_creator_device exposes Niagara variable setters; # the exact variable name must match what is defined inside # your chosen Niagara system asset. # 5. Print a message to help us debug. Print("Mood color chosen at index: {Random_Index}")