Skip to content

Instantly share code, notes, and snippets.

@WahlbeckUEFN
Created May 4, 2023 21:10
Show Gist options
  • Save WahlbeckUEFN/4b6a218813173a81d5fa0db94e93959e to your computer and use it in GitHub Desktop.
Save WahlbeckUEFN/4b6a218813173a81d5fa0db94e93959e to your computer and use it in GitHub Desktop.
Code in Verse to shrink and grow props
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
shrinkies := class<concrete>():
@editable PropManip : prop_manipulator_device = prop_manipulator_device{}
@editable Prop : creative_prop = creative_prop{}
var ShrinkMode<private> : logic = false
Init():void=
PropManip.DamagedEvent.Subscribe(OnPropDamaged)
ToggleShrinkMode():void=
if (ShrinkMode?) { set ShrinkMode = false}
else { set ShrinkMode = true}
OnPropDamaged<private>(Agent : agent):void=
ScaleProp()
ScaleProp():void=
PropScale := Prop.GetTransform().Scale.X
if (ShrinkMode?):
Small := vector3{X:=PropScale - 10.0, Y:=PropScale - 10.0, Z:=PropScale - 10.0}
Tran := transform{
Translation := Prop.GetTransform().Translation,
Rotation := Prop.GetTransform().Rotation,
Scale := Small}
if (Prop.TeleportTo[Tran]) {}
else:
Big := vector3{X:=PropScale + 10.0, Y:=PropScale + 10.0, Z:=PropScale + 10.0}
Tran := transform{
Translation := Prop.GetTransform().Translation,
Rotation := Prop.GetTransform().Rotation,
Scale := Big}
if (Prop.TeleportTo[Tran]) {}
shrinkinator := class(creative_device):
@editable Shrinkables :[]shrinkies = array{}
@editable ShrinkToggle : trigger_device = trigger_device{}
OnBegin<override>()<suspends>:void=
ShrinkToggle.TriggeredEvent.Subscribe(OnShrinkToggle)
for (Shrinkable : Shrinkables):
Shrinkable.Init()
OnShrinkToggle(Agent : ?agent):void=
for (Shrinkable : Shrinkables):
Shrinkable.ToggleShrinkMode()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment