LoginSignup
0
0

【UEFN】Verseで武器のダメージ倍率増やしてみる

Last updated at Posted at 2023-12-18

背景

今回も前回と同じでBOX PVPで武器のパワーが上がる役職を作りたいということで調べ始めました。

やること

トリガーを踏んだらそのプレイヤーの攻撃力を2倍にする。

動画

実装

利用するDevice

ダメージ増幅パワーアップ
image.png
ダメージ増幅の設定
image.png

いつものトリガー
image.png

全体コード

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }


player_damage_device := class(creative_device):

    @editable
    Damage : damage_amplifier_powerup_device = damage_amplifier_powerup_device{}

    @editable
    Trigger :trigger_device = trigger_device{}

    OnBegin<override>()<suspends>:void=
        Trigger.TriggeredEvent.Subscribe(DamageUp)

    DamageUp(QAgent : ?agent):void=
        if (Agent := QAgent?):
            Print("Damage Up")
            Damage.SetMagnitude(2.0)
            Damage.Pickup(Agent)

トリガーに反応すると攻撃の倍率を上げて踏んだプレイヤーに付与させています。

# 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 {}

SetMagnitudeでは攻撃の倍率をfloat型で宣言する形になっています。

まとめ

こちらも簡単に実装できました。本当に基本的な能力の部分を変更するのは簡単そうですね。

余談

この度UEFN/Verseに関するオープンコミュニティサーバーを建ち上げました。ちょっとでも興味があれば奮ってご参加くださいませ。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0