プレイヤーのアイコンを取得する

using { /Verse.org/Simulation }
using { /Verse.org/Assets }
using { /Verse.org/SceneGraph }
using { /Fortnite.com/Characters }
 
(Agent:agent).GetIcon<public>()<decides><transacts>:texture=
    FortCharacter := Agent.GetFortCharacter[]
    CharacterEntity := FortCharacter.GetEntity[]
    IconComponent := CharacterEntity.GetComponent[icon_component]
    IconComponent.Icon

概要

「fort_character」クラスの「GetEntity[]」関数を使用することで、キャラクター情報を持ったentityを取得できます。そのentityに対して「GetComponent」関数を使用し「icon_component」を指定することで、アイコン情報を持ったcomponentを取得できます。

if(IconTexture := Agent.GetIcon[]):
    NewTextureBlock := texture_block:
        DefaultImage := IconTexture
        DefaultDesiredSize := vector2{X := 256.0, Y := 256.0}

# 256x256サイズのテクスチャブロックを生成

実際に使用する際は、フォートナイトの仕掛けなどから取得できる「agent」情報に対して「GetIcon」関数を呼び出すことで、キャラクターのアイコンのtextureインスタンスが取得できます。