How can I spawn a damage amplifier with damage multiplier value defined in verse when a button device is used?
Hi,
In verse, you can access all devices function who can be used, in the Fortnite.digest.verse
If you go on it, you can found
damage_amplifier_powerup_device<public> := class<concrete><final>(powerup_device):
# Sets the *Magnitude* for this powerup, clamped to the Min and Max defined in the device.
# Will not apply to any currently applied effects.
# For the Damage Amplifier Powerup, this is the damage multiplier.
SetMagnitude<public>(Magnitude:float):void = external {}
# Returns the current *Magnitude* for the powerup.
# For the Damage Amplifier Powerup, this is the damage multiplier.
GetMagnitude<public>()<transacts>:float = external {}
As you can the, damage_powerup_device extend from powerup_device, so let’s see his definition
powerup_device<public> := class<abstract><epic_internal>(creative_device_base):
# Signaled when the powerup is picked up by an `agent`.
# Sends the `agent` that picked up the powerup.
ItemPickedUpEvent<public>:listenable(agent) = external {}
# Spawns the powerup into the experience so users can interact with it.
Spawn<public>():void = external {}
# Despawns this powerup from the experience.
Despawn<public>():void = external {}
# Updates the *Duration* for this powerup, clamped to the Min and Max defined in the device.
# Will not apply to any currently applied effects.
SetDuration<public>(Time:float):void = external {}
# Returns the *Duration* that this powerup will be active for on any player it is applied to.
GetDuration<public>()<transacts>:float = external {}
# If the `Agent` has the effect applied to them, this will return the remaining time the effect has.
# Returns -1.0 if the effect has an infinite duration.
# Returns 0.0 if the `Agent` does not have the effect applied.
GetRemainingTime<public>(Agent:agent)<transacts>:float = external {}
# Returns the `Agent` has the powerup's effect (or another of the same type) applied to them.
HasEffect<public>(Agent:agent)<transacts><decides>:void = external {}
# Succeeds if the powerup is currently spawned.
IsSpawned<public>()<transacts><decides>:void = external {}
# Grants this powerup to `Agent`.
Pickup<public>(Agent:agent):void = external {}
# Grants this powerup without an agent reference.
# Requires *Apply To* set to *All Players*.
Pickup<public>():void = external {}
As you can the, the second last are Pickup, with Agent as param, so that’s what we need.
Just call the Pickup(Agent) on your damage_amplifier_device from an InteractedEvent button (who give you the agent caller)
You can use the SetMagnitude function from the damage_amplifier class to increase the value of multiplier
Hello,
At this time I am fairly sure that we do not have the ability to spawn devices via Verse.
What you could try though is to manually place the device and spawn the powerup itself during gameplay.
It might look something like this:
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
my_device := class(creative_device):
@editable
DamageAmplifier:damage_amplifier_powerup_device := damage_amplifier_powerup_device{}
@editable
ActivationButton:button_device := button_device{}
# If you'd like to edit the value directly in the editor that
# is added when the button is activated, you can do this:
# @editable
# DamageValue:float := 50.0
# OR (must be changed in code)
DamageValue:float := 50.0
OnBegin<override>()<suspends>:void=
# In the editor make sure the following is disabled for
# the damage_amplifier_powerup_device:
# - Spawn On Minigame Start
# Subscribe to the button event
ActivationButton.InteractedWithEvent.Subscribe(OnActivationButton)
OnActivationButton(Agent:agent):void=
# Damage multiplier for damage_amplifier_powerup_device.
DamageAmplifier.SetMagnitude(DamageValue)
# Spawn the damage_amplifier_powerup_device
DamageAmplifier.Spawn()
Hopefully that will point you in the right direction. And hopefully we will be able to spawn devices soon.
-dev