- This topic is empty.
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
Last modified: November 27, 2024
Home › Forums › Verse Code › Step on Trigger, Prop Appears – Verse Code
Home › Forums › Verse Code › Step on Trigger, Prop Appears – Verse Code
Tagged: Prop, Simple, Spawn Prop, Trigger, Trigger Device
This is straightforward code.
The prop will be hidden until you step on the trigger.
using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # This class represents a device that makes a prop appear and triggers a VFX when activated Trigger_prop_spawn_device := class(creative_device): # Editable property for the trigger device that will activate the prop and VFX @editable TriggerDevice : trigger_device = trigger_device{} # Editable property for the prop that will appear when triggered @editable PropToAppear : creative_prop = creative_prop{} # Editable property for the VFX spawner that will trigger when the prop appears @editable VFXSpawner : vfx_spawner_device = vfx_spawner_device{} # This method is called when the device begins execution OnBegin<override>()<suspends>:void= # Subscribe to the trigger's TriggeredEvent # This sets up the OnTriggerActivated method to be called when the trigger is activated TriggerDevice.TriggeredEvent.Subscribe(OnTriggerActivated) # Initially hide the prop when the device begins PropToAppear.Hide() # This method is called when the trigger is activated # It takes an optional agent parameter, which represents the entity that activated the trigger OnTriggerActivated(Agent : ?agent):void= # Check if the Agent parameter has a value if (ActualAgent := Agent?): # Try to cast the agent to a player if (Player := player[ActualAgent]): # If it's a player, show the prop PropToAppear.Show() # Enable the VFX spawner VFXSpawner.Enable() # Print a debug message to confirm the prop appeared and VFX triggered Print("Prop appeared and VFX triggered for player")
Last modified: November 27, 2024